|
21 | 21 |
|
22 | 22 | __all__ = ["DetectCoaddSourcesConfig", "DetectCoaddSourcesTask"] |
23 | 23 |
|
24 | | -from lsst.pipe.base import (Struct, PipelineTask, PipelineTaskConfig, PipelineTaskConnections) |
| 24 | +from lsst.pipe.base import Struct |
25 | 25 | import lsst.pipe.base.connectionTypes as cT |
26 | | -from lsst.pex.config import Field, ConfigurableField, ChoiceField |
27 | | -from lsst.meas.algorithms import DynamicDetectionTask, ReferenceObjectLoader, ScaleVarianceTask, \ |
28 | | - SetPrimaryFlagsTask |
29 | | -from lsst.meas.base import ( |
30 | | - SingleFrameMeasurementTask, |
31 | | - ApplyApCorrTask, |
32 | | - CatalogCalculationTask, |
33 | | - SkyMapIdGeneratorConfig, |
34 | | -) |
| 26 | +from lsst.pex.config import Field, ConfigurableField |
| 27 | +from lsst.meas.algorithms import DynamicDetectionTask, ReferenceObjectLoader, ScaleVarianceTask |
| 28 | +from lsst.meas.base import SkyMapIdGeneratorConfig |
35 | 29 | from lsst.meas.extensions.scarlet.io import updateCatalogFootprints |
36 | | -from lsst.meas.astrom import DirectMatchTask, denormalizeMatches |
37 | | -from lsst.pipe.tasks.propagateSourceFlags import PropagateSourceFlagsTask |
| 30 | +from lsst.meas.astrom import denormalizeMatches |
38 | 31 | from lsst.pipe.tasks.multiBand import (MeasureMergedCoaddSourcesConnections, |
39 | 32 | MeasureMergedCoaddSourcesConfig, MeasureMergedCoaddSourcesTask, |
40 | 33 | DetectCoaddSourcesConnections, DetectCoaddSourcesConfig, |
41 | 34 | DetectCoaddSourcesTask) |
42 | 35 | import lsst.afw.table as afwTable |
43 | 36 | import lsst.afw.math as afwMath |
44 | 37 | from lsst.daf.base import PropertyList |
45 | | -from lsst.skymap import BaseSkyMap |
46 | 38 |
|
47 | 39 | # NOTE: these imports are a convenience so multiband users only have to import this file. |
48 | 40 | from .mergeDetections import MergeDetectionsConfig, MergeDetectionsTask # noqa: F401 |
@@ -251,57 +243,12 @@ class DcrMeasureMergedCoaddSourcesConnections( |
251 | 243 | name="{inputCoaddName}Coadd_meas_schema", |
252 | 244 | storageClass="SourceCatalog" |
253 | 245 | ) |
254 | | - # TODO[DM-47797]: remove this deprecated connection. |
255 | | - # refCat = cT.PrerequisiteInput( |
256 | | - # doc="Reference catalog used to match measured sources against known sources", |
257 | | - # name="ref_cat", |
258 | | - # storageClass="SimpleCatalog", |
259 | | - # dimensions=("skypix",), |
260 | | - # deferLoad=True, |
261 | | - # multiple=True, |
262 | | - # deprecated="Reference matching in measureCoaddSources will be removed after v29.", |
263 | | - # ) |
264 | 246 | exposure = cT.Input( |
265 | 247 | doc="Input coadd image", |
266 | 248 | name="{inputCoaddName}Coadd_calexp", |
267 | 249 | storageClass="ExposureF", |
268 | 250 | dimensions=("tract", "patch", "band", "subfilter", "skymap") |
269 | 251 | ) |
270 | | - # skyMap = cT.Input( |
271 | | - # doc="SkyMap to use in processing", |
272 | | - # name=BaseSkyMap.SKYMAP_DATASET_TYPE_NAME, |
273 | | - # storageClass="SkyMap", |
274 | | - # dimensions=("skymap",), |
275 | | - # ) |
276 | | - # # TODO[DM-47424]: remove this deprecated connection. |
277 | | - # visitCatalogs = cT.Input( |
278 | | - # doc="Deprecated and unused.", |
279 | | - # name="src", |
280 | | - # dimensions=("instrument", "visit", "detector"), |
281 | | - # storageClass="SourceCatalog", |
282 | | - # multiple=True, |
283 | | - # deprecated="Deprecated and unused. Will be removed after v29.", |
284 | | - # ) |
285 | | - # sourceTableHandles = cT.Input( |
286 | | - # doc=("Source tables that are derived from the ``CalibrateTask`` sources. " |
287 | | - # "These tables contain astrometry and photometry flags, and optionally " |
288 | | - # "PSF flags."), |
289 | | - # name="sourceTable_visit", |
290 | | - # storageClass="ArrowAstropy", |
291 | | - # dimensions=("instrument", "visit"), |
292 | | - # multiple=True, |
293 | | - # deferLoad=True, |
294 | | - # ) |
295 | | - # finalizedSourceTableHandles = cT.Input( |
296 | | - # doc=("Finalized source tables from ``FinalizeCalibrationTask``. These " |
297 | | - # "tables contain PSF flags from the finalized PSF estimation."), |
298 | | - # name="finalized_src_table", |
299 | | - # storageClass="ArrowAstropy", |
300 | | - # dimensions=("instrument", "visit"), |
301 | | - # multiple=True, |
302 | | - # deferLoad=True, |
303 | | - # ) |
304 | | - # # TODO[DM-47797]: remove this deprecated connection. |
305 | 252 | inputCatalog = cT.Input( |
306 | 253 | doc=("Name of the input catalog to use." |
307 | 254 | "If the single band deblender was used this should be 'deblendedFlux." |
@@ -354,121 +301,13 @@ class DcrMeasureMergedCoaddSourcesConnections( |
354 | 301 |
|
355 | 302 | def __init__(self, *, config=None): |
356 | 303 | super().__init__(config=config) |
357 | | - # # del self.visitCatalogs |
358 | | - # if not config.doPropagateFlags: |
359 | | - # del self.sourceTableHandles |
360 | | - # del self.finalizedSourceTableHandles |
361 | | - # else: |
362 | | - # # Check for types of flags required. |
363 | | - # if not config.propagateFlags.source_flags: |
364 | | - # del self.sourceTableHandles |
365 | | - # if not config.propagateFlags.finalized_source_flags: |
366 | | - # del self.finalizedSourceTableHandles |
367 | | - # # TODO[DM-47797]: only the 'if' block contents here should survive. |
368 | | - # if config.inputCatalog == "deblendedCatalog": |
369 | | - # del self.inputCatalog |
370 | | - # if not config.doAddFootprints: |
371 | | - # del self.scarletModels |
372 | | - # else: |
373 | | - # del self.deblendedCatalog |
374 | | - # del self.scarletModels |
375 | | - |
376 | | - # # TODO[DM-47797]: delete the conditionals below. |
377 | | - # if not config.doMatchSources: |
378 | | - # del self.refCat |
379 | | - # del self.matchResult |
380 | | - |
381 | | - # if not config.doWriteMatchesDenormalized: |
382 | | - # del self.denormMatches |
383 | 304 |
|
384 | 305 |
|
385 | 306 | class DcrMeasureMergedCoaddSourcesConfig(MeasureMergedCoaddSourcesConfig, |
386 | 307 | pipelineConnections=DcrMeasureMergedCoaddSourcesConnections): |
387 | 308 | """Configuration parameters for the MeasureMergedCoaddSourcesTask |
388 | 309 | """ |
389 | | - # inputCatalog = ChoiceField( |
390 | | - # dtype=str, |
391 | | - # default="deblendedCatalog", |
392 | | - # allowed={ |
393 | | - # "deblendedCatalog": "Output catalog from ScarletDeblendTask", |
394 | | - # "deblendedFlux": "Output catalog from SourceDeblendTask", |
395 | | - # "mergeDet": "The merged detections before deblending." |
396 | | - # }, |
397 | | - # doc="The name of the input catalog.", |
398 | | - # # TODO[DM-47797]: remove this config option and anything using it. |
399 | | - # deprecated="Support for old deblender outputs will be removed after v29.", |
400 | | - # ) |
401 | | - # doAddFootprints = Field(dtype=bool, |
402 | | - # default=True, |
403 | | - # doc="Whether or not to add footprints to the input catalog from scarlet models." |
404 | | - # "This should be true whenever using the multi-band deblender, " |
405 | | - # "otherwise this should be False.") |
406 | | - # doConserveFlux = Field(dtype=bool, default=True, |
407 | | - # doc="Whether to use the deblender models as templates to re-distribute the flux " |
408 | | - # "from the 'exposure' (True), or to perform measurements on the deblender " |
409 | | - # "model footprints.") |
410 | | - # doStripFootprints = Field(dtype=bool, default=True, |
411 | | - # doc="Whether to strip footprints from the output catalog before " |
412 | | - # "saving to disk. " |
413 | | - # "This is usually done when using scarlet models to save disk space.") |
414 | | - # measurement = ConfigurableField(target=SingleFrameMeasurementTask, doc="Source measurement") |
415 | | - # setPrimaryFlags = ConfigurableField(target=SetPrimaryFlagsTask, doc="Set flags for primary tract/patch") |
416 | | - # doPropagateFlags = Field( |
417 | | - # dtype=bool, default=True, |
418 | | - # doc="Whether to match sources to CCD catalogs to propagate flags (to e.g. identify PSF stars)" |
419 | | - # ) |
420 | | - # propagateFlags = ConfigurableField(target=PropagateSourceFlagsTask, doc="Propagate source flags to |
421 | | - # coadd") |
422 | | - # doMatchSources = Field( |
423 | | - # dtype=bool, |
424 | | - # default=False, |
425 | | - # doc="Match sources to reference catalog?", |
426 | | - # deprecated="Reference matching in measureCoaddSources will be removed after v29.", |
427 | | - # ) |
428 | | - # match = ConfigurableField( |
429 | | - # target=DirectMatchTask, |
430 | | - # doc="Matching to reference catalog", |
431 | | - # deprecated="Reference matching in measureCoaddSources will be removed after v29.", |
432 | | - # ) |
433 | | - # doWriteMatchesDenormalized = Field( |
434 | | - # dtype=bool, |
435 | | - # default=False, |
436 | | - # doc=("Write reference matches in denormalized format? " |
437 | | - # "This format uses more disk space, but is more convenient to read."), |
438 | | - # deprecated="Reference matching in measureCoaddSources will be removed after v29.", |
439 | | - # ) |
440 | 310 | coaddName = Field(dtype=str, default="dcr", doc="Name of coadd") |
441 | | - # psfCache = Field(dtype=int, default=100, doc="Size of psfCache") |
442 | | - # checkUnitsParseStrict = Field( |
443 | | - # doc="Strictness of Astropy unit compatibility check, can be 'raise', 'warn' or 'silent'", |
444 | | - # dtype=str, |
445 | | - # default="raise", |
446 | | - # ) |
447 | | - # doApCorr = Field( |
448 | | - # dtype=bool, |
449 | | - # default=True, |
450 | | - # doc="Apply aperture corrections" |
451 | | - # ) |
452 | | - # applyApCorr = ConfigurableField( |
453 | | - # target=ApplyApCorrTask, |
454 | | - # doc="Subtask to apply aperture corrections" |
455 | | - # ) |
456 | | - # doRunCatalogCalculation = Field( |
457 | | - # dtype=bool, |
458 | | - # default=True, |
459 | | - # doc='Run catalogCalculation task' |
460 | | - # ) |
461 | | - # catalogCalculation = ConfigurableField( |
462 | | - # target=CatalogCalculationTask, |
463 | | - # doc="Subtask to run catalogCalculation plugins on catalog" |
464 | | - # ) |
465 | | - |
466 | | - # hasFakes = Field( |
467 | | - # dtype=bool, |
468 | | - # default=False, |
469 | | - # doc="Should be set to True if fake sources have been inserted into the input data." |
470 | | - # ) |
471 | | - # idGenerator = SkyMapIdGeneratorConfig.make_field() |
472 | 311 |
|
473 | 312 | @property |
474 | 313 | def refObjLoader(self): |
@@ -543,31 +382,6 @@ class DcrMeasureMergedCoaddSourcesTask(MeasureMergedCoaddSourcesTask): |
543 | 382 | def __init__(self, schema=None, peakSchema=None, refObjLoader=None, initInputs=None, |
544 | 383 | **kwargs): |
545 | 384 | super().__init__(schema, peakSchema, refObjLoader, initInputs, **kwargs) |
546 | | - # self.deblended = self.config.inputCatalog.startswith("deblended") |
547 | | - # self.inputCatalog = "Coadd_" + self.config.inputCatalog |
548 | | - # if initInputs is not None: |
549 | | - # schema = initInputs['inputSchema'].schema |
550 | | - # if schema is None: |
551 | | - # raise ValueError("Schema must be defined.") |
552 | | - # self.schemaMapper = afwTable.SchemaMapper(schema) |
553 | | - # self.schemaMapper.addMinimalSchema(schema) |
554 | | - # self.schema = self.schemaMapper.getOutputSchema() |
555 | | - # afwTable.CoordKey.addErrorFields(self.schema) |
556 | | - # self.algMetadata = PropertyList() |
557 | | - # self.makeSubtask("measurement", schema=self.schema, algMetadata=self.algMetadata) |
558 | | - # self.makeSubtask("setPrimaryFlags", schema=self.schema) |
559 | | - # # TODO[DM-47797]: remove match subtask |
560 | | - # if self.config.doMatchSources: |
561 | | - # self.makeSubtask("match", refObjLoader=refObjLoader) |
562 | | - # if self.config.doPropagateFlags: |
563 | | - # self.makeSubtask("propagateFlags", schema=self.schema) |
564 | | - # self.schema.checkUnits(parse_strict=self.config.checkUnitsParseStrict) |
565 | | - # if self.config.doApCorr: |
566 | | - # self.makeSubtask("applyApCorr", schema=self.schema) |
567 | | - # if self.config.doRunCatalogCalculation: |
568 | | - # self.makeSubtask("catalogCalculation", schema=self.schema) |
569 | | - |
570 | | - # self.outputSchema = afwTable.SourceCatalog(self.schema) |
571 | 385 |
|
572 | 386 | def runQuantum(self, butlerQC, inputRefs, outputRefs): |
573 | 387 | inputs = butlerQC.get(inputRefs) |
|
0 commit comments