Esempio n. 1
0
        /// <summary>
        /// Create a new detector in-memory, with the related classes.
        /// Emulates the INCC relationship constructor, caller must insert new det into global list, then update to DB later for persistence
        /// </summary>
        /// <param name="model">detector to copy</param>
        /// <param name="newId">New detector name</param>
        /// <param name="elecId">Electronics id (just a string)</param>
        /// <param name="typeDesc">Type description (just a string)</param>
        /// <param name="srType">Actual instrument type</param>
        /// <returns>The newly created in-memory Detector class instance</returns>
        static public Detector CreateDetectorWithAssociations(Detector model, string newId, string elecId, string typeDesc, InstrType srType = InstrType.AMSR)
        {
            if (model != null)
            {
                Detector det = new Detector(model); // copies the SR too
                det.Id.SetIdDetails(newId, elecId, typeDesc, model.Id.SRType);

                // copy the model detector's related parameters (skips stratum)
                NormParameters          n          = CentralizedState.App.DB.NormParameters.Get(model);
                NormParameters          Norm       = new NormParameters(n);
                BackgroundParameters    b          = CentralizedState.App.DB.BackgroundParameters.Get(model);
                BackgroundParameters    Background = new BackgroundParameters(b);
                UnattendedParameters    u          = CentralizedState.App.DB.UnattendedParameters.Get(model);
                UnattendedParameters    Unatt      = new UnattendedParameters(u);
                AddASourceSetup         a          = CentralizedState.App.DB.AASSParameters.Get(model);
                AddASourceSetup         Aass       = new AddASourceSetup(a);
                HVCalibrationParameters h          = CentralizedState.App.DB.HVParameters.Get(model);
                HVCalibrationParameters Hv         = new HVCalibrationParameters(h);

                // add copied param instances to in-memory maps
                CentralizedState.App.DB.NormParameters.Map.Add(det, Norm);
                CentralizedState.App.DB.UnattendedParameters.Map.Add(det, Unatt);
                CentralizedState.App.DB.BackgroundParameters.Map.Add(det, Background);
                CentralizedState.App.DB.AASSParameters.Map.Add(det, Aass);
                CentralizedState.App.DB.HVParameters.Map.Add(det, Hv);

                CentralizedState.App.DB.Detectors.Add(det); // add detector to in-memory list

                return(det);
            }
            else
            {
                Detector det = new Detector();
                det.Id.SetIdDetails(newId, elecId, typeDesc, srType);

                if (srType.IsListMode())
                {
                    det.Id.FullConnInfo = new LMConnectionInfo();
                }

                // add fresh param instances to in-memory maps
                CentralizedState.App.DB.NormParameters.Map.Add(det, new NormParameters());
                CentralizedState.App.DB.UnattendedParameters.Map.Add(det, new UnattendedParameters());
                CentralizedState.App.DB.BackgroundParameters.Map.Add(det, new BackgroundParameters());
                CentralizedState.App.DB.AASSParameters.Map.Add(det, new AddASourceSetup());
                CentralizedState.App.DB.HVParameters.Map.Add(det, new HVCalibrationParameters());

                CentralizedState.App.DB.Detectors.Add(det); // add detector to in-memory list

                return(det);
            }

            /*  * todo: create analysis selector (or it happens automatically when first referenced?)
             * creating a stratum association
             * */
        }
Esempio n. 2
0
 public static string NameForViewing(this ConstructedSource src, InstrType device)
 {
     if (device.IsListMode() && src.Live())
     {
         return(ListModeLiveName);
     }
     else
     {
         return(PrettyName[src]);
     }
 }
 private void SetPredelayStepConstraint(InstrType t)
 {
     if (t.IsListMode() || t == InstrType.JSR15)
     {
         PredelayTextBox.Steps = -1;                 // no check
     }
     else
     {
         PredelayTextBox.Steps = 0.25;                 // traditional step increment
         if ((PredelayTextBox.Value % 0.25) != 0)
         {
             PredelayTextBox.Value = Bounce25Step(PredelayTextBox.Value);
         }
     }
 }
Esempio n. 4
0
        /// <summary>
        /// Create a new detector in-memory, with the related classes.
        /// Emulates the INCC relationship constructor, caller must insert new det into global list, then update to DB later for persistence
        /// </summary>
        /// <param name="model">detector to copy</param>
        /// <param name="newId">New detector name</param>
        /// <param name="elecId">Electronics id (just a string)</param>
        /// <param name="typeDesc">Type description (just a string)</param>
        /// <param name="srType">Actual instrument type</param>
        /// <returns>The newly created in-memory Detector class instance</returns>
        public static Detector CreateDetectorWithAssociations(Detector model, string newId, string elecId, string typeDesc, InstrType srType = InstrType.AMSR)
        {
            if (model != null)
            {
                Detector det = new Detector(model); // copies the SR too
                det.Id.SetIdDetails(newId, elecId, typeDesc, model.Id.SRType);

                // copy the model detector's related parameters (skips stratum)
                NormParameters n = CentralizedState.App.DB.NormParameters.Get(model);
                NormParameters Norm = new NormParameters(n);
                BackgroundParameters b = CentralizedState.App.DB.BackgroundParameters.Get(model);
                BackgroundParameters Background = new BackgroundParameters(b);
                UnattendedParameters u = CentralizedState.App.DB.UnattendedParameters.Get(model);
                UnattendedParameters Unatt = new UnattendedParameters(u);
                AddASourceSetup a = CentralizedState.App.DB.AASSParameters.Get(model);
                AddASourceSetup Aass = new AddASourceSetup(a);
                HVCalibrationParameters h = CentralizedState.App.DB.HVParameters.Get(model);
                HVCalibrationParameters Hv = new HVCalibrationParameters(h);

                // add copied param instances to in-memory maps
                CentralizedState.App.DB.NormParameters.Map.Add(det, Norm);
                CentralizedState.App.DB.UnattendedParameters.Map.Add(det, Unatt);
                CentralizedState.App.DB.BackgroundParameters.Map.Add(det, Background);
                CentralizedState.App.DB.AASSParameters.Map.Add(det, Aass);
                CentralizedState.App.DB.HVParameters.Map.Add(det, Hv);

                CentralizedState.App.DB.Detectors.Add(det); // add detector to in-memory list

                return det;
            }
            else
            {
                Detector det = new Detector();
                det.Id.SetIdDetails(newId, elecId, typeDesc,srType);

                if (srType.IsListMode())
                    det.Id.FullConnInfo = new LMConnectionInfo();

                // add fresh param instances to in-memory maps
                CentralizedState.App.DB.NormParameters.Map.Add(det, new NormParameters());
                CentralizedState.App.DB.UnattendedParameters.Map.Add(det, new UnattendedParameters());
                CentralizedState.App.DB.BackgroundParameters.Map.Add(det, new BackgroundParameters());
                CentralizedState.App.DB.AASSParameters.Map.Add(det, new AddASourceSetup());
                CentralizedState.App.DB.HVParameters.Map.Add(det, new HVCalibrationParameters());

                CentralizedState.App.DB.Detectors.Add(det); // add detector to in-memory list

                return det;
            }

            /*  * todo: create analysis selector (or it happens automatically when first referenced?)
                * creating a stratum association
             * */
        }
Esempio n. 5
0
        public static bool LMFiles(this ConstructedSource src, InstrType device)
        {
            bool ack = (src >= ConstructedSource.NCDFile && src <= ConstructedSource.SortedPulseTextFile) && device.IsListMode();  // data from other source and the processing went through the raw counting code

            return(ack);
        }
Esempio n. 6
0
 private void SetPredelayStepConstraint(InstrType t)
 {
     if (t.IsListMode() || t == InstrType.JSR15)
         PredelayTextBox.Steps = -1; // no check
     else
     {
         PredelayTextBox.Steps = 0.25; // traditional step increment
         if ((PredelayTextBox.Value % 0.25) != 0)
         {
             PredelayTextBox.Value = Bounce25Step(PredelayTextBox.Value);
         }
     }
 }