105.3. Forced photometry#
105.3. Forced Photometry¶
For the Rubin Science Platform at data.lsst.cloud.
Data Release: Data Preview 1
Container Size: large
LSST Science Pipelines version: r29.2.0
Last verified to run: 2025-11-03
Repository: github.com/lsst/tutorial-notebooks
Learning objective: Measure sources from an image via forced photometry using IDs and coordinates.
LSST data products: deep_coadd, object table
Packages: lsst.pipe.tasks, lsst.daf.butler
Credit: Originally developed by the Rubin Community Science team working with Erfan Nourbakhsh. Please consider acknowledging them if this notebook is used for the preparation of journal articles, software releases, or other notebooks.
Get Support: Everyone is encouraged to ask questions or raise issues in the Support Category of the Rubin Community Forum. Rubin staff will respond to all questions posted there.
1. Introduction¶
This notebook performs forced photometry using the Data Preview 1 (DP1) data products on an input image, given a set of input IDs and RA/Dec coordinates. The ForcedMeasurementDriverTask serves as a convenience function, allowing users to measure sources without running a full-scale pipetask command or dealing with additional pipeline setup. This task can measure fluxes, shapes, and other properties at known source positions (e.g., from a pre-existing catalog) on a given image, without running source detection. (Note that for brevity we disable shape measurement in this notebook.)
Related tutorials: 100-level Detect and measure sources
1.1. Import packages¶
Import numpy, a fundamental package for scientific computing with arrays in Python
(numpy.org). From the lsst package, we import Butler to access the LSST data repository, which allows us to retrieve images and catalogs using data IDs. Also import ForcedMeasurementDriverConfig and ForcedMeasurementDriverTask, which are mid-level config and task classes used to set up and execute forced photometry.
import matplotlib.pyplot as plt
import numpy as np
import astropy.units as u
from lsst.daf.butler import Butler
from lsst.pipe.tasks.measurementDriver import (
ForcedMeasurementDriverConfig,
ForcedMeasurementDriverTask,
)
from lsst.rsp import get_tap_service
from lsst.utils.plotting import set_rubin_plotstyle
set_rubin_plotstyle()
1.2. Define parameters and functions¶
def fix_flux_columns(table):
"""Rename the columns in an output table from the ForcedMeasurementDriverTask.
This task is necessary to rename "instFlux" columns to "flux" and units from
"ct" to "nJy".
Parameters
----------
table : Astropy Table
An Astropy table resulting from executing the ForcedMeasurementDriver
Outputs
-------
table : Astropy Table
Transformed version of the input table, with columns and units updated.
"""
cols_with_instflux = [col for col in np.array(table.colnames) if 'instFlux' in col]
for col in cols_with_instflux:
new_colname = str.replace(col, 'instFlux', 'flux')
table.rename_column(col, new_colname)
table[new_colname].unit = u.nJy
return table
Create an instance of the butler, and assert that it exists.
butler = Butler("dp1", collections="LSSTComCam/DP1")
assert butler is not None
Instantiate the TAP service and assert that it exists.
service = get_tap_service("tap")
assert service is not None
2. Load an image and table¶
Identify coadded images overlapping a particular sky position and select one to run forced photometry on. Also load the corresponding object table using the TAP service so that forced photometry can be run at the positions of already-detected objects.
ra = 53.1
dec = -28.1
band = 'r'
query = f"band='{band}' AND \
patch.region OVERLAPS POINT({ra}, {dec})"
coadd_img_refs = butler.query_datasets('deep_coadd', where=query)
ref = coadd_img_refs[0]
exposure = butler.get(ref)
Extract a list of objects from the Object table in a small radius near the position of interest. These will be used both as an input list for forced measurement, and as a comparison for the results.
query = f"""SELECT TOP 50 objectId, coord_ra, coord_dec, {band}_psfMag, {band}_psfFlux
FROM dp1.Object
WHERE CONTAINS(POINT('ICRS', coord_ra, coord_dec),
CIRCLE('ICRS', {ra}, {dec}, 0.1)) = 1
AND refExtendedness < 0.5
AND {band}_psfMag < 26 AND {band}_psfMag > 17
AND tract = {ref.dataId['tract']}
AND patch = {ref.dataId['patch']}"""
job = service.submit_job(query)
job.run()
job.wait(phases=['COMPLETED', 'ERROR'])
print('Job phase is', job.phase)
if job.phase == 'ERROR':
job.raise_if_error()
assert job.phase == 'COMPLETED'
objtable = job.fetch_result().to_table()
Job phase is COMPLETED
Option to examine the objtable:
# objtable
3. Run the forced measurement driver¶
Configure the forced measurement driver to use base_PsfFlux as the algorithm for the PSF flux slot, and base_TransformedCentroidFromCoord for centroids transformed from the reference catalog. Set other config parameters to disable shape measurement, avoid replacing other detected footprints with noise, and enable aperture correction for the selected flux slot. These are simply examples of how to set configuration options, and are not required to run the task.
Note: base_PsfFlux and base_TransformedCentroidFromCoord are included by default in the measurement plugins, so there's no need to add them manually to config.measurement.plugins.names. They’ll be picked up automatically.
config = ForcedMeasurementDriverConfig()
config.measurement.slots.psfFlux = "base_PsfFlux"
config.measurement.slots.centroid = "base_TransformedCentroidFromCoord"
config.measurement.slots.shape = None
config.measurement.doReplaceWithNoise = False
config.doApCorr = True
Option: examine the configuration.
# config
Create the forced photometry driver task using the configuration.
driver = ForcedMeasurementDriverTask(config=config)
Run the task using the input table of source positions and IDs, the deep_coadd exposure image, and required parameters: column names for ID, RA, and Dec, plus a PSF footprint scaling factor (used to create synthetic footprints since detection is skipped in forced photometry).
result = driver.runFromAstropy(
objtable,
exposure,
id_column_name="objectId",
ra_column_name="coord_ra",
dec_column_name="coord_dec",
psf_footprint_scaling=3.0,
)
lsst.forcedMeasurementDriver INFO: Measuring 50 sources in a single band using 'ForcedMeasurementTask'
lsst.forcedMeasurementDriver.measurement INFO: Performing forced measurement on 50 sources
lsst.forcedMeasurementDriver INFO: Applying aperture corrections to a single band
lsst.forcedMeasurementDriver.applyApCorr INFO: Applying aperture corrections to 1 instFlux fields
lsst.forcedMeasurementDriver INFO: Finished processing for a single band; output catalog has 88 fields and 50 records
Because the ForcedMeasurementDriverTask relies on code that is typically used in early stages of data processing, it assumes that fluxes are instrumental fluxes and appends the suffixes _instFlux and _instFluxErr to the output columns. It also sets the units for these columns to "ct" (counts). Because we know that we are measuring on calibrated images whose pixel values are in nJy (to confirm this, execute exposure.metadata['BUNIT'] in a code cell to see what the units are), we rename the columns and set their units to nJy. The code that causes this behavior will be updated in the future to use keywords from the input image to set the units and suffixes.
result = fix_flux_columns(result)
Examine the resulting Astropy table containing the measured sources. Each row corresponds to a record from the input table, with columns for source ID, RA, and Dec, along with additional measurement fields defined by the configuration.
result[:5]
| coord_ra | coord_dec | parent | objectId | parentObjectId | deblend_nChild | base_TransformedCentroidFromCoord_x | slot_Centroid_x | base_TransformedCentroidFromCoord_y | slot_Centroid_y | base_CircularApertureFlux_3_0_flux | base_CircularApertureFlux_3_0_fluxErr | base_CircularApertureFlux_3_0_flag | base_CircularApertureFlux_3_0_flag_apertureTruncated | base_CircularApertureFlux_3_0_flag_sincCoeffsTruncated | base_CircularApertureFlux_4_5_flux | base_CircularApertureFlux_4_5_fluxErr | base_CircularApertureFlux_4_5_flag | base_CircularApertureFlux_4_5_flag_apertureTruncated | base_CircularApertureFlux_4_5_flag_sincCoeffsTruncated | base_CircularApertureFlux_6_0_flux | base_CircularApertureFlux_6_0_fluxErr | base_CircularApertureFlux_6_0_flag | base_CircularApertureFlux_6_0_flag_apertureTruncated | base_CircularApertureFlux_6_0_flag_sincCoeffsTruncated | base_CircularApertureFlux_9_0_flux | base_CircularApertureFlux_9_0_fluxErr | base_CircularApertureFlux_9_0_flag | base_CircularApertureFlux_9_0_flag_apertureTruncated | base_CircularApertureFlux_9_0_flag_sincCoeffsTruncated | base_CircularApertureFlux_12_0_flux | base_CircularApertureFlux_12_0_fluxErr | base_CircularApertureFlux_12_0_flag | base_CircularApertureFlux_12_0_flag_apertureTruncated | base_CircularApertureFlux_17_0_flux | base_CircularApertureFlux_17_0_fluxErr | base_CircularApertureFlux_17_0_flag | base_CircularApertureFlux_17_0_flag_apertureTruncated | base_CircularApertureFlux_25_0_flux | base_CircularApertureFlux_25_0_fluxErr | base_CircularApertureFlux_25_0_flag | base_CircularApertureFlux_25_0_flag_apertureTruncated | base_CircularApertureFlux_35_0_flux | base_CircularApertureFlux_35_0_fluxErr | base_CircularApertureFlux_35_0_flag | base_CircularApertureFlux_35_0_flag_apertureTruncated | base_CircularApertureFlux_50_0_flux | base_CircularApertureFlux_50_0_fluxErr | base_CircularApertureFlux_50_0_flag | base_CircularApertureFlux_50_0_flag_apertureTruncated | base_CircularApertureFlux_70_0_flux | base_CircularApertureFlux_70_0_fluxErr | base_CircularApertureFlux_70_0_flag | base_CircularApertureFlux_70_0_flag_apertureTruncated | base_PixelFlags_flag | base_PixelFlags_flag_offimage | base_PixelFlags_flag_edge | base_PixelFlags_flag_nodata | base_PixelFlags_flag_interpolated | base_PixelFlags_flag_saturated | base_PixelFlags_flag_cr | base_PixelFlags_flag_bad | base_PixelFlags_flag_suspect | base_PixelFlags_flag_edgeCenter | base_PixelFlags_flag_nodataCenter | base_PixelFlags_flag_interpolatedCenter | base_PixelFlags_flag_saturatedCenter | base_PixelFlags_flag_crCenter | base_PixelFlags_flag_badCenter | base_PixelFlags_flag_suspectCenter | base_PixelFlags_flag_edgeCenterAll | base_PixelFlags_flag_nodataCenterAll | base_PixelFlags_flag_interpolatedCenterAll | base_PixelFlags_flag_saturatedCenterAll | base_PixelFlags_flag_crCenterAll | base_PixelFlags_flag_badCenterAll | base_PixelFlags_flag_suspectCenterAll | base_PsfFlux_flux | slot_PsfFlux_flux | base_PsfFlux_fluxErr | slot_PsfFlux_fluxErr | base_PsfFlux_area | slot_PsfFlux_area | base_PsfFlux_chi2 | slot_PsfFlux_chi2 | base_PsfFlux_npixels | slot_PsfFlux_npixels | base_PsfFlux_flag | slot_PsfFlux_flag | base_PsfFlux_flag_noGoodPixels | slot_PsfFlux_flag_noGoodPixels | base_PsfFlux_flag_edge | slot_PsfFlux_flag_edge | base_InvalidPsf_flag | base_PsfFlux_apCorr | slot_PsfFlux_apCorr | base_PsfFlux_apCorrErr | slot_PsfFlux_apCorrErr | base_PsfFlux_flag_apCorr | slot_PsfFlux_flag_apCorr |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| rad | rad | pix | pix | pix | pix | nJy | nJy | nJy | nJy | nJy | nJy | nJy | nJy | nJy | nJy | nJy | nJy | nJy | nJy | nJy | nJy | nJy | nJy | nJy | nJy | nJy | nJy | nJy | nJy | pix | pix | pix | pix | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| float64 | float64 | int64 | int64 | int64 | int32 | float64 | float64 | float64 | float64 | float64 | float64 | bool | bool | bool | float64 | float64 | bool | bool | bool | float64 | float64 | bool | bool | bool | float64 | float64 | bool | bool | bool | float64 | float64 | bool | bool | float64 | float64 | bool | bool | float64 | float64 | bool | bool | float64 | float64 | bool | bool | float64 | float64 | bool | bool | float64 | float64 | bool | bool | bool | bool | bool | bool | bool | bool | bool | bool | bool | bool | bool | bool | bool | bool | bool | bool | bool | bool | bool | bool | bool | bool | bool | float64 | float64 | float64 | float64 | float32 | float32 | float32 | float32 | int32 | int32 | bool | bool | bool | bool | bool | bool | bool | float64 | float64 | float64 | float64 | bool | bool |
| 0.9284357235248085 | -0.48955837921319045 | 0 | 611254385447554194 | 0 | 0 | 13284.999720410628 | 13284.999720410628 | 5476.550237359781 | 5476.550237359781 | 267.4403991699219 | 6.649595737457275 | False | False | False | 374.1120910644531 | 9.9679536819458 | False | False | False | 451.2291259765625 | 13.329604148864746 | False | False | False | 487.3237609863281 | 20.0559024810791 | False | False | False | 516.9873642921448 | 27.010765596179162 | False | False | 592.7185564339161 | 38.2286436199333 | False | False | 603.4480983316898 | 56.16045435014221 | False | False | 1389.1180970072746 | 78.58883392020425 | False | False | 13701.634986788034 | 112.41619821442139 | False | False | 16783.954358518124 | 157.08954869334747 | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | 504.0876477231298 | 504.0876477231298 | 11.369714815728049 | 11.369714815728049 | 79.67882 | 79.67882 | 1257.2571 | 1257.2571 | 1225 | 1225 | False | False | False | False | False | False | False | 0.9926227225688778 | 0.9926227225688778 | 0.0 | 0.0 | False | False |
| 0.9282775317464668 | -0.48958578850659457 | 0 | 611254385447554203 | 0 | 0 | 13429.012542012175 | 13429.012542012175 | 5448.402083947918 | 5448.402083947918 | 3343.945068359375 | 7.2206573486328125 | False | False | False | 4737.42138671875 | 10.542635917663574 | False | False | False | 5486.0849609375 | 13.848408699035645 | False | False | False | 6099.17724609375 | 20.4603328704834 | False | False | False | 6305.931492388248 | 27.35771190483854 | False | False | 6662.3800202310085 | 38.54057906635318 | False | False | 7185.683129191399 | 56.36777529446366 | False | False | 7783.820784300566 | 78.82544614627501 | False | False | 8451.208186686039 | 112.51447026545274 | False | False | 9201.015788793564 | 157.2583420106997 | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | 6281.169383703591 | 6281.169383703591 | 12.350997682091442 | 12.350997682091442 | 79.54622 | 79.54622 | 3122.0657 | 3122.0657 | 1225 | 1225 | False | False | False | False | False | False | False | 0.9921914160616393 | 0.9921914160616393 | 0.0 | 0.0 | False | False |
| 0.9272024046327516 | -0.4896004729817264 | 0 | 611254385447554186 | 0 | 0 | 14407.610681273925 | 14407.610681273925 | 5433.802739179831 | 5433.802739179831 | 88.51903533935547 | 6.66691255569458 | False | False | False | 135.90452575683594 | 9.968441009521484 | False | False | False | 175.01821899414062 | 13.363798141479492 | False | False | False | 319.04559326171875 | 20.158843994140625 | False | False | False | 598.8098386824131 | 27.13246037468635 | False | False | 1046.1342959702015 | 38.48990233327417 | False | False | 1406.0898782610893 | 56.581044689317096 | False | False | 2301.9651289880276 | 79.24108602004041 | False | False | 5359.633947879076 | 113.17686730896857 | False | False | 11312.44118487835 | 158.60750134349462 | False | False | False | False | False | False | True | False | True | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | 184.70560611225693 | 184.70560611225693 | 11.356577852522133 | 11.356577852522133 | 79.86682 | 79.86682 | 4223.6074 | 4223.6074 | 1225 | 1225 | False | False | False | False | False | False | False | 0.9918108526120145 | 0.9918108526120145 | 0.0 | 0.0 | False | False |
| 0.9284095641568397 | -0.4894710389109419 | 0 | 611254385447554528 | 0 | 0 | 13308.733371473894 | 13308.733371473894 | 5566.65502189172 | 5566.65502189172 | 333.40179443359375 | 6.633640766143799 | False | False | False | 468.37109375 | 9.903467178344727 | False | False | False | 528.0891723632812 | 13.254477500915527 | False | False | False | 563.399658203125 | 19.955745697021484 | False | False | False | 635.1309954226017 | 26.90392806061721 | False | False | 1356.178539097309 | 38.09122859411815 | False | False | 2647.178950548172 | 56.01577089468925 | False | False | 4299.581887036562 | 78.40007987818127 | False | False | 4872.77668350935 | 111.81898504143693 | False | False | 7012.317384690046 | 156.45652682607104 | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | 618.2581842060997 | 618.2581842060997 | 11.297752410121362 | 11.297752410121362 | 79.86561 | 79.86561 | 12541.634 | 12541.634 | 1225 | 1225 | False | False | False | False | False | False | False | 0.9920744321600977 | 0.9920744321600977 | 0.0 | 0.0 | False | False |
| 0.9270212468925674 | -0.4893837934693033 | 0 | 611254385447554460 | 0 | 0 | 14572.45284106942 | 14572.45284106942 | 5657.331678510893 | 5657.331678510893 | 140.5730743408203 | 6.664852619171143 | False | False | False | 206.09010314941406 | 9.961759567260742 | False | False | False | 232.52064514160156 | 13.341032028198242 | False | False | False | 276.97552490234375 | 20.12602424621582 | False | False | False | 323.38783636689186 | 27.205066957785725 | False | False | 399.21373549103737 | 38.52455134455442 | False | False | 1026.6242810189724 | 56.70204525695046 | False | False | 4801.452009677887 | 79.51730125655827 | False | False | 35313.71744328737 | 114.02059146456531 | False | False | 64719.08585858345 | 159.92814099699558 | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | 260.36672335234454 | 260.36672335234454 | 11.320431535259344 | 11.320431535259344 | 79.50919 | 79.50919 | 1224.4935 | 1224.4935 | 1225 | 1225 | False | False | False | False | False | False | False | 0.9918253476111658 | 0.9918253476111658 | 0.0 | 0.0 | False | False |
The table now includes PSF fluxes (base_psfFlux_flux) and aperture fluxes (e.g., base_CircularApertureFlux_3_0_flux for a 3-pixel aperture), among many other columns.
Most of the output columns are similar to columns that exist in the Source table -- refer to the schema for the DP1 Source table and the 200-level tutorial notebook on the Source catalog for descriptions.
Each flux measurement has an associated flux error and one or more flag columns to allow filtering of bad measurements. Additionally, there are many pixel-based flags (denoted base_PixelFlags_*) highlighting possible issues with the data for each source.
Columns that begin with slot_ are duplicates of other columns in the table. These exist as a way of telling algorithms in the Science Pipelines which is the "preferred" measurement for things like positions, shapes, and fluxes. Because there are multiple ways of measuring shapes (for example), this lets processing algorithms know which of these to select. Note that the specific measurements populating (some of) the slots were configured above, for example when we specified config.measurement.slots.psfFlux = "base_PsfFlux".
The forced measurement functionality is limited to a handful of measurement plugins (for example, model-fitting algorithms will not work with this task because they require more ancillary information than it is set up to receive). Nonetheless, it offers a quick and easy way to extract measurements at arbitrary positions.
3.1 Compare the forced measurements to the Object table¶
Make a plot showing the ratio of the measured PSF fluxes from the forced measurement task to the psfFlux for the same objects in the Object table. Plot these as a function of magnitude, using Astropy units to convert slot_PsfFlux_flux from the result table to AB magnitudes.
meas_mag = (result['slot_PsfFlux_flux'].value*u.nJy).to(u.ABmag)
fig, ax = plt.subplots(figsize=(6, 4))
ax.plot(meas_mag, result['slot_PsfFlux_flux']/objtable['r_psfFlux'], 'k.')
ax.hlines(1.0, 17.3, 26.3, linestyle=':', color='gray')
ax.minorticks_on()
ax.set_xlim(17.3, 26.3)
ax.set_xlabel('measured PSF mag')
ax.set_ylabel('flux ratio (forced/Object)')
plt.tight_layout()
plt.show()
4. Forced measurement on a visit image¶
The forced measurement task can be run on any ExposureF object. To demonstrate this, retrieve a visit_image and execute the driver to extract forced photometry on that image. The appropriate input catalog for visit_image measurements is the Source table.
query = f"band='{band}' AND \
visit.region OVERLAPS POINT({ra}, {dec})"
visit_img_refs = butler.query_datasets('visit_image', where=query)
ref = visit_img_refs[0]
exposure = butler.get(ref)
query = f"""SELECT TOP 50 sourceId, ra, dec, psfFlux
FROM dp1.Source
WHERE CONTAINS(POINT('ICRS', ra, dec),
CIRCLE('ICRS', {ra}, {dec}, 0.1)) = 1
AND extendedness < 0.5
AND visit = {ref.dataId['visit']}
AND detector = {ref.dataId['detector']}"""
job = service.submit_job(query)
job.run()
job.wait(phases=['COMPLETED', 'ERROR'])
print('Job phase is', job.phase)
if job.phase == 'ERROR':
job.raise_if_error()
assert job.phase == 'COMPLETED'
srctable = job.fetch_result().to_table()
Job phase is COMPLETED
config = ForcedMeasurementDriverConfig()
config.measurement.slots.psfFlux = "base_PsfFlux"
config.measurement.slots.centroid = "base_TransformedCentroidFromCoord"
config.measurement.slots.shape = None
config.measurement.doReplaceWithNoise = False
config.doApCorr = True
driver = ForcedMeasurementDriverTask(config=config)
src_result = driver.runFromAstropy(
srctable,
exposure,
id_column_name="sourceId",
ra_column_name="ra",
dec_column_name="dec",
psf_footprint_scaling=3.0,
)
lsst.forcedMeasurementDriver INFO: Measuring 50 sources in a single band using 'ForcedMeasurementTask'
lsst.forcedMeasurementDriver.measurement INFO: Performing forced measurement on 50 sources
lsst.forcedMeasurementDriver INFO: Applying aperture corrections to a single band
lsst.forcedMeasurementDriver.applyApCorr INFO: Applying aperture corrections to 1 instFlux fields
lsst.forcedMeasurementDriver INFO: Finished processing for a single band; output catalog has 88 fields and 50 records
src_result = fix_flux_columns(src_result)
src_result[:5]
| coord_ra | coord_dec | parent | objectId | parentObjectId | deblend_nChild | base_TransformedCentroidFromCoord_x | slot_Centroid_x | base_TransformedCentroidFromCoord_y | slot_Centroid_y | base_CircularApertureFlux_3_0_flux | base_CircularApertureFlux_3_0_fluxErr | base_CircularApertureFlux_3_0_flag | base_CircularApertureFlux_3_0_flag_apertureTruncated | base_CircularApertureFlux_3_0_flag_sincCoeffsTruncated | base_CircularApertureFlux_4_5_flux | base_CircularApertureFlux_4_5_fluxErr | base_CircularApertureFlux_4_5_flag | base_CircularApertureFlux_4_5_flag_apertureTruncated | base_CircularApertureFlux_4_5_flag_sincCoeffsTruncated | base_CircularApertureFlux_6_0_flux | base_CircularApertureFlux_6_0_fluxErr | base_CircularApertureFlux_6_0_flag | base_CircularApertureFlux_6_0_flag_apertureTruncated | base_CircularApertureFlux_6_0_flag_sincCoeffsTruncated | base_CircularApertureFlux_9_0_flux | base_CircularApertureFlux_9_0_fluxErr | base_CircularApertureFlux_9_0_flag | base_CircularApertureFlux_9_0_flag_apertureTruncated | base_CircularApertureFlux_9_0_flag_sincCoeffsTruncated | base_CircularApertureFlux_12_0_flux | base_CircularApertureFlux_12_0_fluxErr | base_CircularApertureFlux_12_0_flag | base_CircularApertureFlux_12_0_flag_apertureTruncated | base_CircularApertureFlux_17_0_flux | base_CircularApertureFlux_17_0_fluxErr | base_CircularApertureFlux_17_0_flag | base_CircularApertureFlux_17_0_flag_apertureTruncated | base_CircularApertureFlux_25_0_flux | base_CircularApertureFlux_25_0_fluxErr | base_CircularApertureFlux_25_0_flag | base_CircularApertureFlux_25_0_flag_apertureTruncated | base_CircularApertureFlux_35_0_flux | base_CircularApertureFlux_35_0_fluxErr | base_CircularApertureFlux_35_0_flag | base_CircularApertureFlux_35_0_flag_apertureTruncated | base_CircularApertureFlux_50_0_flux | base_CircularApertureFlux_50_0_fluxErr | base_CircularApertureFlux_50_0_flag | base_CircularApertureFlux_50_0_flag_apertureTruncated | base_CircularApertureFlux_70_0_flux | base_CircularApertureFlux_70_0_fluxErr | base_CircularApertureFlux_70_0_flag | base_CircularApertureFlux_70_0_flag_apertureTruncated | base_PixelFlags_flag | base_PixelFlags_flag_offimage | base_PixelFlags_flag_edge | base_PixelFlags_flag_nodata | base_PixelFlags_flag_interpolated | base_PixelFlags_flag_saturated | base_PixelFlags_flag_cr | base_PixelFlags_flag_bad | base_PixelFlags_flag_suspect | base_PixelFlags_flag_edgeCenter | base_PixelFlags_flag_nodataCenter | base_PixelFlags_flag_interpolatedCenter | base_PixelFlags_flag_saturatedCenter | base_PixelFlags_flag_crCenter | base_PixelFlags_flag_badCenter | base_PixelFlags_flag_suspectCenter | base_PixelFlags_flag_edgeCenterAll | base_PixelFlags_flag_nodataCenterAll | base_PixelFlags_flag_interpolatedCenterAll | base_PixelFlags_flag_saturatedCenterAll | base_PixelFlags_flag_crCenterAll | base_PixelFlags_flag_badCenterAll | base_PixelFlags_flag_suspectCenterAll | base_PsfFlux_flux | slot_PsfFlux_flux | base_PsfFlux_fluxErr | slot_PsfFlux_fluxErr | base_PsfFlux_area | slot_PsfFlux_area | base_PsfFlux_chi2 | slot_PsfFlux_chi2 | base_PsfFlux_npixels | slot_PsfFlux_npixels | base_PsfFlux_flag | slot_PsfFlux_flag | base_PsfFlux_flag_noGoodPixels | slot_PsfFlux_flag_noGoodPixels | base_PsfFlux_flag_edge | slot_PsfFlux_flag_edge | base_InvalidPsf_flag | base_PsfFlux_apCorr | slot_PsfFlux_apCorr | base_PsfFlux_apCorrErr | slot_PsfFlux_apCorrErr | base_PsfFlux_flag_apCorr | slot_PsfFlux_flag_apCorr |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| rad | rad | pix | pix | pix | pix | nJy | nJy | nJy | nJy | nJy | nJy | nJy | nJy | nJy | nJy | nJy | nJy | nJy | nJy | nJy | nJy | nJy | nJy | nJy | nJy | nJy | nJy | nJy | nJy | pix | pix | pix | pix | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| float64 | float64 | int64 | int64 | int64 | int32 | float64 | float64 | float64 | float64 | float64 | float64 | bool | bool | bool | float64 | float64 | bool | bool | bool | float64 | float64 | bool | bool | bool | float64 | float64 | bool | bool | bool | float64 | float64 | bool | bool | float64 | float64 | bool | bool | float64 | float64 | bool | bool | float64 | float64 | bool | bool | float64 | float64 | bool | bool | float64 | float64 | bool | bool | bool | bool | bool | bool | bool | bool | bool | bool | bool | bool | bool | bool | bool | bool | bool | bool | bool | bool | bool | bool | bool | bool | bool | float64 | float64 | float64 | float64 | float32 | float32 | float32 | float32 | int32 | int32 | bool | bool | bool | bool | bool | bool | bool | float64 | float64 | float64 | float64 | bool | bool |
| 0.9261081148182645 | -0.4911686627122309 | 0 | 600320187643727228 | 0 | 0 | 3101.66259961815 | 3101.66259961815 | 2683.004464538525 | 2683.004464538525 | 10807.9931640625 | 117.04840087890625 | False | False | False | 14554.33984375 | 161.17442321777344 | False | False | False | 16430.48828125 | 204.00741577148438 | False | False | False | 18135.875 | 290.233642578125 | False | False | False | 18850.2669319883 | 380.44648697216655 | False | False | 18621.223867726512 | 530.2929337173343 | False | False | 20332.8076853659 | 772.9056019654408 | False | False | 20894.15279313596 | 1076.531081938482 | False | False | 22019.16297424445 | 1536.5094034569463 | False | False | 27885.559588468866 | 2152.805710172363 | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | 17778.756447556774 | 17778.756447556774 | 180.18195906181134 | 180.18195906181134 | 60.060238 | 60.060238 | 721.8461 | 721.8461 | 625 | 625 | False | False | False | False | False | False | False | 0.9809244686116884 | 0.9809244686116884 | 0.0 | 0.0 | False | False |
| 0.9258628462972498 | -0.49177969085351353 | 0 | 600320187643725537 | 0 | 0 | 2438.7283028993475 | 2438.7283028993475 | 2607.271619806805 | 2607.271619806805 | 717.3385620117188 | 94.7679443359375 | False | False | False | 1011.271240234375 | 140.94180297851562 | False | False | False | 1028.5889892578125 | 187.99290466308594 | False | False | False | 1389.0892333984375 | 282.6224060058594 | False | False | False | 1775.736476920545 | 379.8526842567531 | False | False | 2398.3982537165284 | 538.3793392462661 | False | False | 2547.437992397696 | 791.151575585714 | False | False | 1871.5431990595534 | 1106.7699811746106 | False | False | 20.762026413343847 | 1579.610098628831 | False | False | 2603.195472717285 | 2211.8687754055977 | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | 1316.499294189713 | 1316.499294189713 | 144.42200007852327 | 144.42200007852327 | 64.09392 | 64.09392 | 659.8952 | 659.8952 | 625 | 625 | False | False | False | False | False | False | False | 0.9835306768964074 | 0.9835306768964074 | 0.0 | 0.0 | False | False |
| 0.9258579443251841 | -0.4918512094624013 | 0 | 600320187643725545 | 0 | 0 | 2365.981628818359 | 2365.981628818359 | 2619.4701984414346 | 2619.4701984414346 | 9540.904296875 | 116.2877197265625 | False | False | False | 12732.375 | 161.72169494628906 | False | False | False | 14447.5498046875 | 206.31500244140625 | False | False | False | 15925.21484375 | 296.0376892089844 | False | False | False | 16502.007598618045 | 391.39138390243903 | False | False | 16231.319842783734 | 545.2871911938946 | False | False | 16306.222371668555 | 794.2562894202924 | False | False | 15509.101887841709 | 1108.6240937283785 | False | False | 15566.423372515594 | 1582.4464097529465 | False | False | 15454.48386008956 | 2212.987169375934 | False | False | False | False | False | False | True | False | False | True | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | 16252.081965620302 | 16252.081965620302 | 185.0742737417989 | 185.0742737417989 | 64.46643 | 64.46643 | 687.1295 | 687.1295 | 625 | 625 | False | False | False | False | False | False | False | 0.9838525809503976 | 0.9838525809503976 | 0.0 | 0.0 | False | False |
| 0.9258520844953266 | -0.4915129280229249 | 0 | 600320187643725492 | 0 | 0 | 2704.1706055077134 | 2704.1706055077134 | 2536.087617595198 | 2536.087617595198 | 468.6375427246094 | 92.76402282714844 | False | False | False | 559.5792236328125 | 138.5949249267578 | False | False | False | 545.8077392578125 | 184.9916229248047 | False | False | False | 924.0810546875 | 278.5931701660156 | False | False | False | 1575.320604648441 | 374.6779156372959 | False | False | 1685.3772354964167 | 530.4033398668362 | False | False | 1297.7036626692861 | 779.924690034393 | False | False | 2840.970360888168 | 1092.0769221143248 | False | False | 4930.439350276254 | 1559.53851909711 | False | False | 11492.966477772105 | 2183.545614546594 | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | 811.9116635594163 | 811.9116635594163 | 139.62530431615218 | 139.62530431615218 | 62.738995 | 62.738995 | 581.6456 | 581.6456 | 625 | 625 | False | False | False | False | False | False | False | 0.9821524445255163 | 0.9821524445255163 | 0.0 | 0.0 | False | False |
| 0.9260258826062737 | -0.49092172614552126 | 0 | 600320187643725502 | 0 | 0 | 3332.699980399892 | 3332.699980399892 | 2553.201562890704 | 2553.201562890704 | 458.43310546875 | 91.42707061767578 | False | False | False | 700.7069091796875 | 136.46255493164062 | False | False | False | 885.3251342773438 | 182.42738342285156 | False | False | False | 1039.4859619140625 | 274.1864013671875 | False | False | False | 1458.4040450565517 | 369.48824955448566 | False | False | 1501.442922835471 | 522.4254263048504 | False | False | 3339.7937393246684 | 768.1923238428856 | False | False | 9380.934817486908 | 1075.9891955318915 | False | False | 19759.50555419922 | 1538.1169736551235 | False | False | 51215.99873912055 | 2154.6620911456776 | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | False | 717.0489159549701 | 717.0489159549701 | 132.85099720890076 | 132.85099720890076 | 59.464394 | 59.464394 | 619.6509 | 619.6509 | 625 | 625 | False | False | False | False | False | False | False | 0.9790756961724103 | 0.9790756961724103 | 0.0 | 0.0 | False | False |
4.1 Compare the forced measurements to the Source table¶
Make a plot showing the ratio of the measured PSF fluxes from the forced measurement task to the psfFlux for the same objects in the Source table. Plot these as a function of magnitude, using Astropy units to convert slot_PsfFlux_flux from the result table to AB magnitudes.
meas_mag = (src_result['slot_PsfFlux_flux'].value*u.nJy).to(u.ABmag)
plt.plot(meas_mag, src_result['slot_PsfFlux_flux']/srctable['psfFlux'], 'k.')
plt.hlines(1.0, 17.3, 26.3, linestyle=':', color='gray')
plt.minorticks_on()
plt.xlim(17.3, 26.3)
plt.xlabel('measured PSF mag')
plt.ylabel('flux ratio (forced/sourceTable)')
plt.tight_layout()
plt.show()