public Measurement(MeasurementTuple newMT, AssaySelector.MeasurementOption at, NCCReporter.LMLoggers.LognLM logger) { mt = newMT; this.logger = logger; mid = new MeasId(at); InitMisc(); }
/// <summary> /// Constructs a new Measurement object with default values /// </summary> /// <param name="at">The measurement method or goal</param> /// <param name="logger">the logger handle</param> public Measurement(AssaySelector.MeasurementOption at, LMLoggers.LognLM logger) { mt = new MeasurementTuple(); this.logger = logger; mid = new MeasId(at); InitMisc(); }
public Measurement(AssaySelector.MeasurementOption at) { mt = new MeasurementTuple(); this.logger = null; mid = new MeasId(at); InitMisc(); }
/// <summary> /// Imprint a new measurement with as much information as possible from a results_rec. /// Might need to bring the Item Id into the test soon. /// </summary> /// <param name="rec">The results_rec with the measurement details</param> /// <param name="meaId">Unique id for the measurement, from the results_rec fields</param> /// <param name="logger">logger handle</param> /// <returns>A new measurement</returns> public Measurement(INCCResults.results_rec rec, MeasId meaId, NCCReporter.LMLoggers.LognLM logger) { HVCalibrationParameters hv = NCC.IntegrationHelpers.GetCurrentHVCalibrationParams(rec.det); MeasurementTuple mt = new MeasurementTuple(new DetectorList(rec.det), rec.tests, rec.norm, rec.bkg, rec.iso, rec.acq, hv); this.mt = mt; this.logger = logger; mid = meaId; InitMisc(); }
public static void BuildMeasurementMinimal(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)); CentralizedState.App.Opstate.Measurement = meas; // put the measurement definition on the global state }
/// <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)); FillInMeasurementDetails(meas); // ready for insertion of methods and processing start }
public static Measurement BuildMeasurementTemp(AcquireParameters acq, Detector det, AssaySelector.MeasurementOption mo, TestParameters tp, BackgroundParameters bkg, NormParameters np, AnalysisDefs.Isotopics iso, HVCalibrationParameters hvp) { // gather it all together MeasurementTuple mt = new MeasurementTuple(new DetectorList(det), tp, np, bkg, iso, acq, hvp); 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); FillInMeasurementDetails(meas); // ready for insertion of methods and processing start return(meas); }
/// <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 }
public Measurement(MeasurementTuple newMT, NCCReporter.LMLoggers.LognLM logger) { mt = newMT; this.logger = logger; InitMisc(); }
/// <summary> /// Imprint a new measurement with as much information as possible from a results_rec. /// </summary> /// <param name="rec">The results_rec with the measurement details</param> /// <param name="meaId">Unique id for the measurement, from the results_rec fields</param> /// <param name="logger">logger handle</param> /// <returns>A new measurement</returns> public Measurement(INCCResults.results_rec rec, MeasId meaId, LMLoggers.LognLM logger) { HVCalibrationParameters hv = NCC.IntegrationHelpers.GetCurrentHVCalibrationParams(rec.det); MeasurementTuple mt = new MeasurementTuple(new DetectorList(rec.det), rec.tests, rec.norm, rec.bkg, rec.iso, rec.acq, hv); this.mt = mt; this.logger = logger; mid = meaId; InitMisc(); if (rec.det.ListMode) { AnalysisParams = NC.App.LMBD.CountingParameters(rec.det, applySRFromDetector: true); if (meaId.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 NCC.IntegrationHelpers.ApplyVSRChangesToDefaultDetector(this); } else // it is an INCC5 analysis driven with LM data { // prepare or identify an active CA entry with matching CA gatewidth and FA, with remaining SR params as the detector AnalysisParams.PrepareMatchingVSR(rec.det.MultiplicityParams); } } else { // prepare analyzer params from detector SR params AnalysisParams = NC.App.LMBD.CountingParameters(rec.det, applySRFromDetector: false); if (!AnalysisParams.Exists(w => { return((w is Multiplicity) && (w as Multiplicity).Equals(rec.det.MultiplicityParams)); })) { AnalysisParams.Add(rec.det.MultiplicityParams); } } // get the INCC5 analysis methods INCCAnalysisState = new INCCAnalysisState(); INCCSelector sel = new INCCSelector(rec.acq.detector_id, rec.acq.item_type); AnalysisMethods am; bool found = NC.App.DB.DetectorMaterialAnalysisMethods.TryGetValue(sel, out am); if (found) { am.selector = sel; // gotta do this so that the equality operator is correct INCCAnalysisState.Methods = am; } else { INCCAnalysisState.Methods = new AnalysisMethods(sel); } InitializeContext(clearCounterResults: true); PrepareINCCResults(); // a list mode measurement may not have a multiplicity analyzer at all, create on results, copying the current values if (CountingAnalysisResults.ContainsKey(rec.det.MultiplicityParams)) { MultiplicityCountingRes mcr = (MultiplicityCountingRes)CountingAnalysisResults[rec.det.MultiplicityParams]; if (rec.mcr.AB.Unset) { SDTMultiplicityCalculator.SetAlphaBeta(rec.det.MultiplicityParams, rec.mcr); // works only if MaxBins is set } mcr.CopyFrom(rec.mcr); // copy the mcr results onto the first moskey entry // the same results are copied to the full results structure MeasOptionSelector mos = new MeasOptionSelector(MeasOption, rec.det.MultiplicityParams); INCCResult result = INCCAnalysisState.Lookup(mos); result.CopyFrom(rec.mcr); } Stratum = new Stratum(rec.st); // the stratum from the results rec }
/// <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 }