Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DM-48117: don't use LocalPhotoCalib and LocalWcs in CalibrateImageTask. #1017

Merged
merged 3 commits into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions python/lsst/pipe/tasks/calibrateImage.py
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,36 @@ def validate(self):
CalibrateImageConfig.star_normalized_calibration_flux, self, msg,
)

# Ensure base_LocalPhotoCalib and base_LocalWcs plugins are not run,
# because they'd be running too early to pick up the fitted PhotoCalib
# and WCS.
if "base_LocalWcs" in self.psf_source_measurement.plugins.names:
raise pexConfig.FieldValidationError(
CalibrateImageConfig.psf_source_measurement,
self,
"base_LocalWcs cannot run CalibrateImageTask, as it would be run before the astrometry fit."
)
if "base_LocalWcs" in self.star_measurement.plugins.names:
raise pexConfig.FieldValidationError(
CalibrateImageConfig.star_measurement,
self,
"base_LocalWcs cannot run CalibrateImageTask, as it would be run before the astrometry fit."
)
if "base_LocalPhotoCalib" in self.psf_source_measurement.plugins.names:
raise pexConfig.FieldValidationError(
CalibrateImageConfig.psf_source_measurement,
self,
"base_LocalPhotoCalib cannot run CalibrateImageTask, "
"as it would be run before the photometry fit."
)
if "base_LocalPhotoCalib" in self.star_measurement.plugins.names:
raise pexConfig.FieldValidationError(
CalibrateImageConfig.star_measurement,
self,
"base_LocalPhotoCalib cannot run CalibrateImageTask, "
"as it would be run before the photometry fit."
)


class CalibrateImageTask(pipeBase.PipelineTask):
"""Compute the PSF, aperture corrections, astrometric and photometric
Expand Down
190 changes: 52 additions & 138 deletions schemas/PreSource.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,205 +51,133 @@ funcs:
functor: RADecCovColumn
# One calibrated Calib flux is important:
calibFlux:
functor: LocalNanojansky
functor: Column
args:
- slot_CalibFlux_instFlux
- slot_CalibFlux_instFluxErr
- base_LocalPhotoCalib
- base_LocalPhotoCalibErr
- slot_CalibFlux_flux
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Were the *Err entries never supposed to be here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They were supposed to be there and are still there in the outputs (a few lines down, in this case), but the diff obfuscates that a bit. I'm not sure why the LocalNanoJansky functor required flux and calibration errors to compute the fluxes, but I think that's out of scope.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, yeah, I was just asking if the Err fields were actually required for the LocalNanoJansky functor. Looks to me like they aren't: https://github.com/lsst/pipe_tasks/blob/main/python/lsst/pipe/tasks/functors.py#L1751-L1766
(I get that those fields in general are getting added below).

calibFluxErr:
functor: LocalNanojanskyErr
functor: Column
args:
- slot_CalibFlux_instFlux
- slot_CalibFlux_instFluxErr
- base_LocalPhotoCalib
- base_LocalPhotoCalibErr
- slot_CalibFlux_fluxErr
# Not in DPDD. Used for QA
ap03Flux:
functor: LocalNanojansky
functor: Column
args:
- base_CircularApertureFlux_3_0_instFlux
- base_CircularApertureFlux_3_0_instFluxErr
- base_LocalPhotoCalib
- base_LocalPhotoCalibErr
- base_CircularApertureFlux_3_0_flux
ap03FluxErr:
functor: LocalNanojanskyErr
functor: Column
args:
- base_CircularApertureFlux_3_0_instFlux
- base_CircularApertureFlux_3_0_instFluxErr
- base_LocalPhotoCalib
- base_LocalPhotoCalibErr
- base_CircularApertureFlux_3_0_fluxErr
ap03Flux_flag:
functor: Column
args: base_CircularApertureFlux_3_0_flag
# if we need to add decimal apertures call them e.g. ap04p5Flux
ap06Flux:
functor: LocalNanojansky
functor: Column
args:
- base_CircularApertureFlux_6_0_instFlux
- base_CircularApertureFlux_6_0_instFluxErr
- base_LocalPhotoCalib
- base_LocalPhotoCalibErr
- base_CircularApertureFlux_6_0_flux
ap06FluxErr:
functor: LocalNanojanskyErr
functor: Column
args:
- base_CircularApertureFlux_6_0_instFlux
- base_CircularApertureFlux_6_0_instFluxErr
- base_LocalPhotoCalib
- base_LocalPhotoCalibErr
- base_CircularApertureFlux_6_0_fluxErr
ap06Flux_flag:
functor: Column
args: base_CircularApertureFlux_6_0_flag
ap09Flux:
functor: LocalNanojansky
functor: Column
args:
- base_CircularApertureFlux_9_0_instFlux
- base_CircularApertureFlux_9_0_instFluxErr
- base_LocalPhotoCalib
- base_LocalPhotoCalibErr
- base_CircularApertureFlux_9_0_flux
ap09FluxErr:
functor: LocalNanojanskyErr
functor: Column
args:
- base_CircularApertureFlux_9_0_instFlux
- base_CircularApertureFlux_9_0_instFluxErr
- base_LocalPhotoCalib
- base_LocalPhotoCalibErr
- base_CircularApertureFlux_9_0_fluxErr
ap09Flux_flag:
functor: Column
args: base_CircularApertureFlux_9_0_flag
ap12Flux:
functor: LocalNanojansky
functor: Column
args:
- base_CircularApertureFlux_12_0_instFlux
- base_CircularApertureFlux_12_0_instFluxErr
- base_LocalPhotoCalib
- base_LocalPhotoCalibErr
- base_CircularApertureFlux_12_0_flux
ap12FluxErr:
functor: LocalNanojanskyErr
functor: Column
args:
- base_CircularApertureFlux_12_0_instFlux
- base_CircularApertureFlux_12_0_instFluxErr
- base_LocalPhotoCalib
- base_LocalPhotoCalibErr
- base_CircularApertureFlux_12_0_fluxErr
ap12Flux_flag:
functor: Column
args: base_CircularApertureFlux_12_0_flag
ap17Flux:
functor: LocalNanojansky
functor: Column
args:
- base_CircularApertureFlux_17_0_instFlux
- base_CircularApertureFlux_17_0_instFluxErr
- base_LocalPhotoCalib
- base_LocalPhotoCalibErr
- base_CircularApertureFlux_17_0_flux
ap17FluxErr:
functor: LocalNanojanskyErr
functor: Column
args:
- base_CircularApertureFlux_17_0_instFlux
- base_CircularApertureFlux_17_0_instFluxErr
- base_LocalPhotoCalib
- base_LocalPhotoCalibErr
- base_CircularApertureFlux_17_0_fluxErr
ap17Flux_flag:
functor: Column
args: base_CircularApertureFlux_17_0_flag
ap25Flux:
functor: LocalNanojansky
functor: Column
args:
- base_CircularApertureFlux_25_0_instFlux
- base_CircularApertureFlux_25_0_instFluxErr
- base_LocalPhotoCalib
- base_LocalPhotoCalibErr
- base_CircularApertureFlux_25_0_flux
ap25FluxErr:
functor: LocalNanojanskyErr
functor: Column
args:
- base_CircularApertureFlux_25_0_instFlux
- base_CircularApertureFlux_25_0_instFluxErr
- base_LocalPhotoCalib
- base_LocalPhotoCalibErr
- base_CircularApertureFlux_25_0_fluxErr
ap25Flux_flag:
functor: Column
args: base_CircularApertureFlux_25_0_flag
ap35Flux:
functor: LocalNanojansky
functor: Column
args:
- base_CircularApertureFlux_35_0_instFlux
- base_CircularApertureFlux_35_0_instFluxErr
- base_LocalPhotoCalib
- base_LocalPhotoCalibErr
- base_CircularApertureFlux_35_0_flux
ap35FluxErr:
functor: LocalNanojanskyErr
functor: Column
args:
- base_CircularApertureFlux_35_0_instFlux
- base_CircularApertureFlux_35_0_instFluxErr
- base_LocalPhotoCalib
- base_LocalPhotoCalibErr
- base_CircularApertureFlux_35_0_fluxErr
ap35Flux_flag:
functor: Column
args: base_CircularApertureFlux_35_0_flag
ap50Flux:
functor: LocalNanojansky
functor: Column
args:
- base_CircularApertureFlux_50_0_instFlux
- base_CircularApertureFlux_50_0_instFluxErr
- base_LocalPhotoCalib
- base_LocalPhotoCalibErr
- base_CircularApertureFlux_50_0_flux
ap50FluxErr:
functor: LocalNanojanskyErr
functor: Column
args:
- base_CircularApertureFlux_50_0_instFlux
- base_CircularApertureFlux_50_0_instFluxErr
- base_LocalPhotoCalib
- base_LocalPhotoCalibErr
- base_CircularApertureFlux_50_0_fluxErr
ap50Flux_flag:
functor: Column
args: base_CircularApertureFlux_50_0_flag
ap70Flux:
functor: LocalNanojansky
functor: Column
args:
- base_CircularApertureFlux_70_0_instFlux
- base_CircularApertureFlux_70_0_instFluxErr
- base_LocalPhotoCalib
- base_LocalPhotoCalibErr
- base_CircularApertureFlux_70_0_flux
ap70FluxErr:
functor: LocalNanojanskyErr
functor: Column
args:
- base_CircularApertureFlux_70_0_instFlux
- base_CircularApertureFlux_70_0_instFluxErr
- base_LocalPhotoCalib
- base_LocalPhotoCalibErr
- base_CircularApertureFlux_70_0_fluxErr
ap70Flux_flag:
functor: Column
args: base_CircularApertureFlux_70_0_flag
# TODO: When DM-25019 is complete, these should be
# changed to use the local value of the background
# model, rather than the residual of the background
sky:
functor: LocalNanojansky
functor: Column
args:
- base_LocalBackground_instFlux
- base_LocalBackground_instFluxErr
- base_LocalPhotoCalib
- base_LocalPhotoCalibErr
- base_LocalBackground_flux
skyErr:
functor: LocalNanojanskyErr
functor: Column
args:
- base_LocalBackground_instFlux
- base_LocalBackground_instFluxErr
- base_LocalPhotoCalib
- base_LocalPhotoCalibErr
- base_LocalBackground_fluxErr
psfFlux:
functor: LocalNanojansky
functor: Column
args:
- slot_PsfFlux_instFlux
- slot_PsfFlux_instFluxErr
- base_LocalPhotoCalib
- base_LocalPhotoCalibErr
- slot_PsfFlux_flux
psfFluxErr:
functor: LocalNanojanskyErr
functor: Column
args:
- slot_PsfFlux_instFlux
- slot_PsfFlux_instFluxErr
- base_LocalPhotoCalib
- base_LocalPhotoCalibErr
- slot_PsfFlux_fluxErr

# These PS columns do not make sense anymore as named
# psX
Expand Down Expand Up @@ -304,34 +232,20 @@ funcs:
# DPDD does not include gaussianFluxes, however they are used for
# the single frame extendedness column which is used for QA.
gaussianFlux:
functor: LocalNanojansky
functor: Column
args:
- base_GaussianFlux_instFlux
- base_GaussianFlux_instFluxErr
- base_LocalPhotoCalib
- base_LocalPhotoCalibErr
- base_GaussianFlux_flux
gaussianFluxErr:
functor: LocalNanojanskyErr
functor: Column
args:
- base_GaussianFlux_instFlux
- base_GaussianFlux_instFluxErr
- base_LocalPhotoCalib
- base_LocalPhotoCalibErr
- base_GaussianFlux_fluxErr
extendedness:
functor: Column
args: base_ClassificationExtendedness_value
sizeExtendedness:
functor: Column
args: base_ClassificationSizeExtendedness_value
flags:
- base_LocalPhotoCalib
- base_LocalPhotoCalib_flag
- base_LocalPhotoCalibErr
- base_LocalWcs_flag
- base_LocalWcs_CDMatrix_2_1
- base_LocalWcs_CDMatrix_1_1
- base_LocalWcs_CDMatrix_1_2
- base_LocalWcs_CDMatrix_2_2
- base_Blendedness_abs
- base_Blendedness_flag
- base_Blendedness_flag_noCentroid
Expand Down
Loading