Welcome to mathMB’s documentation¶
mathMB provides mathematical functions designed to be used by nexoclom, although they can be used as stand-alone routines.
interpu¶
interpu()
: 1D linear interpolation using astropy quantities.
This is a wrapper for numpy.interp for use when using astropy quantities. If x and xp have different units, xp is converted to the units of x before interpolation. An exception is raised if the units are not compatible (i.e., the units of xp cannot be converted to the units of x).
- Author
Matthew Burger
-
mathMB.interpu.
interpu
(x, xp, fp, **kwargs)[source]¶ Return one dimensional interpolated astropy quantities.
Parameters
- x
The x-coordinates at which to evaluate the interpolated values
- xp
The x-coordinates of the data points.
- fp
The y-coordinates of the data points
Notes
x and xp must have compatible units. See numpy.interp for details on interpolation.
minmaxmean¶
minmaxmean()
: Print np.min(), np.max(), np.mean() at once.
randomdeviates¶
Compute random deviates from arbitrary 1D and 2D distributions.
-
mathMB.randomdeviates.
random_deviates_1d
(x, f_x, num)[source]¶ Compute random deviates from arbitrary 1D distribution.
f_x does not need to integrate to 1. The function nomralizes the distribution. Uses Transformation method (Numerical Recepies, 7.3.2)
Parameters
- x
The x values of the distribution
- f_x
The relative probability of the value being in x and x+dx
- num
The number of random deviates to compute
Returns
numpy array of length num chosen from the distribution f_x.
- Authors
Matthew Burger
- License
LICENSE