sherlockpipe.bayesian_fit.fitter.Fitter

class sherlockpipe.bayesian_fit.fitter.Fitter(object_dir, fit_dir, only_initial, is_candidate_from_search, candidates_df, mcmc=False, detrend=None, estimate_noise=True, rho_err_multi=5.0, sigma_err_multi=5.0, yerr_err_multi=5.0, odd_even=False, odd_even_dir=None, odd_even_tolerance=None)

Bases: ToolWithCandidate

Used to run a bayesian fit on the Sherlock search results.

__init__(object_dir, fit_dir, only_initial, is_candidate_from_search, candidates_df, mcmc=False, detrend=None, estimate_noise=True, rho_err_multi=5.0, sigma_err_multi=5.0, yerr_err_multi=5.0, odd_even=False, odd_even_dir=None, odd_even_tolerance=None)

Methods

__init__(object_dir, fit_dir, only_initial, ...)

custom_plot(name, period, fit_width, ...[, mode])

Creates a custom fit plot from the allesfitter data

fill_candidate_params(candidate_row, ...)

Fills the candidate planet initial parameters and their distribution to be fit.

fill_candidates_params(candidate_df, ...[, ...])

Fills the candidate planets initial parameters and their distribution to be fit.

fill_instrument_params(star_df, detrend_mode)

Fills the star and systematics information for each instrument (so far only one)

fit(candidate_df, fit_candidate_df, star_df, ...)

Main method to run the alexfitter fit.

is_candidate_aware()

Boolean return to inform whether the candidate to be processed comes from SHERLOCK searches or is user-given.

mask_non_fit_candidates(time, flux, ...)

Masks all the candidates found in previous runs in the SHERLOCK search.

mask_previous_candidates(time, flux, ...)

Masks all the candidates found in previous runs in the SHERLOCK search.

overwrite_settings(settings_file, cpus, ...)

select_fit_width(candidate_df)

Calculates the window to be used for the fit around the transits.

static custom_plot(name, period, fit_width, allesfit_dir, mode='posterior')

Creates a custom fit plot from the allesfitter data

Parameters:
  • name – the candidate name

  • period – the final period

  • fit_width – the fit_width window

  • allesfit_dir – the directory where allesfitter data is stred

  • mode – the allesfitter plot model

static fill_candidate_params(candidate_row, star_df, fit_orbit)

Fills the candidate planet initial parameters and their distribution to be fit.

Parameters:
  • candidate_row – the candidate row from the dataframe

  • star_df – the star dataframe

  • fit_orbit – whether to fit eccentricity and arg. of periastron.

Returns:

the allesfitter candidate parameters

fill_candidates_params(candidate_df, star_df, fit_orbit, detrend_mode, distribution: str = 'uniform', distribution_params: DistributionParams = None)

Fills the candidate planets initial parameters and their distribution to be fit.

Parameters:
  • candidate_df – the candidates dataframe

  • star_df – the star dataframe

  • fit_orbit – whether to fit eccentricity and arg. of periastron.

  • detrend_mode – type of detrend to be used

  • distribution – uniform or normal

  • distribution_params – the distribution parameters if known

Returns:

the allesfitter candidates parameters

fill_instrument_params(star_df, detrend_mode, distribution='uniform', distribution_params: DistributionParams = None)

Fills the star and systematics information for each instrument (so far only one)

Parameters:
  • star_df – the star dataframe

  • detrend_mode – type of detrend to be used

  • distribution – distribution: uniform or normal

:param distribution_params : if set, chooses the baseline fit values :return: the allesfitter instrument params

fit(candidate_df, fit_candidate_df, star_df, cpus, allesfit_dir, tolerance, fit_orbit)

Main method to run the alexfitter fit.

Parameters:
  • candidate_df – the candidates dataframe to be used for noise estimation.

  • fit_candidate_df – the candidates dataframe to be used for the final fit.

  • star_df – the star dataframe.

  • cpus – the number of cpus to be used.

  • allesfit_dir – the directory for the fit to be run.

  • tolerance – the nested sampling tolerance threshold.

  • fit_orbit – whether to fit eccentricity and arg. of periastron.

is_candidate_aware()

Boolean return to inform whether the candidate to be processed comes from SHERLOCK searches or is user-given.

Returns:

boolean with the value

mask_non_fit_candidates(time, flux, flux_err, candidate_df, fit_candidate_df)

Masks all the candidates found in previous runs in the SHERLOCK search.

Parameters:
  • time – the time array

  • flux – the flux measurements array

  • flux_err – the flux error measurements array

  • candidate_df – the candidates used for noise estimation

  • fit_candidate_df – the candidates used for fit

Returns:

time, flux and flux_err with previous candidates in-transit data masked

mask_previous_candidates(time, flux, flux_err, candidate_id)

Masks all the candidates found in previous runs in the SHERLOCK search.

Parameters:
  • time – the time array

  • flux – the flux measurements array

  • flux_err – the flux error measurements array

  • candidate_id – the candidate number

Returns:

time, flux and flux_err with previous candidates in-transit data masked

static select_fit_width(candidate_df)

Calculates the window to be used for the fit around the transits.

Parameters:

candidate_df – the candidates dataframe

Returns:

the maximum calculated fit_width