PowerSpectrum
PowerSpectrum#
- class gadfly.PowerSpectrum(frequency, power, error=None, name=None, norm=None, detrended_lc=None)[source]#
Bases:
object
An observed power spectrum.
- Parameters
frequency (Quantity) – Frequency of each power spectral density measurement
power (Quantity) – Power spectral density at each frequency
error (Quantity) – Uncertainty on PSD measurements
name (str) – Name of the target/instrument
norm (Quantity) – Normalization factor
detrended_lc (LightCurve) – Detrended light curve to cache along with the PSD.
Attributes Summary
Convert from power spectral density to the approximate root mean square of the original light curve.
Angular frequency.
Methods Summary
bin
([bins])Bin the power spectrum.
cutout
([frequency_min, frequency_max])Cut out a section of the power spectrum.
from_light_curve
(light_curve[, method, ...])Compute the power spectrum from a light curve.
plot
(**kwargs)Plot a power spectrum.
Attributes Documentation
- light_curve_rms#
Convert from power spectral density to the approximate root mean square of the original light curve.
- Returns
rms
- Return type
- omega#
Angular frequency.
Returns a numpy array of \(\omega = 2 \pi f\) with f in units of [uHz].
- Returns
omegas
- Return type
Methods Documentation
- bin(bins=None, **kwargs)[source]#
Bin the power spectrum.
Requires scipy. Other keyword arguments passed to
bin_power_spectrum()
.
- cutout(frequency_min=None, frequency_max=None)[source]#
Cut out a section of the power spectrum.
- Parameters
- Returns
new_ps – A new, cropped power spectrum
- Return type
- classmethod from_light_curve(light_curve, method='fft', include_zero_freq=False, name=None, detrend=True, detrend_poly_order=3, save_detrended_lc=True)[source]#
Compute the power spectrum from a light curve.
- Parameters
light_curve (LightCurve, LightCurveCollection # noqa) – Light curve(s)
method (str, options are "fft" or "lomb-scargle") – Method used to compute the power spectrum.
include_zero_freq (bool) – Include
frequency=0
in the first entry of the results.name (str) – Name for the power spectrum
detrend (bool) – If
True
, detrend the light curve.detrend_poly_order (int) – Polynomial order used for detrending the light curve
save_detrended_lc (bool) – If
True
, save the detrended light curve in an attribute on the PSD object.
- plot(**kwargs)[source]#
Plot a power spectrum.
Requires
matplotlib
.- Parameters
ax (
Axes
) –kernel (None or subclass of
Term
) –obs (PowerSpectrum) –
freq (Quantity) –
figsize (list of floats) –
n_samples (int) –
p_mode_inset (bool) –
legend (bool) –
scaling_low_freq (str) –
scaling_p_mode (str) –
inset_xlim (list of floats) –
inset_ylim (list of floats) –
title (str) –
label_inset (str) –
label_obs (str) –
label_kernel (str) –
kernel_kwargs (dict) –
obs_kwargs (dict) –
inset_kwargs (dict) –
create_new_figure (bool) –
inset_bounds (list) –
- Returns