hyperspy.misc.math_tools module
- hyperspy.misc.math_tools.anyfloatin(things)
Check if iterable contains any non integer.
- hyperspy.misc.math_tools.check_random_state(seed, lazy=False)
Turn a random seed into a np.random.RandomState instance.
- Parameters
seed (None or int or np.random.RandomState or dask.array.random.RandomState) –
- If None:
Return the RandomState singleton used by np.random or dask.array.random
- If int:
Return a new RandomState instance seeded with
seed
.- If np.random.RandomState:
Return it.
- If dask.array.random.RandomState:
Return it.
lazy (bool, default False) – If True, and seed is
None
orint
, return a dask.array.random.RandomState instance instead.
- hyperspy.misc.math_tools.get_linear_interpolation(p1, p2, x)
Given two points in 2D returns y for a given x for y = ax + b
- hyperspy.misc.math_tools.hann_window_nth_order(m, order)
Calculates 1D Hann window of nth order
- hyperspy.misc.math_tools.isfloat(number)
Check if a number or array is of float type.
This is necessary because e.g. isinstance(np.float32(2), float) is False.
- hyperspy.misc.math_tools.optimal_fft_size(target, real=False)
Wrapper around scipy function next_fast_len() for calculating optimal FFT padding.
scipy.fft was only added in 1.4.0, so we fall back to scipy.fftpack if it is not available. The main difference is that next_fast_len() does not take a second argument in the older implementation.
- hyperspy.misc.math_tools.order_of_magnitude(number)
Order of magnitude of the given number
- Parameters
number (float) –
- Returns
- Return type
Float
- hyperspy.misc.math_tools.outer_nd(*vec)
Calculates outer product of n vectors
- Parameters
vec (vector) –
- Returns
out
- Return type
ndarray