コード例 #1
0
        // stub, TBD
        public void UpdateAnalysisMethodResults(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} method parameters, skipping to next entry", detname, md.Item1.ToString());
                        continue;
                    }

                    NC.App.Pest.logger.TraceEvent(LogLevels.Verbose, 34030, "Updating <{0},{1}>: {2}", detname, mat, md.Item2.GetType().Name);

                    DB.ElementList parms = null;
                    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.Collar:
                    case AnalysisMethod.ActiveMultiplicity:
                        parms = ((ParameterBase)md.Item2).ToDBElementList();
                        break;

                    default:
                        break;
                    }
                    if (parms != null)
                    {
                        db.UpdateCalib(detname, mat, md.Item2.GetType().Name, parms);  // det, mat, amid, params
                    }
                }
            }
        }
コード例 #2
0
ファイル: CounterPersistence.cs プロジェクト: radtek/INCC6
 public void InsertCounters(string detname, CountingAnalysisParameters cap)
 {
     DB.CountingAnalysisParameters db = new DB.CountingAnalysisParameters();
     foreach (SpecificCountingAnalyzerParams s in cap)
     {
         DB.ElementList parms = s.ToDBElementList();
         if (parms != null)
         {
             db.Insert(detname, s.GetType().Name, parms);
         }
     }
 }
コード例 #3
0
        public void ReplaceCounters(Detector det, CountingAnalysisParameters cap)
        {
            DB.CountingAnalysisParameters db = new DB.CountingAnalysisParameters();
            DB.Detectors dets = new DB.Detectors(db.db);
            long         l    = dets.PrimaryKey(det.Id.DetectorName);

            if (l == -1)
            {
                return;
            }

            foreach (SpecificCountingAnalyzerParams s in cap)
            {
                DB.ElementList parms = s.ToDBElementList();
                if (parms != null)
                {
                    db.Delete(l, s.GetType().Name, parms);
                }
            }
        }
コード例 #4
0
        // todo: collar/k5 detached params (no explicit detector mapping)
        /// 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 = (INCCAnalysisParams.INCCMethodDescriptor) new INCCAnalysisParams.active_rec();
                                break;

                            case AnalysisMethod.ActiveMultiplicity:
                                rec = (INCCAnalysisParams.INCCMethodDescriptor) new INCCAnalysisParams.active_mult_rec();
                                break;

                            case AnalysisMethod.ActivePassive:
                                rec = (INCCAnalysisParams.INCCMethodDescriptor) new INCCAnalysisParams.active_passive_rec();
                                break;

                            case AnalysisMethod.AddASource:
                                rec = (INCCAnalysisParams.INCCMethodDescriptor) new INCCAnalysisParams.add_a_source_rec();
                                break;

                            case AnalysisMethod.CalibrationCurve:
                                rec = (INCCAnalysisParams.INCCMethodDescriptor) new INCCAnalysisParams.cal_curve_rec();
                                break;

                            case AnalysisMethod.Collar:
                                //This may not be enough for collar params creation. hn 9.23.2015
                                rec = (INCCAnalysisParams.INCCMethodDescriptor) new INCCAnalysisParams.collar_combined_rec();
                                break;

                            case AnalysisMethod.CuriumRatio:
                                rec = (INCCAnalysisParams.INCCMethodDescriptor) new INCCAnalysisParams.cm_pu_ratio_rec();
                                break;

                            case AnalysisMethod.KnownA:
                                rec = (INCCAnalysisParams.INCCMethodDescriptor) new INCCAnalysisParams.known_alpha_rec();
                                break;

                            case AnalysisMethod.KnownM:
                                rec = (INCCAnalysisParams.INCCMethodDescriptor) new INCCAnalysisParams.known_m_rec();
                                break;

                            case AnalysisMethod.Multiplicity:
                                rec = (INCCAnalysisParams.INCCMethodDescriptor) new INCCAnalysisParams.multiplicity_rec();
                                break;

                            case AnalysisMethod.TruncatedMultiplicity:
                                rec = (INCCAnalysisParams.INCCMethodDescriptor) new INCCAnalysisParams.truncated_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;
                    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.Collar:
                    case AnalysisMethod.ActiveMultiplicity:
                        parms = ((ParameterBase)md.Item2).ToDBElementList();
                        break;

                    default:
                        break;
                    }
                    if (parms != null)
                    {
                        db.UpdateCalib(detname, mat, md.Item2.GetType().Name, parms);  // det, mat, amid, params
                    }
                    //Something amiss and sometimes not storing. Could this be it?
                    else
                    {
                        //Didn't exist, so create and store. hn 9.22.2015
                        sam.AddMethod(md.Item1, md.Item2);
                    }
                }
            }
        }