Пример #1
0
 private void DoAcq(WorkParameters args, IProgress <ProgressObject> progress, CancellationToken cancel)
 {
     LastAcqWidth = Camera.AcqWidth;
     LastVBin     = Camera.Image.vbin;
     int[] DataBuffer = new int[Camera.AcqSize];
     for (int i = 0; i < args.NScans; i++)
     {
         if (args.ReadMethod == "GetAcquiredData")
         {
             LastStatus = Camera.Acquire(DataBuffer);
         }
         else
         {
             LastStatus = CameraAs <AndorCamera>().AcquireImage(DataBuffer);
         }
         RawData.WriteNext(DataBuffer, 0);
         progress.Report(new ProgressObject()
         {
             CurrentScan = i, Data = (int[])DataBuffer.Clone()
         });
         DoPause();
         if (cancel.IsCancellationRequested)
         {
             return;
         }
     }
 }
Пример #2
0
        /// <summary>
        /// Readout of pixel counts based on camera settings
        /// Updates graph with output
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void DoWork(object sender, DoWorkEventArgs e)
        {
            DoTempCheck(() => PauseCancelProgress(e, 0, new ProgressObject(null, Dialog.TEMPERATURE)));

            if (PauseCancelProgress(e, 0, new ProgressObject(null, Dialog.INITIALIZE)))
            {
                return;
            }

            // set up acquisition
            var args = (WorkArgs)e.Argument; // pass number of accumulations and Accumulations

            // create pixel sequence
            int[] pixel = new int[andor.XDim];
            for (int i = 0; i < andor.XDim; i++)
            {
                pixel[i] = i + 1;
            }
            List <int[]> DataArray = new List <int[]>();

            // initialize arrays
            int[] DataBuffer = new int[andor.XDim];
            int[] DataSum    = new int[andor.XDim];

            for (int i = 0; i < args.Accumulations; i++)
            {
                Array.Clear(DataBuffer, 0, DataBuffer.Length);

                if (args.ReadMode == "FVB")
                {
                    andor.Acquire(DataBuffer);
                }
                else
                {
                    andor.Acquire(DataBuffer, args.TrackCenter, args.TrackHeight);
                }
                MathOps.MatrixSum(DataSum, DataBuffer); // what is column sum????
                DataArray.Add(DataSum);
                if (PauseCancelProgress(e, i, new ProgressObject(null, Dialog.PROGRESS)))
                {
                    return;
                }
            }
            e.Result = DataArray;
        }