Extended Aperture Photometry#

Use case: Measure galaxy photometry in a field. Related to JDox Science Use Case #22.
Data: WST simulated NIRCam images from JADES JWST GTO extragalactic blank field.
(Williams et al. 2018) https://ui.adsabs.harvard.edu/abs/2018ApJS..236…33W.
Tools: photutils, matplotlib, scipy, scikit.
Cross-intrument: potentially MIRI.
Documentation: This notebook is part of a STScI’s larger post-pipeline Data Analysis Tools Ecosystem.

Introduction#

This notebook uses photutils to detect objects/galaxies in NIRCam deep imaging. Detections are first made in a F200W image, then isophotal photometry is obtained in all 9 filters (F090W, F115W, F150W, F200W, F277W, F335M, F356W, F410M, F444W). The catalog is loaded back in and some simple analysis is performed on the full catalog and on an individual galaxy.

The notebook analyzes only the central 1000 x 1000 pixels (30” x 30”) of the full JADES simulation. These cutouts have been staged at STScI with permission from the authors (Williams et al.).

NOTE: The photometry is aperture matched, but no PSF corrections are made. For more accurate color measurements, PSF corrections should be implemented, given the large range of wavelengths (and thus PSF FWHM) spanning a factor of >4.

NOTE: The simulated JADES images have different units (e-/s) than JWST pipeline products (MJy/sr).

NOTE: An exposure map is missing but required to calculate flux uncertainties.

To Do#

  • PSF corrections

  • Check accuracy of photometry against simulated JADES catalog

  • Exposure map required for input to error calculation

  • ABmag units cannot be written to ecsv file (astropy update coming soon)

  • plot with text labels looks horrible (I wish cursor hover would show id number instead)

  • Fix plot secondary axis: mag vs. flux

  • requirements.txt file – but I don’t know what versions are “required”

  • rest of Robel’s comments: https://github.com/spacetelescope/dat_pyinthesky/pull/82#pullrequestreview-355206337

Download WEBBPSF Data#

import os
import tarfile
import urllib.request

boxlink = 'https://stsci.box.com/shared/static/34o0keicz2iujyilg4uz617va46ks6u9.gz'                                                           
boxfile = './webbpsf-data/webbpsf-data-1.0.0.tar.gz'

webbpsf_folder = './webbpsf-data'

# Check whether the specified path exists or not
isExist = os.path.exists(webbpsf_folder)
if not isExist:
  # Create a new directory because it does not exist 
  os.makedirs(webbpsf_folder)
    
urllib.request.urlretrieve(boxlink, boxfile)
gzf = tarfile.open(boxfile)
gzf.extractall(webbpsf_folder)

Import packages#

import os

import numpy as np

from astropy.convolution import convolve
from astropy.io import fits
from astropy.stats import gaussian_fwhm_to_sigma
from astropy.table import QTable
import astropy.units as u
from astropy.visualization import make_lupton_rgb, SqrtStretch, ImageNormalize, simple_norm
import astropy.wcs as wcs

from photutils.background import Background2D, MedianBackground
from photutils.segmentation import (detect_sources, deblend_sources, SourceCatalog,
                                    make_2dgaussian_kernel, SegmentationImage)
from photutils.utils import calc_total_error

Matplotlib setup for plotting#

There are two versions

  • notebook – gives interactive plots, but makes the overall notebook a bit harder to scroll

  • inline – gives non-interactive plots for better overall scrolling

import matplotlib.pyplot as plt
import matplotlib as mpl

# Use this version for non-interactive plots (easier scrolling of the notebook)
%matplotlib inline

# Use this version if you want interactive plots
# %matplotlib notebook

# These gymnastics are needed to make the sizes of the figures
# be the same in both the inline and notebook versions
%config InlineBackend.print_figure_kwargs = {'bbox_inches': None}

mpl.rcParams['savefig.dpi'] = 80
mpl.rcParams['figure.dpi'] = 80

Create list of images to be loaded and analyzed#

baseurl = 'https://data.science.stsci.edu/redirect/JWST/jwst-data_analysis_tools/nircam_photometry/'

filters = 'F090W F115W F150W F200W F277W F335M F356W F410M F444W'.split()

# Data images [e-/s]
imagefiles = {}
for filt in filters:
    filename = f'jades_jwst_nircam_goods_s_crop_{filt}.fits'
    imagefiles[filt] = os.path.join(baseurl, filename)

# Weight images (Inverse Variance Maps; IVM)
weightfiles = {}
for filt in filters:
    filename = f'jades_jwst_nircam_goods_s_crop_{filt}_wht.fits'
    weightfiles[filt] = os.path.join(baseurl, filename)

Load detection image: F200W#

filt = 'F200W'
infile = imagefiles[filt]
hdu = fits.open(infile)
data = hdu[0].data
imwcs = wcs.WCS(hdu[0].header, hdu)

weight = fits.open(weightfiles[filt])[0].data

Report image size and field of view#

ny, nx = data.shape
pixscale = wcs.utils.proj_plane_pixel_scales(imwcs)[0] 
pixscale *= imwcs.wcs.cunit[0].to('arcsec')
outline = '%d x %d pixels' % (ny, nx)
outline += ' = %g" x %g"' % (ny * pixscale, nx * pixscale)
outline += ' (%.2f" / pixel)' % pixscale
print(outline)
1000 x 1000 pixels = 30" x 30" (0.03" / pixel)

Create color image (optional)#

# 3 NIRCam short wavelength channel images
r = fits.open(imagefiles['F200W'])[0].data
g = fits.open(imagefiles['F150W'])[0].data
b = fits.open(imagefiles['F090W'])[0].data

rgb = make_lupton_rgb(r, g, b, Q=5, stretch=0.02)  # , minimum=-0.001

fig = plt.figure(figsize=(8, 8))
ax = plt.subplot(projection=imwcs)
plt.imshow(rgb, origin='lower')
plt.xlabel('Right Ascension')
plt.ylabel('Declination')
fig.tight_layout()
plt.subplots_adjust(left=0.15)
../../_images/5b4ecdcd97877d98d57c2f1a40819642319786e4d69b042844cb9cdbfc6927c2.png

Detect Sources and Deblend using photutils#

https://photutils.readthedocs.io/en/latest/segmentation.html

# For detection, requiring 5 connected pixels 2-sigma above background

# Measure background and set detection threshold
bkg_estimator = MedianBackground()
bkg = Background2D(data, (50, 50), filter_size=(3, 3), bkg_estimator=bkg_estimator)
threshold = bkg.background + (2. * bkg.background_rms)

# Before detection, smooth image with Gaussian FWHM = 3 pixels
smooth_kernel = make_2dgaussian_kernel(3.0, size=3)
convolved_data = convolve(data, smooth_kernel)

# Detect and deblend
segm_detect = detect_sources(convolved_data, threshold, npixels=5)

segm_deblend = deblend_sources(convolved_data, segm_detect, npixels=5, nlevels=32, contrast=0.001)

# Save segmentation map of detected objects
segm_hdu = fits.PrimaryHDU(segm_deblend.data.astype(np.uint32), header=imwcs.to_header())
segm_hdu.writeto('JADES_detections_segm.fits', overwrite=True)

Measure photometry (and more) in detection image#

https://photutils.readthedocs.io/en/latest/segmentation.html#centroids-photometry-and-morphological-properties

#error = bkg.background_rms
# Input weight should be exposure map. Fudging for now.
error = calc_total_error(data, bkg.background_rms, weight/500)
#cat = source_properties(data-bkg.background, segm_deblend, wcs=imwcs, background=bkg.background, error=error)
cat = SourceCatalog(data-bkg.background, segm_deblend, wcs=imwcs, background=bkg.background, error=error)

Show detections alongside images (optional)#

fig, ax = plt.subplots(2, 3, sharex=True, sharey=True, figsize=(9.5, 6))
# For RA,Dec axes instead of pixels, add: , subplot_kw={'projection': imwcs})

# Color image
ax[0, 0].imshow(rgb, origin='lower')
ax[0, 0].set_title('Color Image')

# Data
norm = simple_norm(data, 'sqrt', percent=99.)
ax[0, 1].imshow(data, origin='lower', cmap='Greys_r', norm=norm)
ax[0, 1].set_title('Detection Image F200W')

# Segmentation map
cmap = segm_deblend.make_cmap(seed=12345)
ax[0, 2].imshow(segm_deblend, origin='lower', cmap=cmap, interpolation='nearest')
ax[0, 2].set_title('Detections (Segmentation Image)')

# Weight
ax[1, 0].imshow(weight, origin='lower', cmap='Greys_r', vmin=0)
ax[1, 0].set_title('Weight Image F200W')

# RMS
ax[1, 1].imshow(bkg.background_rms, origin='lower', norm=None)
ax[1, 1].set_title('Background RMS')

# Total error including Poisson noise
norm = simple_norm(error, 'sqrt', percent=99.)
ax[1, 2].imshow(error, origin='lower', norm=norm)
ax[1, 2].set_title('RMS + Poisson noise')

fig.tight_layout()
../../_images/dd3364023108bc7e94469bc015814b12319a6e4311d57841fd30196eb909f9a3.png

View all measured quantities in detection image (optional)#

cat.to_table()
QTable length=326
labelxcentroidycentroidsky_centroidbbox_xminbbox_xmaxbbox_yminbbox_ymaxareasemimajor_sigmasemiminor_sigmaorientationeccentricitymin_valuemax_valuelocal_backgroundsegment_fluxsegment_fluxerrkron_fluxkron_fluxerr
deg,degpix2pixpixdeg
int64float64float64SkyCoordint64int64int64int64float64float64float64float64float64float64float64float64float64float64float64float64
1466.244613500336478.797564260237153.17381009103326,-27.805320830365776460472314101.03.1218835927233961.687718238373556-44.4789474937866060.84127400633129780.00066971646287911340.030035654569434760.00.88635946268619040.043331053793477331.15236463988468780.05542864325311204
2104.8068179161906718.08212941103560253.17721522973072,-27.805243193448323951161027271.04.43307602055267052.8904310038200527-26.549722105819660.75820627200859060.0011695926826142560.056832899952609780.03.38509317966082260.100962735674347584.0643078865604630.1178471432803697
315.0441639655175513.2187096435808353.178060898531776,-27.805283643045666141612148.00.85019454558437720.6682678017840504-38.16122766424210.61820423015873090.00357281017560595040.0060673364311997410.00.040722280965723980.0112228255853605830.100868506984707420.02315230578296353
4710.324288970185814.25977713808687753.17151058505514,-27.805275444028442708712121725.01.27497536431044561.117371994707132-59.261781965590240.48160731527476410.00135306359668158640.0151009560126024680.00.154969013836878560.0185752119272267930.190116865465269460.023625589169720226
5434.529489171350822.21909152799715853.17410887322447,-27.80520896436384244471430268.03.95512761202273972.6287674709150584-8.1400603708823440.7471566761152122-0.00034209583965618370.106560584227364210.03.61478638229980160.087735020881218374.2787412093748450.10086436727140968
6289.3880251501489617.28176556215395453.17547627056455,-27.805250009193262287291152017.01.29130449311472351.197856886386651768.122709231498590.373492561225041150.00195128621973057470.0087972159450054980.00.085138042864578630.01664285701626640.343841986682007160.045989916939691816
7640.486309199531717.77342915466198353.17216853452775,-27.805246129692247638642152021.01.51249166928846180.8803106550282112-64.726783778115280.81316961831549830.00035762508811050880.0099469359108096920.00.097083238320361750.0144624942015966550.176958362626054360.026075310664432968
8762.76229173728528.28991415588462753.171016553902064,-27.8051585496483047547712136200.03.1603157747364452.353609520828006637.5200566173994760.6673561574146197-0.00019417920506550570.105561219677835720.03.82127525451699550.088479101581148913.98113926411816440.09150995786991047
9801.070672216388632.5802611851737453.17065564474934,-27.805122812753073799804313412.01.33494349088449060.6567170220834244-28.755196160479750.87062702081902230.00188568549006148190.0093360177941932860.00.059352035014049560.0121893556449921490.170035041723203220.027778386430149567
............................................................
317638.7423056471345555.451112915793153.1721846558466,-27.80076548202184630647544568256.04.19705304916704951.802182158743307864.567276919530170.90311808410056690.00148161062462474860.26581984901269460.08.6903575611912340.15880373512368948.7815669749162990.16012188685841844
31813.420742051379385884.69439586164553.17807529846922,-27.798021345154865621877892185.03.2854506161310663.147908093244288-13.3930448587041080.28631390025216620.00143610344190947580.034953824689460910.02.1174424728882570.107859322113198613.4115889668775650.15467709845637975
3197.027176577444122891.972789496016653.17813552144662,-27.79796068605963251188989529.01.6031954686028361.3128724093575075-82.752084057865720.57392230501919170.00190184549198246440.013475602039041760.00.214129651791188290.0350244755879704150.68930136830106510.07610234326451545
320143.92969676102126953.697360010852453.17684577662435,-27.79744643361144413914995095759.02.65075811101952661.396406846538550225.197030835258050.8499921992816310.00216170092196250620.0211652306331749260.00.56819240755599290.057438031999664681.2547609875056720.10492362090925443
321142.746173256619959.538991786639953.176856920479636,-27.79739775237413914795796348.02.14274366102136371.2555061677914512-35.474279501961710.81035884341569080.000475836657960552240.0304531849666570370.00.56379821148343390.05687180127081430.88938017849309430.08214060528713435
322790.415367777511955.310696054553753.17075559998907,-27.79743338893658278479695195993.02.6216918453590791.87721361254768815.1579663961045740.69806810009516010.00057679500669287080.040231696440169390.01.1156112062513310.078939427854693341.65211264929793010.10804543306519865
323797.3397409211948965.547894185163553.17069036467991,-27.797348081794517792802958974121.03.03040705074323261.763319778408639279.516579175166230.81327783742279260.0023334202218001770.087616869541827830.02.1169165448821110.106378809744707412.84789719110336260.1315925489047444
324790.7983558965504979.582229630056153.17075198078638,-27.79723112632807781799972989133.04.5064513596653571.493045462994405-44.198244691994310.9435209394229406-0.0012488494588083590.069434441931773130.02.0027505976507430.103721076699361242.8135770385945170.13630578304670982
325307.7502590912509989.99337070341553.175302486237165,-27.79714409344877530531198799337.01.7077279841087371.1914329585464343-56.826020731967630.71641791562883060.00179727124129960860.0305358601308233540.00.38752936791547650.0461670977630497460.73694739204939160.07417814641467854
326306.8506442261885997.24364472551253.1753109550711,-27.79708367385502430231299499951.02.50213536692315271.488388551756650215.3880989486417280.80383869619569260.0028531976752658360.020470511199261450.00.55054544032429590.054603633353214450.77776066915203050.07156975624994025

Only keep some quantities#

columns = 'label xcentroid ycentroid sky_centroid area semimajor_sigma semiminor_sigma ellipticity orientation gini'.split()
tbl = cat.to_table(columns=columns)
tbl.rename_column('semimajor_sigma', 'a')
tbl.rename_column('semiminor_sigma', 'b')
tbl
QTable length=326
labelxcentroidycentroidsky_centroidareaabellipticityorientationgini
deg,degpix2pixpixdeg
int64float64float64SkyCoordfloat64float64float64float64float64float64
1466.244613500336478.797564260237153.17381009103326,-27.805320830365776101.03.1218835927233961.6877182383735560.4593910412587602-44.4789474937866060.3750841422808698
2104.8068179161906718.08212941103560253.17721522973072,-27.805243193448323271.04.43307602055267052.89043100382005270.34798523859744157-26.549722105819660.4292034166747856
315.0441639655175513.2187096435808353.178060898531776,-27.8052836430456668.00.85019454558437720.66826780178405040.21398248759086114-38.16122766424210.10521135944081007
4710.324288970185814.25977713808687753.17151058505514,-27.80527544402844225.01.27497536431044561.1173719947071320.12361287442487268-59.261781965590240.33737600483155716
5434.529489171350822.21909152799715853.17410887322447,-27.8052089643638268.03.95512761202273972.62876747091505840.33535204706817323-8.1400603708823440.5363680123723463
6289.3880251501489617.28176556215395453.17547627056455,-27.80525000919326217.01.29130449311472351.19785688638665170.0723668253509047768.122709231498590.18041073594089005
7640.486309199531717.77342915466198353.17216853452775,-27.80524612969224721.01.51249166928846180.88031065502821120.41797322067741016-64.726783778115280.257339933672325
8762.76229173728528.28991415588462753.171016553902064,-27.805158549648304200.03.1603157747364452.35360952082800660.255261281279942337.5200566173994760.5417393494467531
9801.070672216388632.5802611851737453.17065564474934,-27.80512281275307312.01.33494349088449060.65671702208342440.5080563135685205-28.755196160479750.28793220448127643
..............................
317638.7423056471345555.451112915793153.1721846558466,-27.80076548202184256.04.19705304916704951.80218215874330780.570607724603106964.567276919530170.6381184942652184
31813.420742051379385884.69439586164553.17807529846922,-27.798021345154865185.03.2854506161310663.1479080932442880.041864127316802446-13.3930448587041080.331692826709577
3197.027176577444122891.972789496016653.17813552144662,-27.79796068605963229.01.6031954686028361.31287240935750750.18109024440939903-82.752084057865720.254070174248954
320143.92969676102126953.697360010852453.17684577662435,-27.79744643361144459.02.65075811101952661.39640684653855020.4732047255713316425.197030835258050.2823870637944277
321142.746173256619959.538991786639953.176856920479636,-27.79739775237448.02.14274366102136371.25550616779145120.41406609169806174-35.474279501961710.3421221334166607
322790.415367777511955.310696054553753.17075559998907,-27.79743338893658293.02.6216918453590791.87721361254768810.283968626644381055.1579663961045740.37596577589838664
323797.3397409211948965.547894185163553.17069036467991,-27.797348081794517121.03.03040705074323261.76331977840863920.418124447019033279.516579175166230.47716929153411286
324790.7983558965504979.582229630056153.17075198078638,-27.79723112632807133.04.5064513596653571.4930454629944050.6686871012615841-44.198244691994310.42319913307021234
325307.7502590912509989.99337070341553.175302486237165,-27.79714409344877537.01.7077279841087371.19143295854643430.3023286087519126-56.826020731967630.35854189153102795
326306.8506442261885997.24364472551253.1753109550711,-27.79708367385502451.02.50213536692315271.48838855175665020.405152666225686815.3880989486417280.24216628412005226

Convert measured fluxes (data units) to magnitudes#

https://docs.astropy.org/en/stable/units/

https://docs.astropy.org/en/stable/units/equivalencies.html#photometric-zero-point-equivalency

https://docs.astropy.org/en/stable/units/logarithmic_units.html#logarithmic-units

# not detected: mag =  99; magerr = 1-sigma upper limit assuming zero flux
# not observed: mag = -99; magerr = 0
def fluxes2mags(flux, fluxerr):
    nondet = flux < 0  # Non-detection if flux is negative
    unobs = (fluxerr <= 0) + (fluxerr == np.inf)  # Unobserved if flux uncertainty is negative or infinity

    mag = flux.to(u.ABmag)
    magupperlimit = fluxerr.to(u.ABmag)  # 1-sigma upper limit if flux=0

    mag = np.where(nondet, 99 * u.ABmag, mag)
    mag = np.where(unobs, -99 * u.ABmag, mag)

    magerr = 2.5 * np.log10(1 + fluxerr/flux) 
    magerr = magerr.value * u.ABmag

    magerr = np.where(nondet, magupperlimit, magerr)
    magerr = np.where(unobs, 0*u.ABmag, magerr)
    
    return mag, magerr

# Includes features I couldn't find in astropy:
# mag = 99 / -99 for non-detections / unobserved
# flux uncertainties -> mag uncertainties

Multiband photometry using isophotal apertures defined in detection image#

(Similar to running SourceExtractor in double-image mode)

filters = 'F090W F115W F150W F200W F277W F335M F356W F410M F444W'.split()
for filt in filters:
    infile = imagefiles[filt]
    print(filt)
    print(infile)
    print(weightfiles[filt])
    hdu = fits.open(infile)
    data = hdu[0].data
    zp = hdu[0].header['ABMAG'] * u.ABmag  # zeropoint
    weight = fits.open(weightfiles[filt])[0].data
    
    # Measure background
    bkg = Background2D(data, (50, 50), filter_size=(3, 3), bkg_estimator=bkg_estimator)
    #error = bkg.background_rms
    error = calc_total_error(data, bkg.background_rms, weight/500)
                             
    # Measure properties in each image of previously detected objects 
    filtcat = SourceCatalog(data-bkg.background, segm_deblend, wcs=imwcs, background=bkg.background, error=error)

    # Convert measured fluxes to fluxes in nJy and to AB magnitudes
    filttbl = filtcat.to_table()
    tbl[filt+'_flux']    = flux    = filttbl['segment_flux']     * zp.to(u.nJy)
    tbl[filt+'_fluxerr'] = fluxerr = filttbl['segment_fluxerr'] * zp.to(u.nJy)

    mag, magerr = fluxes2mags(flux, fluxerr)
    #mag = mag * u.ABmag  # incompatible with file writing
    tbl[filt+'_mag']    = mag.value
    tbl[filt+'_magerr'] = magerr.value
F090W
https://data.science.stsci.edu/redirect/JWST/jwst-data_analysis_tools/nircam_photometry/jades_jwst_nircam_goods_s_crop_F090W.fits
https://data.science.stsci.edu/redirect/JWST/jwst-data_analysis_tools/nircam_photometry/jades_jwst_nircam_goods_s_crop_F090W_wht.fits
/opt/hostedtoolcache/Python/3.11.6/x64/lib/python3.11/site-packages/astropy/units/function/logarithmic.py:67: RuntimeWarning: invalid value encountered in log10
  return dex.to(self._function_unit, np.log10(x))
F115W
https://data.science.stsci.edu/redirect/JWST/jwst-data_analysis_tools/nircam_photometry/jades_jwst_nircam_goods_s_crop_F115W.fits
https://data.science.stsci.edu/redirect/JWST/jwst-data_analysis_tools/nircam_photometry/jades_jwst_nircam_goods_s_crop_F115W_wht.fits
/opt/hostedtoolcache/Python/3.11.6/x64/lib/python3.11/site-packages/astropy/units/function/logarithmic.py:67: RuntimeWarning: invalid value encountered in log10
  return dex.to(self._function_unit, np.log10(x))
/opt/hostedtoolcache/Python/3.11.6/x64/lib/python3.11/site-packages/astropy/units/quantity.py:666: RuntimeWarning: invalid value encountered in log10
  result = super().__array_ufunc__(function, method, *arrays, **kwargs)
F150W
https://data.science.stsci.edu/redirect/JWST/jwst-data_analysis_tools/nircam_photometry/jades_jwst_nircam_goods_s_crop_F150W.fits
https://data.science.stsci.edu/redirect/JWST/jwst-data_analysis_tools/nircam_photometry/jades_jwst_nircam_goods_s_crop_F150W_wht.fits
F200W
https://data.science.stsci.edu/redirect/JWST/jwst-data_analysis_tools/nircam_photometry/jades_jwst_nircam_goods_s_crop_F200W.fits
https://data.science.stsci.edu/redirect/JWST/jwst-data_analysis_tools/nircam_photometry/jades_jwst_nircam_goods_s_crop_F200W_wht.fits
F277W
https://data.science.stsci.edu/redirect/JWST/jwst-data_analysis_tools/nircam_photometry/jades_jwst_nircam_goods_s_crop_F277W.fits
https://data.science.stsci.edu/redirect/JWST/jwst-data_analysis_tools/nircam_photometry/jades_jwst_nircam_goods_s_crop_F277W_wht.fits
F335M
https://data.science.stsci.edu/redirect/JWST/jwst-data_analysis_tools/nircam_photometry/jades_jwst_nircam_goods_s_crop_F335M.fits
https://data.science.stsci.edu/redirect/JWST/jwst-data_analysis_tools/nircam_photometry/jades_jwst_nircam_goods_s_crop_F335M_wht.fits
F356W
https://data.science.stsci.edu/redirect/JWST/jwst-data_analysis_tools/nircam_photometry/jades_jwst_nircam_goods_s_crop_F356W.fits
https://data.science.stsci.edu/redirect/JWST/jwst-data_analysis_tools/nircam_photometry/jades_jwst_nircam_goods_s_crop_F356W_wht.fits
F410M
https://data.science.stsci.edu/redirect/JWST/jwst-data_analysis_tools/nircam_photometry/jades_jwst_nircam_goods_s_crop_F410M.fits
https://data.science.stsci.edu/redirect/JWST/jwst-data_analysis_tools/nircam_photometry/jades_jwst_nircam_goods_s_crop_F410M_wht.fits
/opt/hostedtoolcache/Python/3.11.6/x64/lib/python3.11/site-packages/astropy/units/function/logarithmic.py:67: RuntimeWarning: invalid value encountered in log10
  return dex.to(self._function_unit, np.log10(x))
/opt/hostedtoolcache/Python/3.11.6/x64/lib/python3.11/site-packages/astropy/units/quantity.py:666: RuntimeWarning: invalid value encountered in log10
  result = super().__array_ufunc__(function, method, *arrays, **kwargs)
F444W
https://data.science.stsci.edu/redirect/JWST/jwst-data_analysis_tools/nircam_photometry/jades_jwst_nircam_goods_s_crop_F444W.fits
https://data.science.stsci.edu/redirect/JWST/jwst-data_analysis_tools/nircam_photometry/jades_jwst_nircam_goods_s_crop_F444W_wht.fits
/opt/hostedtoolcache/Python/3.11.6/x64/lib/python3.11/site-packages/astropy/units/function/logarithmic.py:67: RuntimeWarning: invalid value encountered in log10
  return dex.to(self._function_unit, np.log10(x))
/opt/hostedtoolcache/Python/3.11.6/x64/lib/python3.11/site-packages/astropy/units/quantity.py:666: RuntimeWarning: invalid value encountered in log10
  result = super().__array_ufunc__(function, method, *arrays, **kwargs)

View complete results (optional)#

tbl
QTable length=326
labelxcentroidycentroidsky_centroidareaabellipticityorientationginiF090W_fluxF090W_fluxerrF090W_magF090W_magerrF115W_fluxF115W_fluxerrF115W_magF115W_magerrF150W_fluxF150W_fluxerrF150W_magF150W_magerrF200W_fluxF200W_fluxerrF200W_magF200W_magerrF277W_fluxF277W_fluxerrF277W_magF277W_magerrF335M_fluxF335M_fluxerrF335M_magF335M_magerrF356W_fluxF356W_fluxerrF356W_magF356W_magerrF410M_fluxF410M_fluxerrF410M_magF410M_magerrF444W_fluxF444W_fluxerrF444W_magF444W_magerr
deg,degpix2pixpixdegnJynJynJynJynJynJynJynJynJynJynJynJynJynJynJynJynJynJy
int64float64float64SkyCoordfloat64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64
1466.244613500336478.797564260237153.17381009103326,-27.805320830365776101.03.1218835927233961.6877182383735560.4593910412587602-44.4789474937866060.37508414228086989.1728113741360760.846427243596817128.9937438426275270.0958306422937143215.2517506658041460.73518661292027228.4417007578649360.05111393562458308618.3560350985098030.907615566909567228.2405528014091020.05239928636667709520.3558801662447270.995128698489914528.1282752861371360.0518212882909908215.3054146318122160.372429099131501428.4378872515976940.0261030798431231914.020837882792390.4536467684272995628.5330650805810180.0345728557738658714.1740145731637470.3999261081137787728.521267812624460.0302103064516409813.8806116819573550.4650116285226762528.5439784881169170.03577704531629849513.8075784440798550.498639263295004728.549706201922080.038518276199782
2104.8068179161906718.08212941103560253.17721522973072,-27.805243193448323271.04.43307602055267052.89043100382005270.34798523859744157-26.549722105819660.429203416674785666.579677612253852.43625593670397426.8416457802162580.03901919740515264667.808073300926541.781930480208537226.821796488735380.02816363896580965270.393384129251092.109685837597136326.781170389473360.03206137974340851677.741090401314922.31868156787635726.67337343055230.03190930252363899472.900690267577690.831882411325622726.7431708987530430.01231936770850041475.272502539519281.07060310590987926.7084091124971150.01533367028926042771.487928966360160.934213121607566226.7644182110873250.01409662645806181961.427673890999040.999308782885589626.9290898249775950.01752068594229819257.22037605466371.05109315762743627.006123230800470.019763151293857934
315.0441639655175513.2187096435808353.178060898531776,-27.8052836430456668.00.85019454558437720.66826780178405040.21398248759086114-38.16122766424210.105211359440810070.301894580750470430.2200328563890326432.7003617071018340.59438702667428370.76733445756473030.2004971048544152731.687538247837740.25203770031058470.71852631045809110.2241374473625416831.7588933114216050.29478533710469820.93521636122917530.2577402310908105731.472719759936880.264281363540913860.349713623329662270.0690028698237118332.540718622818150.195518792806108040.56076173468020880.1133629984973717932.028054073660130.199904727160175320.26686576820951520.070565366515182632.834267827719050.2547307087052081-0.060316541767083690.0827580445377532299.034.105474449211510.117654224275606340.0820075811266348533.7234811880781460.5742186726193422
4710.324288970185814.25977713808687753.17151058505514,-27.80527544402844225.01.27497536431044561.1173719947071320.12361287442487268-59.261781965590240.337376004831557162.65668362107971130.437148813338989230.339150404339740.16539237459845983.8182797524997350.36055790856434229.9453306387060180.097969388847036183.97618217442761160.424625002375230329.9013343150025830.1101651654686413.55897444315034230.4265930516579788430.021687826589590.122913247141083881.69622982190262820.1267276882693104730.8262882640099040.078229629403633621.5905365350914810.1668091058917216830.8961408764255130.108283847620601091.99122551345588940.15112702576884630.6521988794351260.079426225929088091.94383536574491340.17889684257333530.678351301683160.095589325504576581.62531031364175880.1710244148684479430.87265927188790.1086274373485027
5434.529489171350822.21909152799715853.17410887322447,-27.8052089643638268.03.95512761202273972.62876747091505840.33535204706817323-8.1400603708823440.536368012372346348.2350218892651.791998490452027927.1915938001373120.03960539258555663454.21551570217991.365885173093791527.0646910170703950.0270147384460965958.28722233289991.62357994654179626.98606660103220.0298294394506768683.016159382640152.01489761956019726.6020934061792430.026037350500330014133.101917028759151.056137229300284626.0895392236533470.008581100944569356133.484096704706731.282653671522106626.0864261826550030.010383073588802694144.053021534546281.23847235839944926.0036940697342050.009294542790143837161.56838200592771.430304180075947325.8791090603865040.009569320100872941148.333626365368811.572246876965978325.9719009644804720.01144758607362489
6289.3880251501489617.28176556215395453.17547627056455,-27.80525000919326217.01.29130449311472351.19785688638665170.0723668253509047768.122709231498590.180410735940890051.13035543083477560.382167096054356331.2669624369135060.31621706585417751.50114626067312980.2867616101344518430.9589424780715560.189805318708523161.0456240056925170.2893029634602568631.351561136684410.265204904378739341.9552561585880510.3822151365320357630.6719908437858420.19385655954830741.1886164496262840.123682444182432231.2123956592554140.107477566115040251.77084710147560730.1974670158310179430.779547337640330.114783356068400871.49214383421275150.1506799168480845730.965473278294250.104450710850947041.14339271696203640.1756375050398780431.254511446067160.155148311919992820.59265530326064010.1365705667809733531.9679945626145850.2251497308694742
7640.486309199531717.77342915466198353.17216853452775,-27.80524612969224721.01.51249166928846180.88031065502821120.41797322067741016-64.726783778115280.2573399336723251.73185623741598740.3544951964949517630.803720404769350.202189066425502221.6434298430260240.2498558069461806530.860622077354130.153662435358851161.6361021047277310.284066146485871830.8654739916737770.173822203240218942.22958613135484460.3321415421916017530.5294393642967030.150771763920817121.03995986848430630.0961779028754872631.3574585489455870.096036044886159631.65375745174451930.150720959938050630.8538204647295730.0946996913262891.26045722368299450.1159191274040514831.148679721128420.095522726030017380.407881321750577950.1157545116742151732.373665455059720.271238851352037070.56881407078372240.1086500556501025132.012574172449660.18978993015591245
8762.76229173728528.28991415588462753.171016553902064,-27.805158549648304200.03.1603157747364452.35360952082800660.255261281279942337.5200566173994760.541739349446753152.8845733034692741.790581963307944527.0916774884495870.036152551007217255.844804007755341.34040385529675227.03254307229470.02575233246567279561.656514177672831.629973120531874426.9250525806405070.02833005796311033787.758324289164492.031985965992353426.541779195093080.02485287557612766385.910844314879360.787204773810109226.5648800319568960.00990334428786069273.696764079893820.893239425770293426.731378952438490.01308052134695740374.681992063142020.836338501824619726.7169602655563350.01209121737655272370.619100872280840.900119750012822726.7776945405195550.01375147328893841573.99616545286091.038715415080909726.7269769630310560.015134956407915642
9801.070672216388632.5802611851737453.17065564474934,-27.80512281275307312.01.33494349088449060.65671702208342440.5080563135685205-28.755196160479750.287932204481276431.12460361701691360.300478643625907431.2725013100516880.2571011451448371.27974761070761890.230552601172388131.132189181514940.179847389820327941.27343422323037130.259593617706524231.137558706895880.201433811995736651.36306201177940830.279937286460770731.0637109642999860.202804409146797811.0827870683235610.1003013786232939431.3136423490742320.09618538263285320.67813671012309810.116101215374980331.8217068624302930.171583415262564180.57588910431538080.0898934281714666631.999152845351170.157483837331875961.10761760369296080.1352058544185378631.2890253762535830.125048981016840451.1134330029492510.1420534202367805831.2833397750993640.1303698266479056
..........................................................................................................................................
317638.7423056471345555.451112915793153.1721846558466,-27.80076548202184256.04.19705304916704951.80218215874330780.570607724603106964.567276919530170.6381184942652184120.111051233862553.1493498228977226.2010425799714780.02810152116245664165.088845669807342.66346251568541625.8557056728045680.017376934181754438210.825387721961363.524258509556269325.5901927307589540.017999658448518377199.5802883192753.647041565205658525.649705885789260.019661163764616296143.098474941692671.192377609393458426.0109124866686340.009009485356804967125.456201169973271.400120002631767326.153769667731930.01204994954280746115.521816908108321.249681637389729726.2433399730216050.011682107040887598106.858779634355141.312192814536148626.327974474809410.01325130980906172104.252923089939911.463033268249008126.3547793981029270.015130755569956123
31813.420742051379385884.69439586164553.17807529846922,-27.798021345154865185.03.2854506161310663.1479080932442880.041864127316802446-13.3930448587041080.33169282670957718.866841998786471.965226511200632228.2107519688878840.1075829567519056631.878243888856221.714135626712914427.6412640276617340.0568659480934949350.411983445663612.411109131730536427.143665537571010.05072509705139082648.628583606931472.47706661707518627.1827709495965270.0539432452099056636.7599141863171750.821703469431254827.4865637777940040.02400245242646665833.45905257531931.00727329871800927.5887159016450740.0322033763618541734.352933914005310.912840780800503527.5600904151973540.02847398663316221731.6580080050867961.014066411127613427.6487910385622050.034232812531202131.8118927517083781.107344064357658427.6435262259137670.03715062136419812
3197.027176577444122891.972789496016653.17813552144662,-27.79796068605963229.01.6031954686028361.31287240935750750.18109024440939903-82.752084057865720.2540701742489544.465998160865690.882646051001678329.7752036502763460.195812924990617623.5314931438316540.590626482918741130.030104081417470.16790555929505895.1074722038395010.785080244552009629.6294849705747940.155243612522276484.9176408843105480.804362178064438729.670607973080680.164478187832177943.9972871523467680.284366776845450429.8955866307256280.074615535485075883.83778350482695040.366137122692950229.939798820295620.098935089545118953.41237447912869340.3062879888543963430.0673582868921550.093325188190969913.285263871523360.3549824646600951430.108574355713950.1114012893045353.9791561254101990.4049695368455653629.9005225515598030.10523003616876628
320143.92969676102126953.697360010852453.17684577662435,-27.79744643361144459.02.65075811101952661.39640684653855020.4732047255713316425.197030835258050.28238706379442775.3423393011009061.081979293864607629.580671331634470.200239007502720175.9220643401050940.803661682053712829.4688171963515940.138165126364268927.2127925308145530.999637111864562129.2547413992552660.1409205540227747613.048945768038541.319105561108058428.611061434534150.104556111587579448.3787922001590280.4134455928815519729.0920464506231550.0522950141551488956.6945377333171190.504486794403155929.3356985155622460.078882648678986886.4688405080855450.4254484211970982529.3729338910899750.069157591295085537.5253707895246170.528495920804460829.2086802417016570.073691336340465836.7167421878142030.539282580226544729.3321033028272070.08385019406434349
321142.746173256619959.538991786639953.176856920479636,-27.79739775237448.02.14274366102136371.25550616779145120.41406609169806174-35.474279501961710.34212213341666076.93623627526871541.139260790444685629.2971903037886320.165113462953637777.9032548514362690.869397174846005629.15548503351460.1133122912371793410.1876231034166231.126300674358175628.8798178259215630.1138509473215943612.9480299066464631.306101666697101528.6194907653970670.104342673528034229.0230177648825510.4184777153387268529.0116204689373620.0492224428626934845.4470147353357070.4567689453008257329.5596036246653750.08742971518734176.4728886875983230.4196891132056484529.3722546533873050.068208845779479716.4883486447543360.486939506762526729.3696645545042580.078569937425284915.766279267773310.500732540740538529.4977608200984950.09041210263092743
322790.415367777511955.310696054553753.17075559998907,-27.79743338893658293.02.6216918453590791.87721361254768810.283968626644381055.1579663961045740.3759657758983866420.7295954744857131.870347033228309628.1085229320437830.093791267897430928.0339494773257841.538051760665003327.7807892841953930.0579910734619348125.743535401426621.735843787413559727.8733295274275430.0708468198385982125.6208107236193431.812900523374865227.878517829801560.074229237717811821.153422168873440.626489923444431428.0865484077399050.0316887140695651718.8282531675154350.747594125720568328.2129749268436250.0422763481530478917.9646114766730560.659635837874642428.2639554272729540.03915225246889715612.7900649551743420.672215846270953128.6328181248076350.0556147373001650713.5809290191801710.740094537635525428.5676763015556960.05761144934684235
323797.3397409211948965.547894185163553.17069036467991,-27.797348081794517121.03.03040705074323261.76331977840863920.418124447019033279.516579175166230.4771692915341128645.6191970673742662.65180369693960427.252130907264680.06134666425101166550.3922743874511742.018818659353362627.144090099763040.0426481425630090449.8317522684630352.356774882910816627.1562346029059720.05017220416241903548.616505293425642.443065589697064827.1830406570435880.0532335584650968433.583688696988320.777902003986924827.584679011057260.02486216210030646823.7552130360761420.852324377821881527.9606026762168160.0382730614421580923.0238656422024380.759222550305247527.9945543944095160.0352250102219759619.633159290472230.807837335677933528.1675245245583770.04377969092125870418.687314501548860.863325357266125628.2211327632673380.049035202457045374
324790.7983558965504979.582229630056153.17075198078638,-27.79723112632807133.04.5064513596653571.4930454629944050.6686871012615841-44.198244691994310.4231991330702123434.209891407325312.3536239097239727.5646207609911720.0722406193325142936.571354650115381.755790538033174227.4921473813415250.05091356101879860542.688495614491942.206478605566889727.3242228747514880.0547171910314670245.994602511607742.38202884595770327.2432328249786760.0548218838777627534.800043028220410.782298163999233227.546050547683320.0241368470061163123.405681882620230.846231745268850827.9766967549008920.0385617870139375222.7673781948075950.743845746517937928.0067174455400550.03490554080327222520.5012563699189950.820549850987213228.1205488086040520.042608788682020619.0896042068368780.866780953485821528.1980076898289060.048212383021397735
325307.7502590912509989.99337070341553.175302486237165,-27.79714409344877537.01.7077279841087371.19143295854643430.3023286087519126-56.826020731967630.358541891531027957.1261981205936761.091997378452664629.267855269204540.15479643992850696.5981880062773260.766457006981659229.3514382849785280.119317830101563566.1965393671464640.865889760150625529.4196269671221170.14201222369413888.8998896116945671.060260480369763529.026538450053230.122203157473968556.0336102486116920.34161522637612329.448556868127210.059795741210375184.9423776434707940.4073228619036960429.665160183853740.085983857362888337.3357692451906430.4148193197668883529.236385845852090.0597225539913412154.1768142265158380.392216758958128129.847887101395040.09744735961962914.6045842376522960.439548874251967129.7420239437682420.0989902908814326
326306.8506442261885997.24364472551253.1753109550711,-27.79708367385502451.02.50213536692315271.48838855175665020.405152666225686815.3880989486417280.242166284120052268.1401923135684751.178307246195210229.1234133367527370.1467783093291237510.6219228204933260.957959103698457328.8344921462857150.093752473966895810.7351530712243461.113897236630896628.8229793965802440.1071882550223177112.6436705209312021.254011565252638528.6453170747112150.102673006799247089.5530095179528410.4169352328641537428.949649473883190.046381352991875999.1532355496703720.515131417229329328.996063403363430.0594462180549252810.1676347537804870.4754200471048225528.8819501577250860.049615903552018177.8728747391217970.502927182932359729.1596666457951020.067232641380843447.5689023884019640.544402577399418129.2024177389057660.07541224065721708

Save photometry as output catalog#

tbl.write('JADESphotometry.ecsv', overwrite=True)
!head -175 JADESphotometry.ecsv  # show the first 175 lines
# %ECSV 1.0
# ---
# datatype:
# - {name: label, datatype: int64}
# - {name: xcentroid, datatype: float64}
# - {name: ycentroid, datatype: float64}
# - {name: sky_centroid.ra, unit: deg, datatype: float64}
# - {name: sky_centroid.dec, unit: deg, datatype: float64}
# - {name: area, unit: pix2, datatype: float64}
# - {name: a, unit: pix, datatype: float64}
# - {name: b, unit: pix, datatype: float64}
# - {name: ellipticity, datatype: float64}
# - {name: orientation, unit: deg, datatype: float64}
# - {name: gini, datatype: float64}
# - {name: F090W_flux, unit: nJy, datatype: float64}
# - {name: F090W_fluxerr, unit: nJy, datatype: float64}
# - {name: F090W_mag, datatype: float64}
# - {name: F090W_magerr, datatype: float64}
# - {name: F115W_flux, unit: nJy, datatype: float64}
# - {name: F115W_fluxerr, unit: nJy, datatype: float64}
# - {name: F115W_mag, datatype: float64}
# - {name: F115W_magerr, datatype: float64}
# - {name: F150W_flux, unit: nJy, datatype: float64}
# - {name: F150W_fluxerr, unit: nJy, datatype: float64}
# - {name: F150W_mag, datatype: float64}
# - {name: F150W_magerr, datatype: float64}
# - {name: F200W_flux, unit: nJy, datatype: float64}
# - {name: F200W_fluxerr, unit: nJy, datatype: float64}
# - {name: F200W_mag, datatype: float64}
# - {name: F200W_magerr, datatype: float64}
# - {name: F277W_flux, unit: nJy, datatype: float64}
# - {name: F277W_fluxerr, unit: nJy, datatype: float64}
# - {name: F277W_mag, datatype: float64}
# - {name: F277W_magerr, datatype: float64}
# - {name: F335M_flux, unit: nJy, datatype: float64}
# - {name: F335M_fluxerr, unit: nJy, datatype: float64}
# - {name: F335M_mag, datatype: float64}
# - {name: F335M_magerr, datatype: float64}
# - {name: F356W_flux, unit: nJy, datatype: float64}
# - {name: F356W_fluxerr, unit: nJy, datatype: float64}
# - {name: F356W_mag, datatype: float64}
# - {name: F356W_magerr, datatype: float64}
# - {name: F410M_flux, unit: nJy, datatype: float64}
# - {name: F410M_fluxerr, unit: nJy, datatype: float64}
# - {name: F410M_mag, datatype: float64}
# - {name: F410M_magerr, datatype: float64}
# - {name: F444W_flux, unit: nJy, datatype: float64}
# - {name: F444W_fluxerr, unit: nJy, datatype: float64}
# - {name: F444W_mag, datatype: float64}
# - {name: F444W_magerr, datatype: float64}
# meta: !!omap
# - {date: '2023-12-13 15:12:59 UTC'}
# - version: {Python: 3.11.6, astropy: 6.0.0, bottleneck: null, gwcs: 0.20.0, matplotlib: 3.8.2, numpy: 1.26.2, photutils: 1.10.0, scipy: 1.11.4,
#     skimage: 0.22.0, sklearn: null}
# - {localbkg_width: 0}
# - {apermask_method: correct}
# - kron_params: !!python/tuple [2.5, 1.4, 0.0]
# - __serialized_columns__:
#     F090W_flux:
#       __class__: astropy.units.quantity.Quantity
#       unit: &id001 !astropy.units.Unit {unit: nJy}
#       value: !astropy.table.SerializedColumn {name: F090W_flux}
#     F090W_fluxerr:
#       __class__: astropy.units.quantity.Quantity
#       unit: *id001
#       value: !astropy.table.SerializedColumn {name: F090W_fluxerr}
#     F115W_flux:
#       __class__: astropy.units.quantity.Quantity
#       unit: *id001
#       value: !astropy.table.SerializedColumn {name: F115W_flux}
#     F115W_fluxerr:
#       __class__: astropy.units.quantity.Quantity
#       unit: *id001
#       value: !astropy.table.SerializedColumn {name: F115W_fluxerr}
#     F150W_flux:
#       __class__: astropy.units.quantity.Quantity
#       unit: *id001
#       value: !astropy.table.SerializedColumn {name: F150W_flux}
#     F150W_fluxerr:
#       __class__: astropy.units.quantity.Quantity
#       unit: *id001
#       value: !astropy.table.SerializedColumn {name: F150W_fluxerr}
#     F200W_flux:
#       __class__: astropy.units.quantity.Quantity
#       unit: *id001
#       value: !astropy.table.SerializedColumn {name: F200W_flux}
#     F200W_fluxerr:
#       __class__: astropy.units.quantity.Quantity
#       unit: *id001
#       value: !astropy.table.SerializedColumn {name: F200W_fluxerr}
#     F277W_flux:
#       __class__: astropy.units.quantity.Quantity
#       unit: *id001
#       value: !astropy.table.SerializedColumn {name: F277W_flux}
#     F277W_fluxerr:
#       __class__: astropy.units.quantity.Quantity
#       unit: *id001
#       value: !astropy.table.SerializedColumn {name: F277W_fluxerr}
#     F335M_flux:
#       __class__: astropy.units.quantity.Quantity
#       unit: *id001
#       value: !astropy.table.SerializedColumn {name: F335M_flux}
#     F335M_fluxerr:
#       __class__: astropy.units.quantity.Quantity
#       unit: *id001
#       value: !astropy.table.SerializedColumn {name: F335M_fluxerr}
#     F356W_flux:
#       __class__: astropy.units.quantity.Quantity
#       unit: *id001
#       value: !astropy.table.SerializedColumn {name: F356W_flux}
#     F356W_fluxerr:
#       __class__: astropy.units.quantity.Quantity
#       unit: *id001
#       value: !astropy.table.SerializedColumn {name: F356W_fluxerr}
#     F410M_flux:
#       __class__: astropy.units.quantity.Quantity
#       unit: *id001
#       value: !astropy.table.SerializedColumn {name: F410M_flux}
#     F410M_fluxerr:
#       __class__: astropy.units.quantity.Quantity
#       unit: *id001
#       value: !astropy.table.SerializedColumn {name: F410M_fluxerr}
#     F444W_flux:
#       __class__: astropy.units.quantity.Quantity
#       unit: *id001
#       value: !astropy.table.SerializedColumn {name: F444W_flux}
#     F444W_fluxerr:
#       __class__: astropy.units.quantity.Quantity
#       unit: *id001
#       value: !astropy.table.SerializedColumn {name: F444W_fluxerr}
#     a:
#       __class__: astropy.units.quantity.Quantity
#       unit: !astropy.units.Unit {unit: pix}
#       value: !astropy.table.SerializedColumn {name: a}
#     area:
#       __class__: astropy.units.quantity.Quantity
#       unit: !astropy.units.Unit {unit: pix2}
#       value: !astropy.table.SerializedColumn {name: area}
#     b:
#       __class__: astropy.units.quantity.Quantity
#       unit: !astropy.units.Unit {unit: pix}
#       value: !astropy.table.SerializedColumn {name: b}
#     ellipticity:
#       __class__: astropy.units.quantity.Quantity
#       unit: !astropy.units.Unit {unit: ''}
#       value: !astropy.table.SerializedColumn {name: ellipticity}
#     orientation:
#       __class__: astropy.units.quantity.Quantity
#       unit: &id002 !astropy.units.Unit {unit: deg}
#       value: !astropy.table.SerializedColumn {name: orientation}
#     sky_centroid:
#       __class__: astropy.coordinates.sky_coordinate.SkyCoord
#       dec: !astropy.table.SerializedColumn
#         __class__: astropy.coordinates.angles.core.Latitude
#         unit: *id002
#         value: !astropy.table.SerializedColumn {name: sky_centroid.dec}
#       frame: icrs
#       ra: !astropy.table.SerializedColumn
#         __class__: astropy.coordinates.angles.core.Longitude
#         unit: *id002
#         value: !astropy.table.SerializedColumn {name: sky_centroid.ra}
#         wrap_angle: !astropy.coordinates.Angle
#           unit: *id002
#           value: 360.0
#       representation_type: spherical
# schema: astropy-2.0
label xcentroid ycentroid sky_centroid.ra sky_centroid.dec area a b ellipticity orientation gini F090W_flux F090W_fluxerr F090W_mag F090W_magerr F115W_flux F115W_fluxerr F115W_mag F115W_magerr F150W_flux F150W_fluxerr F150W_mag F150W_magerr F200W_flux F200W_fluxerr F200W_mag F200W_magerr F277W_flux F277W_fluxerr F277W_mag F277W_magerr F335M_flux F335M_fluxerr F335M_mag F335M_magerr F356W_flux F356W_fluxerr F356W_mag F356W_magerr F410M_flux F410M_fluxerr F410M_mag F410M_magerr F444W_flux F444W_fluxerr F444W_mag F444W_magerr
1 466.24461350033647 8.7975642602371 53.17381009103326 -27.805320830365776 101.0 3.121883592723396 1.687718238373556 0.4593910412587602 -44.478947493786606 0.3750841422808698 9.172811374136076 0.8464272435968171 28.993743842627527 0.09583064229371432 15.251750665804146 0.735186612920272 28.441700757864936 0.051113935624583086 18.356035098509803 0.9076155669095672 28.240552801409102 0.052399286366677095 20.355880166244727 0.9951286984899145 28.128275286137136 0.05182128829099082 15.305414631812216 0.3724290991315014 28.437887251597694 0.02610307984312319 14.02083788279239 0.45364676842729956 28.533065080581018 0.03457285577386587 14.174014573163747 0.39992610811377877 28.52126781262446 0.03021030645164098 13.880611681957355 0.46501162852267625 28.543978488116917 0.035777045316298495 13.807578444079855 0.4986392632950047 28.54970620192208 0.038518276199782
2 104.80681791619067 18.082129411035602 53.17721522973072 -27.805243193448323 271.0 4.4330760205526705 2.8904310038200527 0.34798523859744157 -26.54972210581966 0.4292034166747856 66.57967761225385 2.436255936703974 26.841645780216258 0.039019197405152646 67.80807330092654 1.7819304802085372 26.82179648873538 0.028163638965809652 70.39338412925109 2.1096858375971363 26.78117038947336 0.032061379743408516 77.74109040131492 2.318681567876357 26.6733734305523 0.031909302523638994 72.90069026757769 0.8318824113256227 26.743170898753043 0.012319367708500414 75.27250253951928 1.070603105909879 26.708409112497115 0.015333670289260427 71.48792896636016 0.9342131216075662 26.764418211087325 0.014096626458061819 61.42767389099904 0.9993087828855896 26.929089824977595 0.017520685942298192 57.2203760546637 1.051093157627436 27.00612323080047 0.019763151293857934
3 15.04416396551755 13.21870964358083 53.178060898531776 -27.805283643045666 8.0 0.8501945455843772 0.6682678017840504 0.21398248759086114 -38.1612276642421 0.10521135944081007 0.30189458075047043 0.22003285638903264 32.700361707101834 0.5943870266742837 0.7673344575647303 0.20049710485441527 31.68753824783774 0.2520377003105847 0.7185263104580911 0.22413744736254168 31.758893311421605 0.2947853371046982 0.9352163612291753 0.25774023109081057 31.47271975993688 0.26428136354091386 0.34971362332966227 0.06900286982371183 32.54071862281815 0.19551879280610804 0.5607617346802088 0.11336299849737179 32.02805407366013 0.19990472716017532 0.2668657682095152 0.0705653665151826 32.83426782771905 0.2547307087052081 -0.06031654176708369 0.08275804453775322 99.0 34.10547444921151 0.11765422427560634 0.08200758112663485 33.723481188078146 0.5742186726193422
4 710.3242889701858 14.259777138086877 53.17151058505514 -27.805275444028442 25.0 1.2749753643104456 1.117371994707132 0.12361287442487268 -59.26178196559024 0.33737600483155716 2.6566836210797113 0.4371488133389892 30.33915040433974 0.1653923745984598 3.818279752499735 0.360557908564342 29.945330638706018 0.09796938884703618 3.9761821744276116 0.4246250023752303 29.901334315002583 0.110165165468641 3.5589744431503423 0.42659305165797884 30.02168782658959 0.12291324714108388 1.6962298219026282 0.12672768826931047 30.826288264009904 0.07822962940363362 1.590536535091481 0.16680910589172168 30.896140876425513 0.10828384762060109 1.9912255134558894 0.151127025768846 30.652198879435126 0.07942622592908809 1.9438353657449134 0.178896842573335 30.67835130168316 0.09558932550457658 1.6253103136417588 0.17102441486844794 30.8726592718879 0.1086274373485027
5 434.5294891713508 22.219091527997158 53.17410887322447 -27.8052089643638 268.0 3.9551276120227397 2.6287674709150584 0.33535204706817323 -8.140060370882344 0.5363680123723463 48.235021889265 1.7919984904520279 27.191593800137312 0.039605392585556634 54.2155157021799 1.3658851730937915 27.064691017070395 0.02701473844609659 58.2872223328999 1.623579946541796 26.9860666010322 0.02982943945067686 83.01615938264015 2.014897619560197 26.602093406179243 0.026037350500330014 133.10191702875915 1.0561372293002846 26.089539223653347 0.008581100944569356 133.48409670470673 1.2826536715221066 26.086426182655003 0.010383073588802694 144.05302153454628 1.238472358399449 26.003694069734205 0.009294542790143837 161.5683820059277 1.4303041800759473 25.879109060386504 0.009569320100872941 148.33362636536881 1.5722468769659783 25.971900964480472 0.01144758607362489
6 289.38802515014896 17.281765562153954 53.17547627056455 -27.805250009193262 17.0 1.2913044931147235 1.1978568863866517 0.07236682535090477 68.12270923149859 0.18041073594089005 1.1303554308347756 0.3821670960543563 31.266962436913506 0.3162170658541775 1.5011462606731298 0.28676161013445184 30.958942478071556 0.18980531870852316 1.045624005692517 0.28930296346025686 31.35156113668441 0.26520490437873934 1.955256158588051 0.38221513653203576 30.671990843785842 0.1938565595483074 1.188616449626284 0.1236824441824322 31.212395659255414 0.10747756611504025 1.7708471014756073 0.19746701583101794 30.77954733764033 0.11478335606840087 1.4921438342127515 0.15067991684808457 30.96547327829425 0.10445071085094704 1.1433927169620364 0.17563750503987804 31.25451144606716 0.15514831191999282 0.5926553032606401 0.13657056678097335 31.967994562614585 0.2251497308694742
7 640.4863091995317 17.773429154661983 53.17216853452775 -27.805246129692247 21.0 1.5124916692884618 0.8803106550282112 0.41797322067741016 -64.72678377811528 0.257339933672325 1.7318562374159874 0.35449519649495176 30.80372040476935 0.20218906642550222 1.643429843026024 0.24985580694618065 30.86062207735413 0.15366243535885116 1.636102104727731 0.2840661464858718 30.865473991673777 0.17382220324021894 2.2295861313548446 0.33214154219160175 30.529439364296703 0.15077176392081712 1.0399598684843063 0.09617790287548726 31.357458548945587 0.09603604488615963 1.6537574517445193 0.1507209599380506 30.853820464729573 0.094699691326289 1.2604572236829945 0.11591912740405148 31.14867972112842 0.09552272603001738 0.40788132175057795 0.11575451167421517 32.37366545505972 0.27123885135203707 0.5688140707837224 0.10865005565010251 32.01257417244966 0.18978993015591245
8 762.762291737285 28.289914155884627 53.171016553902064 -27.805158549648304 200.0 3.160315774736445 2.3536095208280066 0.2552612812799423 37.520056617399476 0.5417393494467531 52.884573303469274 1.7905819633079445 27.091677488449587 0.0361525510072172 55.84480400775534 1.340403855296752 27.0325430722947 0.025752332465672795 61.65651417767283 1.6299731205318744 26.925052580640507 0.028330057963110337 87.75832428916449 2.0319859659923534 26.54177919509308 0.024852875576127663 85.91084431487936 0.7872047738101092 26.564880031956896 0.009903344287860692 73.69676407989382 0.8932394257702934 26.73137895243849 0.013080521346957403 74.68199206314202 0.8363385018246197 26.716960265556335 0.012091217376552723 70.61910087228084 0.9001197500128227 26.777694540519555 0.013751473288938415 73.9961654528609 1.0387154150809097 26.726976963031056 0.015134956407915642

Reformat output catalog for readability (optional)#

# Remove units (pixels) from area
tbl['area'] = tbl['area'].value.astype(int)

# Replace sky_centroid with ra, dec
tbl['ra'] = tbl['sky_centroid'].ra.degree
tbl['dec'] = tbl['sky_centroid'].dec.degree

columns = list(tbl.columns)
columns = columns[:3] + ['ra', 'dec'] + columns[4:-2]

tbl = tbl[columns]
for column in columns:
    tbl[column].info.format = '.4f'

tbl['ra'].info.format = '11.7f'
tbl['dec'].info.format = '11.7f'

tbl['label'].info.format = 'd'
tbl['area'].info.format = 'd'
tbl.write('JADESphotometry.cat', format='ascii.fixed_width_two_line', delimiter=' ', overwrite=True)
!head -10 JADESphotometry.cat  # show the first 10 lines
label xcentroid ycentroid          ra         dec area       a      b ellipticity orientation   gini F090W_flux F090W_fluxerr F090W_mag F090W_magerr F115W_flux F115W_fluxerr F115W_mag F115W_magerr F150W_flux F150W_fluxerr F150W_mag F150W_magerr F200W_flux F200W_fluxerr F200W_mag F200W_magerr F277W_flux F277W_fluxerr F277W_mag F277W_magerr F335M_flux F335M_fluxerr F335M_mag F335M_magerr F356W_flux F356W_fluxerr F356W_mag F356W_magerr F410M_flux F410M_fluxerr F410M_mag F410M_magerr F444W_flux F444W_fluxerr F444W_mag F444W_magerr
----- --------- --------- ----------- ----------- ---- ------- ------ ----------- ----------- ------ ---------- ------------- --------- ------------ ---------- ------------- --------- ------------ ---------- ------------- --------- ------------ ---------- ------------- --------- ------------ ---------- ------------- --------- ------------ ---------- ------------- --------- ------------ ---------- ------------- --------- ------------ ---------- ------------- --------- ------------ ---------- ------------- --------- ------------
    1  466.2446    8.7976  53.1738101 -27.8053208  101  3.1219 1.6877      0.4594    -44.4789 0.3751     9.1728        0.8464   28.9937       0.0958    15.2518        0.7352   28.4417       0.0511    18.3560        0.9076   28.2406       0.0524    20.3559        0.9951   28.1283       0.0518    15.3054        0.3724   28.4379       0.0261    14.0208        0.4536   28.5331       0.0346    14.1740        0.3999   28.5213       0.0302    13.8806        0.4650   28.5440       0.0358    13.8076        0.4986   28.5497       0.0385
    2  104.8068   18.0821  53.1772152 -27.8052432  271  4.4331 2.8904      0.3480    -26.5497 0.4292    66.5797        2.4363   26.8416       0.0390    67.8081        1.7819   26.8218       0.0282    70.3934        2.1097   26.7812       0.0321    77.7411        2.3187   26.6734       0.0319    72.9007        0.8319   26.7432       0.0123    75.2725        1.0706   26.7084       0.0153    71.4879        0.9342   26.7644       0.0141    61.4277        0.9993   26.9291       0.0175    57.2204        1.0511   27.0061       0.0198
    3   15.0442   13.2187  53.1780609 -27.8052836    8  0.8502 0.6683      0.2140    -38.1612 0.1052     0.3019        0.2200   32.7004       0.5944     0.7673        0.2005   31.6875       0.2520     0.7185        0.2241   31.7589       0.2948     0.9352        0.2577   31.4727       0.2643     0.3497        0.0690   32.5407       0.1955     0.5608        0.1134   32.0281       0.1999     0.2669        0.0706   32.8343       0.2547    -0.0603        0.0828   99.0000      34.1055     0.1177        0.0820   33.7235       0.5742
    4  710.3243   14.2598  53.1715106 -27.8052754   25  1.2750 1.1174      0.1236    -59.2618 0.3374     2.6567        0.4371   30.3392       0.1654     3.8183        0.3606   29.9453       0.0980     3.9762        0.4246   29.9013       0.1102     3.5590        0.4266   30.0217       0.1229     1.6962        0.1267   30.8263       0.0782     1.5905        0.1668   30.8961       0.1083     1.9912        0.1511   30.6522       0.0794     1.9438        0.1789   30.6784       0.0956     1.6253        0.1710   30.8727       0.1086
    5  434.5295   22.2191  53.1741089 -27.8052090  268  3.9551 2.6288      0.3354     -8.1401 0.5364    48.2350        1.7920   27.1916       0.0396    54.2155        1.3659   27.0647       0.0270    58.2872        1.6236   26.9861       0.0298    83.0162        2.0149   26.6021       0.0260   133.1019        1.0561   26.0895       0.0086   133.4841        1.2827   26.0864       0.0104   144.0530        1.2385   26.0037       0.0093   161.5684        1.4303   25.8791       0.0096   148.3336        1.5722   25.9719       0.0114
    6  289.3880   17.2818  53.1754763 -27.8052500   17  1.2913 1.1979      0.0724     68.1227 0.1804     1.1304        0.3822   31.2670       0.3162     1.5011        0.2868   30.9589       0.1898     1.0456        0.2893   31.3516       0.2652     1.9553        0.3822   30.6720       0.1939     1.1886        0.1237   31.2124       0.1075     1.7708        0.1975   30.7795       0.1148     1.4921        0.1507   30.9655       0.1045     1.1434        0.1756   31.2545       0.1551     0.5927        0.1366   31.9680       0.2251
    7  640.4863   17.7734  53.1721685 -27.8052461   21  1.5125 0.8803      0.4180    -64.7268 0.2573     1.7319        0.3545   30.8037       0.2022     1.6434        0.2499   30.8606       0.1537     1.6361        0.2841   30.8655       0.1738     2.2296        0.3321   30.5294       0.1508     1.0400        0.0962   31.3575       0.0960     1.6538        0.1507   30.8538       0.0947     1.2605        0.1159   31.1487       0.0955     0.4079        0.1158   32.3737       0.2712     0.5688        0.1087   32.0126       0.1898
    8  762.7623   28.2899  53.1710166 -27.8051585  200  3.1603 2.3536      0.2553     37.5201 0.5417    52.8846        1.7906   27.0917       0.0362    55.8448        1.3404   27.0325       0.0258    61.6565        1.6300   26.9251       0.0283    87.7583        2.0320   26.5418       0.0249    85.9108        0.7872   26.5649       0.0099    73.6968        0.8932   26.7314       0.0131    74.6820        0.8363   26.7170       0.0121    70.6191        0.9001   26.7777       0.0138    73.9962        1.0387   26.7270       0.0151

Start new session and analyze results#

Load catalog and segmentation map#

# Catalog: ecsv format preserves units for loading in Python notebooks
tbl = QTable.read('JADESphotometry.ecsv')

# Reconstitute filter list
filters = []
for param in tbl.columns:
    if param[-4:] == '_mag':
        filters.append(param[:-4])

# Segmentation map
segmfile = 'JADES_detections_segm.fits'
segm = fits.open(segmfile)[0].data
segm = SegmentationImage(segm)

Plot number counts vs. magnitude#

fig = plt.figure(figsize=(8, 4))

filt = 'F200W'
mag1 = tbl[filt + '_mag']

mag1 = mag1[(0 < mag1) & (mag1 < 90)]  # detections only
n = plt.hist(mag1, histtype='step', label=filt)

plt.xlabel('AB magnitude')
plt.ylabel('Number counts')
plt.legend()
<matplotlib.legend.Legend at 0x7fe7071d2710>
../../_images/647b763911bcc4028ffcce2cbbba5088b0029bb25d4e2d00ac84226267b1ccaf.png

Plot F200W vs. F090W magnitudes and look for dropouts#

#import mplcursors
# Would love a better solution here!

mag1 = tbl['F090W_mag']
mag2 = tbl['F200W_mag']

# Only plot detections in F200W
det2 = (0 < mag2) & (mag2 < 90)

mag1 = mag1[det2]
mag2 = mag2[det2]
ids = tbl['label'][det2]

plt.figure(figsize=(8, 4))

plt.plot(mag1, mag2, '.')

for i in range(len(mag1)):
    plt.text(mag1[i], mag2[i], ids[i])

plt.xlabel('F090W AB magnitude')
plt.ylabel('F200W AB magnitude')
Text(0, 0.5, 'F200W AB magnitude')
../../_images/070f8c4e4d70f7c406245ab89a810745dd3726fd0688c5f0166203549fae1f84.png

Look at one object#

# Could select object by position
#x, y = 905, 276
#id = segm.data[y,x]

# Select by ID number
id = 261  # F090W dropout
obj = tbl[id-1]
obj
Row index=260
labelxcentroidycentroidsky_centroidareaabellipticityorientationginiF090W_fluxF090W_fluxerrF090W_magF090W_magerrF115W_fluxF115W_fluxerrF115W_magF115W_magerrF150W_fluxF150W_fluxerrF150W_magF150W_magerrF200W_fluxF200W_fluxerrF200W_magF200W_magerrF277W_fluxF277W_fluxerrF277W_magF277W_magerrF335M_fluxF335M_fluxerrF335M_magF335M_magerrF356W_fluxF356W_fluxerrF356W_magF356W_magerrF410M_fluxF410M_fluxerrF410M_magF410M_magerrF444W_fluxF444W_fluxerrF444W_magF444W_magerr
deg,degpix2pixpixdegnJynJynJynJynJynJynJynJynJynJynJynJynJynJynJynJynJynJy
int64float64float64SkyCoordfloat64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64
261713.6003231522444868.286273146934453.17147927632734,-27.79815855888541111.02.19573642379047441.8718598618520150.14750247726881305-17.3387743379370680.54624528398523883.210645286258773.527254278037805326.5995527752184560.0450750279967876484.188464235048332.587997370314988626.5868685320075430.03287337544318668584.42481718391893.05488636487665526.5838246778152120.03859293439278209478.7288368652023.13178772987917926.6596654118736680.0423530468259579845.2587793950387860.939761047145372727.2607429072804130.02231354487644226435.2778093527472051.005126721872933627.531245977753050.0305020368304290332.91303363827020.912697682965009627.6065802158956720.02969820322677968824.753535319264160.919737711771397827.9159069150581870.03961001376295534425.4013154001160761.040221774063961727.8878594824442380.043576230399079735
obj['ellipticity']
\[0.14750248 \; \mathrm{}\]
segmobj = segm.segments[segm.get_index(id)]
segmobj
<photutils.segmentation.core.Segment>
label: 261
slices: (slice(863, 874, None), slice(708, 720, None))
area: 111

Show the object in all the images#

fig, ax = plt.subplots(2, len(filters)+1, figsize=(9.5, 3.5), sharex=True, sharey=True)

ax[0, 0].imshow(rgb[segmobj.slices], origin='lower', extent=segmobj.bbox.extent)
ax[0, 0].set_title('Color')

cmap = segm.make_cmap(seed=12345)  # ERROR
ax[1, 0].imshow(segm.data[segmobj.slices], origin='lower', extent=segmobj.bbox.extent, cmap=cmap,
               interpolation='nearest')
ax[1, 0].set_title('Segment')

for i in range(1, len(filters)+1):
    filt = filters[i-1]

    # Show data on top row
    data = fits.open(imagefiles[filt])[0].data
    stamp = data[segmobj.slices]
    norm = ImageNormalize(stretch=SqrtStretch())  # scale each filter individually
    ax[0, i].imshow(stamp, extent=segmobj.bbox.extent, cmap='Greys_r', norm=norm, origin='lower')
    ax[0, i].set_title(filt.upper())

    # Show weights on bottom row
    weight = fits.open(weightfiles[filt])[0].data
    stamp = weight[segmobj.slices]
    # set black to zero weight (no exposure time / bad pixel)
    ax[1, i].imshow(stamp, extent=segmobj.bbox.extent, vmin=0, cmap='Greys_r', origin='lower')

ax[0, 0].set_ylabel('Data')
ax[1, 0].set_ylabel('Weight')
Text(0, 0.5, 'Weight')
../../_images/e31f4b14af582178d11d358f19c42cfc950a171fa82aac8c9ee82537fd3dfcda.png

Plot SED (Spectral Energy Distribution)#

fig, ax = plt.subplots(figsize=(8, 6))

for filt in filters:
    lam = int(filt[1:4]) / 100
    plt.errorbar(lam, obj[filt+'_flux'].value, obj[filt+'_fluxerr'].value, marker='.', c='b')

plt.axhline(0, c='k', ls=':')
plt.xlim(0, 5)
plt.xlabel('Wavelength ($\mu$m)')
plt.ylabel('Flux (nJy)')

mlim = 31.4
flim = mlim * u.ABmag
flim = flim.to(u.nJy).value

# Add AB magnitudes as secondary x-axis at right
# https://matplotlib.org/gallery/subplots_axes_and_figures/secondary_axis.html#sphx-glr-gallery-subplots-axes-and-figures-secondary-axis-py
def AB2nJy(mAB):
    m = mAB * u.ABmag
    f = m.to(u.nJy)
    f = f.value
    f = np.where(f > flim, f, flim)
    return f

def nJy2AB(F_nJy):
    f = F_nJy * u.nJy
    m = f.to(u.ABmag)
    m = m.value
    m = np.where(m < mlim, m, mlim)
    return m
    
plt.ylim(flim, plt.ylim()[1])

secax = ax.secondary_yaxis('right', functions=(nJy2AB, AB2nJy))
secax.set_ylabel('magnitude (AB)')
Text(0, 0.5, 'magnitude (AB)')
../../_images/f722ed1331a494bacb505c4ee211034a39a89f0ff3d6f34681c1abb331b3692b.png

Magnitude conversion fails for flux <= 0#

fig, ax = plt.subplots(figsize=(8, 6))

for filt in filters:
    lam = int(filt[1:4]) / 100
    plt.errorbar(lam, obj[filt+'_flux'].value, obj[filt+'_fluxerr'].value, marker='.', c='b')

plt.axhline(0, c='k', ls=':')
plt.xlim(0, 5)
plt.xlabel('Wavelength ($\mu$m)')
plt.ylabel('Flux (nJy)')

f0 = 10**(0.4 * 31.4)  # flux [nJy] at zero magnitude
b0 = 1.e-12  # this should be filter dependent

# Add AB magnitudes as secondary x-axis at right
# https://matplotlib.org/gallery/subplots_axes_and_figures/secondary_axis.html#sphx-glr-gallery-subplots-axes-and-figures-secondary-axis-py
def AB2nJy(m):
    f = np.sinh(-0.4 * m * np.log(10) - np.log(b0)) * 2 * b0 * f0
    return f

# Luptitudes
# https://www.sdss.org/dr12/algorithms/magnitudes/
def nJy2AB(f):
    m = -2.5 / np.log(10) * (np.arcsinh((f / f0) / (2 * b0)) + np.log(b0))
    return m

#plt.ylim(flim, plt.ylim()[1])

secax = ax.secondary_yaxis('right', functions=(nJy2AB, AB2nJy))
secax.set_ylabel('asinh magnitude (AB)')
Text(0, 0.5, 'asinh magnitude (AB)')
../../_images/c4b73a2ce3dd1ef7401e44792c93be8a9a00ba8b1511075622458bf193112372.png