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: object

Constant Parameter base class.

value
class enterprise.signals.parameter.Parameter(name)[source]

Bases: object

get_logpdf(value=None, **kwargs)[source]
get_pdf(value=None, **kwargs)[source]
sample(**kwargs)[source]
params
size
enterprise.signals.parameter.Constant(val=None)[source]
enterprise.signals.parameter.Function(func, name=u'', **func_kwargs)[source]
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.parameter.function(func)[source]

Decorator for Function.

enterprise.signals.parameter.get_funcargs(func)[source]

Convenience function to get args and kwargs of any function.

enterprise.signals.parameter.sample(parlist)[source]

Sample a list of Parameters consistently (i.e., keeping track of hyperparameters).

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: object

A class for Priors. A Prior object can return the probability density using the pdf() and logpdf() methods. These may take scalars or numpy arrays as arguments.

Note that Prior instances contain only the pdf() and logpdf() methods. They do not retain all of the original rv_continuous methods 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.Selection(func)[source]

Class factory for TOA selection.

enterprise.signals.selections.by_backend(backend_flags)[source]

Selection function to split by backend flags.

enterprise.signals.selections.call_me_maybe(obj)[source]

See here for description.

enterprise.signals.selections.cut_half(toas)[source]

Selection function to split by data segment

enterprise.signals.selections.nanograv_backends(backend_flags)[source]

Selection function to split by NANOGRav backend flags only.

enterprise.signals.selections.no_selection(toas)[source]

Default selection with no splitting.

enterprise.signals.selections.selection_func(func)[source]

enterprise.signals.signal_base module

enterprise.signals.utils module

enterprise.signals.white_signals module