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


C# Measurement.InitializeContext方法代码示例

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


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

示例1: FillInReanalysisRemainingDetails

        /// <summary>
        /// Finalize measurement instance content for analysis
        /// Populate calibration parameters maps
        /// </summary>
        /// <param name="meas">The partially initialized measurement instance</param>
        /// <param name="useCurCalibParams">Default behavior is to use active method and other calibration parameters;
        ///                                 skipped if Reanalysis prepared the details from database measurement results
        /// </param>
        public static void FillInReanalysisRemainingDetails(Measurement meas, bool useCurCalibParams = true)
        {
            // get the current INCC5 analysis methods
            if (useCurCalibParams || meas.INCCAnalysisState == null)
            {
                meas.INCCAnalysisState = new INCCAnalysisState();
                INCCSelector sel = new INCCSelector(meas.AcquireState.detector_id, meas.AcquireState.item_type);
                AnalysisMethods am;
                bool found = CentralizedState.App.DB.DetectorMaterialAnalysisMethods.TryGetValue(sel, out am);
                if (found)
                {
                    am.selector = sel; // gotta do this so that the equality operator is not incorrect
                    meas.INCCAnalysisState.Methods = am;
                }
                else
                    meas.INCCAnalysisState.Methods = new AnalysisMethods(sel);
            } // else use what was there

            meas.InitializeContext(clearCounterResults:false);
            meas.PrepareINCCResults();

            System.Collections.IEnumerator iter = meas.CountingAnalysisResults.GetATypedParameterEnumerator(typeof(Multiplicity));
            while (iter.MoveNext())
            {
                Multiplicity mkey = (Multiplicity)iter.Current;
                try
                {
             					MultiplicityCountingRes mcr = (MultiplicityCountingRes)meas.CountingAnalysisResults[mkey];
                    if (mcr.AB.Unset)
                        LMRawAnalysis.SDTMultiplicityCalculator.SetAlphaBeta(mkey, mcr); // works only if MaxBins is set
                    MeasOptionSelector mos = new MeasOptionSelector(meas.MeasOption, mkey);
                    INCCResult result = meas.INCCAnalysisState.Lookup(mos);
                    result.CopyFrom(mcr);
                }
                catch (Exception)
                {
                    //logger.TraceEvent(LogLevels.Error, 4027, "PrepareINCCResults error: " + ex.Message);
                }
            }

            // stratum look up, finds existing stratum by name
            if (useCurCalibParams || meas.Stratum == null)
            {
                List<INCCDB.StratumDescriptor> sl = CentralizedState.App.DB.StrataList();
                INCCDB.StratumDescriptor s = sl.Find(w => string.Compare(w.Desc.Name, meas.AcquireState.stratum_id.Name, true) == 0);
                if (s == null)
                    meas.Stratum = new Stratum();
                else
                    meas.Stratum = new Stratum(s.Stratum);
            }
            INCCResults.results_rec xres = new INCCResults.results_rec(meas);
            meas.INCCAnalysisResults.TradResultsRec = xres;
            CentralizedState.App.Opstate.Measurement = meas;   // put the measurement definition on the global state
        }
开发者ID:hnordquist,项目名称:INCC6,代码行数:62,代码来源:Central.cs

示例2: BuildMeasurement


//.........这里部分代码省略.........
                    list.Remove(item);
                    list.Add(item);
                }
                else
                    list.Add(item);

                // fill in the acquire record from the item id
                acq.ApplyItemId(item);

                meas.MeasurementId.Item = new ItemId(item);
            }

            meas.INCCAnalysisState = new INCCAnalysisState();

            INCCSelector sel = new INCCSelector(acq.detector_id, acq.item_type);
            AnalysisMethods am;
            bool found = NC.App.DB.DetectorMaterialAnalysisMethods.TryGetValue(sel, out am);
            if (found)
            {
                meas.INCCAnalysisState.Methods = am;
                meas.INCCAnalysisState.Methods.selector = sel;
            }
            else
            {
                mlogger.TraceEvent(LogLevels.Error, 34063, "No analysis methods for {0}, (calibration information is missing), creating placeholders", sel.ToString()); // devnote: can get missing paramters from the meas results for calib and verif below, so need to visit this condition after results processing below (newres.methodParams!) and reconstruct the calib parameters.
                meas.INCCAnalysisState.Methods = new AnalysisMethods(mlogger);
                meas.INCCAnalysisState.Methods.selector = sel;
            }
            // prepare analyzer params from sr params above
            meas.AnalysisParams = new AnalysisDefs.CountingAnalysisParameters();
            meas.AnalysisParams.Add(det.MultiplicityParams);

            mlogger.TraceEvent(LogLevels.Verbose, 34030, "Transferring the {0} cycles", itf.run_rec_list.Count);
            meas.InitializeContext();
            meas.PrepareINCCResults(); // prepares INCCResults objects
            ulong MaxBins = 0;
            foreach (run_rec r in itf.run_rec_list)
            {
                ulong x= AddToCycleList(r, det);
                if (x > MaxBins)
                    MaxBins = x;
            }
            for (int cf = 1; (itf.CFrun_rec_list != null) && (cf < itf.CFrun_rec_list.Length); cf++)
            {
                foreach (run_rec r in itf.CFrun_rec_list[cf])
                {
                    AddToCycleList(r, det, cf);
                }
            }

            // summarize the result in the result, if you know what I mean
            MultiplicityCountingRes mcr = (MultiplicityCountingRes)meas.CountingAnalysisResults[det.MultiplicityParams];
            for (int i = 0; i < 9; i++)
                mcr.covariance_matrix[i] = results.covariance_matrix[i];
            mcr.DeadtimeCorrectedRates.Singles.err = results.singles_err;
            mcr.DeadtimeCorrectedRates.Doubles.err = results.doubles_err;
            mcr.DeadtimeCorrectedRates.Triples.err = results.triples_err;
            mcr.DeadtimeCorrectedRates.Singles.v = results.singles;
            mcr.DeadtimeCorrectedRates.Doubles.v = results.doubles;
            mcr.DeadtimeCorrectedRates.Triples.v = results.triples;
            mcr.Scaler1Rate.v = results.scaler1;
            mcr.Scaler2Rate.v = results.scaler2;
            mcr.Scaler1Rate.err = results.scaler1_err;
            mcr.Scaler2Rate.err = results.scaler2_err;
            mcr.Scaler1.v = results.scaler1;
            mcr.Scaler2.v = results.scaler2;
开发者ID:hnordquist,项目名称:INCC6,代码行数:67,代码来源:INCCKnew.cs

示例3: FillInMeasurementDetails

        /// <summary>
        /// Prepare measurement instance content for analysis
        /// Populate calibration and counting parameters maps
        /// Create general results and specific results dictionary map entries
        /// Set up stratum details
        /// </summary>
        /// <param name="meas">The partially initialized measurement instance</param>
        /// <param name="useCurCalibParams">Default behavior is to use active method and other calibration parameters;
        ///                                 skipped if Reanalysis prepared the details from database measurement results
        /// </param>
        public static void FillInMeasurementDetails(Measurement meas, bool useCurCalibParams = true)
        {
            if (meas.Detector.ListMode)
            {
                // APluralityOfMultiplicityAnalyzers: see below
                // URGENT: see below
                //if (an INCC5 DB cycle read or DB Ver reanalysis then rebuild the analyzers from the associated saved LM results:)
                //	object x = CentralizedState.App.DB.GetAnalyzersFromResults(meas.Detector, meas.MeasurementId);
                //else
                      meas.AnalysisParams = CentralizedState.App.LMBD.CountingParameters(meas.Detector, applySRFromDetector: true);
                if (meas.MeasOption.IsListMode()) // pure List Mode, not INCC5
                {
                    // for a list-mode-only measurement with a multiplicity analyzer the detector SR params must match at least one of the multiplicity analyzer SR params
                    ApplyVSRChangesToDefaultDetector(meas);
                }
                else // it is an INCC5 analysis driven with LM data
                {
                    // prepare or identify an active CA entry with matching CA gatewidth and FA, and has the same SR params as the detector
                    if (meas.AnalysisParams.PrepareMatchingVSR(meas.Detector.MultiplicityParams))
                        CentralizedState.App.LMBD.UpdateCounters(meas.Detector.Id.DetectorName, meas.AnalysisParams); // added one, save it
                }
            }
            else // construct param key source with the single mkey entry point
            {
                // prepare analyzer params from detector SR params
                meas.AnalysisParams = CentralizedState.App.LMBD.CountingParameters(meas.Detector, applySRFromDetector: false);
                if (!meas.AnalysisParams.Exists(w => { return (w is Multiplicity) && (w as Multiplicity).Equals(meas.Detector.MultiplicityParams); }))
                    meas.AnalysisParams.Add(meas.Detector.MultiplicityParams);
            }

            // get the current INCC5 analysis methods
            if (useCurCalibParams || meas.INCCAnalysisState == null)
            {
                meas.INCCAnalysisState = new INCCAnalysisState();
                INCCSelector sel = new INCCSelector(meas.AcquireState.detector_id, meas.AcquireState.item_type);
                AnalysisMethods am;
                bool found = CentralizedState.App.DB.DetectorMaterialAnalysisMethods.TryGetValue(sel, out am);
                if (found)
                {
                    am.selector = sel; // gotta do this so that the equality operator is not incorrect
                    meas.INCCAnalysisState.Methods = am;
                }
                else
                    meas.INCCAnalysisState.Methods = new AnalysisMethods(sel);
            } // else use what was there

            meas.InitializeContext(clearCounterResults:true);
            meas.PrepareINCCResults();

            // stratum look up, finds existing stratum by name
            if (useCurCalibParams || meas.Stratum == null)
            {
                List<INCCDB.StratumDescriptor> sl = CentralizedState.App.DB.StrataList();
                INCCDB.StratumDescriptor s = sl.Find(w => string.Compare(w.Desc.Name, meas.AcquireState.stratum_id.Name, true) == 0);
                if (s == null)
                    meas.Stratum = new Stratum();
                else
                    meas.Stratum = new Stratum(s.Stratum);
            }
            INCCResults.results_rec xres = new INCCResults.results_rec(meas);
            meas.INCCAnalysisResults.TradResultsRec = xres;
            CentralizedState.App.Opstate.Measurement = meas;   // put the measurement definition on the global state
        }
开发者ID:hnordquist,项目名称:INCC6,代码行数:73,代码来源:Central.cs

示例4: BuildMeasurement

        /// <summary>
        /// Construct a full measurement state and set it on the internal lameness
        /// </summary>
        /// <param name="acq">Acquire Parameters</param>
        /// <param name="det">Detector</param>
        /// <param name="mo">MeasurementOption</param>
        public static void BuildMeasurement(AcquireParameters acq, Detector det, AssaySelector.MeasurementOption mo)
        {
            // gather it all together
            MeasurementTuple mt = new MeasurementTuple(new DetectorList(det),
                                    CentralizedState.App.DB.TestParameters.Get(),
                                    GetCurrentNormParams(det),
                                    GetCurrentBackgroundParams(det),
                                    GetAcquireIsotopics(acq),
                                    acq,
                                    GetCurrentHVCalibrationParams(det));
            det.Id.source = acq.data_src;  // set the detector overall data source value here

            // create the context holder for the measurement. Everything is rooted here ...
            Measurement meas = new Measurement(mt, mo, CentralizedState.App.Logger(LMLoggers.AppSection.Data));

            if (det.ListMode)
            {
                // dev note: design flaw exposed by this mess here, when LM has > 1 SVR, there is no way to associate > 1 SVRs with a single detector/SR/Mult/Conn pairing
                // It should be the other way around, the Mult params for each LMMultiplicity analyzer override the single entry on the sr_parms_rec when each analyis is performed. 

                meas.AnalysisParams =  CentralizedState.App.LMBD.CountingParameters(det, applySRFromDetector:true);
                if (mo == AssaySelector.MeasurementOption.unspecified) // pure List Mode, not INCC5
                {
                    // for a list-mode-only measurement with a multiplicity analyzer the detector SR params must match at least one of the multiplicity analyzer SR params
                    ApplyVSRChangesToDefaultDetector(meas);
                }
                else // it is an INCC5 analysis driven with LM data
                {
                    // check to see if detector settings are copied into an active CA entry
                    if (!meas.AnalysisParams.Exists(w => { return (w is Multiplicity) && (w as Multiplicity).Equals(det.MultiplicityParams) && w.Active; }))
                        meas.AnalysisParams.Add(det.MultiplicityParams);
                }
            }
            else
            {
                // prepare analyzer params from detector SR params
                meas.AnalysisParams = CentralizedState.App.LMBD.CountingParameters(det, applySRFromDetector:false);
                if (!meas.AnalysisParams.Exists(w => { return (w is Multiplicity) && (w as Multiplicity).Equals(det.MultiplicityParams); }))
                    meas.AnalysisParams.Add(det.MultiplicityParams);
            }

            // get the INCC5 analysis methods
            meas.INCCAnalysisState = new INCCAnalysisState();
            INCCSelector sel = new INCCSelector(acq.detector_id, acq.item_type);
            AnalysisMethods am;
            bool found = CentralizedState.App.DB.DetectorMaterialAnalysisMethods.TryGetValue(sel, out am);
            if (found)
            {
                am.selector = sel; // gotta do this so that the equality operator is not incorrect
                meas.INCCAnalysisState.Methods = am;
            }
            else
                meas.INCCAnalysisState.Methods = new AnalysisMethods(sel);

            meas.InitializeContext();

            meas.PrepareINCCResults();

            // next: stratum not set
            List<INCCDB.StratumDescriptor> sl = CentralizedState.App.DB.StrataList();
            INCCDB.StratumDescriptor s = sl.Find(w => w.Desc.CompareTo(acq.stratum_id) == 0);
            if (s == null)
                meas.Stratum = new Stratum();
            else
                meas.Stratum = new Stratum(s.Stratum);

            INCCResults.results_rec xres = new INCCResults.results_rec(meas);
            meas.INCCAnalysisResults.TradResultsRec = xres;
            CentralizedState.App.Opstate.Measurement = meas;   // put the measurement definition on the global state

            // ready for insertion of methods and processing start

        }
开发者ID:tempbottle,项目名称:INCC6,代码行数:79,代码来源:Central.cs


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