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 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.º 4
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.º 5
0
 public static bool IsCarbonDioxide(this PreciseEditorData ped)
 {
     // TODO: better comment parsing
     // and/or use id+mass pair
     return(ped.Comment == "!co2");
 }
Exemplo n.º 6
0
 // TODO: move to more specific location (Almazov only)
 public static bool IsOxygen(this PreciseEditorData ped)
 {
     // TODO: better comment parsing
     // and/or use id+mass pair
     return(ped.Comment == "!o2");
 }
Exemplo n.º 7
0
 public ScalableDataList(Collector col, PointPairListPlus dataPoints)
 {
     collector = col;
     myPED     = dataPoints.PEDreference;
     SetRows(dataPoints);
 }
Exemplo n.º 8
0
 // precise mode
 public void updateGraphDuringPreciseMeasure(ushort pnt, PreciseEditorData curped, params uint[] ys)
 {
     CurrentPeak = curped;
     // TODO: & peak
     OnNewGraphData(pnt, ys);
 }