Loading Prior Results

The results from a run of pyPetal are both saved in the specified output_dir and resturned as a large dictionary, sorted by module. There are many instances in which the resulting dictionary may be lost or deleted, and it would be usefult to load the results in the same formatted dictionary, instead of either re-running pyPetal or looking through the output directory.

pyPetal has a function to load the results from a prior run and return the formatted dictionary.

This can be done quickly by calling the load function. The only argument this function requires is the output directory from the prior run.

[4]:
import pypetal.utils.load as load

main_dir = 'pypetal/examples/weighting_output/'
res, summary = load(main_dir, verbose=True)

Prior pyPetal run
---------------------
DRW Rejection: True
pyCCF: True
pyZDCF: True
PyROA: True
JAVELIN: True
Weighting: True
---------------------

This resulting dictionary will be formatted in a similar way as the dictionary returned by pypetal.pipeline.run_pipeline. The differences between the original and loaded resulting dictionaries are described below:

[6]:
res.keys()
[6]:
dict_keys(['drw_rej_res', 'pyccf_res', 'pyzdcf_res', 'plike_res', 'pyroa_res', 'javelin_res', 'weighting_res'])

In addition, if weighting is run, the load function will return the summary dicts for each of the lines, combined into one astropy.table.Table object.

[7]:
summary
[7]:
Table length=2
kn0_pyccfpeak_bounds_pyccfpeak_pyccflag_pyccflag_err_pyccffrac_rejected_pyccfn0_javelinpeak_bounds_javelinpeak_javelinlag_javelinlag_err_javelinfrac_rejected_javelinn0_pyroapeak_bounds_pyroapeak_pyroalag_pyroalag_err_pyroafrac_rejected_pyroarmax_pyccfrmax_javelinrmax_pyroa
float32float32float32[2]float32float32float32[2]float32float32float32[2]float32float32float32[2]float32float32float32[2]float32float32float32[2]float32float32float32float32
3.0138.039.874973 .. 167.54588103.01151103.067645.8499713 .. 7.2481510.882138.040.31564 .. 241.38957101.01151156.6180956.24691 .. 23.6269250.7261138.040.347916 .. 162.09218101.01151100.230021.0400501 .. 1.07012550.00.891461550.891461550.89146155
3.0138.0151.5614 .. 321.3808259.0115257.799936.0463576 .. 3.7843890.5783333138.0133.44052 .. 302.4789209.0115204.891141.4374264 .. 42.2603570.8954138.0190.51564 .. 312.1987251.0115250.36950.8950935 .. 0.863749740.00.89469670.893506050.8968668

DRW Rejection

The drw_rej_res key has the same structure as the output results, including the original keys. However, if jitter=False, the loaded results will have a jitters key filled with None. In addition, the loaded results will have the following information in the stated keys:

  • fit_x: The time values for the DRW fit to the input light curve.

  • fit_y: The flux values for the DRW fit.

  • fit_err: The \(1\sigma\) uncertainty in the DRW fit.

  • names: The names of the lines fit, with the first being the continuum light curve.

The arrays containing the DRW fits are arrays of arrays, with each key containning all fits for all lines. The order of these arrays are the same as the names key.

pyCCF

The load module only loads a subest of the keys found in the original results, listed below:

  • CCCD_lags

  • CCPD_lags

  • CCF

  • CCF_lags

  • name

Though, similar to the original dictionary, the pyccf_res key will have a list of dictionaries, one for each line, containing the keys listed above.

pyZDCF

run_pipeline will output a list of pandas.DataFrame objects, one for each line, containing the pyZDCF results. The load function will output a list of dictionaries containing the same information, with the DataFrame under the output key and the line name under the name key.

PLIKE

The PLIKE results are the same as output by run_pipeline, with an added name key for the name of the line for each line’s dictionary.

PyROA

The PyROA results are the same as output by run_pipeline.

JAVELIN

The JAVELIN module will load a subset of the keys found in the original results dictionary, as well as a few new ones. The loaded keys are:

  • sigma: The MCMC chain for :math:\sigma_{\rm DRW}.

  • tau: The MCMC chain for :math:\tau_{\rm DRW}.

  • tophat_params: The tophat parameters for the MCMC run.

  • cont_fit_x: The time values for the continuum fit.

  • cont_fit_y: The flux values for the continuum fit.

  • cont_fit_yerr: The \(1\sigma\) uncertainty in the continuum fit.

  • fit_x: The time values for the line fit.

  • fit_y: The flux values for the line fit.

  • fit_yerr: The 1\(\sigma\) uncertainty in the line fit.

If together=True, the fit_x, fit_y, and fit_yerr keys will be lists of arrays, with each array containing the fit for a different line.

If together=False, each dictionary will also contain the name of the line in the name key.

Weighting

The weighting_res key will be the same as output from run_pipeline, though with three notable changes:

  • Under pyccf, there will be no CCCD key containing the original CCCD from the pyCCF module.

  • Under javelin, there will be no lag_dist key containing the lag distribution from the JAVELIN module.

  • Under pyroa, there will be no lag_dist key containing the lag distribution from the JAVELIN module.

  • There will be a name key in the weighting_res dictionary containing the names of the lines in order.

..note:: The unincluded distributions can be obtained from the pyccf_res, pyroa_res, and javelin_res dictionaries respectively.