Skip to content

Commit

Permalink
Allow exposure key to be set
Browse files Browse the repository at this point in the history
  • Loading branch information
mwcraig committed Feb 14, 2024
1 parent 4f0c18e commit 891c023
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
11 changes: 6 additions & 5 deletions stellarphot/notebooks/photometry/03-photometry-template.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -129,14 +129,15 @@
"outputs": [],
"source": [
"photometry_table = photometry_on_directory(\n",
" image_directory, object_name, \n",
" (star_ra, star_dec), \n",
" aperture, inner_annulus, outer_annulus, \n",
" max_adu, sources['star_id'], \n",
" image_directory, object_name,\n",
" (star_ra, star_dec),\n",
" aperture, inner_annulus, outer_annulus,\n",
" max_adu, sources['star_id'],\n",
" feder_cg_16m,\n",
" observatory_location='feder',\n",
" bjd_coords=main_target_coords,\n",
" fwhm_by_fit=False \n",
" fwhm_by_fit=False,\n",
" exposure_key='exposure',\n",
" )"
]
},
Expand Down
12 changes: 7 additions & 5 deletions stellarphot/photometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ def clipped_sky_per_pix_stats(data, annulus, sigma=5, iters=5):
def add_to_photometry_table(phot, ccd, annulus, apertures, fname='',
star_ids=None, camera=None,
bjd_coords=None, observatory_location=None,
fwhm_by_fit=True):
fwhm_by_fit=True, exposure_key='exposure'):
"""
Calculate several columns for photometry table.
Expand Down Expand Up @@ -362,7 +362,7 @@ def add_to_photometry_table(phot, ccd, annulus, apertures, fname='',
phot['annulus_inner'] = annulus.r_in * u.pixel
phot['annulus_outer'] = annulus.r_out * u.pixel
phot['annulus_area'] = annulus.area # * u.pixel * u.pixel
phot['exposure'] = [ccd.header['exposure']] * len(phot) * u.second
phot['exposure'] = [ccd.header[exposure_key]] * len(phot) * u.second
phot['date-obs'] = [ccd.header['DATE-OBS']] * len(phot)
night = Time(ccd.header['DATE-OBS'], scale='utc')
night.format = 'mjd'
Expand Down Expand Up @@ -403,7 +403,8 @@ def photometry_on_directory(directory_with_images, object_of_interest,
camera,
bjd_coords=None,
observatory_location=None,
fwhm_by_fit=True):
fwhm_by_fit=True,
exposure_key='exposure'):
"""
Perform aperture photometry on a directory of images.
Expand Down Expand Up @@ -546,7 +547,8 @@ def photometry_on_directory(directory_with_images, object_of_interest,
fname=fname, star_ids=star_ids[in_bounds],
camera=camera, bjd_coords=bjd_coords,
observatory_location=observatory_location,
fwhm_by_fit=fwhm_by_fit)
fwhm_by_fit=fwhm_by_fit,
exposure_key=exposure_key)

# And add the final table to the list of tables
phots.append(pho)
Expand Down Expand Up @@ -736,4 +738,4 @@ def find_times(phot_column, exposure, ra, dec,
# Adjust to midpoint of exposure
bary_time = time_barycenter + exposure / 2

return bary_time.jd
return bary_time.jd

0 comments on commit 891c023

Please sign in to comment.