This documentation is for astroML version 0.2

This page

Links

astroML Mailing List

GitHub Issue Tracker

Videos

Scipy 2012 (15 minute talk)

Scipy 2013 (20 minute talk)

Citing

If you use the software, please consider citing astroML.

11.2.2.5. astroML.density_estimation.FunctionDistribution

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

Generate random variables distributed according to an arbitrary function

Parameters :

func : function

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

xmin : float

minimum value of interest

xmax : float

maximum value of interest

Nx : int (optional)

number of samples to draw. Default is 1000

random_state : None, int, or np.random.RandomState instance

random seed or random number generator

func_args : dictionary (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)