Example #1
0
        public IDDCollarCrossRef(INCCAnalysisParams.collar_combined_rec c = null, bool mod = false)
        {
            InitializeComponent();
            mp = new MethodParamFormFields(AnalysisMethod.Collar);

            RelativeDoublesRateTextBox.ToValidate = NumericTextBox.ValidateType.Float;
            RelativeDoublesRateTextBox.NumberFormat = NumericTextBox.Formatter.F3;

            Integ.GetCurrentAcquireDetectorPair(ref mp.acq, ref mp.det);
            this.Text += " for " + mp.det.Id.DetectorName;
            modified = mod;
            mp.RefreshMatTypeComboBox(MaterialTypeComboBox);
            mp.SelectMaterialType(MaterialTypeComboBox);
            if (mp.HasMethod && c == null)
            {
                mp.imd = new INCCAnalysisParams.collar_combined_rec((INCCAnalysisParams.collar_combined_rec)mp.ams.GetMethodParameters(mp.am));
                col = (INCCAnalysisParams.collar_combined_rec)mp.imd;
            }
            else if (mp.HasMethod && c != null)
            {
                col = c;
            }
            else
            {
                mp.imd = new INCCAnalysisParams.collar_combined_rec(); // not mapped, so make a new one
                col = (INCCAnalysisParams.collar_combined_rec)mp.imd;
                modified = true;
            }

            CrossReferenceFieldFiller(col);
            this.TopMost = true;
        }
Example #2
0
        public IDDCorrectionFactors(INCCAnalysisParams.collar_combined_rec c, bool mod)
        {
            InitializeComponent();
            mp = new MethodParamFormFields(AnalysisMethod.Collar);
            modified = mod;
            Integ.GetCurrentAcquireDetectorPair(ref mp.acq, ref mp.det);
            this.Text += " for " + mp.det.Id.DetectorName;

            col = c;
            MaterialLabel.Text = mp.acq.item_type;
            ModeLabel.Text = col.collar.collar_mode ? "Fast(Cd)" : "Thermal (no Cd)";
            DetectorLabel.Text = mp.det.Id.DetectorName;

            ATextBox.NumberFormat = NumericTextBox.Formatter.E6;
            ATextBox.ToValidate = NumericTextBox.ValidateType.Double;
            AErrorTextBox.NumberFormat = NumericTextBox.Formatter.E6;
            AErrorTextBox.ToValidate = NumericTextBox.ValidateType.Double;
            BTextBox.NumberFormat = NumericTextBox.Formatter.E6;
            BTextBox.ToValidate = NumericTextBox.ValidateType.Double;
            BErrorTextBox.NumberFormat = NumericTextBox.Formatter.E6;
            BErrorTextBox.ToValidate = NumericTextBox.ValidateType.Double;

            FillForm();
            this.TopMost = true;
        }
Example #3
0
        public IDDCollarCrossRef(INCCAnalysisParams.collar_combined_rec c = null, bool mod = false)
        {
            InitializeComponent();
            mp = new MethodParamFormFields(AnalysisMethod.CollarAmLi);

            RelativeDoublesRateTextBox.ToValidate   = NumericTextBox.ValidateType.Float;
            RelativeDoublesRateTextBox.NumberFormat = NumericTextBox.Formatter.F3;

            Integ.GetCurrentAcquireDetectorPair(ref mp.acq, ref mp.det);
            this.Text += " for " + mp.det.Id.DetectorName;
            modified   = mod;
            mp.RefreshMatTypeComboBox(MaterialTypeComboBox);
            mp.SelectMaterialType(MaterialTypeComboBox);
            if (mp.HasMethod && c == null)
            {
                mp.imd = new INCCAnalysisParams.collar_combined_rec((INCCAnalysisParams.collar_combined_rec)mp.ams.GetMethodParameters(mp.am));
                col    = (INCCAnalysisParams.collar_combined_rec)mp.imd;
            }
            else if (mp.HasMethod && c != null)
            {
                col = c;
            }
            else
            {
                mp.imd   = new INCCAnalysisParams.collar_combined_rec(); // not mapped, so make a new one
                col      = (INCCAnalysisParams.collar_combined_rec)mp.imd;
                modified = true;
            }

            CrossReferenceFieldFiller(col);
            this.TopMost = true;
        }
Example #4
0
        public IDDCorrectionFactors(INCCAnalysisParams.collar_combined_rec c, bool mod)
        {
            InitializeComponent();
            mp       = new MethodParamFormFields(AnalysisMethod.CollarAmLi);
            modified = mod;
            Integ.GetCurrentAcquireDetectorPair(ref mp.acq, ref mp.det);
            this.Text += " for " + mp.det.Id.DetectorName;

            col = c;
            MaterialLabel.Text = mp.acq.item_type;
            ModeLabel.Text     = col.collar.collar_mode ? "Fast(Cd)" : "Thermal (no Cd)";
            DetectorLabel.Text = mp.det.Id.DetectorName;

            ATextBox.NumberFormat      = NumericTextBox.Formatter.E6;
            ATextBox.ToValidate        = NumericTextBox.ValidateType.Double;
            AErrorTextBox.NumberFormat = NumericTextBox.Formatter.E6;
            AErrorTextBox.ToValidate   = NumericTextBox.ValidateType.Double;
            BTextBox.NumberFormat      = NumericTextBox.Formatter.E6;
            BTextBox.ToValidate        = NumericTextBox.ValidateType.Double;
            BErrorTextBox.NumberFormat = NumericTextBox.Formatter.E6;
            BErrorTextBox.ToValidate   = NumericTextBox.ValidateType.Double;

            FillForm();
            this.TopMost = true;
        }
Example #5
0
 public void CrossReferenceFieldFiller(INCCAnalysisParams.collar_combined_rec col)
 {
     MaterialTypeComboBox.SelectedIndex = MaterialTypeComboBox.FindStringExact(mp.acq.item_type) >= 0?MaterialTypeComboBox.FindStringExact(mp.acq.item_type):0;
     ModeComboBox.SelectedIndex         = col.collar_det.collar_mode;
     RelativeDoublesRateTextBox.Value   = col.collar_det.relative_doubles_rate;
     ReferenceDateTimePicker.Value      = col.collar_det.reference_date;
     poison = NCC.CentralizedState.App.DB.PoisonRods.GetList();
     SetHelp();
 }
Example #6
0
        private void AcquireVerificationClick(object sender, RoutedEventArgs e)
        {
            AcquireParameters ap = Integ.GetCurrentAcquireParams();

            Detector det = new Detector();

            INCCAnalysisParams.collar_combined_rec parms = new INCCAnalysisParams.collar_combined_rec();

            Integ.GetCurrentAcquireDetectorPair(ref ap, ref det);
            NormParameters  npp = Integ.GetCurrentNormParams(det);
            AnalysisMethods am  = Integ.GetMethodSelections(ap);

            if (am != null)
            {
                if (Integ.GetMethodSelections(det.Id.DetectorId, ap.ItemId.material).Has(AnalysisMethod.CollarAmLi))
                {
                    IDDAcquireAssay f      = new IDDAcquireAssay();
                    DialogResult    result = f.ShowDialog();
                    f.Close();
                    if (result == System.Windows.Forms.DialogResult.OK)
                    {
                        IDDCollarItemData data = new IDDCollarItemData();
                        result = data.ShowDialog();
                        data.Close();
                    }

                    if (result == System.Windows.Forms.DialogResult.OK)
                    {
                        IDDK5CollarItemData k5 = new IDDK5CollarItemData(parms, true);
                        result = k5.ShowDialog();
                        k5.Close();
                    }
                    if (result == System.Windows.Forms.DialogResult.OK)
                    {
                        IDDCollarAcquire dlg = new IDDCollarAcquire(npp);
                        dlg.ShowDialog();
                    }
                }
                else
                {
                    IDDAcquireAssay f = new IDDAcquireAssay();
                    f.ShowDialog();
                }
            }
            else
            {
                System.Windows.Forms.MessageBox.Show("You must define at least one analysis method.", "ERROR");
            }
        }
Example #7
0
        public IDDCollarCal(INCCAnalysisParams.collar_combined_rec c, bool mod)
        {
            InitializeComponent();
            mp       = new MethodParamFormFields(AnalysisMethod.CollarAmLi);
            modified = mod;
            Integ.GetCurrentAcquireDetectorPair(ref mp.acq, ref mp.det);
            this.Text += " for " + mp.det.Id.DetectorName;

            col    = c;
            mp.cev = col.collar.cev;
            mp.RefreshCurveEqComboBox(CurveTypeComboBox);
            CalibrationFieldFiller(col.collar.cev);
            SetHelp();
            this.TopMost = true;
        }
Example #8
0
 public IDDCollarAcquire(NormParameters npp)
 {
     InitializeComponent();
     ap = Integ.GetCurrentAcquireParams();
     col = new INCCAnalysisParams.collar_combined_rec();
     ah = new AcquireHandlers();
     ah.mo = AssaySelector.MeasurementOption.verification;
     Text += " for detector " + ah.det.Id.DetectorName;
     //ableTermControls();
     Detector d= new Detector();
     Integ.GetCurrentAcquireDetectorPair(ref ap, ref d);
     npp.CopyTo(norm);
     Integ.BuildMeasurement(ap, d, AssaySelector.MeasurementOption.verification);
     am = Integ.GetMethodSelections(ah.ap);
     // Main window checks if Collar is defined for material type. No check needed here.
     FillForm();
 }
Example #9
0
        private void FillForm()
        {
            AnalysisMethods am = Integ.GetMethodSelections(ap);
            col = new INCCAnalysisParams.collar_combined_rec();
            if (am != null)
            {
                // Grab the settings.
                if (am.HasMethod(AnalysisMethod.CollarAmLi))
                    col = (INCCAnalysisParams.collar_combined_rec)am.GetMethodParameters(AnalysisMethod.CollarAmLi);
            }

            // Default is to request passive measurement info. Once that is entered or pulled from a measurement, we 
            // can enable the active, then the calculation. HN 5/3/2017
            ModeComboBox.SelectedIndex = col.collar.collar_mode;
            PassiveMeasurementRadioButton.Checked = true;
            PassiveMeasurementRadioButton.Enabled = false;
            ActiveMeasurementRadioButton.Checked = false;
            ActiveMeasurementRadioButton.Enabled = false;
            CalculateResultsRadioButton.Checked = false;
            CalculateResultsRadioButton.Enabled = false;

            //These are all filled based on 1) a live measurement or 2) a stored measurement
            ActiveSinglesTextBox.ReadOnly = true;
            ActiveSinglesTextBox.NumberFormat = NumericTextBox.Formatter.F3;
            ActiveSinglesErrorTextBox.ReadOnly = true;
            ActiveSinglesErrorTextBox.NumberFormat = NumericTextBox.Formatter.F3;
            ActiveDoublesTextBox.ReadOnly = true;
            ActiveDoublesTextBox.NumberFormat = NumericTextBox.Formatter.F3;
            ActiveDoublesErrorTextBox.ReadOnly = true;
            ActiveDoublesErrorTextBox.NumberFormat = NumericTextBox.Formatter.F3;

            PassiveSinglesTextBox.ReadOnly = true;
            PassiveSinglesTextBox.NumberFormat = NumericTextBox.Formatter.F3;
            PassiveSinglesErrorTextBox.ReadOnly = true;
            PassiveSinglesErrorTextBox.NumberFormat = NumericTextBox.Formatter.F3;
            PassiveDoublesTextBox.ReadOnly = true;
            PassiveDoublesTextBox.NumberFormat = NumericTextBox.Formatter.F3;
            PassiveDoublesErrorTextBox.ReadOnly = true;
            PassiveDoublesErrorTextBox.NumberFormat = NumericTextBox.Formatter.F3;
        }
Example #10
0
        private void OKBtn_Click(object sender, EventArgs e)
        {
            DialogResult = DialogResult.OK;
            //If they didn't load a passive measurement from the DB, so measure it.

            if (passive == null)
            {
                ItemId Cur = NC.App.DB.ItemIds.Get(ap.item_id);
                Cur.IsoApply(NC.App.DB.Isotopics.Get(ap.isotopics_id));           // apply the iso dates to the item

                NC.App.DB.ItemIds.Set();  // writes any new or modified item ids to the DB
                NC.App.DB.ItemIds.Refresh();    // save and update the in-memory item list 

                if (DialogResult == DialogResult.OK)
                {
                    Visible = false;
                    // Add strata update to measurement object.    HN 9.23.2015              
                    UIIntegration.Controller.SetAssay();  // tell the controller to do an assay operation using the current measurement state
                    UIIntegration.Controller.Perform();  // start the measurement file or DAQ thread
                }
                DialogResult = DialogResult.None;
                passive = NCC.CentralizedState.App.Opstate.Measurement;
            }
            else // We've got the passive data, go ahead and get the active cycles
            {
                Visible = false;
                INCCAnalysisParams.collar_combined_rec ka = (INCCAnalysisParams.collar_combined_rec)am.GetMethodParameters(AnalysisMethod.CollarAmLi);
                Integ.BuildMeasurement(ap, Integ.GetCurrentAcquireDetector(), AssaySelector.MeasurementOption.verification);
                Integ.PersistDetectorAndAssociations(Integ.GetCurrentAcquireDetector());
                //active = new Measurement(AssaySelector.MeasurementOption.verification, NC.App.Loggers.DataLogger);
                //active.InitializeResultsSummarizers();
                //active.InitializeContext(true);
                //active.Persist();
                // Add strata update to measurement object.    HN 9.23.2015              
                UIIntegration.Controller.SetAssay();  // tell the controller to do an assay operation using the current measurement state
                UIIntegration.Controller.Perform();  // start the measurement file or DAQ thread
                Close();
            }
        }
Example #11
0
        public IDDK5CollarItemData(INCCAnalysisParams.collar_combined_rec c, bool mod)
        {
            InitializeComponent();
            col                         = c;
            modified                    = mod;
            K5TextBox.ToValidate        = NumericTextBox.ValidateType.Double;
            K5TextBox.NumberFormat      = NumericTextBox.Formatter.E3;
            K5ErrorTextBox.ToValidate   = NumericTextBox.ValidateType.Double;
            K5ErrorTextBox.NumberFormat = NumericTextBox.Formatter.E3;
            K5TextBox.Value             = col.collar.sample_corr_fact.v;
            K5ErrorTextBox.Value        = col.collar.sample_corr_fact.err;

            for (int i = 0; i < INCCAnalysisParams.MAX_COLLAR_K5_PARAMETERS; i++)
            {
                if (col.k5.k5[i] != null)
                {
                    DataGridViewRow row = new DataGridViewRow();
                    row.CreateCells(dataGridView1);
                    dataGridView1.Rows.Add(new object[] { col.k5.k5_checkbox[i], col.k5.k5_label[i], col.k5.k5[i].v, col.k5.k5[i].err });
                }
            }
            k5TotalTextBox.Value    = total;
            k5TotalErrTextBox.Value = totalerr;
        }
Example #12
0
 public void CrossReferenceFieldFiller(INCCAnalysisParams.collar_combined_rec col)
 {
     MaterialTypeComboBox.SelectedIndex = MaterialTypeComboBox.FindStringExact(mp.acq.item_type) >= 0?MaterialTypeComboBox.FindStringExact(mp.acq.item_type):0;
     ModeComboBox.SelectedIndex         = Convert.ToInt32(col.collar_det.collar_mode);
     RelativeDoublesRateTextBox.Value   = col.collar_det.relative_doubles_rate;
     ReferenceDateTimePicker.Value      = col.collar_det.reference_date;
     poison = NCC.CentralizedState.App.DB.PoisonRods.GetList();
     for (int i = 0; i < poison.Count; i++)
     {
         PoisonRodTypesComboBox.Items.Add(poison[i].rod_type);
     }
     if (PoisonRodTypesComboBox.Items.Count > 0)
     {
         int idx = PoisonRodTypesComboBox.FindStringExact(col.collar.poison_rod_type[0]);
         PoisonRodTypesComboBox.SelectedIndex = idx;
         PoisonAbsorptionFactorTextBox.Value  = poison[idx].absorption_factor;
     }
     else
     {
         PoisonRodTypesComboBox.Items.Add("No types defined");
         PoisonAbsorptionFactorTextBox.Value = 0;
     }
     SetHelp();
 }
Example #13
0
        public IDDK5CollarItemData(INCCAnalysisParams.collar_combined_rec c, bool mod)
        {
            InitializeComponent();
            col = c;
            modified = mod;
            K5TextBox.ToValidate = NumericTextBox.ValidateType.Double;
            K5TextBox.NumberFormat = NumericTextBox.Formatter.E3;
            K5ErrorTextBox.ToValidate = NumericTextBox.ValidateType.Double;
            K5ErrorTextBox.NumberFormat = NumericTextBox.Formatter.E3;
            K5TextBox.Value = col.collar.sample_corr_fact.v;
            K5ErrorTextBox.Value = col.collar.sample_corr_fact.err;

            for (int i = 0; i < INCCAnalysisParams.MAX_COLLAR_K5_PARAMETERS; i ++)
            {
                if (col.k5.k5[i] != null)
                {
                    DataGridViewRow row = new DataGridViewRow();
                    row.CreateCells(dataGridView1);
                    dataGridView1.Rows.Add(new object[] { col.k5.k5_checkbox[i], col.k5.k5_label[i], col.k5.k5[i].v, col.k5.k5[i].err });
                }
            }
            k5TotalTextBox.Value = total;
            k5TotalErrTextBox.Value = totalerr;
        }
Example #14
0
        /// <summary>
        /// Get specific parameter sets for the given detector, material type pair.
        /// Returns default values if database entry not found
        /// </summary>
        /// <param name="detname"></param>
        /// <param name="mat"></param>
        /// <param name="db"></param>
        public void IngestAnalysisMethodSpecificsFromDB(INCCSelector sel, AnalysisMethods ams, DB.AnalysisMethodSpecifiers db)
        {
            foreach (AnalysisMethod am in System.Enum.GetValues(typeof(AnalysisMethod)))
            {
                if (!ams.choices[(int)am])
                    continue;
                if (!(am > AnalysisMethod.None && am <= AnalysisMethod.TruncatedMultiplicity && (am != AnalysisMethod.INCCNone)))
                {
                    if (!am.IsNone())
                        NC.App.Pest.logger.TraceEvent(LogLevels.Warning, 34061, "Skipping DB ingest of {0} {1} calib params", sel, am);
                    continue;
                }
                string current = String.Format("{0} {1} parameters", sel, am.FullName());
                int logid = 34170 + (int)am;
                LogLevels lvl = LogLevels.Verbose;
                DataRow dr;
                switch (am)
                {
                    case AnalysisMethod.KnownA:
                        INCCAnalysisParams.known_alpha_rec ks = new INCCAnalysisParams.known_alpha_rec();
                        dr = db.Get(sel.detectorid, sel.material, "known_alpha_rec");
                        if (dr != null)
                        {
                            ks.rho_zero = DB.Utils.DBDouble(dr["rho_zero"]);
                            ks.alpha_wt = DB.Utils.DBDouble(dr["alpha_wt"]);
                            ks.k = DB.Utils.DBDouble(dr["k"]);
                            ks.cev.a = DB.Utils.DBDouble(dr["a"]);
                            ks.cev.b = DB.Utils.DBDouble(dr["b"]);
                            ks.cev.var_a = DB.Utils.DBDouble(dr["var_a"]);
                            ks.cev.var_b = DB.Utils.DBDouble(dr["var_b"]);
                            ks.cev.setcovar(Coeff.a, Coeff.b, DB.Utils.DBDouble(dr["covar_ab"]));
                            ks.cev.sigma_x = DB.Utils.DBDouble(dr["sigma_x"]);
                            ks.known_alpha_type = (INCCAnalysisParams.KnownAlphaVariant)(DB.Utils.DBInt32(dr["known_alpha_type"]));
                            ks.ring_ratio.cal_curve_equation = (INCCAnalysisParams.CurveEquation)(DB.Utils.DBInt32(dr["ring_ratio_equation"]));
                            ks.ring_ratio.a = DB.Utils.DBDouble(dr["ring_ratio_a"]);
                            ks.ring_ratio.b = DB.Utils.DBDouble(dr["ring_ratio_b"]);
                            ks.ring_ratio.c = DB.Utils.DBDouble(dr["ring_ratio_c"]);
                            ks.ring_ratio.d = DB.Utils.DBDouble(dr["ring_ratio_d"]);
                            ks.dcl_mass = DB.Utils.ReifyDoubles((string)dr["dcl_mass"]);
                            ks.doubles = DB.Utils.ReifyDoubles((string)dr["doubles"]);
                            ks.heavy_metal_reference = DB.Utils.DBDouble(dr["heavy_metal_reference"]);
                            ks.heavy_metal_corr_factor = DB.Utils.DBDouble(dr["heavy_metal_corr_factor"]);
                            ks.cev.upper_mass_limit = DB.Utils.DBDouble(dr["upper_mass_limit"]);
                            ks.cev.lower_mass_limit = DB.Utils.DBDouble(dr["lower_mass_limit"]);
                        }
                        else
                            lvl = LogLevels.Info;
                        ams.AddMethod(am, ks);
                        break;
                    case AnalysisMethod.CalibrationCurve:
                        INCCAnalysisParams.cal_curve_rec cs = new INCCAnalysisParams.cal_curve_rec();
                        dr = db.Get(sel.detectorid, sel.material, "cal_curve_rec");
                        if (dr != null)
                        {
                            CalCurveDBSnock(cs.cev, dr);
                            cs.CalCurveType = (INCCAnalysisParams.CalCurveType)DB.Utils.DBInt32(dr["cal_curve_type"]);
                            cs.dcl_mass = DB.Utils.ReifyDoubles((string)dr["dcl_mass"]);
                            cs.doubles = DB.Utils.ReifyDoubles((string)dr["doubles"]);
                            cs.percent_u235 = DB.Utils.DBDouble(dr["percent_u235"]);
                            cs.heavy_metal_reference = DB.Utils.DBDouble(dr["heavy_metal_reference"]);
                            cs.heavy_metal_corr_factor = DB.Utils.DBDouble(dr["heavy_metal_corr_factor"]);
                        }
                        else
                            lvl = LogLevels.Info;
                        ams.AddMethod(am, cs);
                        break;
                    case AnalysisMethod.KnownM:
                        INCCAnalysisParams.known_m_rec ms = new INCCAnalysisParams.known_m_rec();
                        dr = db.Get(sel.detectorid, sel.material, "known_m_rec");
                        if (dr != null)
                        {
                            ms.sf_rate = DB.Utils.DBDouble(dr["sf_rate"]);
                            ms.vs1 = DB.Utils.DBDouble(dr["vs1"]);
                            ms.vs2 = DB.Utils.DBDouble(dr["vs2"]);
                            ms.vi1 = DB.Utils.DBDouble(dr["vi1"]);
                            ms.vi2 = DB.Utils.DBDouble(dr["vi2"]);
                            ms.b = DB.Utils.DBDouble(dr["b"]);
                            ms.c = DB.Utils.DBDouble(dr["c"]);
                            ms.sigma_x = DB.Utils.DBDouble(dr["sigma_x"]);
                            ms.lower_mass_limit = DB.Utils.DBDouble(dr["lower_mass_limit"]);
                            ms.upper_mass_limit = DB.Utils.DBDouble(dr["upper_mass_limit"]);
                        }
                        else
                            lvl = LogLevels.Info;
                        ams.AddMethod(am, ms);
                        break;
                    case AnalysisMethod.Multiplicity:
                        INCCAnalysisParams.multiplicity_rec mu = new INCCAnalysisParams.multiplicity_rec();
                        dr = db.Get(sel.detectorid, sel.material, "multiplicity_rec");
                        if (dr != null)
                        {
                            mu.solve_efficiency = (INCCAnalysisParams.MultChoice)DB.Utils.DBInt32(dr["solve_efficiency"]);
                            mu.sf_rate = DB.Utils.DBDouble(dr["sf_rate"]);
                            mu.vs1 = DB.Utils.DBDouble(dr["vs1"]);
                            mu.vs2 = DB.Utils.DBDouble(dr["vs2"]);
                            mu.vs3 = DB.Utils.DBDouble(dr["vs3"]);
                            mu.vi1 = DB.Utils.DBDouble(dr["vi1"]);
                            mu.vi2 = DB.Utils.DBDouble(dr["vi2"]);
                            mu.vi3 = DB.Utils.DBDouble(dr["vi3"]);
                            mu.a = DB.Utils.DBDouble(dr["a"]);
                            mu.b = DB.Utils.DBDouble(dr["b"]);
                            mu.c = DB.Utils.DBDouble(dr["c"]);
                            mu.sigma_x = DB.Utils.DBDouble(dr["sigma_x"]);
                            mu.alpha_weight = DB.Utils.DBDouble(dr["alpha_weight"]);
                            mu.multEffCorFactor = DB.Utils.DBDouble(dr["eff_cor"]);
                        }
                        else
                            lvl = LogLevels.Info;
                        ams.AddMethod(am, mu);
                        break;
                    case AnalysisMethod.TruncatedMultiplicity:
                        INCCAnalysisParams.truncated_mult_rec tm = new INCCAnalysisParams.truncated_mult_rec();
                        dr = db.Get(sel.detectorid, sel.material, "truncated_mult_rec");
                        if (dr != null)
                        {
                            tm.known_eff = DB.Utils.DBBool(dr["known_eff"]);
                            tm.solve_eff = DB.Utils.DBBool(dr["vs1"]);
                            tm.a = DB.Utils.DBDouble(dr["a"]);
                            tm.b = DB.Utils.DBDouble(dr["b"]);
                        }
                        else
                            lvl = LogLevels.Info;
                        ams.AddMethod(am, tm);
                        break;
                    case AnalysisMethod.CuriumRatio:
                        INCCAnalysisParams.curium_ratio_rec cm = new INCCAnalysisParams.curium_ratio_rec();
                        dr = db.Get(sel.detectorid, sel.material, "curium_ratio_rec");
                        if (dr != null)
                        {
                            cm.curium_ratio_type = (INCCAnalysisParams.CuriumRatioVariant)DB.Utils.DBInt32(dr["curium_ratio_type"]);
                            CalCurveDBSnock(cm.cev, dr);
                        }
                        else
                            lvl = LogLevels.Info;
                        ams.AddMethod(am, cm);
                        break;
                    case AnalysisMethod.Active:
                        INCCAnalysisParams.active_rec ar = new INCCAnalysisParams.active_rec();
                        dr = db.Get(sel.detectorid, sel.material, "active_rec");
                        if (dr != null)
                        {
                            CalCurveDBSnock(ar.cev, dr);
                            ar.dcl_mass = DB.Utils.ReifyDoubles((string)dr["dcl_mass"]);
                            ar.doubles = DB.Utils.ReifyDoubles((string)dr["doubles"]);
                        }
                        else
                            lvl = LogLevels.Info;
                        ams.AddMethod(am, ar);
                        break;
                    case AnalysisMethod.AddASource:
                        INCCAnalysisParams.add_a_source_rec aas = new INCCAnalysisParams.add_a_source_rec();
                        dr = db.Get(sel.detectorid, sel.material, "add_a_source_rec");
                        if (dr != null)
                        {
                            CalCurveDBSnock(aas.cev, dr);
                            aas.dcl_mass = DB.Utils.ReifyDoubles((string)dr["dcl_mass"]);
                            aas.doubles = DB.Utils.ReifyDoubles((string)dr["doubles"]);

                            aas.cf.a = DB.Utils.DBDouble(dr["cf_a"]);
                            aas.cf.b = DB.Utils.DBDouble(dr["cf_b"]);
                            aas.cf.c = DB.Utils.DBDouble(dr["cf_c"]);
                            aas.cf.d = DB.Utils.DBDouble(dr["cf_d"]);

                            aas.dzero_avg = DB.Utils.DBDouble(dr["dzero_avg"]);
                            aas.num_runs = DB.Utils.DBUInt16(dr["num_runs"]);
                            aas.position_dzero = DB.Utils.ReifyDoubles((string)dr["position_dzero"]);
                            aas.dzero_ref_date = DB.Utils.DBDateTime(dr["dzero_ref_date"]);
                            aas.use_truncated_mult = DB.Utils.DBBool(dr["use_truncated_mult"]);
                            aas.tm_dbls_rate_upper_limit = DB.Utils.DBDouble(dr["tm_dbls_rate_upper_limit"]);
                            aas.tm_weighting_factor = DB.Utils.DBDouble(dr["tm_weighting_factor"]);
                        }
                        else
                            lvl = LogLevels.Info;
                        ams.AddMethod(am, aas);
                        break;
                    case AnalysisMethod.ActiveMultiplicity:
                        INCCAnalysisParams.active_mult_rec amr = new INCCAnalysisParams.active_mult_rec();
                        dr = db.Get(sel.detectorid, sel.material, "active_mult_rec");
                        if (dr != null)
                        {
                            amr.vf1 = DB.Utils.DBDouble(dr["vf1"]);
                            amr.vf2 = DB.Utils.DBDouble(dr["vf2"]);
                            amr.vf3 = DB.Utils.DBDouble(dr["vf3"]);
                            amr.vt1 = DB.Utils.DBDouble(dr["vt1"]);
                            amr.vt2 = DB.Utils.DBDouble(dr["vt2"]);
                            amr.vt3 = DB.Utils.DBDouble(dr["vt3"]);
                        }
                        else
                            lvl = LogLevels.Info;
                        ams.AddMethod(am, amr);
                        break;
                    case AnalysisMethod.ActivePassive:
                        INCCAnalysisParams.active_passive_rec acp = new INCCAnalysisParams.active_passive_rec();
                        dr = db.Get(sel.detectorid, sel.material, "active_passive_rec");
                        if (dr != null)
                        {
                            CalCurveDBSnock(acp.cev, dr);
                        }
                        else
                            lvl = LogLevels.Info;
                        ams.AddMethod(am, acp);
                        break;
                    case AnalysisMethod.Collar:
                        INCCAnalysisParams.collar_combined_rec cr = new INCCAnalysisParams.collar_combined_rec();
                        dr = db.Get(sel.detectorid, sel.material, "collar_detector_rec");
                        if (dr != null)
                        {
                            cr.collar_det.collar_mode = DB.Utils.DBBool(dr["collar_detector_mode"]);
                            cr.collar_det.reference_date = DB.Utils.DBDateTime(dr["reference_date"]);
                            cr.collar_det.relative_doubles_rate = DB.Utils.DBDouble(dr["relative_doubles_rate"]);
                        }
                        else
                            lvl = LogLevels.Info;
                        dr = db.Get(sel.detectorid, sel.material, "collar_rec");
                        if (dr != null)
                        {
                            CalCurveDBSnock(cr.collar.cev, dr);
                            cr.collar.collar_mode = DB.Utils.DBBool(dr["collar_mode"]);
                            cr.collar.number_calib_rods = DB.Utils.DBInt32(dr["number_calib_rods"]);
                            cr.collar.sample_corr_fact.v = DB.Utils.DBDouble(dr["sample_corr_fact"]);
                            cr.collar.sample_corr_fact.err = DB.Utils.DBDouble(dr["sample_corr_fact_err"]);
                            cr.collar.u_mass_corr_fact_a.v = DB.Utils.DBDouble(dr["u_mass_corr_fact_a"]);
                            cr.collar.u_mass_corr_fact_a.err = DB.Utils.DBDouble(dr["u_mass_corr_fact_a_err"]);
                            cr.collar.u_mass_corr_fact_b.v = DB.Utils.DBDouble(dr["u_mass_corr_fact_b"]);
                            cr.collar.u_mass_corr_fact_b.err = DB.Utils.DBDouble(dr["u_mass_corr_fact_b_err"]);
                            cr.collar.poison_absorption_fact = DB.Utils.ReifyDoubles(dr["poison_absorption_fact"].ToString());
                            cr.collar.poison_rod_type = DB.Utils.ReifyStrings(dr["poison_rod_type"].ToString());
                            TupleArraySlurp(ref cr.collar.poison_rod_a, "poison_rod_a", dr);
                            TupleArraySlurp(ref cr.collar.poison_rod_b, "poison_rod_b", dr);
                            TupleArraySlurp(ref cr.collar.poison_rod_c, "poison_rod_c", dr);
                        }
                        else
                            lvl = LogLevels.Info;
                        dr = db.Get(sel.detectorid, sel.material, "collar_k5_rec");
                        if (dr != null)
                        {
                            cr.k5.k5_mode = DB.Utils.DBBool(dr["k5_mode"]);
                            cr.k5.k5_checkbox = DB.Utils.ReifyBools(dr["k5_checkbox"].ToString());
                            cr.k5.k5_item_type = string.Copy(sel.material);
                            cr.k5.k5_label = DB.Utils.ReifyStrings(dr["k5_label"].ToString());
                            TupleArraySlurp(ref cr.k5.k5, "k5", dr);
                        }
                        else
                            lvl = LogLevels.Info;
                        ams.AddMethod(am, cr);
                        break;
                    default:
                        lvl = LogLevels.Error; logid = 34181; current = "Choosing to not construct" + current;
                        break;
                }
                switch (lvl)
                {
                    case LogLevels.Info:
                        current = "Using default for " + current;
                        lvl = LogLevels.Verbose;
                        break;
                    case LogLevels.Verbose:
                        current = "Retrieved for " + current;
                        break;
                    default:
                        break;
                }
                NC.App.Pest.logger.TraceEvent(lvl, logid, current);
            } // for
        }
Example #15
0
 public void CrossReferenceFieldFiller(INCCAnalysisParams.collar_combined_rec col)
 {
 }
Example #16
0
        INCCAnalysisParams.collar_combined_rec CollarEntryProcesser(INCCInitialDataCalibrationFile idcf, INCCSelector sel, byte mode)
        {
            DetectorMaterialMethod m1 = new DetectorMaterialMethod(sel.material, sel.detectorid, INCC.COLLAR_DETECTOR_SAVE_RESTORE); m1.extra = mode;
            DetectorMaterialMethod m2 = new DetectorMaterialMethod(sel.material, sel.detectorid, INCC.COLLAR_SAVE_RESTORE); m2.extra = mode;
            DetectorMaterialMethod m3 = new DetectorMaterialMethod(sel.material, sel.detectorid, INCC.COLLAR_K5_SAVE_RESTORE); m3.extra = mode;

            KeyValuePair<DetectorMaterialMethod, object> k1, k2, k3;
            bool ok = idcf.DetectorMaterialMethodParameters.GetPair(m1, out k1);
            if (!ok)
            {
                mlogger.TraceEvent(LogLevels.Verbose, 30811, "No collar detector values for " + m1.ToString());
                ok = idcf.DetectorMaterialMethodParameters.GetPair(m2, out k2);
                if (ok)
                {
                    // k5 and collar but no det entry, find the closest match det entry and make a fake one and use it
                    List<KeyValuePair<DetectorMaterialMethod, object>> l = idcf.DetectorMaterialMethodParameters.GetDetectorsWithEntries;
                    if (l.Count > 0)
                    {
                        object o = l[0].Value;
                        collar_detector_rec rec = MakeAFake((collar_detector_rec)o, sel.detectorid, sel.material);
                        DetectorMaterialMethod mf1 = new DetectorMaterialMethod(sel.material, sel.detectorid, INCC.COLLAR_DETECTOR_SAVE_RESTORE); mf1.extra = mode;
                        k1 = new KeyValuePair<DetectorMaterialMethod, object>(mf1, rec);
                    }
                    else
                        return null;
                }
                else
                {
                    mlogger.TraceEvent(LogLevels.Verbose, 30812, "No collar values for " + m2.ToString());
                    return null;
                }
            }
            else
            {
                ok = idcf.DetectorMaterialMethodParameters.GetPair(m2, out k2);
                if (!ok)
                {
                    mlogger.TraceEvent(LogLevels.Verbose, 30812, "No collar values for " + m2.ToString());
                    return null;
                }
            }
            ok = idcf.DetectorMaterialMethodParameters.GetPair(m3, out k3);
            if (!ok)
            {
                mlogger.TraceEvent(LogLevels.Verbose, 30813, "No k5 values for " + m3.ToString());
                return null;
            }
            collar_rec collar;
            collar_detector_rec collar_detector;
            collar_k5_rec collar_k5;
            if (k1.Key.extra == -1)
                return null;
            collar_detector = (collar_detector_rec)k1.Value;
            if (k2.Key.extra == -1)
                return null;
            collar = (collar_rec)k2.Value;
            if (k3.Key.extra == -1)
                return null;
            collar_k5 = (collar_k5_rec)k3.Value;
            // got the three
            INCCAnalysisParams.collar_combined_rec combined = new INCCAnalysisParams.collar_combined_rec();
            ushort bonk = 0;
            CollarDet(combined, collar_detector, bonk);
            bonk = 1;
            CollarParm(combined, collar, bonk);
            bonk = 2;
            CollarK5(combined, collar_k5, bonk);
            bonk = 3;

            k1.Key.extra = -1;
            k2.Key.extra = -1;
            k3.Key.extra = -1;
            return combined;
        }
Example #17
0
        /// the details
        public void UpdateAnalysisMethodSpecifics(string detname, string mat, DB.AnalysisMethodSpecifiers db = null)
        {
            if (db == null)
                db = new DB.AnalysisMethodSpecifiers();
            var res =   // this finds the am for the given detector and acquire type
                    from am in this.DetectorMaterialAnalysisMethods
                    where (am.Key.detectorid.Equals(detname, StringComparison.OrdinalIgnoreCase) &&
                           am.Key.material.Equals(mat, StringComparison.OrdinalIgnoreCase))
                    select am;
            if (res.Count() > 0)  // now execute the select expression and test the result for existence
            {
                KeyValuePair<INCCSelector, AnalysisMethods> kv = res.First();
                AnalysisMethods sam = kv.Value;  // the descriptor instance

                IEnumerator iter = kv.Value.GetMethodEnumerator();
                while (iter.MoveNext())
                {
                    System.Tuple<AnalysisMethod, INCCAnalysisParams.INCCMethodDescriptor> md = (System.Tuple<AnalysisMethod, INCCAnalysisParams.INCCMethodDescriptor>)iter.Current;
                    if (md.Item2 == null) // case from INCC5 transfer missing params, reflects file write bugs in INCC5 code
                    {
                        NC.App.Pest.logger.TraceEvent(LogLevels.Warning, 34029, "Missing {0}'s INCC {1} {2} method parameters, adding default values", detname, kv.Key.material, md.Item1.FullName());
                        //OK, there is probably smarter way of doing ths, but for now, does find the nulls, then add default params where necessary. hn 9.23.2015
                        if (md.Item2 == null)
                        {
                            INCCAnalysisParams.INCCMethodDescriptor rec = new INCCAnalysisParams.INCCMethodDescriptor();
                            switch (md.Item1)
                            {
                                case AnalysisMethod.Active:
                                    rec = new INCCAnalysisParams.active_rec();
                                    break;
                                case AnalysisMethod.ActiveMultiplicity:
                                    rec = new INCCAnalysisParams.active_mult_rec();
                                    break;
                                case AnalysisMethod.ActivePassive:
                                    rec = new INCCAnalysisParams.active_passive_rec();
                                    break;
                                case AnalysisMethod.AddASource:
                                    rec = new INCCAnalysisParams.add_a_source_rec();
                                    break;
                                case AnalysisMethod.CalibrationCurve:
                                    rec = new INCCAnalysisParams.cal_curve_rec();
                                    break;
                                case AnalysisMethod.Collar:
                                    rec = new INCCAnalysisParams.collar_combined_rec();
                                    break;
                                case AnalysisMethod.CuriumRatio:
                                    rec = new INCCAnalysisParams.curium_ratio_rec();
                                    break;
                                case AnalysisMethod.KnownA:
                                    rec = new INCCAnalysisParams.known_alpha_rec();
                                    break;
                                case AnalysisMethod.KnownM:
                                    rec = new INCCAnalysisParams.known_m_rec();
                                    break;
                                case AnalysisMethod.Multiplicity:
                                    rec = new INCCAnalysisParams.multiplicity_rec();
                                    break;
                                case AnalysisMethod.TruncatedMultiplicity:
                                    rec = new INCCAnalysisParams.truncated_mult_rec();
                                    break;
                                case AnalysisMethod.DUAL_ENERGY_MULT_SAVE_RESTORE:
                                    rec = new INCCAnalysisParams.de_mult_rec();
                                    break;
                                default:
                                    break;
                            }
                            sam.AddMethod(md.Item1, rec);
                        }
                        continue;
                    }

                    NC.App.Pest.logger.TraceEvent(LogLevels.Verbose, 34030, "Updating {0},{1} {2}", detname, mat, md.Item2.GetType().Name);
                    DB.ElementList parms = null;
                    bool bonk = false;
                    switch (md.Item1)
                    {
                        case AnalysisMethod.KnownA:
                        case AnalysisMethod.CalibrationCurve:
                        case AnalysisMethod.KnownM:
                        case AnalysisMethod.Multiplicity:
                        case AnalysisMethod.TruncatedMultiplicity:
                        case AnalysisMethod.AddASource:
                        case AnalysisMethod.CuriumRatio:
                        case AnalysisMethod.Active:
                        case AnalysisMethod.ActivePassive:
                        case AnalysisMethod.ActiveMultiplicity:
                        case AnalysisMethod.DUAL_ENERGY_MULT_SAVE_RESTORE:
                            parms = (md.Item2).ToDBElementList();
                            break;
                        case AnalysisMethod.Collar:  // bad mojo with the design break here
                            parms = (md.Item2).ToDBElementList();
                            db.UpdateCalib(detname, mat, parms.OptTable, parms);
                            parms = (md.Item2).ToDBElementList();
                            db.UpdateCalib(detname, mat, parms.OptTable, parms);
                            parms = (md.Item2).ToDBElementList();
                            db.UpdateCalib(detname, mat, parms.OptTable, parms);
                            parms = null; bonk = false;  // skip the final processing step below
                            break;
                        default:
                            bonk = true;
                            break;
                    }
                    if (parms != null)
                        db.UpdateCalib(detname, mat, md.Item2.GetType().Name, parms);  // det, mat, amid, params
                    else if (bonk)
                    {
                        //Didn't exist, so create and store. hn 9.22.2015
                        sam.AddMethod(md.Item1, md.Item2);
                    }
                }
            }
        }