Utility functions (starclass.utilities)

Utility functions.

Code author: Rasmus Handberg <rasmush@phys.au.dk>

starclass.utilities.get_periods(featdict, nfreqs, time, in_days=True, ignore_harmonics=False)[source]

Cuts frequency data down to desired number of frequencies (in uHz) and optionally transforms them into periods in days.

Parameters
  • featdict (dict) –

  • nfreq (int) – Number of frequencies/periods to extract

  • time (ndarray) –

  • in_days (bool, optional) – Return periods in days instead of frequencies in uHz.

  • ignore_harmonics (bool, optional) – Sort frequency table by amplitude (i.e. ignore into harmonic structure).

Returns

  • periods:

  • n_usedfreqs (int): Number of true periods/frequencies that are used.

  • usedfreqs: Indices of the used periods/frequencies in the astropy table.

Return type

tuple

Code author: Jeroen Audenaert <jeroen.audenaert@kuleuven.be>

Code author: Rasmus Handberg <rasmush@phys.au.dk>

starclass.utilities.ptp(lc)[source]

Compute robust Point-To-Point scatter.

Parameters

lc (lightkurve.TessLightCurve object) – Lightcurve to calculate PTP for.

Returns

Robust PTP.

Return type

float

Code author: Rasmus Handberg <rasmush@phys.au.dk>

starclass.utilities.rms_timescale(lc, timescale=0.041666666666666664)[source]

Compute robust RMS on specified timescale. Using MAD scaled to RMS.

Parameters
  • lc (lightkurve.TessLightCurve object) – Timeseries to calculate RMS for.

  • timescale (float, optional) – Timescale to bin timeseries before calculating RMS. Default=1 hour.

Returns

Robust RMS on specified timescale.

Return type

float

Code author: Rasmus Handberg <rasmush@phys.au.dk>

starclass.utilities.roc_curve(labels_test, y_prob, sclasses)[source]

Calculate ROC values and return optimal thresholds

https://scikit-learn.org/stable/auto_examples/model_selection/plot_roc.html

Parameters
  • labels_test (dict) –

  • () (y_prob) –

  • class_names (list) –

Returns

  • false_positive_rate (dict)

  • true_positive_rate (dict)

  • roc_auc (dict)

  • roc_threshold_index (dict)

  • roc_best_thresholds (dict)

Return type

dict

Code author: Jeroen Audenaert <jeroen.audenaert@kuleuven.be>

Code author: Rasmus Handberg <rasmush@phys.au.dk>

starclass.utilities.mad_to_sigma = 1.482602218505602

Conversion constant from MAD to Sigma. Constant is 1/norm.ppf(3/4)