python_utils#
Back to API tree index
Purpose#
Numeric and Python utility helpers shared across modules.
Module summary#
No module-level description available.
Function |
Summary |
|---|---|
return c1 \* np.conjugate(c2) with numba vectorization |
|
x.real^2 + x.imag^2 |
|
sum x.real^2 + x.imag^2 along last axis |
|
No docstring summary available. |
|
get axis=-1 (innermost \`column’) index of max in arr |
|
get unraveled (tuple) index of maximal element in arr |
|
recursive x == y that handles ragged mixed-type containers |
|
get n samples from log-uniform distribution between vmin and vmax |
|
formatting number as string |
|
Avoid annoying errors due to loading matplotlib on the server |
|
return dictionary with inverted key-value pairs |
|
check if type(x) is one of numpy’s float types |
|
check if type(x) is one of numpy’s integer types |
|
load python module by name (string) |
|
load n x n symmetric matrix from 1d array formatted as in store_symmetric_matrix() |
|
merge multiple dictionaries into one, accepting repeated keys if values are consistent, otherwise raise ValueError |
|
get next power of 2 following n |
|
ASSUMES nfft even <=> len(rfft_arr) odd |
|
ASSUMES nfft even <=> rfftlen odd |
|
append columns to array from .npy file at path infile if outfile_new given, write the result there; otherwise rewrite infile_npy with appended columns |
|
append rows to array from .npy file at path infile if outfile_new given, write the result there; otherwise rewrite infile_npy with appended rows |
|
wrapper for np.array2string printing |
|
get nangles (int or tuple) samples ~ U(0, 2\*np.pi) |
|
get nangles (int or tuple) samples ~ U(-1, 1) |
|
get nangles (int or tuple) samples ~ np.arccos(U(-1, 1)) |
|
ASSUMES nfft even <=> len(rfft_arr) odd |
|
store n x n symmetric matrix as 1d array of length n\*(n+1)/2 |
|
back taper of tukey window (last half of hann) |
|
taper_width is frequency interval length in Hz to be tapered at each end f_nyq & rfft_len are the nyquist frequency and length of the rfftfreq array |
|
front taper of tukey window (first half of hann) |
|
get tukey window based on numbers of total and windowed points |
|
pad arr axis=-1 with zeros at (right/back) end to length pad_to_N if arr.shape[-1] < pad_to_N, raise ValueError |
|
O(10^3)x faster np.array([row for row in np.broadcast(\*args)]) usable when args are all at most 1d. |
No public classes were found.