Exemplo n.º 1
0
 public ScalableDataList(Collector col)
 {
     collector = col;
     myPED = null;//!
     points[(int)DisplayValue.Step] = new PointPairListPlus(null, this);
     points[(int)DisplayValue.Voltage] = new PointPairListPlus(null, this);
     points[(int)DisplayValue.Mass] = new PointPairListPlus(null, this);
 }
Exemplo n.º 2
0
        public CyclingMeasureMode(ushort startDelay, Flavor.Common.Data.Measure.MeasureMode.Precise cycle, Action<long[][], List<PreciseEditorData>, short?> successfulExit, int iterations, int timeLimit, PreciseEditorData checkerPeak, int checkerIndex, short? initialShift, ushort allowedShift)
            : base((s, e) => {
                var ee = (Flavor.Common.Data.Measure.MeasureMode.Precise.SuccessfulExitEventArgs)e;
                successfulExit(ee.Counts, ee.Points, ee.Shift);
            })
        {
            // TODO: checker peak received by index, after sort found by equality again
            //_cycle = new Flavor.Common.Data.Measure.MeasureMode.Precise(min, max, peaks, startDelay, stepDelay, exposition, forwardDelay, backwardDelay, graphUpdater, (ps, peds, shift) => OnSuccessfulExit(new Flavor.Common.Data.Measure.MeasureMode.Precise.SuccessfulExitEventArgs(ps, peds, shift)), initialShift, CheckShift);
            _cycle = cycle;
            _cycle.VoltageStepChangeRequested += Cycle_VoltageStepRequested;
            _cycle.Finalize += Cycle_Finalize;
            _cycle.Disable += cycle_Disable;

            this.allowedShift = allowedShift;
            stopper = new MeasureStopper(iterations, timeLimit);
            _checkerIndex = checkerIndex;
            peak = checkerPeak;
        }
Exemplo n.º 3
0
 void GraphForm_OnDiffOnPoint(ushort step, byte?collectorNumber, PreciseEditorData pedReference)
 {
     if (PreciseSpectrumDisplayed)
     {
         openSpecterFileDialog.Filter = Config.PRECISE_SPECTRUM_FILE_DIALOG_FILTER;
     }
     else
     {
         openSpecterFileDialog.Filter = Config.SPECTRUM_FILE_DIALOG_FILTER;
     }
     if (openSpecterFileDialog.ShowDialog() == DialogResult.OK)
     {
         try {
             Config.distractSpectra(openSpecterFileDialog.FileName, step, collectorNumber, pedReference, graph);
         } catch (Config.ConfigLoadException cle) {
             cle.visualise();
         }
     }
 }
        void refreshGraphicsOnPreciseStep(PreciseEditorData peak)
        {
            // TODO: move logic up
            long? carbonDioxideCounts = null;
            long? oxygenCounts = null;
            if (peak.IsCarbonDioxide()) {
                // TODO: simplify
                if (peak.AssociatedPoints != null && peak.AssociatedPoints.PLSreference != null) {
                    carbonDioxideCounts = peak.AssociatedPoints.PLSreference.PeakSum;
                }
            } else if (peak.IsOxygen()) {
                if (peak.AssociatedPoints != null && peak.AssociatedPoints.PLSreference != null) {
                    oxygenCounts = peak.AssociatedPoints.PLSreference.PeakSum;
                }
            }
            if (carbonDioxideCounts != null && oxygenCounts != null && oxygenCounts != 0) {
                double ratio = (double)carbonDioxideCounts / (double)oxygenCounts;
                ratioTextLabel.Visible = true;
                ratioLabel.Visible = true;
                ratioLabel.Text = ratio.ToString("F2");
                ratioLabel.ForeColor = ratio > 1 ? System.Drawing.Color.Red : System.Drawing.Color.Green;
            }

            label37.Visible = true;
            peakNumberLabel.Text = (peak.pNumber + 1).ToString();
            peakNumberLabel.Visible = true;
            label39.Visible = true;
            peakCenterLabel.Text = peak.Step.ToString();
            peakCenterLabel.Visible = true;
            label41.Visible = true;
            peakWidthLabel.Text = peak.Width.ToString();
            peakWidthLabel.Visible = true;

            //scanRealTimeLabel.Visible = true;
            stepNumberLabel.Visible = true;
            //label35.Visible = true;
            label36.Visible = true;
            // TODO: modify to display any collector counts!
            if (peak.Collector == 1) {
                detector1CountsLabel.Visible = true;
                label15.Visible = true;
                detector2CountsLabel.Visible = false;
                label16.Visible = false;
                detector3CountsLabel.Visible = false;
                label0.Visible = false;
            } else if (peak.Collector == 2) {
                detector1CountsLabel.Visible = false;
                label15.Visible = false;
                detector2CountsLabel.Visible = true;
                label16.Visible = true;
                detector3CountsLabel.Visible = false;
                label0.Visible = false;
            } else {
                detector1CountsLabel.Visible = false;
                label15.Visible = false;
                detector2CountsLabel.Visible = false;
                label16.Visible = false;
                detector3CountsLabel.Visible = true;
                label0.Visible = true;
            }
        }
Exemplo n.º 5
0
 // precise mode
 public void updateGraphDuringPreciseMeasure(ushort pnt, PreciseEditorData curped, params uint[] ys)
 {
     CurrentPeak = curped;
     // TODO: & peak
     OnNewGraphData(pnt, ys);
 }
Exemplo n.º 6
0
 public ScalableDataList(Collector col, PointPairListPlus dataPoints)
 {
     collector = col;
     myPED = dataPoints.PEDreference;
     SetRows(dataPoints);
 }
        void refreshGraphicsOnPreciseStep(PreciseEditorData peak)
        {
            // TODO: move logic up
            long?carbonDioxideCounts = null;
            long?oxygenCounts        = null;

            if (peak.IsCarbonDioxide())
            {
                // TODO: simplify
                if (peak.AssociatedPoints != null && peak.AssociatedPoints.PLSreference != null)
                {
                    carbonDioxideCounts = peak.AssociatedPoints.PLSreference.PeakSum;
                }
            }
            else if (peak.IsOxygen())
            {
                if (peak.AssociatedPoints != null && peak.AssociatedPoints.PLSreference != null)
                {
                    oxygenCounts = peak.AssociatedPoints.PLSreference.PeakSum;
                }
            }
            if (carbonDioxideCounts != null && oxygenCounts != null && oxygenCounts != 0)
            {
                double ratio = (double)carbonDioxideCounts / (double)oxygenCounts;
                ratioTextLabel.Visible = true;
                ratioLabel.Visible     = true;
                ratioLabel.Text        = ratio.ToString("F2");
                ratioLabel.ForeColor   = ratio > 1 ? System.Drawing.Color.Red : System.Drawing.Color.Green;
            }

            label37.Visible         = true;
            peakNumberLabel.Text    = (peak.pNumber + 1).ToString();
            peakNumberLabel.Visible = true;
            label39.Visible         = true;
            peakCenterLabel.Text    = peak.Step.ToString();
            peakCenterLabel.Visible = true;
            label41.Visible         = true;
            peakWidthLabel.Text     = peak.Width.ToString();
            peakWidthLabel.Visible  = true;

            //scanRealTimeLabel.Visible = true;
            stepNumberLabel.Visible = true;
            //label35.Visible = true;
            label36.Visible = true;
            // TODO: modify to display any collector counts!
            if (peak.Collector == 1)
            {
                detector1CountsLabel.Visible = true;
                label15.Visible = true;
                detector2CountsLabel.Visible = false;
                label16.Visible = false;
                detector3CountsLabel.Visible = false;
                label0.Visible = false;
            }
            else if (peak.Collector == 2)
            {
                detector1CountsLabel.Visible = false;
                label15.Visible = false;
                detector2CountsLabel.Visible = true;
                label16.Visible = true;
                detector3CountsLabel.Visible = false;
                label0.Visible = false;
            }
            else
            {
                detector1CountsLabel.Visible = false;
                label15.Visible = false;
                detector2CountsLabel.Visible = false;
                label16.Visible = false;
                detector3CountsLabel.Visible = true;
                label0.Visible = true;
            }
        }
Exemplo n.º 8
0
 void CheckShift(PreciseEditorData curPeak)
 {
     if (!cycle.shift.HasValue || curPeak == null || !curPeak.Equals(peak)) {
         // do not store value here!
         return;
     }
     long[] counts = cycle._counts[checkerIndex];
     ushort width = peak.Width;
     if (counts.Length != 2 * width + 1) {
         // data mismatch. strange.
         return;
     }
     long max = -1;
     int index = -1;
     for (int i = 0; i < counts.Length; ++i) {
         if (counts[i] > max) {
             max = counts[i];
             index = i;
         }
     }
     if (max == counts[width]) {
         index = width;
     }
     // delta from peak center
     short delta = (short)(index - width);
     if (delta > allowedShift || delta < -allowedShift) {
         cycle.shift += delta;
         if (ignoreInvalidity) {
             return;
         }
         throw new ShiftException();
     }
 }
Exemplo n.º 9
0
                public Monitor(ushort min, ushort max, List<PreciseEditorData> peaks, ushort startDelay, ushort stepDelay, ushort exposition, ushort forwardDelay, ushort backwardDelay, Action<ushort, PreciseEditorData> graphUpdater, Action<long[][], List<PreciseEditorData>, short?> successfulExit, int iterations, int timeLimit, PreciseEditorData checkerPeak, short? initialShift, ushort allowedShift)
                    : base((s, e) => {
                        var ee = (SuccessfulExitEventArgs)e;
                        successfulExit(ee.Counts, ee.Points, ee.Shift);
                    })
                {
                    // TODO: checker peak received by index, after sort found by equality again
                    cycle = new Precise(min, max, peaks, startDelay, stepDelay, exposition, forwardDelay, backwardDelay, graphUpdater, (ps, peds, shift) => OnSuccessfulExit(new SuccessfulExitEventArgs(ps, peds, shift)), initialShift, CheckShift);
                    cycle.VoltageStepChangeRequested += Cycle_VoltageStepRequested;
                    cycle.Finalize += Cycle_Finalize;
                    cycle.Disable += cycle_Disable;

                    this.allowedShift = allowedShift;
                    stopper = new MeasureStopper(iterations, timeLimit);
                    // redundant data
                    if (initialShift.HasValue && checkerPeak != null) {
                        // TODO: move up to Commander. only index here
                        peak = checkerPeak;
                        checkerIndex = peaks.FindIndex(peak.Equals);
                    }
                }
Exemplo n.º 10
0
 public PointPairListPlus(PointPairListPlus other, PreciseEditorData ped, ScalableDataList pls)
     : base(other)
 {
     PEDreference = ped;
     PLSreference = pls;
 }
Exemplo n.º 11
0
 void GraphForm_OnDiffOnPoint(ushort step, byte? collectorNumber, PreciseEditorData pedReference)
 {
     if (PreciseSpectrumDisplayed) {
         openSpecterFileDialog.Filter = Config.PRECISE_SPECTRUM_FILE_DIALOG_FILTER;
     } else {
         openSpecterFileDialog.Filter = Config.SPECTRUM_FILE_DIALOG_FILTER;
     }
     if (openSpecterFileDialog.ShowDialog() == DialogResult.OK) {
         try {
             Config.distractSpectra(openSpecterFileDialog.FileName, step, collectorNumber, pedReference, graph);
         } catch (Config.ConfigLoadException cle) {
             cle.visualise();
         }
     }
 }
Exemplo n.º 12
0
 public PointPairListPlus(PointPairListPlus other, PreciseEditorData ped, ScalableDataList pls)
     : base(other)
 {
     PEDreference = ped;
     PLSreference = pls;
 }