Function.init (function)
def __init__(self, func, args, kwargs, vectorized=True, hist_samples=None, unit=None, label=None, label_latex=None, wrap_at=None, uniqueid=None)
Create a Function distribution from two other distributions.
Arguments
func
: callable function that accepts args and kwargs (as floats, after being sampled from any distribution objects)args
(list of distribution objects or floats): distribution objects or floats to pass as args tofunc
. Any items that are Distribution objects will be sampled and passed as floats.kwargs
(dictionary of distribution objects or floats): distribution objects or floats to pass as kwargs tofunc
. Any items that are Distribution objects will be sampled and passed as floats.vectorized
(bool, optional, default=True): whetherfunc
supports passing arrays toargs
andkwargs
.hist_samples
(int, optional, default=None): number of samples to draw when generating the underlying Histogram distribution used for all probability calls. If not provided or None, this will default to 1e6 ifvectorized
or 1e5 if not. Iffunc
takes a long time or many samples in Function.sample are rejected and have to be re-drawn, it may be necessary to lowerhist_samples
.unit
(astropy.units object, optional): the units returned byfunc
. Note that any Distribution objects inargs
andkwargs
should be in the appropriate units (as the inputs and outputs tofunc
are floats and not quantities)label
(string, optional): a label for the distribution. This is used for the x-label while plotting the distribution iflabel_latex
is not provided, as well as a shorthand notation when creating a Composite distribution.label_latex
(string, optional): a latex label for the distribution. This is used for the x-label while plotting.wrap_at
(float, None, or False, optional, default=None): value to use for wrapping. If None andunit
are angles, will default to 2*pi (or 360 degrees). If None andunit
are cycles, will default to 1.0.
Returns
- a Function object.