otaf.distribution package
Module contents
- otaf.distribution.compute_sup_inf_distributions(distributions, x_min=-10, x_max=10, n_points=10000)[source]
Compute the supremum (sup) and infimum (inf) CDFs for a list of distributions.
This function evaluates the Cumulative Distribution Functions (CDFs) at n_points evenly spaced points between x_min and x_max for a given list of distributions. It then computes the pointwise supremum and infimum of the CDFs across the distributions at each of these points.
Parameters:
- distributionslist
A list of objects where each object has a computeCDF(x) method to evaluate the CDF at a point x.
- x_minfloat
The lower bound of the x values over which the CDFs are evaluated.
- x_maxfloat
The upper bound of the x values over which the CDFs are evaluated.
- n_pointsint, optional
The number of points at which the CDFs are evaluated between x_min and x_max. Default is 10,000.
Returns:
: sup_data : np.ndarray
A 2D array with shape (n_points, 2), where the first column is the x values and the second column contains the pointwise supremum of the CDFs at each x.
- inf_datanp.ndarray
A 2D array with shape (n_points, 2), where the first column is the x values and the second column contains the pointwise infimum of the CDFs at each x.
Generate bivariate correlated samples.
- otaf.distribution.get_composed_normal_defect_distribution(defect_names, mu_list=[], sigma_list=[], mu_dict={}, sigma_dict={})[source]
Create a composed distribution of defects based on their names and associated standard deviations.
- Parameters:
defect_names (list) – A list of defect variable names (symbols).
mu_list (list, optional) – List of means for each defect. If not provided, defaults to 0.0 for all defects.
sigma_list (list, optional) – List of standard deviations for each defect. If not provided, defaults to 1.0 for all defects.
mu_dict (dict, optional) – Dictionary mapping defect names to their mean values.
sigma_dict (dict, optional) – Dictionary mapping defect names to their standard deviation values.
- Returns:
A composed distribution object.
- Return type:
ot.ComposedDistribution
Notes
- The defect names are expected to have specific prefixes to identify their type:
u_
for translation along the x-axisv_
for translation along the y-axisw_
for translation along the z-axisalpha_
for rotation around the x-axisbeta_
for rotation around the y-axisgamma_
for rotation around the z-axis
This has to be reflected in the mu_dict/sigma_dict if provided, e.g.,
sigma_dict = {'u':1.0}
.
- otaf.distribution.get_means_standards_composed_distribution(composed_distribution)[source]
Extracts the means and standard deviations from the composed distribution. Assumes all distributions are normal (mean/std).
- Parameters:
composed_distribution – The composed distribution of normal distributions.
- Returns:
A list of the means of the distributions. stds: A list of the standard deviations of the distributions.
- Return type:
means
- otaf.distribution.get_prob_below_threshold(data_inf_sup, threshold=0)[source]
Get the probability of the gap statistic being below a specified threshold.
This function finds the element in the array data_inf_sup where the absolute value of the difference between the first column and the threshold is the smallest, and then returns the corresponding value from the second column.
Parameters: data_inf_sup : numpy array
Array where the first column contains gap values and the second column contains probabilities.
- thresholdfloat, optional
The threshold to check against (default is 0).
Returns: float
The probability corresponding to the gap closest to the threshold.
- otaf.distribution.multiply_composed_distribution_standard_with_constants(composed_distribution, constants)[source]
Multiply the standard deviations of each sub-distribution by corresponding constants.
This function assumes each sub-distribution is a Normal distribution, where each distribution’s parameters are in the form [mean, std, mean, std, …].
- Parameters:
composed_distribution (ot.ComposedDistribution) – The original composed distribution.
constants (list[float]) – A list of constants to multiply each distribution’s standard deviation.
- Returns:
A copy of the original composed distribution, with updated standard deviations.
- Return type:
ot.ComposedDistribution
- otaf.distribution.multiply_composed_distribution_with_constant(composed_distribution, constant)[source]
Multiply all parameters in a ComposedDistribution by a constant.
- Parameters:
composed_distribution (ot.ComposedDistribution) – The original composed distribution.
constant (float) – The constant value by which to multiply all parameters.
- Returns:
A copy of the original composed distribution, with its parameters scaled by the given constant.
- Return type:
ot.ComposedDistribution