Utilities (corrections.utilities)

Collection of utility functions that can be used throughout the corrections package.

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

corrections.utilities.loadPickle(fname)[source]

Load an object from file using pickle.

Parameters:
  • fname (string) – File name to save to. If the name ends in ‘.gz’ the file will be automatically unzipped.
  • obj (object) – Any pickalble object to be saved to file.
Returns:

The unpickled object from the file.

Return type:

object

corrections.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>

corrections.utilities.savePickle(fname, obj)[source]

Save an object to file using pickle.

Parameters:
  • fname (string) – File name to save to. If the name ends in ‘.gz’ the file will be automatically gzipped.
  • obj (object) – Any pickalble object to be saved to file.
corrections.utilities.sphere_distance(ra1, dec1, ra2, dec2)[source]

Calculate the great circle distance between two points using the Vincenty formulae.

Parameters:
  • ra1 (float or ndarray) – Longitude of first point in degrees.
  • dec1 (float or ndarray) – Lattitude of first point in degrees.
  • ra2 (float or ndarray) – Longitude of second point in degrees.
  • dec2 (float or ndarray) – Lattitude of second point in degrees.
Returns:

Distance between points in degrees.

Return type:

ndarray

corrections.utilities.PICKLE_DEFAULT_PROTOCOL = 4

Default protocol to use for saving pickle files.

corrections.utilities.mad_to_sigma = 1.482602218505602

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