当前位置: 首页>>代码示例>>C#>>正文


C# Measurement.Add方法代码示例

本文整理汇总了C#中Measurement.Add方法的典型用法代码示例。如果您正苦于以下问题:C# Measurement.Add方法的具体用法?C# Measurement.Add怎么用?C# Measurement.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Measurement的用法示例。


在下文中一共展示了Measurement.Add方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddReviewFileCycle

        unsafe void AddReviewFileCycle(int i, run_rec_ext run, INCCReviewFile.run_rec_ext_plus rrep, Measurement meas, string fn)
        {
            Cycle cycle = new Cycle(datalog);
            try
            {
                cycle.UpdateDataSourceId(ConstructedSource.ReviewFile, meas.Detectors[0].Id.SRType,
                        rrep.dt, fn);
                cycle.seq = (run.run_number > 0 ? run.run_number : i); // INCC run record sequence numbers start at 1
                cycle.TS = TimeSpan.FromSeconds(run.run_count_time);

                /* init run tests */
                cycle.SetQCStatus(meas.Detectors[0].MultiplicityParams, QCTestStatus.Pass, run.run_high_voltage); // multmult creates entry if not found
                meas.Add(cycle);
                /* singles, reals + accidentals, accidentals */
                cycle.Totals = (ulong)run.run_singles;
                MultiplicityCountingRes mcr = new MultiplicityCountingRes(meas.Detectors[0].MultiplicityParams.FA, cycle.seq); // multmult
                cycle.CountingAnalysisResults.Add(meas.Detectors[0].MultiplicityParams, mcr); // multmult
                mcr.AB.TransferIntermediates(meas.Detectors[0].AB);  // copy alpha beta onto the cycle's results 
                mcr.Totals = cycle.Totals;
                mcr.TS = cycle.TS;
                mcr.ASum = run.run_acc;
                mcr.RASum = run.run_reals_plus_acc;
                mcr.Scaler1.v = run.run_scaler1;
                mcr.Scaler2.v = run.run_scaler2;
                cycle.SinglesRate = run.run_singles / run.run_count_time;

                // assign the hits to a single channel (0)
                cycle.HitsPerChannel[0] = cycle.Totals;

                mcr.RawSinglesRate.v = cycle.SinglesRate;

                // now back-compute the actual limits of the bins
                for (int n = rrep.n_mult - 1; n >= 0; n--)
                {
                    if ((run.run_mult_reals_plus_acc[n] > 0.0) || (run.run_mult_acc[n] > 0.0))
                    {
                        mcr.MinBins = mcr.MaxBins = (ulong)(n + 1);
                        break;
                    }
                }
                mcr.RAMult = new ulong[mcr.MaxBins];
                mcr.NormedAMult = new ulong[mcr.MaxBins];
                mcr.UnAMult = new ulong[mcr.MaxBins]; // todo: compute this

                // copy the bin values, if any
                for (UInt16 j = 0; j < mcr.MaxBins; j++)
                {
                    mcr.RAMult[j] = (ulong)run.run_mult_reals_plus_acc[j];
                    mcr.NormedAMult[j] = (ulong)run.run_mult_acc[j];
                }
                ctrllog.TraceEvent(LogLevels.Verbose, 5439, "Cycle " + cycle.seq.ToString() + (rrep.n_mult > 0 ? " n_:" + rrep.n_mult.ToString() + " max:" + mcr.MaxBins.ToString() : " *"));
            }
            catch (Exception e)
            {
                ctrllog.TraceEvent(LogLevels.Warning, 33085, "Cycle processing error {0} {1}", run, e.Message);
            }
        }
开发者ID:tempbottle,项目名称:INCC6,代码行数:57,代码来源:FileCtrlINCC5.cs

示例2: AddTestDataCycle

        void AddTestDataCycle(int run, uint run_seconds, double run_count_time, Measurement meas, TestDataFile td, string pivot = "", int cfindex = -1)
        {
            Cycle cycle = new Cycle(datalog);
            try
            {
                cycle.UpdateDataSourceId(ConstructedSource.CycleFile, meas.Detectors[0].Id.SRType,
                        td.DTO.AddSeconds(run_seconds), td.Filename);
                cycle.seq = run;
                cycle.TS = TimeSpan.FromSeconds(run_count_time);  // dev note: check if this is always only in seconds, or fractions of a second
                                                                  // hn -- 9/4/14 -- not integer for count time.  Convert from double seconds here.
                                                                  // Joe still has force to int.  bleck!

                /* init run tests */
                cycle.SetQCStatus(meas.Detectors[0].MultiplicityParams, QCTestStatus.None); // multmult creates entry if not found
                meas.Add(cycle, cfindex);
                /* singles, reals + accidentals, accidentals */
                string l = td.reader.ReadLine();
                string[] zorks = l.Split((char[])null, StringSplitOptions.RemoveEmptyEntries);
                double[] v = new double[5];
                for (int z = 0; z < 5; z++)
                {
                    double d;
                    bool b = Double.TryParse(zorks[z], out d);
                    if (b)
                        v[z] = d;
                }
                cycle.Totals = (ulong)v[0];
                MultiplicityCountingRes mcr = new MultiplicityCountingRes(meas.Detectors[0].MultiplicityParams.FA, cycle.seq); // multmult
                cycle.CountingAnalysisResults.Add(meas.Detectors[0].MultiplicityParams, mcr);  // multmult
                mcr.AB.TransferIntermediates(meas.Detectors[0].AB);  // copy alpha beta onto the cycle's results 
                mcr.Totals = cycle.Totals;
                mcr.TS = cycle.TS;
                mcr.ASum = v[4];
                mcr.RASum = v[3];
                mcr.Scaler1.v = v[1];
                mcr.Scaler2.v = v[2];
                cycle.SinglesRate = v[0] / run_count_time;

                // assign the hits to a single channel (0)
                cycle.HitsPerChannel[0] = cycle.Totals;

                mcr.RawSinglesRate.v = cycle.SinglesRate;

                /* number of multiplicity values */
                string mv = td.reader.ReadLine();
                UInt16 k = 0;
                UInt16.TryParse(mv, out k);
                if (k == 0)  // test data files require an entry with 1 bin set 0s for the absence of multiplicity, go figure
                {
                    ctrllog.TraceEvent(LogLevels.Error, 440, "This" + pivot + " cycle " + run.ToString() + " has no good multiplicity data.");
                    return;
                }
                mcr.MinBins = mcr.MaxBins = k;
                mcr.RAMult = new ulong[k];
                mcr.NormedAMult = new ulong[k];
                mcr.UnAMult = new ulong[k]; // todo: compute this
                /* multiplicity values */
                for (UInt16 j = 0; j < k; j++)
                {
                    string ra = td.reader.ReadLine();
                    string[] blorks = ra.Split((char[])null, StringSplitOptions.RemoveEmptyEntries);
                    double[] ve = new double[2];
                    for (int z = 0; z < 2; z++)
                    {
                        double d;
                        bool b = Double.TryParse(blorks[z], out d);
                        if (b)
                            ve[z] = d;
                    }
                    mcr.RAMult[j] = (ulong)ve[0];
                    mcr.NormedAMult[j] = (ulong)ve[1];
                }
                ctrllog.TraceEvent(LogLevels.Verbose, 5439, "Cycle " + cycle.seq.ToString() + pivot + ((mcr.RAMult[0] + mcr.NormedAMult[0]) > 0 ? " max:" + mcr.MaxBins.ToString() : " *"));

            }
            catch (Exception e)
            {
                ctrllog.TraceEvent(LogLevels.Warning, 33085, pivot + "cycle processing error {0} {1} {2}", run, e.Message, pivot);
            }
        }
开发者ID:tempbottle,项目名称:INCC6,代码行数:80,代码来源:FileCtrlINCC5.cs


注:本文中的Measurement.Add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。