ism3d.maths.stats.cdf2rv

ism3d.maths.stats.cdf2rv(x, cdf, size=100000, seed=None)[source]

**** only here for backward compaibility *

Generate a pseudo-random random variable set following a target distribution described by the CDF, using the inverse transform / pesudo-random number sampling method

The input CDF is presumed to be sorted already with mono increasing trend.

The result should stay within the range of cdf_x

this is for backward compaibility make sure

x[0] cdf=0 x[-1] cdf=1

icdf=interpolate.interp1d(y_cdf,x,kind=’linear’) # icdf: inverse cumulative distribution function # a.k.a Percent point function (inverse of cdf) # https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.rv_continuous.html#scipy.stats.rv_continuous # It seems that scipy.interpolate mess up units when x.type is QUANTITY return icdf(pick)