This documentation is for astroML version 0.2

This page


astroML Mailing List

GitHub Issue Tracker


Scipy 2012 (15 minute talk)

Scipy 2013 (20 minute talk)


If you use the software, please consider citing astroML. 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


rvs(shape) Draw random variables from the distribution
__init__(func, xmin, xmax, Nx=1000, random_state=None, func_args=None)