schrodinger.application.desmond.measurement module

A class for simple arithmetic with uncertainty.

Copyright Schrodinger, LLC. All rights reserved.

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

Bases: object

Basic method for uncertainty propagation: Say we have a few measurements: x1, x2, x3, …, and they each has a 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, uncertainty=nan)
__repr__()
__eq__(rhs)

Return self==value.

__str__()
__float__()
__int__()
__tuple__()
__add__(rhs)
__radd__(lhs)
__sub__(rhs)
__rsub__(lhs)
__neg__()
__pos__()
__abs__()
__mul__(rhs)
__rmul__(lhs)
__div__(rhs)
__rdiv__(lhs)
__truediv__(rhs)
to_string(num_digits)

Convert Measurement to string with given num_digits decimal places

classmethod from_string(s)

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

__class__

alias of builtins.type

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.application.desmond.measurement', '__doc__': "\n Basic method for uncertainty propagation:\n Say we have a few measurements: x1, x2, x3, ..., and they each has a uncertainty: d1, d2, d3, ..., respectively.\n Now we have a function: f( x1, x2, x3, ... ), we want to get the value of this function with given measurements x1, x2, x3,\n ... and also the uncertainty of the result of f.\n A way to do this is the following:\n 1. We need to get the contribution to the uncertainty of f result due to each measurement: fd1, fd2, fd3, ...\n This can be given by the following equations:\n fd1 = df / dx1 * d1\n fd2 = df / dx2 * d2\n fd3 = df / dx3 * d3\n ...\n where `df / dx1' is a partial derivative of f with respect to x1.\n 2. With fd1, fd2, fd3, ..., we can get the uncertainty of f using this equation:\n fd = math.sqrt( fd1 * fd1 + fd2 * fd2 + fd3 * fd3 + ... )\n ", '__init__': <function Measurement.__init__>, '__repr__': <function Measurement.__repr__>, '__eq__': <function Measurement.__eq__>, '__str__': <function Measurement.__str__>, '__float__': <function Measurement.__float__>, '__int__': <function Measurement.__int__>, '__tuple__': <function Measurement.__tuple__>, '__add__': <function Measurement.__add__>, '__radd__': <function Measurement.__radd__>, '__sub__': <function Measurement.__sub__>, '__rsub__': <function Measurement.__rsub__>, '__neg__': <function Measurement.__neg__>, '__pos__': <function Measurement.__pos__>, '__abs__': <function Measurement.__abs__>, '__mul__': <function Measurement.__mul__>, '__rmul__': <function Measurement.__rmul__>, '__div__': <function Measurement.__div__>, '__rdiv__': <function Measurement.__rdiv__>, '__truediv__': <function Measurement.__truediv__>, 'to_string': <function Measurement.to_string>, 'from_string': <classmethod object>, '__dict__': <attribute '__dict__' of 'Measurement' objects>, '__weakref__': <attribute '__weakref__' of 'Measurement' objects>, '__hash__': None})
__dir__() → list

default dir() implementation

__format__()

default object formatter

__ge__

Return self>=value.

__getattribute__

Return getattr(self, name).

__gt__

Return self>value.

__hash__ = None
__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__le__

Return self<=value.

__lt__

Return self<value.

__module__ = 'schrodinger.application.desmond.measurement'
__ne__

Return self!=value.

__new__()

Create and return a new object. See help(type) for accurate signature.

__reduce__()

helper for pickle

__reduce_ex__()

helper for pickle

__setattr__

Implement setattr(self, name, value).

__sizeof__() → int

size of object in memory, in bytes

__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

__weakref__

list of weak references to the object (if defined)

schrodinger.application.desmond.measurement.string2measurement(s)

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

This method is deprecated in favor of Measurement.from_string