PSF Model Construction

Demonstration of building an ePSF model from Gaia stars in an LCO image.

import os
import diffimageml
from matplotlib import pyplot as plt

# Get a dict with test data filenames
example_data_dict = diffimageml.get_example_data()
searchim1 = example_data_dict['searchim1']

Out:

Created TAP+ (v1.2.1) - Connection:
        Host: gea.esac.esa.int
        Use HTTPS: True
        Port: 443
        SSL Port: 443
Created TAP+ (v1.2.1) - Connection:
        Host: geadata.esac.esa.int
        Use HTTPS: True
        Port: 443
        SSL Port: 443

PSF Model Construction Overview

To construct a PSF model we go through the following steps

  • Load an example fits image

  • Fetch a catalog of stars in the image from the Gaia db

  • Do photometry of the Gaia stars

  • Measure the zero point for the image.

  • Build an ePSF model from the Gaia stars

assert(os.path.isfile(searchim1))
searchim = diffimageml.FitsImage(searchim1)

Out:

/usr/local/anaconda3/envs/astroconda/lib/python3.7/site-packages/astropy/wcs/wcs.py:709: FITSFixedWarning: 'obsfix' made the change 'Set OBSGEO-L to   149.070647 from OBSGEO-[XYZ].
Set OBSGEO-B to   -31.272933 from OBSGEO-[XYZ].
Set OBSGEO-H to     1164.993 from OBSGEO-[XYZ]'.
  FITSFixedWarning)

Fetch a catalog of stars in the image from the Gaia db (or read in a saved local copy)

searchim.fetch_gaia_sources(overwrite=False)
searchim.plot_gaia_sources(magmin=12, magmax=18)
Locations of Gaia Sources with 12<mag<18

Out:

Gaia catalog /Users/rodney/Dropbox/src/diffimageml/diffimageml/test_data/sky_image_1_GaiaCat.ecsv exists.
Reading without fetching.

Do photometry of the Gaia stars, within a user-specified magnitude range

searchim.do_stellar_photometry(searchim.gaia_source_table)

searchim.plot_stellar_photometry()
plot epsfmodel

Out:

/Users/rodney/Dropbox/src/diffimageml/diffimageml/fakeplanting.py:592: RuntimeWarning: invalid value encountered in log10
  phot['mag'] = -2.5 * np.log10( phot['aper_sum_bkgsub'] )

Measure the zero point for this image from the Gaia stars

searchim.measure_zeropoint(showplot=True)
plot epsfmodel

Out:

/Users/rodney/Dropbox/src/diffimageml/diffimageml/fakeplanting.py:668: RuntimeWarning: divide by zero encountered in true_divide
  (np.abs(star_flux/star_flux_err)>20))
/usr/local/anaconda3/envs/astroconda/lib/python3.7/site-packages/numpy/core/fromnumeric.py:748: UserWarning: Warning: 'partition' will ignore the 'mask' of the MaskedArray.
  a.partition(kth, axis=axis, kind=kind, order=order)
/usr/local/anaconda3/envs/astroconda/lib/python3.7/site-packages/numpy/core/fromnumeric.py:748: UserWarning: Warning: 'partition' will ignore the 'mask' of the MaskedArray.
  a.partition(kth, axis=axis, kind=kind, order=order)
/usr/local/anaconda3/envs/astroconda/lib/python3.7/site-packages/numpy/core/fromnumeric.py:748: UserWarning: Warning: 'partition' will ignore the 'mask' of the MaskedArray.
  a.partition(kth, axis=axis, kind=kind, order=order)
/usr/local/anaconda3/envs/astroconda/lib/python3.7/site-packages/numpy/core/fromnumeric.py:748: UserWarning: Warning: 'partition' will ignore the 'mask' of the MaskedArray.
  a.partition(kth, axis=axis, kind=kind, order=order)
/usr/local/anaconda3/envs/astroconda/lib/python3.7/site-packages/numpy/core/fromnumeric.py:748: UserWarning: Warning: 'partition' will ignore the 'mask' of the MaskedArray.
  a.partition(kth, axis=axis, kind=kind, order=order)
/usr/local/anaconda3/envs/astroconda/lib/python3.7/site-packages/numpy/core/fromnumeric.py:748: UserWarning: Warning: 'partition' will ignore the 'mask' of the MaskedArray.
  a.partition(kth, axis=axis, kind=kind, order=order)
/usr/local/anaconda3/envs/astroconda/lib/python3.7/site-packages/numpy/core/_asarray.py:136: UserWarning: Warning: converting a masked element to nan.
  return array(a, dtype, copy=False, order=order, subok=True)

Build an ePSF Model from the Gaia stars that are not saturated

searchim.build_epsf_model(verbose=False, save_suffix='TestEPSFModel')
searchim.plot_epsf_model()
plot epsfmodel

Total running time of the script: ( 0 minutes 3.438 seconds)

Gallery generated by Sphinx-Gallery