# Module: features.cadence_features¶

 cesium.features.cadence_features.cad_prob(…) Given the observed distribution of time lags cads, compute the probability that the next observation occurs within time minutes of an arbitrary epoch. cesium.features.cadence_features.delta_t_hist(t) Build histogram of all possible |t_i - t_j|’s. cesium.features.cadence_features.double_to_single_step(cads) Ratios (t[i+2] - t[i]) / (t[i+1] - t[i]). cesium.features.cadence_features.find_sorted_peaks(x) Find peaks, i.e. cesium.features.cadence_features.normalize_hist(…) Normalize histogram such that integral from t_min to t_max equals 1. cesium.features.cadence_features.peak_bin(…) Return the (bin) index of the ith largest peak. cesium.features.cadence_features.peak_ratio(…) Compute the ratio of the values of the ith and jth largest peaks.

cesium.features.cadence_features.cad_prob(cads, time)

Given the observed distribution of time lags cads, compute the probability that the next observation occurs within time minutes of an arbitrary epoch.

## delta_t_hist¶

cesium.features.cadence_features.delta_t_hist(t, nbins=50, conv_oversample=50)

Build histogram of all possible |t_i - t_j|’s.

For efficiency, we construct the histogram via a convolution of the PDF rather than by actually computing all the differences. For better accuracy we use a factor conv_oversample more bins when performing the convolution and then aggregate the result to have nbins total values.

## double_to_single_step¶

cesium.features.cadence_features.double_to_single_step(cads)

Ratios (t[i+2] - t[i]) / (t[i+1] - t[i]).

## find_sorted_peaks¶

cesium.features.cadence_features.find_sorted_peaks(x)

Find peaks, i.e. local maxima, of an array. Interior points are peaks if they are greater than both their neighbors, and edge points are peaks if they are greater than their only neighbor. In the case of ties, we (arbitrarily) choose the first index in the sequence of equal values as the peak. Returns a list of tuples (i, x[i]) of peak indices i and values x[i], sorted in decreasing order by peak value.

## normalize_hist¶

cesium.features.cadence_features.normalize_hist(hist, total_time)

Normalize histogram such that integral from t_min to t_max equals 1. cf. np.histogram(…, density=True).

## peak_bin¶

cesium.features.cadence_features.peak_bin(peaks, i)

Return the (bin) index of the ith largest peak. Peaks is a list of tuples (i, x[i]) of peak indices i and values x[i], sorted in decreasing order by peak value.

## peak_ratio¶

cesium.features.cadence_features.peak_ratio(peaks, i, j)

Compute the ratio of the values of the ith and jth largest peaks. Peaks is a list of tuples (i, x[i]) of peak indices i and values x[i], sorted in decreasing order by peak value.