pymecht.RandomParameters module
- class pymecht.RandomParameters.Parameter(low, high, value, rtype)[source]
Bases:
objectData structure to store a random parameter.
- class pymecht.RandomParameters.RandomParameters(params)[source]
Bases:
objectA class to generate random parameters from sample parameters
- Parameters:
params (ParamDict) – A dictionary of parameters (e.g., obtained from sample.parameters)
- sample(N=1, sample_type=None)[source]
Returns a list of N samples of the parameters
- Parameters:
N (int) – Number of samples to be generated
sample_type (str) –
Type of sampling to be performed. Options are
None (default)
’lhcube’ for Latin-Hypercube sampling
’sobol’ for Sobol sequence sampling
If None, random sampling is performed.
- Returns:
A list of N dictionaries with random values of the parameters
- Return type:
list
- fix(keys, x=None)[source]
Fix the parameters to the value x
- Parameters:
keys (str or list of str) – The keys of the parameters to be fixed
x (float or list of float) – The value to which the parameters are fixed
- Return type:
None
- make_normal(key, x=None)[source]
Make the parameter normal with mean x
- Parameters:
key (str) – The key of the parameter to be made normal
x (float) – The mean of the normal distribution
- Return type:
None
- make_lognormal(key, x=None)[source]
Make the parameter lognormal with mean x
- Parameters:
key (str) – The key of the parameter to be made lognormal
x (float) – The mean of the lognormal distribution
- Return type:
None
- add(key, value, low, high, rtype)[source]
Add a new parameter
- Parameters:
key (str) – The key of the parameter
value (float) – The default value of the parameter
low (float) – The lower bound of the parameter
high (float) – The upper bound of the parameter
rtype (str) – The type of the parameter. Options are ‘fixed’, ‘uniform’, ‘normal’, and ‘lognormal’
- Return type:
None