Conditional distributions
this patch implements a scheme to support general conditional distributions within EventGenerators. The main changes are as follows
eventgen/distributions.py
- added
_required
attribute to allSamplingDistribution
s - added logic to explicitly check whether the appropriate number of arguments have been passed to
rvs
,pdf
,jacobian
, andhessian
by comparing them to_variates
and_required
as necessary.- this includes delegating to separate processes for each child after checking, called
_rvs
,_pdf
,_jacobian
, and_hessian
. Child processes overwrite the_*
methods instead of the*
method so that the checks still work when users call the*
method. -
Note, I decided to not use generators here because they required a lot of extra work to get class attributes into them because
self
is not defined at compilation time and class inheritance was doing funny things with variable scopes.
- this includes delegating to separate processes for each child after checking, called
- added
ParetoFlatComponentMassConditionedOnRedshift
, which is the first instance of a conditioned distribution
eventgen/generators.py
- changed instantiation to always run thru
append_generator
,append_transform
, andappend_conditional
so that any sanity checks defined in those methods are used at instantiation time. - added properties to get the generators, transforms, and conditionals
- added logic to check whether all the a generator or transform will produce a variate that will already be produced and whether they require a variate that has not been produced within
append_*
methods. In either case, anAssertionError
will be raised. - added logic to pass both the variates and required attributes from each event to the generators and transforms within
EventGenerator.generate_events
andEventGenerator.pdf
- cleaned up a bunch of the instantation logic within
MonteCarloIntegrator
because it is now handled withinEventGenerator.append_*
. We still check that all required variates will be generated for each event, though.
eventgen/transforms.py
- changed the variable name from
_generates
to_variates
to match the nomenclature
Edited by Reed Essick