示例#1
0
        public override ReturnCode IngestFile(ChannelCompartment compartment, string fileName)
        {
            ReturnCode returnCode = spectrumParser.ParseSpectrumFile(fileName);
            Spectrum   spectrum   = spectrumParser.GetSpectrum();
            DateTime   time       = spectrum.GetStartTime();
            TimeSpan   duration   = TimeSpan.FromSeconds(spectrum.GetRealTime());
            DataFile   dataFile   = new DataFile(fileName, time, time + duration);
            int        counts     = 0;

            for (int ch = 0; ch < spectrum.GetNChannels(); ch++)
            {
                counts += spectrum.GetCounts()[ch];
            }
            channels[COUNT_RATE].AddDataPoint(compartment, time, counts / spectrum.GetLiveTime(), duration, dataFile);


            foreach (VirtualChannel chan in virtualChannels)
            {
                if (chan is ROIChannel)
                {
                    ((ROIChannel)chan).AddDataPoint(compartment, time, spectrum, duration, dataFile);
                }
            }
            return(ReturnCode.SUCCESS);
        }
示例#2
0
 public ReturnCode Add(Spectrum spectrum)
 {
     if (spectrum.GetNChannels() != counts.Length)
     {
         return(ReturnCode.FAIL);
     }
     int[] otherCounts = spectrum.GetCounts();
     for (int i = 0; i < counts.Length; i++)
     {
         counts[i] += otherCounts[i];
     }
     realTime += spectrum.GetRealTime();
     liveTime += spectrum.GetLiveTime();
     return(ReturnCode.SUCCESS);
 }