schrodinger.application.matsci.uq_utils module¶
Utilities for uncertainty quantification.
Copyright Schrodinger, LLC. All rights reserved.
-
schrodinger.application.matsci.uq_utils.
get_bilinear_regions
(original_data)¶ Gets the initial early and late regions such that the R squared values are maximized.
Parameters: original_data (list) – contains pair tuples of data points Return type: tuple, tuple Returns: (min, max) tuples for early and late regions
-
schrodinger.application.matsci.uq_utils.
get_points_in_region
(data, region)¶ Determine which data points fall into a region given its lower and upper bound.
Parameters: - data (list) – contains pair tuples of data points
- region (tuple) – a tuple containing the lower and upper boundaries points of the region
Returns: all points within the region
Return type: list
-
schrodinger.application.matsci.uq_utils.
get_bilinear_regression
(data)¶ Return the regression information.
Parameters: data (list) – contains pair tuples of data points Return type: tuple Returns: (slope, intercept, R^2)
-
schrodinger.application.matsci.uq_utils.
get_bilinear_prop
(early_regression, late_regression)¶ Returns the bilinear property if both regressions are available.
Parameters: - early_regression (tuple) – (slope, intercept, R^2) for early part
- late_regression (tuple) – (slope, intercept, R^2) for late part
Returns: the property
Return type: float
-
schrodinger.application.matsci.uq_utils.
get_bilinear_fit_property
(x, x_intersection, early_regression, late_regression, invert_y=True)¶ Return the fit property given the x-value.
Parameters: - x (float) – the x-value
- x_intersection (float) – the x intersection point
- early_regression (tuple) – (slope, intercept, R^2) for early part
- late_regression (tuple) – (slope, intercept, R^2) for late part
- invert_y (bool) – whether to invert the y-values
Return type: float or None
Returns: the fit property value or None if there isn’t one
-
schrodinger.application.matsci.uq_utils.
get_bilinear_prop_from_points
(points)¶ Return a bilinear property using the given points.
Parameters: points (list) – list of (x,y) tuples Return type: float or None Returns: the property or None if there isn’t one
-
schrodinger.application.matsci.uq_utils.
get_min_max_avg
(data)¶ Return (min, max, avg) of the given data.
Parameters: data (list) – the data Return type: float, float, float Returns: the min, max, avg
-
schrodinger.application.matsci.uq_utils.
get_hyperbola_regression
(data, avg_x)¶ Return the regression information.
Parameters: - data (list) – contains pair tuples of data points
- avg_x (float) – the average x-value
Return type: tuple
Returns: (t0, a, b, c, p0) parameters
-
schrodinger.application.matsci.uq_utils.
calc_property
(x_scaled, t0, a, b, c, p0)¶ Calculate the hyperbolic property.
Parameters: - x_scaled (float) – the scaled x-value
- t0 (float) – the scaled T_0 factor in polynomial
- a (float) – a factor in polynomial
- b (float) – b factor in polynomial
- c (float) – c factor in polynomial
- p0 (float) – p_0 factor in polynomial
-
schrodinger.application.matsci.uq_utils.
get_hyperbola_fit_property
(x, regression)¶ Return the fit property given the x-value.
Parameters: - x (float) – the x-value
- regression (tuple) – (t0, a_coeff, b_coeff, c_coeff, p0)
Return type: float or None
Returns: the fit property value or None if there isn’t one
-
schrodinger.application.matsci.uq_utils.
get_hyperbola_prop_from_points
(points)¶ Return a hyperbola property using the given points.
Parameters: points (list) – list of (x,y) tuples Return type: float or None Returns: the property or None if there isn’t one
-
class
schrodinger.application.matsci.uq_utils.
BootstrapNoiseHistogramData
¶ Bases:
object
Manage data of a histogram of a quantity derived from a parametric bootstrap analysis of uncorrelated Gaussian white noise.
-
SAMPLE_SIZE
= 1000¶
-
__init__
()¶ Create an instance.
-
setOriginalData
(points)¶ Set the original data used to derive the histogram.
Parameters: points (list) – list of (x,y) tuples
-
setFitFunction
(fit_function)¶ Set the fit function, i.e. the function that was fit to the original data.
Parameters: fit_function (function) – the fit function
-
setXBiasFunction
(x_bias_function=None)¶ Set a biasing function for the original x data.
Parameters: x_bias_function (function or None) – a biasing function for the original x data or None if there isn’t one
-
seedRandom
(seed=None)¶ Seed the random number generator.
Parameters: seed (int or None) – the seed
-
setSampleSize
(size=None)¶ Set the sample size.
Parameters: size (int or None) – the sample size, if None then the default of SAMPLE_SIZE is used
-
setTargetFunction
(target_function)¶ Set the target function, i.e. the function used to obtain the target quantity from points.
Parameters: target_function (function) – the target function
-
getHistogramData
()¶ Return the histogram data which is just a list of sampled target values.
Raises: RuntimeError – if required variables are not defined Return type: list or None Returns: list of sampled target values or None if there isn’t one
-
static
getSampleHistogram
(points, fit_function, target_function, x_bias_function=None, seed=None, size=None)¶ Return a sample of histogram data using the given points, fit function, and target function.
Parameters: - points (list) – list of (x,y) tuples
- fit_function (function) – the fit function
- target_function (function) – the target function
- x_bias_function (function or None) – a biasing function for the original x data or None if there isn’t one
- seed (int or None) – the seed
- size (int or None) – the sample size, if None then the default of SAMPLE_SIZE is used
Return type: list or None
Returns: list of sampled target values or None if there isn’t one
-
static
getNormalParameters
(data)¶ Return the mean, standard deviation, covariance matrix, and figure of merit parameters from a normal fit of the given data.
Parameters: data (list) – contains (x, y) tuples Return type: float, float, numpy.array, float or None, None, None, and None Returns: the mean, standard deviation, covariance matrix, and figure of merit or None, None, None, and None if there aren’t any
-
-
class
schrodinger.application.matsci.uq_utils.
BilinearHistogramData
(invert_y=True)¶ Bases:
schrodinger.application.matsci.uq_utils.BootstrapNoiseHistogramData
Manage a histogram using bilinear data.
-
__init__
(invert_y=True)¶ Create an instance.
Parameters: invert_y (bool) – whether to invert the y-values
-
static
getSampleHistogram
(points, fit_function, target_function, seed=None, size=None, invert_y=True)¶ Return a sample of histogram data using the given points, fit function, and target function.
Parameters: - points (list) – list of (x,y) tuples
- fit_function (function) – the fit function
- target_function (function) – the target function
- seed (int or None) – the seed
- size (int or None) – the sample size, if None then the default of SAMPLE_SIZE is used
- invert_y (bool) – whether to invert the y-values
Return type: list or None
Returns: list of sampled target values or None if there isn’t one
-
SAMPLE_SIZE
= 1000¶
-
getHistogramData
()¶ Return the histogram data which is just a list of sampled target values.
Raises: RuntimeError – if required variables are not defined Return type: list or None Returns: list of sampled target values or None if there isn’t one
-
static
getNormalParameters
(data)¶ Return the mean, standard deviation, covariance matrix, and figure of merit parameters from a normal fit of the given data.
Parameters: data (list) – contains (x, y) tuples Return type: float, float, numpy.array, float or None, None, None, and None Returns: the mean, standard deviation, covariance matrix, and figure of merit or None, None, None, and None if there aren’t any
-
seedRandom
(seed=None)¶ Seed the random number generator.
Parameters: seed (int or None) – the seed
-
setFitFunction
(fit_function)¶ Set the fit function, i.e. the function that was fit to the original data.
Parameters: fit_function (function) – the fit function
-
setOriginalData
(points)¶ Set the original data used to derive the histogram.
Parameters: points (list) – list of (x,y) tuples
-
setSampleSize
(size=None)¶ Set the sample size.
Parameters: size (int or None) – the sample size, if None then the default of SAMPLE_SIZE is used
-
setTargetFunction
(target_function)¶ Set the target function, i.e. the function used to obtain the target quantity from points.
Parameters: target_function (function) – the target function
-
setXBiasFunction
(x_bias_function=None)¶ Set a biasing function for the original x data.
Parameters: x_bias_function (function or None) – a biasing function for the original x data or None if there isn’t one
-
-
class
schrodinger.application.matsci.uq_utils.
HyperbolaHistogramData
¶ Bases:
schrodinger.application.matsci.uq_utils.BootstrapNoiseHistogramData
Manage a histogram using hyperbola data.
-
__init__
()¶ Create an instance.
-
static
getSampleHistogram
(points, fit_function, target_function, seed=None, size=None)¶ Return a sample of histogram data using the given points, fit function, and target function.
Parameters: - points (list) – list of (x,y) tuples
- fit_function (function) – the fit function
- target_function (function) – the target function
- seed (int or None) – the seed
- size (int or None) – the sample size, if None then the default of SAMPLE_SIZE is used
Return type: list or None
Returns: list of sampled target values or None if there isn’t one
-
SAMPLE_SIZE
= 1000¶
-
getHistogramData
()¶ Return the histogram data which is just a list of sampled target values.
Raises: RuntimeError – if required variables are not defined Return type: list or None Returns: list of sampled target values or None if there isn’t one
-
static
getNormalParameters
(data)¶ Return the mean, standard deviation, covariance matrix, and figure of merit parameters from a normal fit of the given data.
Parameters: data (list) – contains (x, y) tuples Return type: float, float, numpy.array, float or None, None, None, and None Returns: the mean, standard deviation, covariance matrix, and figure of merit or None, None, None, and None if there aren’t any
-
seedRandom
(seed=None)¶ Seed the random number generator.
Parameters: seed (int or None) – the seed
-
setFitFunction
(fit_function)¶ Set the fit function, i.e. the function that was fit to the original data.
Parameters: fit_function (function) – the fit function
-
setOriginalData
(points)¶ Set the original data used to derive the histogram.
Parameters: points (list) – list of (x,y) tuples
-
setSampleSize
(size=None)¶ Set the sample size.
Parameters: size (int or None) – the sample size, if None then the default of SAMPLE_SIZE is used
-
setTargetFunction
(target_function)¶ Set the target function, i.e. the function used to obtain the target quantity from points.
Parameters: target_function (function) – the target function
-
setXBiasFunction
(x_bias_function=None)¶ Set a biasing function for the original x data.
Parameters: x_bias_function (function or None) – a biasing function for the original x data or None if there isn’t one
-