schrodinger.application.desmond.measurement module

class schrodinger.application.desmond.measurement.Measurement(value: float, uncertainty: float = nan)

Bases: object

Basic method for uncertainty propagation: Say we have a few measurements: x1, x2, x3, …, and they each have an uncertainty: d1, d2, d3, …, respectively. Now we have a function: f(x1, x2, x3, … ), we want to get the value of this function with given measurements x1, x2, x3, and also the uncertainty of the result of f. A way to do this is the following:

  1. We need to get the contribution to the uncertainty of f result due to each measurement: fd1, fd2, fd3, … This can be given by the following equations:

    fd1 = df / dx1 * d1
    fd2 = df / dx2 * d2
    fd3 = df / dx3 * d3
    ...
    

    where df / dx1 is a partial derivative of f with respect to x1.

  2. With fd1, fd2, fd3, ..., we can get the uncertainty of f using this equation:

    fd = math.sqrt( fd1 * fd1 + fd2 * fd2 + fd3 * fd3 + ... )
    
__init__(value: float, uncertainty: float = nan)
to_string(num_digits: int) str

Convert Measurement to string with given num_digits decimal places

classmethod from_string(s: str) schrodinger.application.desmond.measurement.Measurement

Convert string (e.g: “5.0+-0.3”) to Measurement

schrodinger.application.desmond.measurement.string2measurement(s: str) schrodinger.application.desmond.measurement.Measurement

Convert string (e.g: “5.0+-0.3”) to Measurement

This method is deprecated in favor of Measurement.from_string

schrodinger.application.desmond.measurement.approx_equal(measurement_0: schrodinger.application.desmond.measurement.Measurement, measurement_1: schrodinger.application.desmond.measurement.Measurement, rel_tol: float = 1e-06, abs_tol: float = 0) bool

Check whether two measurements are approximately equal.

This function compares the given measurements’ values and uncertainties separately using the provided relative tolerance, rel_tol, and absolute tolerance abs_tol. Note that it is order independent. This function provides more flexibility than Measurement.__eq__ because it allows for custom tolerances.

Parameters
  • measurement_0 – The first measurement to compare

  • measurement_1 – The second measurement to compare

  • rel_tol – The relative tolerance to allow

  • abs_tol – The absolute tolerance to allow

Returns

whether the values and uncertainties of both measurements are approximately equal