HECATE.utils

Functions

linear_interpolation_matrix(x_old, x_new)

Builds a sparse matrix W that linearly interpolates data from x_old → x_new.

Classes

fit_profile

Fit a CCF or spectral line profile to observed CCF/spectral line.

get_limb_darkening

Class to compute limb darkening coefficients and specific intensity I(mu) for a given limb darkening law using LDTK.

get_phase_mu

Collect orbital parameters and information, including orbital phases, mu, transit duration, duration between ingress and egress, array indices of in-transit and out-of-transit,

profile_models

Spectral line/CCF profile models.

class get_limb_darkening[source]

Bases: object

Class to compute limb darkening coefficients and specific intensity I(mu) for a given limb darkening law using LDTK.

Parameters:
  • stellar_params (dict) – dictionary containing the following stellar parameters: effective temperature and error, superficial gravity and error, metallicity and error.

  • planet_params (dict) – dictionary containing the following planetary parameters: system scale, planet-to-star radius ratio and planetary inclination.

  • wav_range (list) – list containing the minimum and maximum wavelengths [nm] of the spectrograph.

ld_coeffs(law)[source]

computes limb darkening coefficients for a given law using LDTK.

compute_I(mu, coeffs, law)[source]

computes the specific intensity I(mu) for a given limb darkening law and coefficients.

get_weighted_mu(phases_in, law, plot)[source]

computes the brightness weighted mu values for a given set of orbital phases and limb darkening law.

get_geometric_mu(phases_in)[source]

computes the geometric mu values for a given set of orbital phases.

__init__(stellar_params: dict, planet_params: dict, wav_range: list)[source]
ld_coeffs(law: str)[source]

Computes limb darkening coefficients for a given law using LDTK.

Parameters:

law (str) – limb darkening law. Supported laws: linear, quadratic, square-root, exponential, claret-nonlinear.

Returns:

coeffs – limb darkening coefficients for the specified law.

Return type:

numpy array

compute_I(mu: numpy.array, coeffs: numpy.array, law: str)[source]

Computes the specific intensity I(mu) for a given limb darkening law and coefficients.

Parameters:
  • mu (numpy array) – array of mu values (cosine of the angle between the line of sight and the normal to the stellar surface).

  • coeffs (numpy array) – limb darkening coefficients for the specified law.

  • law (str) – limb darkening law. Supported laws: linear, quadratic, square-root, exponential, claret-nonlinear.

Returns:

I – specific intensity I(mu) for the given limb darkening law and coefficients.

Return type:

numpy array

get_weighted_mu(phases_in: numpy.array, law: str, plot: bool = False)[source]

Computes the brightness weighted mu values for a given set of orbital phases and limb darkening law.

Parameters:
  • phases_in (numpy array) – array of in-transit orbital phases.

  • law (str) – limb darkening law. Supported laws: linear, quadratic, square-root, exponential, claret-nonlinear.

  • plot (bool) – whether to plot the intensity map in a given position of the planet.

Returns:

weighted_mu – array of brightness weighted mu values for the given in-transit orbital phases and limb darkening law.

Return type:

numpy array

get_geometric_mu(phases_in: numpy.array)[source]

Computes the geometric mu values for a given set of orbital phases.

Parameters:

phases_in (numpy array) – array of in-transit orbital phases.

Returns:

geometric_mu – array of geometric mu values for the given in-transit orbital phases.

Return type:

numpy array

class get_phase_mu[source]

Bases: object

Collect orbital parameters and information, including orbital phases, mu, transit duration, duration between ingress and egress, array indices of in-transit and out-of-transit,

Parameters:
  • planet_params (dict) – dictionary containing the following planetary parameters: orbital period, system scale, planet-to-star radius ratio, mid-transit time, eccentricity, argument of periastron, planetary inclination and spin-orbit angle.

  • time (numpy array) – time of observations in BJD.

get_phase(planet_params, time)[source]

computes orbital phases, transit duration, time between ingress and egress, array indices in-transit and out-of-transit.

__init__(time: numpy.array, planet_params: dict, stellar_params: dict, mu_type: str = 'weighted', ld_law: str = 'quadratic', wav_range: list = [380, 788])[source]
get_phase(planet_params: dict, time: numpy.array)[source]
linear_interpolation_matrix(x_old, x_new)[source]

Builds a sparse matrix W that linearly interpolates data from x_old → x_new. Each row i corresponds to interpolation weights for x_new[i].

Parameters:

x_old, x_new (numpy array) – original and interpolated arrays.

Returns:

W – linear interpolation matrix.

Return type:

numpy array

class profile_models[source]

Bases: object

Spectral line/CCF profile models. Models available: modified Gaussian, Gaussian and Lorentzian.

Parameters:
  • model (str) – type of profile model to fit.

  • num_lines (int) – number of lines to fit (1 for single line, 2 for doublet).

_build_model(model_type, num_lines)[source]

builds the model function for curve fitting based on the specified model type and number of lines.

_convert_to_fit(local_spectra, flux_fit_params, indices_final)[source]

converts the fitted parameters into a flux array for plotting.

__init__(model_type: str, num_lines: int = 1)[source]
class fit_profile[source]

Bases: object

Fit a CCF or spectral line profile to observed CCF/spectral line.

Parameters:
  • phase (float) – orbital phase.

  • data (numpy array) – CCF profile (RV, flux and flux error) or spectral line profile (wavelength, flux and flux error).

  • data_type (str) – whether it’s a CCF or spectral line profile.

  • observation_type (str) – whether it’s a local, average out-of-transit or raw profile.

  • model_type (str) – type of profile model to fit.

fit_profile(wave_ctr_line, mask_x, print_output)

fits the specified profile model to the observed CCF/spectral line and returns the fitted profile parameters, coefficient of determination, profile data and fitted profile for plotting.

r2(y, yfit)[source]

computes coefficient of determination.

__init__(phase: float, data: numpy.array, data_type: str = 'CCF', observation_type: str = 'raw', model_type: str = 'modified Gaussian')[source]
static r2(y, yfit)[source]

Compute coefficient of determination.

Parameters:
  • y (numpy array) – observed flux.

  • yfit (numpy array) – fitted flux.

Returns:

r – coefficient of determination.

Return type:

float