py4sci

Previous topic

Hosts

Next topic

PDF

This Page

Parameters

class puq.Parameter(*args, **kargs)

Superclass for all Parameter subclasses. For backwards compatibility it can be called directly and will return the proper subclass.

When the parameter is sampled using one of the PSweep classes (e.g., Monte Carlo), the sample values are available in the values property of the Parameter object.

Parameters:
  • name – Name of the parameter. This should be a short name, like a variable.
  • description – A longer description of the parameter.
  • kargs – Keyword args defined by the distribution.
class puq.CustomParameter(name, description, attrs=None, **kwargs)

Class implementing a Parameter with a Custom distribution.

Parameters:
  • name – Name of the parameter. This should be a short name, like a variable.

  • description – A longer description of the parameter.

  • attrs – a list of tuples (‘attrname’,attrval) which are additional attributes to assign

  • to this parameter.

  • kwargs – Keyword args. Valid args are:

    Arg Description
    pdf PDF or numpy array of samples
    use_samples When using a response surface (RS) to conduct UQ, Use data samples (if available) attached to pdf, as sample points on the RS. For constructing the RS, the samples are fitted using a Gaussian kernel. Puq then samples from the fitted PDF. The fitted pdf can be accessed via the pdf attribute of this class.
    use_samples_val

    if True, the samples provided in pdf will be used as the parameter values when running a UQ method (Monte Carlo, LHS, SimpleSweep only) instead of sampling the PDF fitted from the samples.

    Notes:

    If use_samples_val=True, pdf must be an ExperimentalPDF or a 1D array of samples. If pdf is an ExperimentalPDF , the samples of this CustomParameter are obtained from the ‘data’ attribute of the pdf object.

    Care must be taken to ensure that the samples correspond to the UQ method. E.g., if the UQ method is LHS, the samples must have been previously generated via an LHS algorithm.

    Also the number of samples must equal the number of runs for the UQ method.

    If creating a response surface, setting use_samples_val to True has no effect.

    If all parameters in an analysis have the use_samples_val flag set, it is equivalent to running a SimpleSweep

description = None

Parameter description (same as description from constructor)

name = None

Parameter name (same as name from constructor

pdf = None

The PDF associated with this parameter (same as the pdf kwarg from the constructor)

values = None

A 1D array of parameter values. These are the values used when evaluating the TestProgram

class puq.ExponParameter(name, description, **kwargs)

Class implementing a Parameter with an Exponential distribution.

Parameters:
  • name – Name of the parameter. This should be a short name, like a variable.

  • description – A longer description of the parameter.

  • kwargs – Keyword args. Valid args are:

    Arg Description
    rate The rate parameter. Must be > 0.

See also

ExponPDF

class puq.NormalParameter(name, description, attrs=None, **kwargs)

Class implementing a Parameter with a Normal distribution.

Parameters:
  • name – Name of the parameter. This should be a short name, like a variable.

  • description – A longer description of the parameter.

  • attrs – a list of tuples (‘attrname’,attrval) which are additional attributes to assign

  • to this parameter.

  • kwargs – Keyword args. Valid args are:

    Arg Description
    mean The mean of the distribution
    dev The standard deviation
class puq.RayleighParameter(name, description, **kwargs)

Class implementing a Parameter with a Rayleigh distribution.

Parameters:
  • name – Name of the parameter. This should be a short name, like a variable.

  • description – A longer description of the parameter.

  • kwargs – Keyword args. Valid args are:

    Arg Description
    scale The scale. Must be > 0.

See also

RayleighPDF

class puq.UniformParameter(name, description, attrs=None, **kwargs)

Class implementing a Parameter with a Uniform distribution.

Parameters:
  • name – Name of the parameter. This should be a short name, like a variable.

  • description – A longer description of the parameter.

  • attrs – a list of tuples (‘attrname’,attrval) which are additional attributes to assign

  • to this parameter.

  • kwargs – Keyword args. Valid args are:

    Property Description
    mean The mean of the distribution
    max The maximum
    min The minimum

You must specify two of the above properties. If you give all three, they will be checked for consistency. \(mean = (min + max)/2\)

class puq.WeibullParameter(name, description, **kwargs)

Class implementing a Parameter with a Weibull distribution.

Parameters:
  • name – Name of the parameter. This should be a short name, like a variable.

  • description – A longer description of the parameter.

  • kwargs – Keyword args. Valid args are:

    Arg Description
    shape The shape. Must be > 0.
    scale The scale. Must be > 0.

See also

WeibullPDF

class puq.TriangParameter(name, description, **kwargs)

Class implementing a Parameter with an Triangular distribution.

Parameters:
  • name – Name of the parameter. This should be a short name, like a variable.

  • description – A longer description of the parameter.

  • kwargs – Keyword args. Valid args are:

    Arg Description
    min The minimum value.
    mode The modal value.
    max The maximum value

See also

TrianglePDF

class puq.ConstantParameter(name, description, attrs=None, **kwargs)

Class implementing a Parameter which is a constant. When a variable parameter needs to be treated as a constant, this class can be used as a drop-in replacement for any of the other Parameter classes.

Parameters:
  • name – Name of the parameter. This should be a short name, like a variable.

  • description – A longer description of the parameter.

  • attrs – a list of tuples (‘attrname’,attrval) which are additional attributes to assign

  • to this parameter.

  • kwargs – Keyword args. Valid args are:

    Property Description
    value The constant value