private void saveDataToXMLFile(string fn)
 {
     try
     {
         XMLDataFile xdf = new XMLDataFile(fn);
         xdf.startGroup("SpectralMeasurement");
         xdf.startGroup("Config");
         xdf.writeNumeric("fs", spectrumAnalyzer.owner.sampleRate);
         xdf.writeNumeric("Points", _blockSize);
         xdf.writeNumeric("Channels", channels);
         xdf.writeNumeric("AmplitudeCorrectionFactordB", FFTProcessor.windowAmplitudeCorrectionFactorsdB[(int)windowType]);
         xdf.writeNumeric("PowerCorrectionFactordB", FFTProcessor.windowPowerCorrectionFactorsdB[(int)windowType]);
         string[] windows = Enum.GetNames(typeof(FFTProcessor.WindowType));
         xdf.writeString("Window", windows[(int)windowType]);
         xdf.closeGroup();
         xdf.writeNumericArray("f", fftProcessor.freq);
         for (int j = 0; j < channels; j++)
         {
             xdf.writeNumericArray(string.Format("raw{0}", j + 1), lines[j].data);
             xdf.writeNumericArray(string.Format("peak{0}", j + 1), lines[j].dataMax);
             xdf.writeNumericArray(string.Format("avg{0}", j + 1), lines[j].dataAvg);
         }
         xdf.closeGroup();
         xdf.close();
     }
     catch (Exception e)
     {
         MessageBox.Show(e.Message, "Error Writing File", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
예제 #2
0
 private void saveDataToXMLFile(string fn)
 {
     try
     {
         XMLDataFile xdf = new XMLDataFile(fn);
         xdf.startGroup("VNAMeasurement");
         xdf.startGroup("Config");
         xdf.writeNumeric("FMin", vna.config.sweepFMin);
         xdf.writeNumeric("FMax", vna.config.sweepFMax);
         xdf.writeNumeric("LogScale", (vna.config.sweepLogF)?1:0);
         xdf.writeNumeric("Points", vna.config.sweepPoints);
         xdf.writeNumeric("LoopDelay", vna.config.sweepLoopDelay);
         xdf.writeNumeric("Periods", vna.config.sweepMPeriods);
         xdf.writeNumeric("Channels", channels);
         xdf.closeGroup();
         xdf.writeNumericArray("f", absA.getXData());
         xdf.writeNumericArray("absA", absA.getYData());
         xdf.writeNumericArray("logA", logA.getYData());
         xdf.writeNumericArray("phiA", phiA.getYData());
         for (int j = 0; j < channels; j++)
         {
             xdf.writeNumericArray(string.Format("absB{0}", j + 1), absB[j].getYData());
             xdf.writeNumericArray(string.Format("absBA{0}", j + 1), absBA[j].getYData());
             xdf.writeNumericArray(string.Format("phiBA{0}", j + 1), phiBA[j].getYData());
             xdf.writeNumericArray(string.Format("logB{0}", j + 1), logB[j].getYData());
             xdf.writeNumericArray(string.Format("logBA{0}", j + 1), logBA[j].getYData());
             xdf.writeNumericArray(string.Format("phiB{0}", j + 1), phiB[j].getYData());
         }
         xdf.closeGroup();
         xdf.close();
     }
     catch (Exception e)
     {
         MessageBox.Show(e.Message, "Error Writing File", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }