Skip to content

connorrobinson/ensemble

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 

Repository files navigation

ensemble

This is an interactive widget implementation of the Honeycutt (1992) inhomogeneous ensemble photometry method which can be used to correct for atmospheric variations when creating light curves via differential photometry. It is intended for use within Jupyter lab. This code was written by Connor Robinson and has been used both for research and instructional purposes (in particular, Observational Astronomy, ASTR 341, at Amherst College).

If you use this code, please cite Robinson et al. (2022, currently in press) and Honeycutt (1992).

Here are instructions for setting up a conda environment that should allow you to use widgets. If your conda/Jupyter lab installation is already set up to work with widgets, this step may not be necessary.

conda create --name ensemble python=3.8.5
conda activate ensemble
conda install numpy
pip install jupyterlab --upgrade
pip install ipympl --upgrade
conda install nodejs
pip install ipywidgets --upgrade
jupyter labextension install jupyter-matplotlib
jupyter labextension install jupyterlab-plotly
jupyter labextension update --all
jupyter lab build
jupyter labextension list

If you are creating a new conda environement, you may also need to install a few other third-party modules via:

pip install astropy
pip install photutils
pip install scipy

The widget lets you interactively include/exclude stars in all exposures, entire exposures, and stars from individual exposures.

Before running the widget, it is recommended to use the basicExclude function to eliminate nans/negative fluxes. Before running the widget interactively, you must use the solveEnsemble function to get an initial solution. With this in mind, the average use of this function looks like the following:

import ensemble
%matplotlib widget 

ens_obj = ensemble.ens(photfiles, time, snr_cutoff = 5, save_name = 'ensemble', save_path = './')
ens_obj.basicExclude()
ens_obj.solveEnsemble()
ens_obj.plotEnsemble()

In this example, photfiles is a list of photometry files' names. Such files are typically generated via photutils.

Each of those photometry files must contain the following two columns, aper_sum_bkgsub and err. These two columns contain the background-subtracted photometry and the uncertainty in that measurement, respectively. The total number of stars and the order of the stars must not change between photometry files.

After the code above has been run, a set of 7 figures should appear. The top row of figures is interactive. Clicking on the points in those figures will mark a star/exposure for removal. Clicking again on that point will remove the mark. Clicking the Recalculate Solution button will add those stars to the mask, and re-calculate the instrumental magnitudes.

The Reset Weights button will return the solution to its initial state, and then automatically apply a basicExclude to the object.

The Select Star from Panel 3 button will let you select a star from the third panel from the left (mean instrumental magnitude without transparency variations vs. uncertainty in that value). This will cause an 8th plot to appear with the light curve for that object. This panel is interactive, and individual exposures of that particular star can be masked. This panel can also be created for an individual star by referring to its index in the photometry file (indexing starts at 0).

Masks generated by the widget can be reloaded and applied using the loadMask function via:

ens_obj = ensemble.ens(photfiles, time, snr_cutoff = 5, save_name = 'ensemble', save_path = './')
ens_obj.loadMask(maskfile = 'previous_created_mask.dat')
ens_obj.basicExclude()
ens_obj.solveEnsemble()

The entire code is written in an object-oriented sense, so after running the widget you have access to all of the object's attributes.

For example, ens_obj.M will give you all of the atmospheric-corrected instrumental magnitudes.

Similarly, ens_obj.w3 will give you the matrix of masked exposures/stars/stars in individual exposures.

Note that using this solution introduces an arbitrary zeropoint (in addition to the typical zeropoint) that you will need to correct for in order to place your photometry into an absolute scale.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors