Beispiel #1
0
        /// <summary>
        /// Считать заголовок файла
        /// </summary>
        /// <param name="bReader"></param>
        /// <param name="fi"></param>
        /// <param name="bscanLength"></param>
        /// <returns></returns>
        private TempFileInfo ReadFileHeader(BinaryReader bReader, FileInfo fi, out int bscanLength)
        {
            // file info
            short fileVersion = bReader.ReadInt16();
            bscanLength = bReader.ReadInt32();
            string comment = bReader.ReadString();
            string timeCreated = bReader.ReadString();

            // python settings
            uint startType = bReader.ReadUInt32();
            uint bufferSize = bReader.ReadUInt32();
            double frequency = bReader.ReadDouble();
            uint control = bReader.ReadUInt32();
            uint preHistory = bReader.ReadUInt32();
            uint startDelay = bReader.ReadUInt32();
            uint hysteresis = bReader.ReadUInt32();
            uint packetNumber = bReader.ReadUInt32();
            double threshold = bReader.ReadDouble();
            uint controlSynchro = bReader.ReadUInt32();
            uint waitTime = bReader.ReadUInt32();
            int channelsNum = bReader.ReadInt32();
            RshChannel[] channels = new RshChannel[channelsNum];
            for (int i = 0; i < channels.Length; i++)
            {
                channels[i] = new RshChannel();
                channels[i].control = bReader.ReadUInt32();
                channels[i].delta = bReader.ReadDouble();
                channels[i].gain = bReader.ReadUInt32();
            }
            uint digitalPort = bReader.ReadUInt32();

            // survey settings
            double dt = bReader.ReadDouble();
            double dx = bReader.ReadDouble();
            double eps = bReader.ReadDouble();
            int zoom = bReader.ReadInt32();
            string palette = bReader.ReadString();
            int repRate = bReader.ReadInt32();

            int marksCount = bReader.ReadInt32();
            Dictionary<int, int> Marks = new Dictionary<int, int>();
            for (int i = 0; i < marksCount; i++)
                Marks.Add(bReader.ReadInt32(), bReader.ReadInt32());

            PythonSettings pythset = new PythonSettings(
                startType,
                bufferSize,
                frequency,
                control,
                preHistory,
                startDelay,
                hysteresis,
                packetNumber,
                threshold,
                controlSynchro,
                channels,
                waitTime,
                digitalPort);

            TempFileInfo tempInfo = new TempFileInfo(fileVersion, pythset, Marks);

            Settings.Init(zoom, dx, dt, eps, palette, repRate, Settings.CalibrationProps);

            return tempInfo;
        }
Beispiel #2
0
 private void RawDataProcessingInit(PythonSettings pythonSettings)
 {
     var tab = (tabPageRawProcessor.Controls[0] as RawDataProcessingTab);
     var operations = tab.Scenario;
     var scenario = ConnectionWrapper.Instance.Processor.Scenario;
     scenario.Clear();
     foreach (var nameOperation in operations)
     {
         switch (nameOperation)
         {
             case ProcessingSynchro.NameConst:
                 scenario.Add(
                     new ProcessingSynchro(
                         pythonSettings.channels.Length,
                         Convert.ToUInt32(pythonSettings.preHistory),
                         Convert.ToDouble(pythonSettings.threshold),
                         pythonSettings.controlSynchro == (uint)RshInitADC.ControlSynchroBit.SlopeFront));
                 break;
             case ProcessingAverage.NameConst:
                 scenario.Add(new ProcessingAverage());
                 break;
             case ProcessingMedian.NameConst:
                 scenario.Add(new ProcessingMedian());
                 break;
             default:
                 throw new ArgumentOutOfRangeException("Unexpected IProcessingFunction");
         }
     }
     ConnectionWrapper.Instance.NumberAscansToProcess = tab.NumAscans;
 }