The psd module#
- apollinaire.psd.series_to_psd(series, dt, correct_dc=True)#
Take a timeseries and compute its PSD
- Parameters:
series (ndarray) – input timeseries.
dt (float) – sampling of the timeseries, in seconds.
correct_dc (bool) – if set to True, will compute the duty_cycle to adjust the psd values. Optional, default False.
- Returns:
frequency and psd array. The frequency units are in
Hz
and the PSD inseries_units**2/Hz
. Note that theapollinaire.peakbagging
submodule works with frequency inmuHz
and PSD inppm**2/muH
(or(m/s)**2/muHz
for radial velocity PSD), frequency array and PSD should therefore be normalised accordingly before using the peakbagging functions.- Return type:
tuple of ndarray
- apollinaire.psd.echelle_diagram(freq, PSD, dnu, twice=False, fig=None, index=111, figsize=(16, 16), title=None, smooth=10, cmap='cividis', cmap_scale='linear', mode_freq=None, mode_freq_err=None, vmin=None, vmax=None, scatter_color='white', fmt='+', ylim=None, shading='gouraud', mfc='none', ms=20, index_offset=None, mec=None, xlabel=None, ylabel=None, **kwargs)#
Build the echelle diagram of a given PSD.
- Parameters:
freq (ndarray) – input vector of frequencies.
PSD (ndarray) – input vector of power. Must be of same size than freq.
dnu (float) – the large frequency separation use to cut slices into the diagram.
twice (bool) – slice using 2 x dnu instead of dnu, default False.
fig (matplotlib Figure) – figure on which the echelle diagram will be plotted. If
None
, a new figure instance will be created. Optional, defaultNone
.index (int) – position of the echelle diagram Axe in the figure. Optional, default
111
.figsize (tuple) – size of the echelle diagram to plot.
title (str) – title of the figure. Optional, default
(16, 16)
smooth (int) – size of the rolling window used to smooth the PSD. Default 10.
cmap (str) – select one available color map provided by matplotlib, default
cividis
cmap_scale (str) – scale use for the colormap. Can be ‘linear’ or ‘logarithmic’. Optional, default ‘linear’.
mode_freq (ndarray or tuple of array) – frequency array of the modes to represent on the diagram. It can be single array or a tuple of array.
mode_freq_err (ndarray or tuple of array) – frequency uncertainty of the modes to represent on the diagram. It can be a single array or a tuple of array.
vmin (float) – minimum value for the colormap.
vmax (float) – maximum value for the colormap.
scatter_color (str) – color of the scatter point of the mode frequencies. Optional, default
white
.fmt (str or tuple) – the format of the errorbar to plot. Can be a single string or a tuple of string with the same dimension that
mode_freq
.ylim (tuple) – the y-bounds of the echelle diagram.
mew (float) – marker edge width. Optional, default 1.
markersize (float) – size of the markers used for the errorbar plot. Optional, default 10.
capsize (float) – length of the error bar caps. Optional, default 2.
- Returns:
the matplotlib Figure with the echelle diagram.
- Return type:
matplotlib Figure
- apollinaire.psd.tf(series, dt)#
Take a timeseries and compute its properly normalised Fourier transform.
- Parameters:
series (ndarray) – input timeseries
dt (float) – sampling of the timeseries
- Returns:
frequency and psd array
- Return type:
tuple of ndarray
- apollinaire.psd.tf_to_psd(tf, T)#
- Parameters:
tf (ndarray) – complex Fourier transform from which to compute the PSD.
T (float) – resolution of the Fourier transform.
- Returns:
corresponding PSD
- Return type:
ndarray
- apollinaire.psd.plot_psd_fits(filename, rv=True, index=0)#
Plot the PSD of a fits file containing frequency and power array. The frequency in the file are supposed to be in Hz and the power in (m/s)^2/Hz (spectroscopy) or ppm^2/Hz (photometry)
- Parameters:
filename (str) – name of the fits file
rv (bool) – set to True if it is a radial velocity PSD, to False if it is a photometric PSD.
index (int) – index of the hdulist of the fits file where the PSD can be found. Default is 0.