Model Parameters¶
-
class
pyfuse.ModPar(name, minval, maxval, optguess, pardistribution, *kargs)[source]¶ Model Parameter class
The parameter is defined by his distribution, boundaries and optimal guess
Parameters: name : string
Name of the parameter
minval : float
Minimum value of the parameter distribution
maxval : float
Maximum value of the parameter distribution
optguess : float
Optimal guess of the parameter, must be between min and max value
pardistribution : string
choose a distributionfrom: randomUniform, randomTriangular, randomTrapezoidal, randomNormal, randomLogNormal
*kargs :
Extra arguments necessaty for the chosen distribution
Examples
>>> import pyFUSE as pf >>> par1=pf.ModPar('parameter1',0.0,3.0,2.5,'randomUniform') >>> par1.aValue() >>> 2.20263437200365 #random >>> par1.optguess >>> 2.5 >>> par1.pardistribution >>> 'randomUniform
-
LatinH(nruns)[source]¶ Return a sample of nMC samples from the par distribution with Latin Hypercube sampling (always randomUniform)
Parameters: nruns: int
number of Latin HYpercube samples to take
-
MCSample(nruns)[source]¶ Give a sample of nMC samples from the par distribution
Parameters: nruns: int
number of Monte Carlo samples to take
Returns: mcsample: array
numpy array with the specified number of Monte Carlo samples
-
ahist(nruns, nbins=30, saveit='show', *args, **kwargs)[source]¶ Returns a histogram from the current parameter distribution
Parameters: nruns: int
number of Monte Carlo samples
nbins: int
number of bins to use in the histogram
saveit; ‘show’ or True
if True, figure is saved, otherwise the picture is shown
*args:
matplotlib histogram keyword arguments
**kwargs:
kwargs are used to update the properties of the class:~matplotlib.patches.Patch instances returned by hist
Returns: fig:
figure with the histogram
-
-
pyfuse.reScale(arr, vmin, vmax)[source]¶ Rescale the sampled values between 0 and 1 towards the real boundaries of the pars
Parameters: arr: array
array of the sampled values
vmin: float
minimal value to rescale to
vmax: float
maximum value to rescale to
-
pyfuse.Sobol(ParsIn, nruns, seed=1)[source]¶ Return a sobol sampling of the parameter space; Sobol is always performed on the entire set of parameters used in the analysis.
Parameters: ParsIn: list of ModPar instances
List with all the parameters to sample from
nruns: int
number of samples
seed: int
seed to start from, change this when performing multiple samples or to make sure the values are continued by using the last seed
Returns: Pars: narray
2D array with the rows the different runs and the pars in the columns