BLS generators

class gerbls.pyBLSModel

Base class for BLS model generators. Should not be created directly.

class gerbls.pyBruteForceBLS

Bases: pyBLSModel

Brute-force (slow) BLS generator. setup() should be used before run().

N_freq

Number of tested frequencies.

Type:

int

freq

Array of tested frequencies.

Type:

np.ndarray

run(verbose=True)

Run the BLS generator.

Parameters:

verbose (bool) – Whether to print output to the console, by default True.

Return type:

None

setup(data, min_period, max_period, target=None, dt_per_step=0.0, t_bins=0.0, N_bins_min=0, duration_mode='', min_duration_factor=0.0, max_duration_factor=0.0)

Set up the BLS generation.

Parameters:
  • data (gerbls.pyDataContainer) – Input data.

  • min_period (float) – Minimum searched orbital period.

  • max_period (float) – Maximum searched orbital period.

  • target (gerbls.pyTarget, optional) – Stellar parameters, by default None.

  • dt_per_step (float, optional) – Period spacing will be calculated such that over the course of the entire time baseline of the data, any transit midtime will not be expected to shift by more than this value due to finite period spacing, by default 0.003.

  • t_bins (float, optional) – Time cadence that phase-folded light curves will be binned to, by default 0.007.

  • N_bins_min (int, optional) – Regardless of the value specified by t_bins, phase-folded light curves at each period are guaranteed to have at least this many bins in total, by default 100.

  • duration_mode ({'constant', 'fractional', 'physical'}, optional) – Affects how the maximum tested transit duration is determined at each period, by default ‘fractional’.

  • min_duration_factor (float, optional) – Affects the minimum searched transit duration at each period, by default 0.

  • max_duration_factor (float, optional) – Affects the maximum searched transit duration at each period, by default 0.1.

Return type:

None

setup_from_freq(data, freq_, target=None, t_bins=0.0, N_bins_min=0, duration_mode='', min_duration_factor=0.0, max_duration_factor=0.0)

Set up the BLS generation with a predefined array of orbital frequencies.

Parameters:
  • data (gerbls.pyDataContainer) – Input data.

  • freq (ArrayLike) – Array of orbital frequencies (= 1/period) to test.

  • target (gerbls.pyTarget, optional) – Stellar parameters, by default None.

  • t_bins (float, optional) – Time cadence that phase-folded light curves will be binned to, by default 0.007.

  • N_bins_min (int, optional) – Regardless of the value specified by t_bins, phase-folded light curves at each period are guaranteed to have at least this many bins in total, by default 100.

  • duration_mode ({'constant', 'fractional', 'physical'}, optional) – Affects how the maximum tested transit duration is determined at each period, by default ‘fractional’.

  • min_duration_factor (float, optional) – Affects the minimum searched transit duration at each period, by default 0.

  • max_duration_factor (float, optional) – Affects the maximum searched transit duration at each period, by default 0.1.

Return type:

None

class gerbls.pyFastBLS

Bases: pyBLSModel

Fast-folding BLS generator. setup() should be used before run().

N_freq

Number of tested frequencies.

Type:

int

freq

Array of tested frequencies.

Type:

np.ndarray

rdata

Resampled data generated by run(), with a time sampling given by t_samp.

Type:

gerbls.pyDataContainer

run(verbose=True)

Run the BLS generator.

Parameters:

verbose (bool) – Whether to print output to the console, by default True.

Return type:

None

run_double(verbose=True)

Run the BLS generator with all output results in double precision.

Parameters:

verbose (bool) – Whether to print output to the console, by default True.

Return type:

None

setup(data, min_period, max_period, target=None, t_samp=0.0, verbose=True, duration_mode='', min_duration_factor=0.0, max_duration_factor=0.0, downsample=False, downsample_invpower=3.0, downsample_threshold=1.1)

Set up the BLS generation.

Parameters:
  • data (gerbls.pyDataContainer) – Input data.

  • min_period (float) – Minimum searched orbital period.

  • max_period (float) – Maximum searched orbital period.

  • target (gerbls.pyTarget, optional) – Stellar parameters, by default None.

  • t_samp (float, optional) – Desired initial time sampling of the data, by default 0. Overwrites the value in t_samp(). If 0, the median time cadence of the input data will be used instead.

  • verbose (bool, optional) – Whether to print output to the console, by default True.

  • duration_mode ({'constant', 'fractional', 'physical'}, optional) – Affects how the maximum tested transit duration is determined at each period, by default ‘fractional’.

  • min_duration_factor (float, optional) – Affects the minimum searched transit duration at each period, by default 0.

  • max_duration_factor (float, optional) – Affects the maximum searched transit duration at each period, by default 0.1.

  • downsample (bool, optional) – Whether to automatically downsample the data at longer periods, by default False.

  • downsample_invpower (float, optional) – Affects the rate of downsampling, by default 3.

  • downsample_threshold (float, optional) – Affects the threshold that triggers downsampling, by default 1.1.

Return type:

None

t_samp

Desired (initial) time sampling during BLS generation. Value can be set manually.

Type:

float

time_spent

The runtime spent at each orbital period during run().

Type:

np.ndarray

gerbls.run_bls(time, mag, err, min_period, max_period, t_samp=0.0, duration_mode='fractional', min_duration_factor=0.0, max_duration_factor=0.2)

A basic convenience function to generate a BLS spectrum. The data must be evenly sampled in time to run the BLS, use t_samp to specify the cadence for any resampling.

Parameters:
  • time (npt.ArrayLike) – Array of observation timestamps.

  • mag (npt.ArrayLike) – Array of observed fluxes.

  • err (npt.ArrayLike) – Array of flux uncertainties for each observation.

  • min_period (float) – Minimum BLS period to search.

  • max_period (float) – Maximum BLS period to search.

  • t_samp (float, optional) – Time sampling to bin the data before running the BLS. If 0 (default), the median time difference between observations is used.

  • duration_mode (str, optional) – Determines how the tested transit durations are calculated at each period. If ‘constant’, the maximum duration is set to max_duration_factor. If ‘fractional’, the tested orbital period is multiplied by max_duration_factor. If ‘physical’, the expected transit duration for a circular orbit is multiplied by max_duration_factor.

  • min_duration_factor (float, optional) – A scaling factor that affects the minimum tested transit duration.

  • max_duration_factor (float, optional) – A scaling factor that affects the maximum tested transit duration.

Returns:

Dictionary with BLS results: * P is the list of tested periods * dchi2 is the BLS statistic (Delta chi squared) at each period * t0 is the best-fit transit mid-point at each period * dur is the best-fit duration at each period * mag0 is the best-fit flux baseline at each period * dmag is the best-fit transit depth at each period

Return type:

dict