BLS pulse algorithm¶
drive_bls_pulse – Driver interface to BLS pulse¶
bls_pulse_python – Naive pure Python implementation¶
BLS_PULSE algorithm, based on bls_pulse.pro originally written by Peter
McCullough.
-
bls_pulse_python.__calc_sr_max(n, nbins, mindur, maxdur, direction, binTime, binFlx, ppb)¶ Calculates the maximum signal residual for a given segment.
Parameters: - n (int) – Total number of points that were binned to this segment
- nbins (int) – Number of bins in each segment
- mindur (int) – Minimum signal duration to accept, in units of bins
- maxdur (int) – Maximum signal duration to accept, in units of bins
- direction (int) – Signal direction to accept; -1 for dips, +1 for blips, or 0 for best
- binTime (numpy.ndarray) – Array of binned times
- binFlx (numpy.ndarray) – Array of binned fluxes
- ppb (numpy.ndarray) – Weights for each bin; each weight is the number of points that were binned to the corresponding bin
Return type:
-
bls_pulse_python.__convert_duration_to_bins(duration_days, nbins, segment_size, duration_type)¶ Converts the requested duration (in days) to a duration in (full) units of bins. Rounds down for min and round up for max.
Parameters: Return type:
-
bls_pulse_python.bls_pulse(time, flux, fluxerr, n_bins, segment_size, min_duration, max_duration, direction=0, detrend_order=0)¶ Main function for this module; performs the BLS pulse algorithm on the input lightcurve data. Lightcurve should be 0-based if no detrending is used.
See Kovacs et al. (2002)
Parameters: - time (numpy.ndarray) – Array of times of observations; nominally in units of days
- flux (numpy.ndarray) – Array of fluxes corresponding to times
- fluxerr (numpy.ndarray) – Array of flux errors corresponding to times
- n_bins (int) – Number of bins in each segment
- segment_size (float) – Length of a segment, in days
- min_duration (float) – Minimum signal duration to accept, in days
- max_duration (float) – Maximum signal duration to accept, in days
- direction (int) – Signal direction to accept; -1 for dips, +1 for blips, or 0 for best
- detrend_order (int) – Order of detrending to use on input; 0 for no detrending
Return type:
bls_pulse_vec – Vectorized Python implementation¶
-
bls_pulse_vec.__compute_signal_residual(binned_segment, matrix, duration, n_bins_min_duration, direction)¶ Run BLS algorithm on a binned segment.
Parameters: - binned_segment (pandas.DataFrame) – Segment for which to calculate the residual
- matrx – Matrix of i1, i2 indices
- duration (numpy.ndarray) – Array of durations to consider
- n_bins_min_duration (int) – Length of minimum duration in full bins
- direction (int) – Signal direction to accept; -1 for dips, +1 for blips, or 0 for best
Return type: pandas.Series
-
bls_pulse_vec.__phase_bin(segment, bins)¶ Phase-bin a light curve segment.
Parameters: - segment (pandas.DataFrame) – Segment to bin
- bins (numpy.ndarray) – Array of bin edges to use
Return type: pandas.DataFrame
-
bls_pulse_vec.__reindex_to_matrix(series, matrix)¶ Reindexes a series on a 2d matrix of values. Pandas does not support 2d indexing, so we need to flatten the matrix, reindex, and then reshape the result back to 2d.
Parameters: - series (pandas.Series) – Array to reindex
- matrix (numpy.ndarray) – Reindexing matrix
Return type: numpy.ndarray
-
bls_pulse_vec.bls_pulse(time, flux, fluxerr, n_bins, segment_size, min_duration, max_duration, detrend_order=3, direction=0, remove_nan_segs=False)¶ Main function for this module; performs the BLS pulse algorithm on the input lightcurve data, in a vectorized way. Lightcurve should be 0-based if no detrending is used.
See Kovacs et al. (2002)
Parameters: - time (numpy.ndarray) – Array of times of observations; nominally in units of days
- flux (numpy.ndarray) – Array of fluxes corresponding to times
- fluxerr (numpy.ndarray) – Array of flux errors corresponding to times
- n_bins (int) – Number of bins in each segment
- segment_size (float) – Length of a segment, in days
- min_duration (float) – Minimum signal duration to accept, in days
- max_duration (float) – Maximum signal duration to accept, in days
- direction (int) – Signal direction to accept; -1 for dips, +1 for blips, or 0 for best
- detrend_order (int) – Order of detrending to use on input; 0 for no detrending
- remove_nan_segs (bool) – Remove from the output segments with no accepted events
Return type: