API

Fitting in the Graphical User Interface (GUI)

allesfitter.GUI()

Input:

  • None

Returns:

  • None

Outputs:

Fitting in Python

allesfitter.show_initial_guess(datadir, do_logprint=True, do_plot=True, return_figs=False)

Input:

  • datadir: str

The directory path, for example 'Users/JohnWayne/Science/allesfit'

  • do_logprint: bool (default: True)

If True, it will save a logfile.

  • do_plot: bool (default: True)

If True, it will make and save the plots.

  • return_figs: bool (default: True)

If True, it will it will return a list of the figure objects.

Returns:

  • If return_figs is True, then it will return a list of figure objects that were plotted.

Outputs:

  • Creates initial guess plots and a logfile in the given directory path


allesfitter.mcmc_fit(datadir)

Input:

  • datadir: str

The directory path, for example 'Users/JohnWayne/Science/allesfit'

Returns:

  • A German saying.

Outputs:

  • Creates the file 'mcmc_save.h5' and a logfile in the given directory path


allesfitter.mcmc_output(datadir)

Input:

  • datadir: str

The directory path, for example 'Users/JohnWayne/Science/allesfit'

Returns:

  • A nerdy quote.

Outputs:

  • Creates all output plots and a logfile in the given directory path


allesfitter.ns_fit(datadir)

Input:

  • datadir: str

The directory path, for example 'Users/JohnWayne/Science/allesfit'

Returns:

  • A German saying.

Outputs:

  • Creates the file 'ns_save.pickle' and a logfile in the given directory path


allesfitter.ns_output(datadir)

Input:

  • datadir: str

The directory path, for example 'Users/JohnWayne/Science/allesfit'

Returns:

  • A nerdy quote.

Outputs:

  • Creates all output plots and a logfile in the given directory path

Post-processing in Python

allesfitter.ns_plot_bayes_factors(datadirs, labels=None, return_logZ=False)

Input:

  • datadirs: list of str

A list of all the directory paths to be compared, for example ['allesfit_circular', 'allesfit_eccentric']

  • labels: list of str (default: None)

If given, this will set the plot labels accordingly. Otherwise, the datadir names will be used.

  • return_logZ: bool (default: False)

If True, it will it will return a list of the Bayesian evidences, log Z, of all model fits

Returns:

  • If return_figs is True, then it will return a list of figure objects that were plotted.

Outputs:

  • Creates a histogram plot comparing all the Bayes factors between different model fits

allesclass

CLASS allesfitter.allesclass(datadir)

Inputs:

  • datadir: str

The directory path, for example 'Users/JohnWayne/Science/allesfit'


Attributes:

  • fulldata

A dictionary with the full data set that was loaded.

  • data

A dictionary with the data set that was used for the fit. This means, if fast_fit was used and out-of-transit data was neglected, it will not show up here.

  • settings

A dictionary of all settings.


  • initial_guess_samples

A 2d numpy array with all initial guess parameters

  • initial_guess_params_median

A dictionary with all initial guess parameters


  • params_star

A dictionary with the stellar parameters (if any were given)

  • external_priors

A dictionary with all external parameters (if any were given)


  • posterior_samples

A 2d numpy array with all posterior parameters

  • posterior_samples_at_maximum_likelihood

A 1d numpy array with all posterior parameters at the highest maximum likelihood step in the entire sampling

  • posterior_params

A dictionary with all posterior parameters

  • posterior_params_median

A dictionary with the medians of all posterior parameters

  • posterior_params_ll

A dictionary with the lower errors of all posterior parameters

  • posterior_params_ul

A dictionary with the upper errors of all posterior parameters

  • posterior_params_at_maximum_likelihood

A dictionary with all posterior parameters at the highest maximum likelihood step in the entire sampling

  • posterior_derived_params

A dictionary of all the derived parameters


Methods:

  • plot(inst, companion, style, fig=None, ax=None, mode='posterior', Nsamples=20, samples=None, timelabel='Time', rasterized=True, marker='.', linestyle='none', color='b', markersize=8)

  • get_initial_guess_model(inst, key, xx=None, phased=False)
  • get_initial_guess_baseline(inst, key, xx=None, model=None, phased=False)
  • get_initial_guess_stellar_var(self, inst, key, xx=None, phased=False)

  • get_posterior_median_model(inst, key, xx=None, phased=False)
  • get_posterior_median_baseline(inst, key, xx=None, model=None, phased=False)
  • get_posterior_median_stellar_var(inst, key, xx=None, phased=False)
  • get_posterior_median_residuals(inst, key)
  • get_posterior_median_yerr(inst, key)

  • get_one_posterior_curve_set(inst, key, xx=None, sample_id=None, phased=False)
  • get_one_posterior_model(inst, key, xx=None, sample_id=None, phased=False)
  • get_one_posterior_baseline(inst, key, xx=None, sample_id=None, phased=False)
  • get_one_posterior_stellar_var(inst, key, xx=None, sample_id=None, phased=False)

Injection recovery tests

from allesfitter.transit_search.injection_recovery_test import inject_and_tls_search
inject_and_tls_search(time, flux, flux_err, 
                      periods, rplanets, logfname, 
                      SNR_threshold=5.,
                      known_transits=None, 
                      R_star=0.13, R_star_min=1., R_star_max=3.5, 
                      M_star=0.1, M_star_min=1., M_star_max=1.,
                      show_plot=False, save_plot=False)

Summary:

  • Injects a planet signal via ellc, for a given period and radius (at random epoch)
  • Runs TLS on these injected data and infos


Input:

  • time : array of float

time stamps of observations

  • flux : array of float

normalized flux

  • flux_err : array of float

error of normalized flux

  • periods : float or array of float

a period or list of periods for injections

  • rplanets : float or array of float

a planet radius or list of planet radii for injections

  • logfname : str

file path and name for the log file

  • SNR_threshold : float

the SNR threshold at which to stop the TLS search

  • known_transits : None or dict

if dict and one transit is already known:

known_transits = {'period':[1.3], 'duration':[2.1], 'epoch':[245800.0]}

if dict and multiple transits are already known:

known_transits = {'period':[1.3, 21.0], 'duration':[2.1, 4.1], 'epoch':[245800.0, 245801.0]}

'period' is the period of the transit

'duration' must be the total duration, i.e. from first ingress point to last egrees point, in days

'epoch' is the epoch of the transit

  • R_star : float

radius of the star (e.g. median)

default 1 R_sun (from TLS)

  • R_star_min : float

minimum radius of the star (e.g. 1st percentile)

default 0.13 R_sun (from TLS)

  • R_star_max : float

maximum radius of the star (e.g. 99th percentile)

default 3.5 R_sun (from TLS)

  • M_star : float

mass of the star (e.g. median)

default 1. M_sun (from TLS)

  • M_star_min : float

minimum mass of the star (e.g. 1st percentile)

default 0.1 M_sun (from TLS)

  • M_star_max : float

maximum mass of the star (e.g. 99th percentile)

default 1. M_sun (from TLS)

  • show_plot : bool

show a plot in the terminal or not

  • save_plot : bool

save a plot or not


Returns:

  • None


Outputs:

  • A list of all TLS results will get saved to a log file

Internal nomenclature: time series

On the observation time grid:

  • time
  • flux
  • flux_err
  • rv
  • rv_err
  • model_flux
  • model_rv


On a phase-folded grid:

  • phi


On a phase-folded and binned time grid:

  • phase
  • phaseflux
  • phaseflux_err
  • phaserv
  • phaserv_err
  • model_phaseflux
  • model_phaserv


On a finely interpolated observation time grid (for plots):

  • time_grid
  • model_flux_grid
  • model_rv_grid


On a finely interpolated phase-folded grid (for plots):

  • phase_grid
  • model_phaseflux_grid
  • model_phaserv_grid

Internal nomenclature: parameters

Model parameter abbreviations:

  • rr: radius of the companion divided by radius of the host [unit-less]
  • rsuma: radius of the companion plus radius of the host divided by the semi-major axis [unit-less]
  • epoch: transit/eclipse epoch [in days]
  • period: orbital period [in days]
  • cosi: cosine of the inclination [unit-less]
  • K: RV semi-amplitude [in km/s]
  • f_c: sqrt(ecc) * cos(omega) [unit-less]
  • f_s: sqrt(ecc) * sin(omega) [unit-less]
  • sbratio: surface brightness ratio [unit-less]
  • dil: dilution, defined as D_0 = 1 - (F_target / (F_target + F_blend)) [unit-less]


Other abbreviations:

  • incl: inclination in degree
  • ecc: eccentricity
  • omega: argument of periastron in degree
  • a: semi-major axis in AU
  • ldc: list of the limb darkening parameters in u-space
  • ld: limb darkening law


Dictionary keywords:

  • R_companion/a: radius of the companion divided by the semi-major axis [unit-less]
  • R_host/a: radius of the host divided by the semi-major axis [unit-less]
  • R_companion: radius of the companion [in R_earth or R_jupiter]
  • R_host: radius of the host [in R_sun]