示例#1
0
 public IDDErrorCalcMethod()
 {
     InitializeComponent();
     ap = Integ.GetCurrentAcquireParams();
     ex = ap.error_calc_method;
     SampleRadioButton.Checked = (ap.error_calc_method == ErrorCalculationTechnique.Sample);
 }
示例#2
0
        AcquireParameters ConfigureAcquireState(Detector det, AcquireParameters def, DateTimeOffset dto, ushort runs, string path)
        {
            AcquireParameters acq = NC.App.DB.LastAcquireFor(det, def.item_type);

            if (acq == null)
            {
                acq = new AcquireParameters(def);
            }
            acq.MeasDateTime     = dto; acq.lm.TimeStamp = dto;
            acq.detector_id      = string.Copy(det.Id.DetectorId);
            acq.meas_detector_id = string.Copy(acq.detector_id);
            acq.num_runs         = runs;
            int tx = def.comment.IndexOf(SourceFilePrefixComment);

            if (tx >= 0)
            {
                acq.comment = def.comment.Substring(0, tx);
            }
            else
            {
                acq.comment = def.comment;
            }
            acq.comment += (SourceFilePrefixComment + " " + System.IO.Path.GetFileName(path));
            INCCDB.AcquireSelector sel = new INCCDB.AcquireSelector(det, acq.item_type, dto);
            NC.App.DB.ReplaceAcquireParams(sel, acq);             // only one allowed, same for actual measurement
            return(acq);
        }
示例#3
0
 public IDDEndingComment()
 {
     InitializeComponent();
     acq   = N.App.Opstate.Measurement.AcquireState;
     Text += " for " + acq.detector_id;
     FieldFiller();
 }
示例#4
0
        // Constructor including initialization of comboboxen in the various panels
        public LMConnectionParams(Detector candidate, AcquireParameters acq, bool isnew)
        {
            AddingNew = isnew;
            InitializeComponent();
            oTitle = this.Text;

            // Reposition the various panels on top of each other
            this.SelectorPanel.Top = 4;
            this.SelectorPanel.Left = 6;
            this.LMMMPanel.Top = 4;
            this.LMMMPanel.Left = 6;
            this.PTR32Panel.Top = 4;
            this.PTR32Panel.Left = 6;
            this.AddDetectorTypePanel.Top = 4;
            this.AddDetectorTypePanel.Left = 6;
            this.AddDetectorTypePanel.Top = 4;
            this.AddDetectorTypePanel.Left = 6;

            RefreshDetectorCombo();
            DetectorComboBox.SelectedItem = candidate;

            RefreshDetectorTypeCombo();
            AddDetectorTypeComboBox.SelectedItem = candidate.Id.SRType;

            det = candidate;
            this.acq = acq;
            PopulateParamFields();

        }
示例#5
0
        // Constructor including initialization of comboboxen in the various panels
        public LMConnectionParams(Detector candidate, AcquireParameters acq, bool isnew)
        {
            AddingNew = isnew;
            InitializeComponent();
            oTitle = this.Text;

            // Reposition the various panels on top of each other
            this.SelectorPanel.Top         = 4;
            this.SelectorPanel.Left        = 6;
            this.LMMMPanel.Top             = 4;
            this.LMMMPanel.Left            = 6;
            this.PTR32Panel.Top            = 4;
            this.PTR32Panel.Left           = 6;
            this.AddDetectorTypePanel.Top  = 4;
            this.AddDetectorTypePanel.Left = 6;
            this.AddDetectorTypePanel.Top  = 4;
            this.AddDetectorTypePanel.Left = 6;

            RefreshDetectorCombo();
            DetectorComboBox.SelectedItem = candidate;

            RefreshDetectorTypeCombo();
            AddDetectorTypeComboBox.SelectedItem = candidate.Id.SRType;

            det      = candidate;
            this.acq = acq;
            PopulateParamFields();
        }
示例#6
0
 public IDDErrorCalcMethod()
 {
     InitializeComponent();
     ap = Integ.GetCurrentAcquireParams();
     ex = ap.error_calc_method;
     SampleRadioButton.Checked = (ap.error_calc_method == ErrorCalculationTechnique.Sample);
 }
示例#7
0
        AcquireParameters ConfigureAcquireState(Detector det, AcquireParameters def, DateTimeOffset dto, ushort runs, string path)
        {
            AcquireParameters acq = NC.App.DB.LastAcquireFor(det);

            if (acq == null)
            {
                acq = new AcquireParameters(def);
            }
            acq.MeasDateTime     = dto; acq.lm.TimeStamp = dto;
            acq.detector_id      = String.Copy(det.Id.DetectorId);
            acq.meas_detector_id = string.Copy(acq.detector_id);
            acq.num_runs         = runs;
            int tx = def.comment.IndexOf(" (Original file name");

            if (tx >= 0)
            {
                acq.comment = def.comment.Substring(0, tx);
            }
            else
            {
                acq.comment = def.comment;
            }
            acq.comment += " (Original file name " + System.IO.Path.GetFileName(path) + ")";
            INCCDB.AcquireSelector sel = new INCCDB.AcquireSelector(det, acq.item_type, dto);
            if (NC.App.DB.AcquireParametersMap().ContainsKey(sel))  // only one allowed, same for actual measurement
            {
                NC.App.DB.AcquireParametersMap().Remove(sel);
            }
            NC.App.DB.AcquireParametersMap().Add(sel, acq);
            NC.App.DB.UpdateAcquireParams(acq, det.ListMode);
            return(acq);
        }
示例#8
0
        private void OKButton_Click(object sender, EventArgs e)
        {
            if (!String.IsNullOrEmpty(DetectorIdTextBox.Text))
            {
                Detector newdet = null;
                if (srtype)
                {
                    newdet = Integ.CreateDetectorWithAssociations(model, DetectorIdTextBox.Text, ElectronicsIdTextBox.Text, DetectorTypeTextBox.Text);
                    IDDShiftRegisterSetup f = new IDDShiftRegisterSetup(newdet); // copies updated SR PAram value to the newdet instance, database persist follows below
                    f.ShowDialog();
                    if (f.DialogResult == System.Windows.Forms.DialogResult.OK)
                    {
                        // new behavior: newdet.SRParams has the changes already;
                    }
                }
                else
                {
                    newdet = Integ.CreateDetectorWithAssociations(model, DetectorIdTextBox.Text, ElectronicsIdTextBox.Text, DetectorTypeTextBox.Text, (InstrType)LMTypes.SelectedItem);

                    AcquireParameters  acq = Integ.GetCurrentAcquireParams();
                    LMConnectionParams f   = new LMConnectionParams(newdet, acq, false);
                    f.StartWithLMDetail();
                    f.ShowDialog();
                    if (f.DialogResult == DialogResult.OK)
                    {
                    }
                }
                Integ.PersistDetectorAndAssociations(newdet);
                RefreshDetectorCombo(); // Assuming the detector was added to the internal detector list by CreateDetectorWithAssociations, this will add a new detector to the detector list

                this.DialogResult = System.Windows.Forms.DialogResult.OK;
                this.Close();
            }
        }
示例#9
0
 static bool AcquistionChangeNeeded(AcquireParameters acq, string det, string mtl, string fac, string mba)
 {
     return(!acq.detector_id.Equals(det, StringComparison.OrdinalIgnoreCase) ||
            !acq.meas_detector_id.Equals(det, StringComparison.OrdinalIgnoreCase) ||
            (!string.IsNullOrEmpty(fac) && !acq.facility.Name.Equals(fac, StringComparison.OrdinalIgnoreCase)) ||
            (!string.IsNullOrEmpty(mba) && !acq.mba.Name.Equals(mba, StringComparison.OrdinalIgnoreCase)) ||
            (!string.IsNullOrEmpty(mtl) && !acq.item_type.Equals(mtl, StringComparison.OrdinalIgnoreCase)));
 }
示例#10
0
 public INCCSR(ShiftRegisterParameters sr, DataSourceIdentifier id, AcquireParameters acq, TestParameters test, LMLoggers.LognLM log)
 {
     sr_parms = new ShiftRegisterParameters(sr);
     dsid = new DataSourceIdentifier(id);
     dsid.SerialPort -= 1; // serial ports are 0 based at the HW layer 
     acquire_parms = new AcquireParameters(acq);
     test_parms = new TestParameters(test);
     this.log = log;
 }
示例#11
0
 public INCCSR(ShiftRegisterParameters sr, DataSourceIdentifier id, AcquireParameters acq, TestParameters test, LMLoggers.LognLM log)
 {
     sr_parms         = new ShiftRegisterParameters(sr);
     dsid             = new DataSourceIdentifier(id);
     dsid.SerialPort -= 1; // serial ports are 0 based at the HW layer
     acquire_parms    = new AcquireParameters(acq);
     test_parms       = new TestParameters(test);
     this.log         = log;
 }
示例#12
0
        AcquireParameters ConfigureAcquireState(Detector det, AcquireParameters def, INCCReviewFile irf)
        {
            AcquireParameters acq = NC.App.DB.LastAcquireFor(det);

            if (acq == null)
            {
                acq = new AcquireParameters(def);
            }
            acq.MeasDateTime = irf.dt; acq.lm.TimeStamp = irf.dt;
            acq.num_runs     = irf.num_runs; // RequestedRepetitions
            int tx = def.comment.IndexOf(" (Original file name");

            if (tx >= 0)
            {
                acq.comment = def.comment.Substring(0, tx);
            }
            else
            {
                acq.comment = def.comment;
            }
            acq.comment         += " (Original file name " + System.IO.Path.GetFileName(irf.Path) + ")";
            acq.detector_id      = String.Copy(det.Id.DetectorId);
            acq.meas_detector_id = string.Copy(acq.detector_id);

            // iid should have been added from the NOP processing above
            ItemId iid = NC.App.DB.ItemIds.Get(irf.item);

            if (iid == null)
            {
                ctrllog.TraceEvent(LogLevels.Warning, 5439, "Item id '" + irf.item + "' is referenced by the Review file measurement data, but is not found in op. rev. files or the database");
            }
            else
            {
                acq.ApplyItemId(iid);
                INCCDB.Descriptor s = NC.App.DB.Stratums.Get(iid.stratum);
                INCCDB.Descriptor m = NC.App.DB.MBAs.Get(iid.mba);
                if (s != null)
                {
                    acq.stratum_id = s;
                }
                if (m != null)
                {
                    acq.mba = m;
                }
            }
            // todo: also need to account for iid UMass to mass condition

            INCCDB.AcquireSelector sel = new INCCDB.AcquireSelector(det, acq.item_type, irf.dt);
            if (NC.App.DB.AcquireParametersMap().ContainsKey(sel))  // only one allowed, same for actual measurement
            {
                NC.App.DB.AcquireParametersMap().Remove(sel);
            }
            NC.App.DB.AcquireParametersMap().Add(sel, acq);
            NC.App.DB.UpdateAcquireParams(acq, det.ListMode);
            return(acq);
        }
示例#13
0
 public static AnalysisDefs.Isotopics GetAcquireIsotopics(AcquireParameters acq)
 {
     AnalysisDefs.Isotopics iso = CentralizedState.App.DB.Isotopics.GetList().
                                  Find(i => string.Compare(i.id, acq.isotopics_id, true) == 0);
     if (iso == null)
     {
         iso = CentralizedState.App.DB.Isotopics.GetDefault();
     }
     return(iso);
 }
示例#14
0
        public static AcquireParameters GetCurrentAcquireParamsFor(Detector det)
        {
            AcquireParameters acq = CentralizedState.App.DB.LastAcquireFor(det);

            if (acq == null)
            {
                acq = new AcquireParameters();
            }
            return(acq);
        }
示例#15
0
        public IDDFacility()
        {
            InitializeComponent();
            FacilityComboBox.Items.Clear();
            foreach (INCCDB.Descriptor desc in NC.App.DB.Facilities.GetList())
            {
                FacilityComboBox.Items.Add(desc);
            }
            MBAComboBox.Items.Clear();
            foreach (INCCDB.Descriptor desc in NC.App.DB.MBAs.GetList())
            {
                MBAComboBox.Items.Add(desc);
            }

            AcquireParameters _acq = null;

            Integ.GetCurrentAcquireDetectorPair(ref _acq, ref det);
            acq         = new AcquireParameters(_acq);        // making a copy fixes an aliasing issue for some current detector conditions
            initdetname = string.Copy(det.Id.DetectorId);
            try
            {
                FacilityComboBox.SelectedItem = NC.App.DB.Facilities.Get(acq.facility.Name);
            }
            catch (InvalidOperationException)
            { }
            try
            {
                MBAComboBox.SelectedItem = NC.App.DB.MBAs.Get(acq.mba.Name);
            }
            catch (InvalidOperationException)
            { }

            DetectorIdComboBox.Items.Clear();
            foreach (Detector d in NC.App.DB.Detectors)
            {
                DetectorIdComboBox.Items.Add(d);
            }

            if (det != null)
            {
                DetectorIdComboBox.SelectedItem = det;
            }
            DetectorParametersCheckBox.Checked                  = acq.review.DetectorParameters;
            CalibrationParametersCheckBox.Checked               = acq.review.CalibrationParameters;
            IsotopicsCheckBox.Checked                           = acq.review.Isotopics;
            IndividualCycleRawDataCheckBox.Checked              = acq.review.RawCycleData;
            IndividualCycleRateData.Checked                     = acq.review.RateCycleData;
            SummedRawCoincidenceDataCheckBox.Checked            = acq.review.SummedRawCoincData;
            SummedMultiplicityDistributionsCheckBox.Checked     = acq.review.SummedMultiplicityDistributions;
            IndividualMultiplicityDistributionsCheckBox.Checked = acq.review.MultiplicityDistributions;
            InspectorNameTextBox.Text                           = acq.user_id;
            InspectionNumberTextBox.Text                        = acq.campaign_id;
        }
示例#16
0
 public IDDIsotopics(string selected = "default")
 {
     InitializeComponent();
     applog = NC.App.Logger(NCCReporter.LMLoggers.AppSection.App);
     acq = Integ.GetCurrentAcquireParams();
     if (string.IsNullOrEmpty(selected) || string.Compare(selected, "default",true) == 0)
     {
         // get current acquire composite isotopics id and use that
         selected = acq.isotopics_id;
     }
     RefreshIsoCodeCombo();
     RefreshIdComboWithDefaultOrSet(selected);
 }
示例#17
0
        private void StrataView_CellValueChanged(object sender, DataGridViewCellEventArgs e)
        {
            int row = e.RowIndex;
            int col = e.ColumnIndex;

            if (row >= 0)
            {
                if (row >= sl.Count) // Is a new stratum
                {
                    INCCDB.Descriptor        candidate = new INCCDB.Descriptor(StrataView[0, row].Value.ToString(), StrataView[0, row].Value.ToString());
                    Stratum                  st        = new Stratum();
                    INCCDB.StratumDescriptor newst     = new INCCDB.StratumDescriptor(candidate, st);
                    AcquireParameters        acq       = NC.App.DB.LastAcquire();
                    string curdet = acq.detector_id;
                    if (!String.IsNullOrEmpty(StrataView[0, row].Value.ToString()))
                    {
                        NC.App.DB.StrataList().Add(newst);
                        NC.App.DB.AssociateStratum(NC.App.DB.Detectors.Find(di => string.Compare(di.Id.DetectorName, curdet, true) == 0), candidate, st);
                    }
                    sl.Add(newst);
                }
                else
                {
                    INCCDB.StratumDescriptor changed = sl.ElementAt(row);
                    double d;
                    switch (col)
                    {
                    case 1:
                        Double.TryParse((StrataView[col, row]).Value.ToString(), out d);
                        changed.Stratum.bias_uncertainty = d;
                        changed.Stratum.modified         = true;
                        StrataView[col, row].Value       = d.ToString("F2");
                        break;

                    case 2:
                        Double.TryParse((StrataView[col, row]).Value.ToString(), out d);
                        changed.Stratum.random_uncertainty = d;
                        changed.Stratum.modified           = true;
                        StrataView[col, row].Value         = d.ToString("F2");
                        break;

                    case 3:
                        Double.TryParse((StrataView[col, row]).Value.ToString(), out d);
                        changed.Stratum.systematic_uncertainty = d;
                        StrataView[col, row].Value             = d.ToString("F2");
                        changed.Stratum.modified = true;
                        break;
                    }
                }
            }
        }
示例#18
0
        public IDDFacility()
        {
            InitializeComponent();
            FacilityComboBox.Items.Clear();
            foreach (INCCDB.Descriptor desc in NC.App.DB.Facilities.GetList())
            {
                FacilityComboBox.Items.Add(desc);
            }
            MBAComboBox.Items.Clear();
            foreach (INCCDB.Descriptor desc in NC.App.DB.MBAs.GetList())
            {
                MBAComboBox.Items.Add(desc);
            }

            AcquireParameters _acq = null;
            Integ.GetCurrentAcquireDetectorPair(ref _acq, ref det);
            acq = new AcquireParameters(_acq);    // making a copy fixes an aliasing issue for some current detector conditions
            initdetname = string.Copy(det.Id.DetectorId);
            try
            {
                FacilityComboBox.SelectedItem = NC.App.DB.Facilities.Get(acq.facility.Name);
            }
            catch (InvalidOperationException)
            { }
            try
            {
                MBAComboBox.SelectedItem = NC.App.DB.MBAs.Get(acq.mba.Name);
            }
            catch (InvalidOperationException)
            { }

            DetectorIdComboBox.Items.Clear();
            foreach (Detector d in NC.App.DB.Detectors)
            {
                DetectorIdComboBox.Items.Add(d);
            }

            if (det != null)
                DetectorIdComboBox.SelectedItem = det;
            DetectorParametersCheckBox.Checked = acq.review.DetectorParameters;
            CalibrationParametersCheckBox.Checked = acq.review.CalibrationParameters;
            IsotopicsCheckBox.Checked = acq.review.Isotopics;
            IndividualCycleRawDataCheckBox.Checked = acq.review.RawCycleData;
            IndividualCycleRateData.Checked = acq.review.RateCycleData;
            SummedRawCoincidenceDataCheckBox.Checked = acq.review.SummedRawCoincData;
            SummedMultiplicityDistributionsCheckBox.Checked = acq.review.SummedMultiplicityDistributions;
            IndividualMultiplicityDistributionsCheckBox.Checked = acq.review.MultiplicityDistributions;
            InspectorNameTextBox.Text = acq.user_id;
            InspectionNumberTextBox.Text = acq.campaign_id;
        }
示例#19
0
 private void OKBtn_Click(object sender, EventArgs e)
 {
     foreach (var stratum in sl)
     {
         if (stratum.Stratum.modified)
         {
             AcquireParameters acq    = NC.App.DB.LastAcquire();
             string            curdet = acq.detector_id;
             NC.App.DB.UpdateStratum(stratum.Desc, stratum.Stratum);
             NC.App.DB.AssociateStratum(NC.App.DB.Detectors.Find(d => string.Compare(d.Id.DetectorName, curdet, true) == 0), stratum.Desc, stratum.Stratum); // associates it with the detector
         }
     }
     this.Close();
 }
示例#20
0
 public IDDKValSelector()
 {
     InitializeComponent();
     MessageBox.Show("This functionality is not implemented yet.", "DOING NOTHING NOW");
     acq = Integ.GetCurrentAcquireParams();
     if (acq.KValSource == KValsSource.AGTNMC)
         PANDARadioButton.Checked = true;
     else if (acq.KValSource == KValsSource.N_HENCC)
         N9588RadioButton.Checked = true;
     else if (acq.KValSource == KValsSource.ESARDA_128)
         ESARDA128RadioButton.Checked = true;
     else if (acq.KValSource == KValsSource.ESARDA_64)
         ESARDA64RadioButton.Checked = true;
 }
示例#21
0
文件: Cmd.cs 项目: radtek/INCC6
        static void BuildMeasurement()
        {
            Detector          det = null;
            AcquireParameters ap  = null;

            AssaySelector.MeasurementOption mo = (AssaySelector.MeasurementOption)N.App.Config.Cur.AssayType;
            Integ.GetCurrentAcquireDetectorPair(ref ap, ref det);
            INCCDB.AcquireSelector sel = new INCCDB.AcquireSelector(det, ap.item_type, DateTime.Now);

            N.App.DB.ReplaceAcquireParams(sel, ap);             // add new or replace existing with new

            // The acquire is set to occur, build up the measurement state
            Integ.BuildMeasurement(ap, det, mo);
        }
示例#22
0
        private void EditBtn_Click(object sender, EventArgs e)
        {
            AcquireParameters acq = null;

            acq = Integ.GetCurrentAcquireParamsFor(det);

            LMConnectionParams f = new LMConnectionParams(det, acq, false);

            f.StartWithLMDetail();
            f.ShowDialog();
            if (f.DialogResult == DialogResult.OK)  // update performed in OK EH
            {
            }
        }
示例#23
0
        private void SetLMVSRFATypeAndVis()
        {
            LMFA.Visible = det.ListMode;

            if (!det.ListMode)
            {
                return;
            }

            AcquireParameters acq = Integ.GetCurrentAcquireParamsFor(det);

            m_curGateTriggerType = m_gateTriggerType = acq.lm.FADefault;
            LMFA.Checked         = (m_gateTriggerType == FAType.FAOn);
        }
示例#24
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");
            }
        }
示例#25
0
文件: Cmd.cs 项目: tempbottle/INCC6
        static void BuildMeasurement()
        {
            Detector          det = null;
            AcquireParameters ap  = null;

            AssaySelector.MeasurementOption mo = (AssaySelector.MeasurementOption)NC.App.Config.Cur.AssayType;
            Integ.GetCurrentAcquireDetectorPair(ref ap, ref det);
            INCCDB.AcquireSelector sel = new INCCDB.AcquireSelector(det, ap.item_type, DateTime.Now);

            NC.App.DB.AcquireParametersMap().Add(sel, ap);  // it's a new one, not the existing one modified
            NC.App.DB.UpdateAcquireParams(ap, det.ListMode);

            // The acquire is set to occur, build up the measurement state
            Integ.BuildMeasurement(ap, det, mo);
        }
示例#26
0
        private void OKButton_Click(object sender, EventArgs e)
        {
            //Check for cloning.
            if (CloneCheckbox.Checked)
            {
                //Make sure they selected a clone source
                if (CloneSourceCombo.SelectedIndex != -1)
                {
                    //We have a valid sourc
                    Detector from = (Detector)CloneSourceCombo.SelectedItem;
                }
            }
            if (String.IsNullOrEmpty(DetectorIdTextBox.Text))
            {
                DialogResult = DialogResult.Cancel;
                return;
            }
            Detector newdet = null;

            if (srtype)
            {
                newdet = Integ.CreateDetectorWithAssociations(model, DetectorIdTextBox.Text, ElectronicsIdTextBox.Text, DetectorTypeTextBox.Text);
                IDDShiftRegisterSetup f = new IDDShiftRegisterSetup(newdet); // copies updated SR Param value to the newdet instance, database persist follows below
                f.ShowDialog();
                if (f.DialogResult == System.Windows.Forms.DialogResult.OK)
                {
                    // new behavior: newdet.SRParams has the changes already;
                }
                Integ.PersistDetectorAndAssociations(newdet);
            }
            else
            {
                newdet = Integ.CreateDetectorWithAssociations(model, DetectorIdTextBox.Text, ElectronicsIdTextBox.Text, DetectorTypeTextBox.Text, (InstrType)LMTypes.SelectedItem);
                Integ.PersistDetectorAndAssociations(newdet);

                AcquireParameters  acq = Integ.GetCurrentAcquireParams();
                LMConnectionParams f   = new LMConnectionParams(newdet, acq, isnew: true);
                f.StartWithLMDetail();
                f.ShowDialog();
                if (f.DialogResult == DialogResult.OK)
                {
                }
            }
            RefreshDetectorCombo(); // Assuming the detector was added to the internal detector list by CreateDetectorWithAssociations, this will add a new detector to the detector list

            this.DialogResult = System.Windows.Forms.DialogResult.OK;
            this.Close();
        }
示例#27
0
        /// <summary>
        ///  retrieves the most recent acquire record and associated detector
        /// </summary>
        /// <param name="acq"></param>
        /// <param name="det"></param>
        public static void GetCurrentAcquireDetectorPair(ref AcquireParameters acq, ref Detector det)
        {
            acq = CentralizedState.App.DB.LastAcquire();
            String curdet = acq.detector_id;

            det = CentralizedState.App.DB.Detectors.Find(d => string.Compare(d.Id.DetectorName, curdet, true) == 0);
            if (det == null || string.IsNullOrWhiteSpace(det.Id.DetectorName))
            {
                det = new AnalysisDefs.Detector();
                CentralizedState.App.Logger(LMLoggers.AppSection.App).TraceEvent(LogLevels.Warning, 32444, "Detector " + curdet + " is not defined in the database");
            }
            if (det.ListMode)
            {
                det.MultiplicityParams.FA = acq.lm.FADefault;
            }
        }
示例#28
0
文件: Overview.cs 项目: radtek/INCC6
        private void toolStripMenuItem3_Click(object sender, EventArgs e)
        {
            Detector          det = null;
            AcquireParameters acq = null;

            Integ.GetCurrentAcquireDetectorPair(ref acq, ref det);
            if (det.ListMode)
            {
                LMConnectionParams f = new LMConnectionParams(det, acq, false);
                f.StartWithLMDetail();
                f.ShowDialog();
            }
            else
            {
                toolStripMenuItem2_Click(sender, e);
            }
        }
示例#29
0
 public LMAcquire(AcquireParameters _ap, Detector _det, bool fromINCC5Acq = false)
 {
     InitializeComponent();
     FromINCC5Acquire = fromINCC5Acq;
     Text += (_det.Id.DetectorId);
     det = _det;
     ap = _ap;
     if (!FromINCC5Acquire)  // reset and build occurs in the INCC5 acquire handler code
     {
         ResetMeasurement();
         Integ.BuildMeasurement(ap, det, AssaySelector.MeasurementOption.unspecified);
     }
     PreserveAnalyzerChanges = AnalyzersLoaded = LMParamUpdate = AcqParamUpdate = false;
     BuildAnalyzerCombo();
     Swap(ap.data_src.Live());
     SelectTheBestINCC5AcquireVSRRow();
 }
示例#30
0
        private void SetupLMInstConnParamsClick(object sender, RoutedEventArgs e)
        {
            Detector          det = null;
            AcquireParameters acq = null;

            Integ.GetCurrentAcquireDetectorPair(ref acq, ref det);
            if (det.ListMode)
            {
                NewUI.LMConnectionParams f = new NewUI.LMConnectionParams(det, acq, false);
                f.StartWithLMDetail();
                f.ShowDialog();
            }
            else
            {
                SetupMeasParamsClick(sender, e);
            }
        }
示例#31
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();
 }
示例#32
0
        public static Detector GetCurrentAcquireDetector()
        {
            Detector          det    = null;
            AcquireParameters acq    = CentralizedState.App.DB.LastAcquire();
            string            curdet = acq.detector_id;

            det = CentralizedState.App.DB.Detectors.Find(d => string.Compare(d.Id.DetectorName, curdet, true) == 0);
            if (det == null)
            {
                det = new AnalysisDefs.Detector();
            }
            if (det.ListMode)
            {
                det.MultiplicityParams.FA = acq.lm.FADefault;
            }
            return(det);
        }
示例#33
0
        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
        }
示例#34
0
        public static HVCalibrationParameters GetCurrentHVCalibrationParams(Detector det)
        {
            HVCalibrationParameters bp = new AnalysisDefs.HVCalibrationParameters();

            if (det != null)
            {
                if (CentralizedState.App.DB.HVParameters.Map.ContainsKey(det))
                {
                    bp.Copy(CentralizedState.App.DB.HVParameters.Map[det]);
                }
                else if (det.ListMode)
                {
                    AcquireParameters acq = GetCurrentAcquireParamsFor(det);
                    bp = new AnalysisDefs.HVCalibrationParameters(acq.lm);
                }
            }
            return(bp);
        }
示例#35
0
        public static bool SetNewCurrentDetector(string name, bool checkForExistence)
        {
            AcquireParameters acq = GetCurrentAcquireParams();
            bool     exists       = true;
            Detector det          = CentralizedState.App.DB.Detectors.Find(d => string.Compare(d.Id.DetectorName, name, true) == 0);

            if (det == null)
            {
                exists = false;
                CentralizedState.App.Logger(LMLoggers.AppSection.Control).TraceEvent(LogLevels.Warning, 32441, "Detector " + name + " undefined");
                if (checkForExistence)
                {
                    return(false);
                }
                else
                {
                    det = new Detector();
                }
            }
            acq.MeasDateTime = DateTime.Now;
            if (!acq.detector_id.Equals(name, StringComparison.OrdinalIgnoreCase) || !acq.meas_detector_id.Equals(name, StringComparison.OrdinalIgnoreCase))
            {
                // change detector on current acquire parms state
                if (!exists)
                {
                    CentralizedState.App.Logger(LMLoggers.AppSection.Control).TraceEvent(LogLevels.Warning, 32442, "Temporary detector definition for missing detector " + name + " created");
                }
                acq.detector_id      = string.Copy(name);
                acq.meas_detector_id = string.Copy(name);
                INCCDB.AcquireSelector sel = new INCCDB.AcquireSelector(det, acq.item_type, acq.MeasDateTime);
                CentralizedState.App.DB.AddAcquireParams(sel, acq);
                if (!exists)
                {
                    CentralizedState.App.DB.Detectors.Add(det);
                }
            }
            else    // update existing entry
            {
                CentralizedState.App.DB.UpdateAcquireParams(acq, det.ListMode);
            }
            CentralizedState.App.Logger(LMLoggers.AppSection.Control).TraceEvent(LogLevels.Info, 32444, "The current detector is now " + name);

            return(true);
        }
示例#36
0
        /// <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
        }
示例#37
0
        public static void SetNewCurrentDetector(string name)
        {
            AcquireParameters acq = GetCurrentAcquireParams();
            Detector          det = CentralizedState.App.DB.Detectors.Find(d => string.Compare(d.Id.DetectorName, name, true) == 0);

            if (det == null)
            {
                det = new AnalysisDefs.Detector();
            }
            acq.MeasDateTime = DateTime.Now;
            if (!acq.detector_id.Equals(name, StringComparison.OrdinalIgnoreCase) || !acq.meas_detector_id.Equals(name, StringComparison.OrdinalIgnoreCase))
            {
                acq.detector_id      = string.Copy(name);
                acq.meas_detector_id = string.Copy(name);
                CentralizedState.App.DB.AcquireParametersMap().Add(new INCCDB.AcquireSelector(det, acq.item_type, acq.MeasDateTime), acq);
            }
            CentralizedState.App.DB.UpdateAcquireParams(acq, det.ListMode);
            CentralizedState.App.Logger(LMLoggers.AppSection.Control).TraceEvent(LogLevels.Info, 32444, "The current detector is now " + name);
        }
示例#38
0
 public IDDReviewCalibration()
 {
     InitializeComponent();
     det = Integ.GetCurrentAcquireDetector();
     acq = Integ.GetCurrentAcquireParams();
     if (acq.review_detector_parms)
         DetectorParametersCheckBox.Checked = true;
     if (acq.review_isotopics)
         IsotopicsCheckBox.Checked = true;
     if (acq.review_run_raw_data)
         IndividualCycleRawDataCheckBox.Checked = true;
     if (acq.review_run_rate_data)
         IndividualCycleRateDataCheckBox.Checked = true;
     if (acq.review_summed_raw_data)
         SummedRawCoincidenceDataCheckBox.Checked = true;
     if (acq.review_summed_mult_dist)
         SummedMultiplicityDistributionsCheckBox.Checked = true;
     if (acq.review_run_mult_dist)
         SummedRawCoincidenceDataCheckBox.Checked = true;
     if (acq.print)
         PrintTextCheckBox.Checked = true; 
 }
示例#39
0
        // Constructor including initialization of comboboxen in the various panels
        public LMConnectionParams(Detector candidate, AcquireParameters acq, bool isnew)
        {
            AddingNew = isnew;
            InitializeComponent();
            oTitle = Text;

            // Reposition the various panels on top of each other
            SelectorPanel.Top = 4;
            SelectorPanel.Left = 6;
            LMMMPanel.Top = 4;
            LMMMPanel.Left = 6;
            PTR32Panel.Top = 4;
            PTR32Panel.Left = 6;
            AddDetectorTypePanel.Top = 4;
            AddDetectorTypePanel.Left = 6;
            AddDetectorTypePanel.Top = 4;
            AddDetectorTypePanel.Left = 6;

            RefreshDetectorCombo();
            DetectorComboBox.SelectedItem = candidate;

            RefreshDetectorTypeCombo();
            AddDetectorTypeComboBox.SelectedItem = candidate.Id.SRType;

            det = candidate;
            this.acq = acq;
            MCAComboBox.Visible = false;
            if (det != null)
            {
                if (det.Id.SRType == InstrType.MCA527)
                {
                    PopulateMCA527ParamFields();
                } else
                {
                    PopulateLMMM_PTR32ParamFields();
                }
            }
        }
示例#40
0
        /// <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
        }
示例#41
0
 public static AnalysisMethods GetMethodSelections(AcquireParameters acq)
 {
     return GetMethodSelections(acq.detector_id, acq.item_type);
 }
示例#42
0
 public static AcquireParameters GetCurrentAcquireParamsFor(Detector det)
 {
     AcquireParameters acq = CentralizedState.App.DB.LastAcquireFor(det);
     if (acq == null)
         acq = new AcquireParameters();
     return acq;
 }
示例#43
0
 /// <summary>
 ///  retrieves the most recent acquire record and associated detector
 /// </summary>
 /// <param name="acq"></param>
 /// <param name="det"></param>
 public static void GetCurrentAcquireDetectorPair(ref AcquireParameters acq, ref Detector det)
 {
     acq = CentralizedState.App.DB.LastAcquire();
     string curdet = acq.detector_id;
     det = CentralizedState.App.DB.Detectors.Find(d => string.Compare(d.Id.DetectorName, curdet, true) == 0);
     if (det == null || string.IsNullOrWhiteSpace(det.Id.DetectorName))
     {
         det = new Detector();
         CentralizedState.App.Logger(LMLoggers.AppSection.App).TraceEvent(LogLevels.Warning, 32443, "Detector " + curdet + " is not defined in the database");
     }
     if (det.ListMode)
         det.MultiplicityParams.FA = acq.lm.FADefault;
 }
示例#44
0
 public AcquireHandlers(AcquireParameters a, Detector dt)
 {
     ap = a; det = dt;
 }
示例#45
0
        /// <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

        }
示例#46
0
        public AnalysisWizard(AWSteps startHere, AcquireParameters lmap, Detector lmdet)
        {

            det = lmdet;
            ap = lmap;

            if (startHere == AWSteps.Step1)  // fresh List Mode only
            {
                ResetMeasurement();
                Integ.BuildMeasurement(ap, det, AssaySelector.MeasurementOption.unspecified);
            }

            //cntap = CountingAnalysisParameters.Copy(NC.App.Opstate.Measurement.AnalysisParams);
            alt = CountingAnalysisParameters.Copy(NC.App.Opstate.Measurement.AnalysisParams);

            InitializeComponent();

            // Stack all the panels up on top of each other; window is set to autosize to whatever is visible.
            this.Step2APanel.Left = 4;
            this.Step2APanel.Top = 6;
            this.Step2BPanel.Left = 4;
            this.Step2BPanel.Top = 6;
            this.Step3Panel.Left = 4;
            this.Step3Panel.Top = 6;
            this.Step4Panel.Left = 4;
            this.Step4Panel.Top = 6;

            state = startHere;
            if (state != AWSteps.Step1)
            {
                fromINCCAcquire = true;
                ap.data_src = (state == AWSteps.Step2B ? ConstructedSource.Live : ConstructedSource.NCDFile);  // default file type is NCD, updated in UI from acquire param details
            }
            CycleIntervalPatch(); // guard for bad LM cycle and interval
            // Set the visibilities correctly for the initial state 
            UpdateUI();
        }
示例#47
0
        AcquireParameters ConfigureAcquireState(Detector det, AcquireParameters def, INCCReviewFile irf)
        {
            AcquireParameters acq = NC.App.DB.LastAcquireFor(det);
            if (acq == null)
                acq = new AcquireParameters(def);
            acq.MeasDateTime = irf.dt; acq.lm.TimeStamp = irf.dt;
            acq.num_runs = irf.num_runs; // RequestedRepetitions
            int tx = def.comment.IndexOf(" (Original file name");
            if (tx >= 0)
                acq.comment = def.comment.Substring(0, tx);
            else
                acq.comment = def.comment;
            acq.comment += " (Original file name " + System.IO.Path.GetFileName(irf.Path) + ")";
            acq.detector_id = String.Copy(det.Id.DetectorId);
            acq.meas_detector_id = string.Copy(acq.detector_id);

            // iid should have been added from the NOP processing above
            ItemId iid = NC.App.DB.ItemIds.Get(irf.item);
            if (iid == null)
            {
                ctrllog.TraceEvent(LogLevels.Warning, 5439, "Item id '" + irf.item + "' is referenced by the Review file measurement data, but is not found in op. rev. files or the database");
            }
            else
            {
                acq.ApplyItemId(iid);
                INCCDB.Descriptor s = NC.App.DB.Stratums.Get(iid.stratum);
                INCCDB.Descriptor m = NC.App.DB.MBAs.Get(iid.mba);
                if (s != null)
                    acq.stratum_id = s;
                if (m != null)
                    acq.mba = m;
            }
            // todo: also need to account for iid UMass to mass condition

            INCCDB.AcquireSelector sel = new INCCDB.AcquireSelector(det, acq.item_type, irf.dt);
            if (NC.App.DB.AcquireParametersMap().ContainsKey(sel))  // only one allowed, same for actual measurement
            {
                NC.App.DB.AcquireParametersMap().Remove(sel);
            }
            NC.App.DB.AcquireParametersMap().Add(sel, acq);
            NC.App.DB.UpdateAcquireParams(acq, det.ListMode);
            return acq;
        }
示例#48
0
        /// <summary>
        /// Process one or more .NCC Review measurement data files, with related .NOP/.COP files.
        /// see Import Operator Declarations from Operator Review and Measurements from Radiation Review p. 24,
        /// See Operator Declaration File Format p. 87, 
        /// See Operator Declaration File Format for Curium Ratio Measurements p. 88, 
        /// See Radiation Review Measurement Data File Format p. 93, INCC Software Users Manual, March 29, 2009
        /// </summary>
        void INCCReviewFileProcessing()
        {

            FireEvent(EventType.ActionPrep, this);
            NC.App.Opstate.StampOperationStartTime();
            // This code would be the same for an interactive version of this operation
            //  > Start here
            // first find and process and .NOP files 
            List<string> exts = new List<string>() { ".nop", ".cop" };
            FileList<CSVFile> hdlr = new FileList<CSVFile>();
            hdlr.Init(exts, ctrllog);
            FileList<CSVFile> files = null;

            // The INCC5 semantics
            if (NC.App.AppContext.FileInputList == null)
                files = (FileList<CSVFile>)hdlr.BuildFileList(NC.App.AppContext.FileInput, NC.App.AppContext.Recurse, true);
            else
                files = (FileList<CSVFile>)hdlr.BuildFileList(NC.App.AppContext.FileInputList);

            // construct lists of isotopics and items from the NOP and COP files
            OPFiles opfiles = new OPFiles();
            opfiles.Process(files);

            ctrllog.TraceEvent(LogLevels.Verbose, 33085, "NOP items " + opfiles.NOPItemIds.Count);

            // process the NCC files only
            INCCFileOrFolderInfo foo = new INCCFileOrFolderInfo(ctrllog, "*.NCC");
            if (NC.App.AppContext.FileInputList == null)
                foo.SetPath(NC.App.AppContext.FileInput);
            else
                foo.SetFileList(NC.App.AppContext.FileInputList);
            List<INCCTransferBase> res = foo.Restore();
            // use RemoveAll to cull those NCC files that reference a non-existent detector
            DetectorList dl = NC.App.DB.Detectors;
            foreach (INCCReviewFile rf in res)
            {
                List<Detector> tdk = dl.FindAll(d => 0 == string.Compare(d.Id.DetectorName, rf.detector, true));
                if (tdk.Count < 1)
                {
                    rf.skip = true;
                    ctrllog.TraceEvent(LogLevels.Warning, 33085, "No detector " + rf.detector + " defined, cannot complete processing NCC review file " + System.IO.Path.GetFileName(rf.Path));
                }
            }
            res.RemoveAll(rf => (rf as INCCReviewFile).skip);
            res.Sort((rf1, rf2) => // sort chronologically
            {
                return DateTime.Compare((rf1 as INCCReviewFile).dt, (rf2 as INCCReviewFile).dt);
            });
            /// end here > The sorted, filtered and processed list here would be returned to the UI for display and interactive selection

            if (res == null || res.Count < 1)
            {
                NC.App.Opstate.StopTimer(0);
                NC.App.Opstate.StampOperationStopTime();
                FireEvent(EventType.ActionStop, this);
                ctrllog.TraceEvent(LogLevels.Warning, 33085, "No useable NCC review files found in " + System.IO.Path.GetFullPath(foo.GetPath()));
                return;
            }

            AcquireParameters orig_acq = new AcquireParameters(NC.App.Opstate.Measurement.AcquireState);

            // Each NCC file is a separate measurement 
            foreach (INCCReviewFile irf in res)
            {
                ResetMeasurement();
                if (NC.App.Opstate.IsQuitRequested)
                    break;
                // Find the detector named in the NCC file (existence shown in earlier processing above)
                Detector curdet = NC.App.DB.Detectors.Find(d => string.Compare(d.Id.DetectorName, irf.detector, true) == 0);

                // set up acquire state based on the NCC file content
                AcquireParameters newacq = ConfigureAcquireState(curdet, orig_acq, irf);

                AssaySelector.MeasurementOption mo = NCCMeasOption(irf);
                // make a temp MeasId
                MeasId thisone = new MeasId(mo, newacq.MeasDateTime);
                // get the list of measurement Ids for this detector
                List<MeasId> list = NC.App.DB.MeasurementIds(curdet.Id.DetectorName, mo.PrintName());
                MeasId already = list.Find(mid => mid.Equals(thisone));
                if (already != null)
                {
                    // URGENT: do the replacement as it says 
                    ctrllog.TraceEvent(LogLevels.Warning, 33085, "Replacing the matching {0} measurement, timestamp {1} (in a future release)", already.MeasOption.PrintName(), already.MeasDateTime.ToString());
                }

                IntegrationHelpers.BuildMeasurement(newacq, curdet, mo);
                Measurement meas = NC.App.Opstate.Measurement;
                meas.MeasDate = newacq.MeasDateTime; // use the date and time from the NCC file content      

                meas.Persist();  // preserve the basic results record
                if (AssaySelector.ForMass(meas.MeasOption) && !meas.INCCAnalysisState.Methods.AnySelected())
                    ctrllog.TraceEvent(LogLevels.Warning, 437, "No mass methods for " + meas.INCCAnalysisState.Methods.selector.ToString());

                try
                {

                    UInt16 total_number_runs = 0;
                    double run_count_time = 0;
                    double total_good_count_time = 0;

                    if (irf.num_runs == 0)
                    {
                        ctrllog.TraceEvent(LogLevels.Error, 440, "This measurement has no good cycles.");
                        continue;
                    }
                    if (meas.MeasOption == AssaySelector.MeasurementOption.holdup)
                        continue;

                    /* convert to total count time */
                    total_number_runs = irf.num_runs;
                    total_good_count_time = (double)irf.num_runs *
                        run_count_time;
                    meas.RequestedRepetitions = total_number_runs;

                    // convert runs to cycles
                    for (int i = 0; i < irf.num_runs; i++)
                    {
                        /* run date and time (IAEA format) */
                        AddReviewFileCycle(i, irf.runs[i], irf.times[i], meas, irf.Path);
                        if (i % 8 == 0)
                            FireEvent(EventType.ActionInProgress, this);
                    }
                    FireEvent(EventType.ActionInProgress, this);

                    // NEXT: handle true AAS cycles as in INCC5
                    if (meas.MeasOption == AssaySelector.MeasurementOption.verification &&
                        meas.INCCAnalysisState.Methods.Has(AnalysisMethod.AddASource) &&
                        meas.AcquireState.well_config == WellConfiguration.Passive)
                    {
                        ctrllog.TraceEvent(LogLevels.Error, 440, "No add-a-source data processed because I am lame. " + "AAS ");
                        //AddASourceSetup aass = IntegrationHelpers.GetCurrentAASSParams(meas.Detectors[0]);
                        //for (int n = 1; n <= aass.number_positions; n++)
                        //{
                        //    /* number of good runs */
                        //    string l = td.reader.ReadLine();
                        //    if (td.reader.EndOfStream)
                        //    {
                        //        ctrllog.TraceEvent(LogLevels.Error, 440, "No add-a-source data found in disk file. " + "AAS p" + n.ToString());

                        //    }
                        //}
                    }
                }
                catch (Exception e)
                {
                    NC.App.Opstate.SOH = NCC.OperatingState.Trouble;
                    ctrllog.TraceException(e, true);
                    ctrllog.TraceEvent(LogLevels.Error, 437, "NCC file processing stopped with error: '" + e.Message + "'");
                }
                finally
                {
                    NC.App.Loggers.Flush();
                }
                FireEvent(EventType.ActionInProgress, this);
                ComputeFromINCC5SRData(meas);
                FireEvent(EventType.ActionInProgress, this);
            }


            NC.App.Opstate.ResetTokens();
            NC.App.Opstate.SOH = NCC.OperatingState.Stopping;
            NC.App.Opstate.StampOperationStopTime();
            FireEvent(EventType.ActionStop, this);
        }
示例#49
0
 AcquireParameters ConfigureAcquireState(Detector det, AcquireParameters def, DateTimeOffset dto, ushort runs, string path)
 {
     AcquireParameters acq = NC.App.DB.LastAcquireFor(det);
     if (acq == null)
         acq = new AcquireParameters(def);
     acq.MeasDateTime = dto; acq.lm.TimeStamp = dto;
     acq.detector_id = String.Copy(det.Id.DetectorId);
     acq.meas_detector_id = string.Copy(acq.detector_id);
     acq.num_runs = runs;
     int tx = def.comment.IndexOf(" (Original file name");
     if (tx >= 0)
         acq.comment = def.comment.Substring(0, tx);
     else
         acq.comment = def.comment;
     acq.comment += " (Original file name " + System.IO.Path.GetFileName(path) + ")";
     INCCDB.AcquireSelector sel = new INCCDB.AcquireSelector(det, acq.item_type, dto);
     if (NC.App.DB.AcquireParametersMap().ContainsKey(sel))  // only one allowed, same for actual measurement
     {
         NC.App.DB.AcquireParametersMap().Remove(sel);
     }
     NC.App.DB.AcquireParametersMap().Add(sel, acq);
     NC.App.DB.UpdateAcquireParams(acq, det.ListMode);
     return acq;
 }
示例#50
0
        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
        }
示例#51
0
 public static AnalysisDefs.Isotopics GetAcquireIsotopics(AcquireParameters acq)
 {
     AnalysisDefs.Isotopics iso = CentralizedState.App.DB.Isotopics.GetList().
                                     Find(i => string.Compare(i.id, acq.isotopics_id, true) == 0);
     if (iso == null)
         iso = CentralizedState.App.DB.Isotopics.GetDefault();
     return iso;
 }
示例#52
0
        void TestDataAssay()
        {
            List<string> exts = new List<string>() { ".dat", ".cnn" };
            FileList<TestDataFile> hdlr = new FileList<TestDataFile>();
            hdlr.Init(exts, ctrllog);
            FileList<TestDataFile> files = null;

            // initialize operation timer here
            NC.App.Opstate.ResetTimer(0, filegather, files, 170, (int)NC.App.AppContext.StatusTimerMilliseconds);
            FireEvent(EventType.ActionPrep, this);
            NC.App.Opstate.StampOperationStartTime();

            if (NC.App.AppContext.FileInputList == null)
                files = (FileList<TestDataFile>)hdlr.BuildFileList(NC.App.AppContext.FileInput, NC.App.AppContext.Recurse, true);
            else
                files = (FileList<TestDataFile>)hdlr.BuildFileList(NC.App.AppContext.FileInputList);
            if (files == null || files.Count < 1)
            {
                NC.App.Opstate.StopTimer(0);
                NC.App.Opstate.StampOperationStopTime();
                FireEvent(EventType.ActionStop, this);
                ctrllog.TraceEvent(LogLevels.Warning, 33085, "No useable Test data/Disk .dat files found");
                return;
            }

            AcquireParameters orig_acq = new AcquireParameters(NC.App.Opstate.Measurement.AcquireState);
            Detector curdet = NC.App.Opstate.Measurement.Detectors[0];
            AssaySelector.MeasurementOption mo = NC.App.Opstate.Measurement.MeasOption;

            // Each .dat file is a separate measurement 
            foreach (TestDataFile td in files)
            {
                Measurement meas = null;
                ResetMeasurement();

                try
                {
                    if (!td.OpenForReading())
                        continue;
                    if (NC.App.Opstate.IsQuitRequested)
                        break;
                    UInt32 run_seconds;

                    UInt16 number_good_runs = 0;
                    UInt16 total_number_runs = 0;
                    double run_count_time = 0;
                    double total_good_count_time = 0;

                    if (mo != AssaySelector.MeasurementOption.holdup)
                    {
                        /* number of good runs */
                        string l = td.reader.ReadLine();
                        UInt16.TryParse(l, out number_good_runs);
                        if (number_good_runs == 0)
                        {
                            ctrllog.TraceEvent(LogLevels.Error, 440, "This measurement has no good cycles.");
                            continue;
                        }
                        /* run count time */
                        l = td.reader.ReadLine();
                        Double.TryParse(l, out run_count_time);
                        if (run_count_time <= 0.0)
                        {
                            ctrllog.TraceEvent(LogLevels.Error, 441, "Count time is <= 0.");
                            continue;
                        }
                    }

                    // update acq and then meas here
                    AcquireParameters newacq = ConfigureAcquireState(curdet, orig_acq, DateTimeOffset.Now, number_good_runs, td.Filename);
                    IntegrationHelpers.BuildMeasurement(newacq, curdet, mo);
                    meas = NC.App.Opstate.Measurement;
                    meas.MeasDate = newacq.MeasDateTime;
                    meas.Persist();  // preserve the basic results record

                    /* convert to total count time */
                    total_number_runs = number_good_runs;
                    total_good_count_time = (double)number_good_runs *
                        run_count_time;
                    meas.RequestedRepetitions = total_number_runs;

                    // update the acq status and do the persist

                    /* read in run data */
                    for (int i = 0; i < number_good_runs; i++)
                    {
                        /* run date and time (IAEA format) */
                        run_seconds = (UInt32)(i * (UInt16)run_count_time); // from start time
                        AddTestDataCycle(i, run_seconds, run_count_time, meas, td);
                        if (i % 8 == 0)
                            FireEvent(EventType.ActionInProgress, this);
                    }
                    FireEvent(EventType.ActionInProgress, this);

                    if (meas.MeasOption == AssaySelector.MeasurementOption.verification &&
                        meas.INCCAnalysisState.Methods.Has(AnalysisMethod.AddASource) &&
                        meas.AcquireState.well_config == WellConfiguration.Passive)
                    {
                        AddASourceSetup aass = IntegrationHelpers.GetCurrentAASSParams(meas.Detectors[0]);
                        for (int n = 1; n <= aass.number_positions; n++)
                        {
                            /* number of good runs */
                            string l = td.reader.ReadLine();
                            if (td.reader.EndOfStream)
                            {
                                ctrllog.TraceEvent(LogLevels.Error, 440, "No add-a-source data found in disk file. " + "AAS p" + n.ToString());
                            }
                            UInt16.TryParse(l, out number_good_runs);
                            if (number_good_runs == 0)
                            {
                                ctrllog.TraceEvent(LogLevels.Error, 440, "This measurement has no good cycles. " + "AAS p" + n.ToString());
                                continue;
                            }
                            /* run count time */
                            l = td.reader.ReadLine();
                            Double.TryParse(l, out run_count_time);
                            if (run_count_time <= 0.0)
                            {
                                ctrllog.TraceEvent(LogLevels.Error, 441, "Count time is <= 0. " + "AAS p" + n.ToString());
                                continue;
                            }
                            /* read in run data */
                            for (int i = 0; i < number_good_runs; i++)
                            {
                                /* run date and time (IAEA format) */
                                run_seconds = (UInt32)((n + 1) * (i + 1) * (UInt16)run_count_time); // from start time
                                AddTestDataCycle(i, run_seconds, run_count_time, meas, td, " AAS p" + n.ToString(), n);
                                if (i % 8 == 0)
                                    FireEvent(EventType.ActionInProgress, this);
                            }
                            FireEvent(EventType.ActionInProgress, this);
                        }
                    }
                }
                catch (Exception e)
                {
                    NC.App.Opstate.SOH = NCC.OperatingState.Trouble;
                    ctrllog.TraceException(e, true);
                    ctrllog.TraceEvent(LogLevels.Error, 437, "Test data file processing stopped with error: '" + e.Message + "'");
                }
                finally
                {
                    td.CloseReader();
                    NC.App.Loggers.Flush();
                }
                FireEvent(EventType.ActionInProgress, this);
                ComputeFromINCC5SRData(meas);
                FireEvent(EventType.ActionInProgress, this);
            }

            NC.App.Opstate.ResetTokens();
            NC.App.Opstate.SOH = NCC.OperatingState.Stopping;
            NC.App.Opstate.StampOperationStopTime();
            FireEvent(EventType.ActionStop, this);
        }
示例#53
0
 public void RefreshParams()
 {
     ap = Integ.GetCurrentAcquireParamsFor(det);
 }