Utilities¶
-
maelstrom.utils.
unique_colors
(n, cmap='hls')[source]¶ Calculates n unique colours for plotting in a given colorspace
- Parameters
n (int) – Number of colours required.
cmap (str) – Colormap (either “hls” or “colorblind”)
- phaselist
A list of phases for the given frequencies
-
maelstrom.utils.
amplitude_spectrum
(t, y, fmin=None, fmax=None, oversample_factor=10.0)[source]¶ Calculates the amplitude spectrum of a given signal
- Parameters
t (array) – Time values
y (array) – Flux or magnitude measurements
fmin (float (default None)) – Minimum frequency to calculate spectrum. Defaults to df
fmax (float) – Maximum frequency to calculate spectrum. Defaults to Nyquist.
oversample_factor (float) – Amount by which to oversample the spectrum. Defaults to 10.
-
maelstrom.utils.
dft_phase
(x, y, freq)[source]¶ Discrete fourier transform to calculate the ASTC phase given x, y, and an array of frequencies
- Parameters
x (array) – Array in which to calculate
y (array) –
- phaselist
A list of phases for the given frequencies
-
maelstrom.utils.
mass_function
(period, asini)[source]¶ Calculates the mass function for a given system
- Parameters
period (astropy.units.quantity.Quantity) – Orbital period
asini (astropy.units.quantity.Quantity) – Convolved semi-major axis
- Returns
Mass function in M_sun
- Return type
astropy.units.quantity.Quantity
-
maelstrom.utils.
phase_error
(x, y, freq)[source]¶ Calculates the phase uncertainty on the given frequency
- Parameters
x (array) – Time values
y (rray) – flux values
freq (array) – Frequency values
- Returns
Array of uncertainties for each phase calculated
- Return type
array
-
maelstrom.utils.
smooth
(freq, power, filter_width=2.0)[source]¶ Smooths the input power spectrum with a boxkernel filter
- Parameters
freq (array) – Frequency values
power (array) – Power values
filter_width (float, optional) – Width of the boxkernel. Defaults to 2.
- Returns
Smoothed power values
- Return type
array