11.2.2.4. astroML.density_estimation.FunctionDistribution

class astroML.density_estimation.FunctionDistribution(func, xmin, xmax, Nx=1000, random_state=None, func_args=None)[source]

Generate random variables distributed according to an arbitrary function

Parameters
funcfunction

func should take an array of x values, and return an array proportional to the probability density at each value

xminfloat

minimum value of interest

xmaxfloat

maximum value of interest

Nxint (optional)

number of samples to draw. Default is 1000

random_stateNone, int, or np.random.RandomState instance

random seed or random number generator

func_argsdictionary (optional)

additional keyword arguments to be passed to func

Methods

rvs(shape)

Draw random variables from the distribution

__init__(func, xmin, xmax, Nx=1000, random_state=None, func_args=None)[source]

Initialize self. See help(type(self)) for accurate signature.