retriving data and models

The allesclass let’s you retrieve all data, models, posteriors etc etc. For example, you can use this to save your light curves, models and residuals to a file to share with your collaborators:

#::: your settings
datadir = 'allesfit' #change this to what you need
inst = 'TESS' #change this to what you need
key = 'flux' #change this to what you need

#::: initialize the allesclass
alles = allesfitter.allesclass(datadir)

#::: load the data (and the correct error bars)
time = alles.data[inst]['time']
flux = alles.data[inst][key]
flux_err = alles.data[inst]['err_scales_'+key] * alles.posterior_params_median['err_'+key+'_'+inst]

#::: load the median baseline and median lightcurve model
baseline = alles.get_posterior_median_baseline(inst, key)
model = alles.get_posterior_median_model(inst, key)

#::: compute the detrended flux and the residuals
detrended_flux = flux-baseline
residuals = flux-(model+baseline)

#::: save everything to a file for your collaborators
X = np.column_stack((time, flux, flux_err, detrended_flux, model, residuals))
np.savetxt('my_final_file.csv', X, delimiter=',')