pygcam.mcs.distro
¶
API¶
This module is based on code originally developed by Sam Fendell.
-
class
pygcam.mcs.distro.
DistroGen
(distName, func)¶ Stores information required to generate a Distro instance from an argDict
-
classmethod
genDistros
()¶ Generate a basic set of distributions
-
makeRV
(argDict)¶ Call the generator function with an argDict to create a frozen RV
-
classmethod
signature
(distName, keywords)¶ Makes a unique signature for a distribution type out of its name and a collection of argument names.
-
classmethod
-
class
pygcam.mcs.distro.
Empirical
(values)¶ Create an empirical distribution and ppf from an array of observations.
-
class
pygcam.mcs.distro.
GridRV
(min, max, count)¶ Return an object that behaves like an RV in that it returns N values when when requested via the ppf (percent point function), though the N values are merely a shuffled sequence of a “gridded” range repeated to produce N values. No other methods of the standard RV class are implemented. This is intended for use in CoreMCS and derivatives only.
-
ppf
(q)¶ Return ‘n’ values from this object’s list of values, repeating those values as many times as necessary to produce ‘n’ values, where ‘n’ is the length of the percentile list given by ‘q’. (We ignore the values, though.)
-
-
class
pygcam.mcs.distro.
constant
(value)¶ Return an object that produces an array holding the given constant value. Useful for forcing a parameter to a given value.
-
pygcam.mcs.distro.
logfactor
(factor)¶ Define a lognormal distribution assuming the 2.5% and 97.5% values are 1/factor and factor, respectively.
-
pygcam.mcs.distro.
lognormalRv
(logMean, logStd)¶ Define a lognormal RV by its own mean and stdev
-
pygcam.mcs.distro.
lognormalRvFor95th
(lo, hi)¶ Define a lognormal RV by its 95% CI.
-
pygcam.mcs.distro.
lognormalRvForIQR
(q1, q3)¶ Define a lognormal RV by its Q1 and Q3 values
-
pygcam.mcs.distro.
lognormalRvForNormal
(mu, sigma)¶ Define a lognormal RV by the mean and stdev of the underlying Normal distribution
-
pygcam.mcs.distro.
makeDistroKey
(name, dimensions, dropZeros=False)¶ Generate a dictionary key for the variable and a list of dimension indices. This is a normal function because it is used by both the MatrixRV and ParameterSet classes. Inverse of parseDistroKey.
-
pygcam.mcs.distro.
parseDistroKey
(key)¶ Gets the name and list of dimensions from a distro key. Inverse of makeDistroKey
-
class
pygcam.mcs.distro.
sequence
(values)¶ Return an object that produces an array holding the given sequence of constant values. Useful for forcing parameters to given values.