This is the documentation for gadfly, a package for generating photometry of stars with granulation and p-mode oscillations.

## Basic Usage¶

Let’s synthesize a time series of 60-second cadence observations of the Sun spanning 100 days of observations:

from gadfly import generate_solar_fluxes
import astropy.units as u

time, flux, kernel = generate_solar_fluxes(
duration=100 * u.day, cadence=60 * u.s
)


and let’s plot the power spectrum of those simulated observations:

from gadfly.psd import power_spectrum
import matplotlib.pyplot as plt
import numpy as np

freq, power = power_spectrum(flux)

plt.loglog(
1e6 * freq,
kernel.get_psd(2 * np.pi * freq) * (1e6 / 2 / np.pi),
'r', label='Kernel'
)
plt.loglog(1e6 * freq, power, ',k', label='Sim. obs.')
plt.ylim([1e-7, 1e3])
plt.legend()
plt.gca().set(
xlabel='Freq [$\mu$Hz]', ylabel='Power [ppm$^2$ $\mu$Hz$^{-1}$]'
)
plt.show()


## Tutorials¶

 generate_solar_fluxes(duration[, cadence, seed]) Generate an array of fluxes with zero mean which mimic the power spectrum of the SOHO/VIRGO SPM observations. generate_stellar_fluxes(duration, M, T_eff, R, L) Generate an array of fluxes with zero mean which mimic the power spectrum of the SOHO/VIRGO SPM observations, scaled for a star with a given mass, effective temperature, luminosity and radius. interpolate_missing_data(times, fluxes[, ...]) Assuming times are uniformly spaced with missing cadences, fill in the missing cadences with linear interpolation. power_spectrum(fluxes[, d]) Compute the power spectrum of fluxes in units of [ppm^2 / microHz].