Exemple #1
0
        public Tolerance GetProductTolerance()
        {
            double        value = (double)numericUpDown1.Value;
            ToleranceUnit type  = (ToleranceUnit)comboBox1.SelectedItem;

            return(new Tolerance(type, value));
        }
Exemple #2
0
        public static Tolerance CalculatePrecursorMassError(double theoreticalMass, double observedMass, out int nominalMassOffset, out double adjustedObservedMass, double difference = Constants.C13C12Difference,
                                                            ToleranceUnit type = ToleranceUnit.PPM)
        {
            double massError = observedMass - theoreticalMass;

            nominalMassOffset = (int)Math.Round(massError / difference);
            double massOffset = nominalMassOffset * difference;

            adjustedObservedMass = observedMass - massOffset;
            return(new Tolerance(type, adjustedObservedMass, theoreticalMass));
        }
Exemple #3
0
        public static double GetTolerance(double experimental, double theoretical, ToleranceUnit type)
        {
            switch (type)
            {
            case ToleranceUnit.PPM:
                return(Math.Abs((experimental - theoretical) / theoretical * 1e6));

            default:
                return(Math.Abs(experimental - theoretical));
            }
        }
Exemple #4
0
        public static double GetTolerance(double experimental, double theoretical, ToleranceUnit type)
        {
            switch (type)
            {
            case ToleranceUnit.MMU:
                return((experimental - theoretical) * 1000.0);

            case ToleranceUnit.PPM:
                return((experimental - theoretical) / theoretical * 1e6);

            default:
                return(experimental - theoretical);
            }
        }
Exemple #5
0
 public Tolerance(ToleranceUnit unit, double experimental, double theoretical, ToleranceType type = ToleranceType.PlusAndMinus)
     : this(unit, GetTolerance(experimental, theoretical, unit), type)
 {
 }
Exemple #6
0
 public Tolerance(ToleranceUnit unit, double value, ToleranceType type = ToleranceType.PlusAndMinus)
 {
     Unit  = unit;
     Value = value;
     Type  = type;
 }
Exemple #7
0
 /// <summary>
 /// Creates a new tolerance given a unit, two points (one experimental and one theoretical), and whether the tolerance is ±
 /// </summary>
 /// <param name="unit">The units for this tolerance</param>
 /// <param name="experimental">The experimental value</param>
 /// <param name="theoretical">The theoretical value</param>
 /// <param name="type">Whether the tolerance is full or half width</param>
 public Tolerance(ToleranceUnit unit, double experimental, double theoretical, ToleranceType type = ToleranceType.PlusAndMinus)
     : this(unit, GetTolerance(experimental, theoretical, unit), type)
 {
 }
Exemple #8
0
 /// <summary>
 /// Creates a new tolerance given a unit, value, and whether the tolerance is ±
 /// </summary>
 /// <param name="unit">The units for this tolerance</param>
 /// <param name="value">The numerical value of the tolerance</param>
 /// <param name="type">Whether the tolerance is full or half width</param>
 public Tolerance(ToleranceUnit unit, double value, ToleranceType type = ToleranceType.PlusAndMinus)
 {
     Unit = unit;
     Value = value;
     Type = type;
 }
Exemple #9
0
        public static double GetTolerance(double experimental, double theoretical, ToleranceUnit type)
        {
            switch (type)
            {
                case ToleranceUnit.MMU:
                    return (experimental - theoretical)*1000.0;

                case ToleranceUnit.PPM:
                    return (experimental - theoretical)/theoretical*1e6;

                default:
                    return experimental - theoretical;
            }
        }
Exemple #10
0
 public static Tolerance CalculatePrecursorMassError(double theoreticalMass, double observedMass, out int nominalMassOffset, out double adjustedObservedMass, double difference = Constants.C13C12Difference,
     ToleranceUnit type = ToleranceUnit.PPM)
 {
     double massError = observedMass - theoreticalMass;
     nominalMassOffset = (int) Math.Round(massError/difference);
     double massOffset = nominalMassOffset*difference;
     adjustedObservedMass = observedMass - massOffset;
     return new Tolerance(type, adjustedObservedMass, theoreticalMass);
 }
Exemple #11
0
 public Tolerance(double value, ToleranceUnit unit)
 {
     _value = value;
     _unit  = unit;
 }
Exemple #12
0
 public Tolerance(double value, ToleranceUnit unit)
 {
     _value = value;
     _unit = unit;
 }
Exemple #13
0
 /// <summary>
 /// Creates a new tolerance given a unit, two points (one experimental and one theoretical), and whether the tolerance is ±
 /// </summary>
 /// <param name="unit">The units for this tolerance</param>
 /// <param name="experimental">The experimental value</param>
 /// <param name="theoretical">The theoretical value</param>
 public Tolerance(ToleranceUnit unit, double experimental, double theoretical)
     : this(unit, GetTolerance(experimental, theoretical, unit))
 {
 }
Exemple #14
0
 /// <summary>
 /// Creates a new tolerance given a unit, value, and whether the tolerance is ±
 /// </summary>
 /// <param name="unit">The units for this tolerance</param>
 /// <param name="value">The numerical value of the tolerance</param>
 public Tolerance(ToleranceUnit unit, double value)
 {
     Unit  = unit;
     Value = Math.Abs(value);
 }