40from .
import measurePsf, repair, setPrimaryFlags, photoCal, \
45 dimensions=(
"instrument",
"visit",
"detector")):
47 astrometry_ref_cat = connectionTypes.PrerequisiteInput(
48 doc=
"Reference catalog to use for astrometric calibration.",
49 name=
"gaia_dr3_20230707",
50 storageClass=
"SimpleCatalog",
51 dimensions=(
"skypix",),
55 photometry_ref_cat = connectionTypes.PrerequisiteInput(
56 doc=
"Reference catalog to use for photometric calibration.",
57 name=
"ps1_pv3_3pi_20170110",
58 storageClass=
"SimpleCatalog",
59 dimensions=(
"skypix",),
64 exposures = connectionTypes.Input(
65 doc=
"Exposure (or two snaps) to be calibrated, and detected and measured on.",
67 storageClass=
"Exposure",
69 dimensions=[
"instrument",
"exposure",
"detector"],
73 initial_stars_schema = connectionTypes.InitOutput(
74 doc=
"Schema of the output initial stars catalog.",
75 name=
"initial_stars_schema",
76 storageClass=
"SourceCatalog",
81 output_exposure = connectionTypes.Output(
82 doc=
"Photometrically calibrated exposure with fitted calibrations and summary statistics.",
84 storageClass=
"ExposureF",
85 dimensions=(
"instrument",
"visit",
"detector"),
88 stars = connectionTypes.Output(
89 doc=
"Catalog of unresolved sources detected on the calibrated exposure; "
90 "includes source footprints.",
91 name=
"initial_stars_footprints_detector",
92 storageClass=
"SourceCatalog",
93 dimensions=[
"instrument",
"visit",
"detector"],
95 applied_photo_calib = connectionTypes.Output(
96 doc=
"Photometric calibration that was applied to exposure.",
97 name=
"initial_photoCalib_detector",
98 storageClass=
"PhotoCalib",
99 dimensions=(
"instrument",
"visit",
"detector"),
101 background = connectionTypes.Output(
102 doc=
"Background models estimated during calibration task.",
103 name=
"initial_pvi_background",
104 storageClass=
"Background",
105 dimensions=(
"instrument",
"visit",
"detector"),
113 psf_stars = connectionTypes.Output(
114 doc=
"Catalog of bright unresolved sources detected on the exposure used for PSF determination; "
115 "includes source footprints.",
116 name=
"initial_psf_stars_footprints",
117 storageClass=
"SourceCatalog",
118 dimensions=[
"instrument",
"visit",
"detector"],
120 astrometry_matches = connectionTypes.Output(
121 doc=
"Source to reference catalog matches from the astrometry solver.",
122 name=
"initial_astrometry_match_detector",
123 storageClass=
"Catalog",
124 dimensions=(
"instrument",
"visit",
"detector"),
126 photometry_matches = connectionTypes.Output(
127 doc=
"Source to reference catalog matches from the photometry solver.",
128 name=
"initial_photometry_match_detector",
129 storageClass=
"Catalog",
130 dimensions=(
"instrument",
"visit",
"detector"),
135 if not config.optional_outputs:
136 self.outputs.remove(
"psf_stars")
137 self.outputs.remove(
"astrometry_matches")
138 self.outputs.remove(
"photometry_matches")
142 optional_outputs = pexConfig.ListField(
143 doc=
"Which optional outputs to save (as their connection name)?",
147 default=[
"psf_stars",
"astrometry_matches",
"photometry_matches"],
152 id_generator = lsst.meas.base.DetectorVisitIdGeneratorConfig.make_field()
154 snap_combine = pexConfig.ConfigurableField(
156 doc=
"Task to combine two snaps to make one exposure.",
160 install_simple_psf = pexConfig.ConfigurableField(
162 doc=
"Task to install a simple PSF model into the input exposure to use "
163 "when detecting bright sources for PSF estimation.",
165 psf_repair = pexConfig.ConfigurableField(
167 doc=
"Task to repair cosmic rays on the exposure before PSF determination.",
169 psf_subtract_background = pexConfig.ConfigurableField(
170 target=lsst.meas.algorithms.SubtractBackgroundTask,
171 doc=
"Task to perform intial background subtraction, before first detection pass.",
173 psf_detection = pexConfig.ConfigurableField(
174 target=lsst.meas.algorithms.SourceDetectionTask,
175 doc=
"Task to detect sources for PSF determination."
177 psf_source_measurement = pexConfig.ConfigurableField(
178 target=lsst.meas.base.SingleFrameMeasurementTask,
179 doc=
"Task to measure sources to be used for psf estimation."
181 psf_measure_psf = pexConfig.ConfigurableField(
183 doc=
"Task to measure the psf on bright sources."
188 measure_aperture_correction = pexConfig.ConfigurableField(
190 doc=
"Task to compute the aperture correction from the bright stars."
194 star_detection = pexConfig.ConfigurableField(
195 target=lsst.meas.algorithms.SourceDetectionTask,
196 doc=
"Task to detect stars to return in the output catalog."
198 star_sky_sources = pexConfig.ConfigurableField(
199 target=lsst.meas.algorithms.SkyObjectsTask,
200 doc=
"Task to generate sky sources ('empty' regions where there are no detections).",
202 star_mask_streaks = pexConfig.ConfigurableField(
204 doc=
"Task for masking streaks. Adds a STREAK mask plane to an exposure.",
206 star_deblend = pexConfig.ConfigurableField(
207 target=lsst.meas.deblender.SourceDeblendTask,
208 doc=
"Split blended sources into their components"
210 star_measurement = pexConfig.ConfigurableField(
211 target=lsst.meas.base.SingleFrameMeasurementTask,
212 doc=
"Task to measure stars to return in the output catalog."
214 star_apply_aperture_correction = pexConfig.ConfigurableField(
215 target=lsst.meas.base.ApplyApCorrTask,
216 doc=
"Task to apply aperture corrections to the selected stars."
218 star_catalog_calculation = pexConfig.ConfigurableField(
219 target=lsst.meas.base.CatalogCalculationTask,
220 doc=
"Task to compute extendedness values on the star catalog, "
221 "for the star selector to remove extended sources."
223 star_set_primary_flags = pexConfig.ConfigurableField(
225 doc=
"Task to add isPrimary to the catalog."
227 star_selector = lsst.meas.algorithms.sourceSelectorRegistry.makeField(
229 doc=
"Task to select isolated stars to use for calibration."
233 astrometry = pexConfig.ConfigurableField(
234 target=lsst.meas.astrom.AstrometryTask,
235 doc=
"Task to perform astrometric calibration to fit a WCS.",
237 astrometry_ref_loader = pexConfig.ConfigField(
238 dtype=lsst.meas.algorithms.LoadReferenceObjectsConfig,
239 doc=
"Configuration of reference object loader for astrometric fit.",
241 photometry = pexConfig.ConfigurableField(
243 doc=
"Task to perform photometric calibration to fit a PhotoCalib.",
245 photometry_ref_loader = pexConfig.ConfigField(
246 dtype=lsst.meas.algorithms.LoadReferenceObjectsConfig,
247 doc=
"Configuration of reference object loader for photometric fit.",
250 compute_summary_stats = pexConfig.ConfigurableField(
252 doc=
"Task to to compute summary statistics on the calibrated exposure."
280 "ext_shapeHSM_HsmSourceMoments",
281 "base_CircularApertureFlux",
284 "base_ClassificationSizeExtendedness",
291 "base_CircularApertureFlux_12_0_instFlux"
305 "ext_shapeHSM_HsmSourceMoments",
306 'ext_shapeHSM_HsmPsfMoments',
309 "base_CircularApertureFlux",
310 "base_ClassificationSizeExtendedness",
318 self.
star_measurement.plugins[
'base_PixelFlags'].masksFpAnywhere = [
'STREAK']
332 self.
astrometry.wcsFitter.retarget(lsst.meas.astrom.FitAffineWcsTask)
337 self.
astrometry.sourceSelector[
"science"].doFlags =
True
338 self.
astrometry.sourceSelector[
"science"].flags.bad = [
"sky_source"]
339 self.
photometry.match.sourceSelection.doFlags =
True
340 self.
photometry.match.sourceSelection.flags.bad = [
"sky_source"]