Spectrum#
- class morse.Spectrum#
Class to represent frequency data either extracted from the oscillation spectrum of a star or generated using the equation of the traditional approximation of rotation in its asymptotic formulation.
- path#
Path to the file containing the frequency data.
- Type:
str
- freqs#
Frequencies (in µHz).
- Type:
np.array
- periods#
Periods (in d).
- Type:
np.array
- errs#
Errors on frequencies (in µHz).
- Type:
np.array
- amps#
Amplitudes.
- Type:
np.array
- m#
Azimutal order.
- Type:
int
- k#
Ordering index (Lee & Saio 97).
- Type:
int
- nurot#
Rotation frequency (in µHz).
- Type:
float
- buoy_r#
Buoyancy radius (in s).
- Type:
float
- offset#
Offset.
- Type:
float
- n#
Radial orders.
- Type:
np.array
- periods_co#
Periods in the co-rotating frame (in d).
- Type:
np.array
- cluster(eps, min_samples)#
Automatically detects frequency groups using the scikit-learn DBSCAN clustering algorithm.
- Parameters:
eps (float) – Maximum distance between two peak frequencies for one to be considered in the neighbourhood of the other.
min_samples (int) – Minimum number of peak frequencies in a neighbourhood for a given peak frequency to be considered as a core point (including the frequency peak considered).
- Returns:
Array of Spectrum objects representing the frequency groups detected by the clustering algorithm. They are ordered by increasing frequency.
- Return type:
frequency_groups (np.array)
- filter(ampmin=0, ampmax=inf, freqmin=0, freqmax=inf, periodmin=0, periodmax=inf, nmin=0, nmax=inf, boolean=None)#
Filters the spectrum according to the period/frequency/amplitude of the modes or in an arbitrary way.
Only modes that satify all conditions are kept (logical and).
- Parameters:
ampmin (float) – Minimum amplitude.
ampmax (float) – Maximum amplitude.
freqmin (float) – Minimum mode frequency.
freqmax (float) – Maximum mode frequency.
periodmin (float) – Minimum mode period.
periodmax (float) – Maximum mode period.
nmin (int) – Minimum radial order.
nmax (int) – Maximum radial order.
boolean (np.array) – Custom mask.
- Returns:
The filtered spectrum.
- Return type:
- generate(m, k, nurot, buoy_r, offset=0.0, nmin=1, nmax=90)#
Generates synthetic frequency data using the asymptotic formulation of the traditional approximation of rotation (TAR).
- Parameters:
m (int) – Azimuthal order.
k (int) – Ordering index (Lee & Saio 97).
nurot (float) – Rotation frequency (in µHz).
buoy_r (float) – Buoyancy radius (in s).
offset (float) – Offset.
nmin (int) – Minimum radial order.
nmax (int) – Maximum radial order.
- load(path, colfreqs=0, colerrs=-1, colamps=-1)#
Loads frequency data from a file.
The file must contain the mode frequencies in µHz at the very least. Peak amplitudes and errors on frequencies may also be loaded. By default, only frequencies are loaded.
- Parameters:
path (str) – Path to the file containing the frequency data.
colfreqs (int) – Column number of frequencies.
colerrs (int) – Column number of frequency errors.
colamps (int) – Column number of mode amplitudes.
- match(model, tolerance=0.0005, max_miss=5)#
Finds common modes with a reference spectrum.
- plot()#
Plots the oscillation spectrum.