Skip to content

API - Running the tool

For normal use it should suffice to use only the Erebus class. The WrappedFits, PhotometryData, and WrappedMCMC classes give control over each step of the process.

Erebus

erebus.Erebus

Bases: erebus.utility.h5_serializable_file.H5Serializable

Object instance for running the full pipeline, starting from calints files.

config: ErebusRunConfig = run_cfg instance-attribute

The configuration file used for this instance of the Erebus pipeline.

individual_fits: list[IndividualFit] = [] instance-attribute

The individual fit instances of each visit.

joint_fit: JointFit = None instance-attribute

The joint fit instance.

photometry: list[PhotometryData] = [] instance-attribute

The photometry data of each visit.

planet = Planet(planet_path) instance-attribute

The planet configuration file used for this instance of the pipeline

visit_names: list[str] = [] instance-attribute

The unique names of each visit.

load(path: str) staticmethod

Helper method to directly load an Erebus instance cache file.

run(force_clear_cache: bool = False, output_folder='./output_{DATE}/')

Performs all individual and joint fits. Results and plots are saved to the given folder. Output folder can optionally include the current time by writing {DATE}


WrappedFits

wrapped_fits.WrappedFits

Bases: erebus.utility.h5_serializable_file.H5Serializable

A class wrapping the flux and time data from the calints fits files of a single visit If the star pixel position is not provided we will fit for it Contains the flux in a 127x127 pixel region centered around the star Performs outerlier rejection and interpolation of bad pixels.

Acts as the equivalent to a JWST Stage 3 input to the Erebus pipeline.

frames = [] instance-attribute

3D array respresenting time series images making up this observation.

raw_frames = [] instance-attribute

3D array respresenting time series images making up this observation, before performing outlier and nan rejection.

source_folder: str = source_folder instance-attribute

The directory containing the files this WrappedFits is based on

time: list[float] = [] instance-attribute

The time values loaded from the corresponding fits files

visit_name: str = visit_name instance-attribute

The unique name of the visit being observed.

load(path: str) staticmethod

Helper method to directly load a WrappedFits instance cache file.


PhotometryData

photometry_data.PhotometryData

Bases: erebus.utility.h5_serializable_file.H5Serializable

A class representing the photometric data from a single visit loaded from a calints fits file with a specific aperture and annulus

Also prepares frames for FN PCA

Acts as Stage 3 of the Erebus pipeline

annulus_end = annulus[1] instance-attribute

Outer pixel radius of the annulus used for background subtraction when doing aperture photometry.

annulus_start = annulus[0] instance-attribute

Inner pixel radius of the annulus used for background subtraction when doing aperture photometry.

fits_file_location = os.path.abspath(fits_file._cache_file) instance-attribute

Absolute path of the cache file for the fits file that aperture photometry was performed on.

normalized_frames = [] instance-attribute

Normalized and background subtracted frames used for performing FN-PCA.

radius = radius instance-attribute

Pixel radius used for aperture photometry.

raw_flux = [] instance-attribute

Raw flux from the star after performing background subtraction.

source_folder: str = fits_file.source_folder instance-attribute

The directory containing the files this WrappedFits is based on

time = fits_file.time instance-attribute

The time values loaded from the corresponding fits files.

visit_name: str = fits_file.visit_name instance-attribute

The unique name of the visit being observed.

load(path: str) staticmethod

Helper method to directly load a PhotometryData instance cache file.


WrappedMCMC

mcmc_model.WrappedMCMC

Bases: erebus.utility.h5_serializable_file.H5Serializable

Wrapper class for emcee User can define a method that is to be fit and parameters with Bayesian priors The model will always fit for a Gaussian noise parameter "y_err"

auto_correlation = 0 instance-attribute

The integrated autocorrelation time after the MCMC has finished running

iterations = 0 instance-attribute

How many iterations this MCMC ran for before stopping.

model_function: Callable[[Any], float] = None instance-attribute

The function to be fit

params: dict = {} instance-attribute

Dictionary of parameters. Each is a bayesian_parameter instance.

results: dict = {} instance-attribute

Dictionary of results after fitting

sampler: emcee.EnsembleSampler | emcee.backends.HDFBackend = None instance-attribute

The emcee EnsembleSampler or HDFBackend which this class wrapped

add_parameter(name: str, param: Parameter)

Adds bayesian parameters to our method, must be called before set_method

evaluate_model(x: np.ndarray, *params: list[Parameter]) -> float

Evaluates the model with the given x input and parameters

get_free_params() -> list[Parameter]

Returns the keys of any parameter that isn't fixed i.e., will be fitted for

log_likelihood(theta: list[float], x: float, y: float)

Given the parameters theta and the x and y values, calculates the Bayesian log likelihood.

run(x, y, max_steps=2000000, walkers=64, force_clear_cache=False) -> tuple[np.ndarray, emcee.EnsembleSampler, float, int]

Runs the MCMC, gets the results (with errors), ensemble sampler instance, autocorrelation time, and interation count

set_method(method: Callable[[Any], float])

Updates the method which will be fit for, and verifies that the method signature matches the parameters specified First parameter must be 'x' After that the order which parameters were added in must match their positions in the method signature