Example #1
0
 public void CurveTypeSelectionStep()
 {
     if (CalcDataList == null)
         CalcDataList = new CalibrationCurveList();  // one-time init upon first use.
     ict.CalcDataList = CalcDataList;// pre-load last best result, not maybe the best approach ...
     ict.ShowDialog();
     CalcDataList = ict.CalcDataList; // preserve the last list generated by any processing
 }
Example #2
0
 public IDDCurveType()
 {
     InitializeComponent();
     det = Integ.GetCurrentAcquireDetector();
     Text += " for detector " + det.Id.DetectorName;
     CurveTypeComboBox.Items.Clear();
     foreach (INCCAnalysisParams.CurveEquation cs in Enum.GetValues(typeof(INCCAnalysisParams.CurveEquation)))
     {
         CurveTypeComboBox.Items.Add(cs.ToDisplayString());
     }
     CurveTypeComboBox.Refresh();
     CurveTypeComboBox.SelectedIndex = 0;
     CalcDataList = new CalibrationCurveList();
 }
Example #3
0
 public EqCoeffViewer(INCCAnalysisParams.CurveEquationVals coeff, INCCAnalysisParams.CurveEquation eq, CalibrationCurveList cclist)
 {
     InitializeComponent();
     det = Integ.GetCurrentAcquireDetector();
     Text += " for detector " + det.Id.DetectorName;
     disprows = new List<DataLoad>();
     CurveEquation = eq;
     Coefficients = coeff;
     CalcDataList = cclist;
     BuildRep();
     BuildRows();
     BuildCurveCombo();
     LowerMassLimitTextBox.Text = CalcDataList.LowerMassLimit.ToString("N4");
     UpperMassLimitTextBox.Text = CalcDataList.UpperMassLimit.ToString("N4");
     _reg = new Regex("[1-9][0-9]*\\.?[0-9]*([Ee][+-]?[0-9]+)?");  // reg ex for number test
 }
Example #4
0
        void ApplyCoefficients(INCCAnalysisParams.CurveEquationVals coeff, CalibrationCurveList cclist)
        {
            INCCSelector sel = new INCCSelector(det.Id.DetectorId, Material);
            AnalysisMethods lam;
            bool found = N.App.DB.DetectorMaterialAnalysisMethods.TryGetValue(sel, out lam);
            if (!found)
            {
                lam = new AnalysisMethods(sel);
            }
            if (!lam.HasMethod(AnalysisMethod))  // create it from scratch here ????
            {
                MessageBox.Show(string.Format("{0} method not specified for detector {1} and material {2}",
                                    AnalysisMethod.FullName(), det.Id.DetectorId, Material),
                    "Coefficient File Ingester", MessageBoxButtons.OK);
                return;
            }

            INCCAnalysisParams.INCCMethodDescriptor imd = lam.GetMethodParameters(AnalysisMethod);
            switch (AnalysisMethod)
            {
            case AnalysisMethod.CalibrationCurve:
                INCCAnalysisParams.cal_curve_rec c = (INCCAnalysisParams.cal_curve_rec)imd;
                CopyCoefficients(coeff, c.cev);
                c.cev.cal_curve_equation = CurveEquation;
                c.cev.lower_mass_limit = cclist.LowerMassLimit;
                c.cev.upper_mass_limit = cclist.UpperMassLimit;
                c.dcl_mass = cclist.MassAsArray;
                c.doubles = cclist.DoublesAsArray;
                break;
            case AnalysisMethod.KnownA:
                INCCAnalysisParams.known_alpha_rec ka = (INCCAnalysisParams.known_alpha_rec)imd;
                CopyCoefficients(coeff, ka.cev);
                ka.cev.cal_curve_equation = CurveEquation;
                ka.cev.lower_mass_limit = cclist.LowerMassLimit;
                ka.cev.upper_mass_limit = cclist.UpperMassLimit;
                ka.dcl_mass = cclist.MassAsArray;
                ka.doubles = cclist.DoublesAsArray;
                break;
            case AnalysisMethod.AddASource:
                INCCAnalysisParams.add_a_source_rec aas = (INCCAnalysisParams.add_a_source_rec)imd;
                CopyCoefficients(coeff, aas.cev);
                aas.cev.cal_curve_equation = CurveEquation;
                aas.cev.lower_mass_limit = cclist.LowerMassLimit;
                aas.cev.upper_mass_limit = cclist.UpperMassLimit;
                aas.dcl_mass = cclist.MassAsArray;
                aas.doubles = cclist.DoublesAsArray;
                break;
            case AnalysisMethod.Active:
                INCCAnalysisParams.active_rec ac = (INCCAnalysisParams.active_rec)imd;
                CopyCoefficients(coeff, ac.cev);
                ac.cev.cal_curve_equation = CurveEquation;
                ac.cev.lower_mass_limit = cclist.LowerMassLimit;
                ac.cev.upper_mass_limit = cclist.UpperMassLimit;
                ac.dcl_mass = cclist.MassAsArray;
                ac.doubles = cclist.DoublesAsArray;
                break;
            }
            imd.modified = true;
            // ok save it now
            N.App.DB.UpdateAnalysisMethod(sel, lam);  // flush changes on internal map to the DB
            MessageBox.Show(string.Format("Calibration data for analysis method {0} and material type {1} successfully stored in the database",
                                    det.Id.DetectorId, Material),
                    "Coefficient File Ingester", MessageBoxButtons.OK);
        }
Example #5
0
 private void OKBtn_Click(object sender, EventArgs e)
 {
     DialogResult = DialogResult.OK;
     CurveEquation = (INCCAnalysisParams.CurveEquation)CurveTypeComboBox.SelectedIndex;
     Close();
     IDDDemingFitSelect measlist = new IDDDemingFitSelect();
     measlist.CurveEquation = CurveEquation;
     measlist.AnalysisMethod = AnalysisMethod;
     measlist.Material = Material;
     measlist.Init(det.Id.DetectorId);
     if (measlist.bGood)
         measlist.ShowDialog();
     CalcDataList = measlist.CalcDataList;
 }