sample_distribution_func#

atompy.sample_distribution_func(f, size, xlimits, ylimits, rng, *args, **kwargs)[source]#

Sample a distribution described by f.

Parameters:
fCallable

Function which shape the distribution should follow. Call signature is f(x, *args, **kwargs).

sizeint

Size of the distribution.

xlimitstuple[int, int]

Lower and upper limits in-between which to sample the distribution.

ylimitstuple[int, int] or "auto"

Maximum and minimum value of f(x). Return should be larger zero in-between xlimits.

If "auto", calculate 100 steps of f(x), where xlimits[0] <= x < xlimits[1] and set ylimtis = (0.0, max(f(x))).

Returns:
samplendarray, shape(size,)

A sample ranging from xlimits[0] to xlimits[1] with a distribution corresponding to f.

Other Parameters:
*args

Additional positional arguements of f.

**kwargs

Additional keyword arguments of f.

Notes

See also Sample a random distribution.