enterprise.signals package¶
Submodules¶
enterprise.signals.deterministic_signals module¶
enterprise.signals.gp_signals module¶
enterprise.signals.parameter module¶
Contains parameter types for use in enterprise Signal classes.
-
class
enterprise.signals.parameter.ConstantParameter(name)[source]¶ Bases:
objectConstant Parameter base class.
-
value¶
-
-
enterprise.signals.parameter.LinearExp(pmin, pmax, size=None)[source]¶ Class factory for LinearExp parameters (with pdf(x) ~ 10^x).
-
enterprise.signals.parameter.LinearExpPrior(value, pmin, pmax)[source]¶ Prior function for LinearExp parameters.
-
enterprise.signals.parameter.LinearExpSampler(pmin, pmax, size)[source]¶ Sampling function for LinearExp parameters.
-
enterprise.signals.parameter.Normal(mu=0, sigma=1, size=None)[source]¶ Class factory for Normal parameters.
-
enterprise.signals.parameter.NormalPrior(value, mu, sigma)[source]¶ Prior function for Normal parameters. Note that sigma can be a scalar for a 1-d distribution, a vector for multivariate distribution that uses the vector as the sqrt of the diagonal of the covaraince matrix, or a matrix which is the covariance.
-
enterprise.signals.parameter.NormalSampler(mu, sigma, size=None)[source]¶ Sampling function for Normal parameters.
-
enterprise.signals.parameter.Uniform(pmin, pmax, size=None)[source]¶ Class factory for Uniform parameters.
-
enterprise.signals.parameter.UniformPrior(value, pmin, pmax)[source]¶ Prior function for Uniform parameters.
-
enterprise.signals.parameter.UniformSampler(pmin, pmax, size=None)[source]¶ Sampling function for Uniform parameters.
-
enterprise.signals.parameter.UserParameter(prior, sampler=None, size=None)[source]¶ Class factory for UserParameter, with prior given as an Enterprise Function (one argument, the value; arbitrary keyword arguments, which become hyperparameters). Optionally, sampler can be given as a regular (not Enterprise function), taking the same keyword parameters as prior.
enterprise.signals.prior module¶
Defines classes used for evaluation of prior probabilities. Currently this is only capable of handling independent 1D priors on each parameter. We may want to include joint ND prior distributions for collections of correlated parameters…
-
class
enterprise.signals.prior.Prior(rv)[source]¶ Bases:
objectA class for Priors. A Prior object can return the probability density using the
pdf()andlogpdf()methods. These may take scalars or numpy arrays as arguments.Note that Prior instances contain only the
pdf()andlogpdf()methods. They do not retain all of the originalrv_continuousmethods and attributes.Parameters: rv – rv_frozen Private member that holds an instance of rv_frozen used to define the prior distribution. It must be a ‘frozen distribution’, with all shape parameters (i.e. a, b, loc, scale) set. For more info see rv_continuous. For a list of functions suitable for use see continuous-distributions.
Examples: # A half-bounded uniform prior on Agw, ensuring Agw >= 0. model.Agw.prior = Prior(UniformUnnormedRV(lower=0.)) # A normalized uniform prior on Agw in [10^-18, 10^-12] model.Agw.prior = Prior(UniformBoundedRV(1.0e-18, 1.0e-12)) # A Gaussian prior for gamma = 13/3 +/- 2/3 mean, std = 13./3., 2./3. model.gamma.prior = Prior(scipy.stats.norm(loc=mean, scale=std)) # A bounded Gaussian prior to ensure that eccentrity is in [0, 1] mean, std, low, up = 0.9, 0.1, 0.0, 1.0 model.ecc.prior = Prior(GaussianBoundedRV(loc=mean, scale=std, lower=low, upper=up))
-
logpdf(value)[source]¶ Return the logarithm of probability distribution function at a specified value.
Parameters: value (float) – Input value of parameter. Returns: log-pdf at input value.
-
pdf(value)[source]¶ Return the probability distribution function at a specified value.
Parameters: value (float) – Input value of parameter. Returns: pdf at input value.
-
sample(size=1, random_state=None)[source]¶ Return a sample from probability distribution function. This calls the rvs method of the underlying rv_continuous class.
Parameters: size (int or tuple of ints) – Defining number of random variates (default is 1). Random_state: If int or RandomState, use it for drawing the random variates. If None, rely on self.random_state. Default is None. Returns: random variate of size Return type: ndarray or float
-
-
enterprise.signals.prior.GaussianBoundedRV(loc=0.0, scale=1.0, lower=0.0, upper=1.0)[source]¶ A Gaussian prior between two finite bounds. This is a convenience function with more natural bound parameters than
scipy.stats.truncnorm.Parameters: - loc (float) – location parameter, mean of distribution
- scale (float) – standard deviation of distribution
- lower (float) – lower bound of parameter range
- upper (float) – upper bound of parameter range
Returns: a frozen rv_continuous instance with normalized Gaussian probability truncated to the range [lower, upper] and 0 outside
-
enterprise.signals.prior.LinearExpRV(lower=0, upper=1)[source]¶ A prior proportional to 10^x with lower and upper bounds.
-
enterprise.signals.prior.UniformBoundedRV(lower=0.0, upper=1.0)[source]¶ A uniform prior between two finite bounds. This is a convenience function with more natural bound parameters than
scipy.stats.uniform.Parameters: - lower (float) – lower bound of parameter range
- upper (float) – upper bound of parameter range
Returns: a frozen rv_continuous instance with normalized uniform probability inside the range [lower, upper] and 0 outside
-
enterprise.signals.prior.UniformUnnormedRV(lower=-inf, upper=inf)[source]¶ An unnormalized uniform prior suitable for unbounded or half-bounded intervals.
Parameters: - lower (float) – lower bound of parameter range
- upper (float) – upper bound of parameter range
Returns: a frozen rv_continuous instance with pdf equal to unity in the allowed interval and 0 elsewhere
enterprise.signals.selections module¶
Contains various selection functions to mask parameters by backend flags, time-intervals, etc.
-
enterprise.signals.selections.by_backend(backend_flags)[source]¶ Selection function to split by backend flags.