Skip to content

Commit b830df3

Browse files
committed
Revert "Merge pull request #412 from lsst/tickets/DM-51228"
This reverts commit 6c75a56, reversing changes made to 5e1b9f9.
1 parent 6c75a56 commit b830df3

File tree

2 files changed

+15
-48
lines changed

2 files changed

+15
-48
lines changed

python/lsst/ip/diffim/detectAndMeasure.py

Lines changed: 13 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -420,28 +420,6 @@ def __init__(self, **kwargs):
420420
self.schema.addField(
421421
"ip_diffim_forced_PsfFlux_flag_edge", "Flag",
422422
"Forced PSF flux object was too close to the edge of the image to use the full PSF model.")
423-
self.schema.addField(
424-
"ip_diffim_forced_template_PsfFlux_instFlux", "D",
425-
"Forced PSF flux measured on the template image.",
426-
units="count")
427-
self.schema.addField(
428-
"ip_diffim_forced_template_PsfFlux_instFluxErr", "D",
429-
"Forced PSF flux error measured on the template image.",
430-
units="count")
431-
self.schema.addField(
432-
"ip_diffim_forced_template_PsfFlux_area", "F",
433-
"Forced template PSF flux effective area of PSF.",
434-
units="pixel")
435-
self.schema.addField(
436-
"ip_diffim_forced_template_PsfFlux_flag", "Flag",
437-
"Forced template PSF flux general failure flag.")
438-
self.schema.addField(
439-
"ip_diffim_forced_template_PsfFlux_flag_noGoodPixels", "Flag",
440-
"Forced template PSF flux not enough non-rejected pixels in data to attempt the fit.")
441-
self.schema.addField(
442-
"ip_diffim_forced_template_PsfFlux_flag_edge", "Flag",
443-
"""Forced template PSF flux object was too close to the edge of the image """
444-
"""to use the full PSF model.""")
445423
self.makeSubtask("forcedMeasurement", refSchema=self.schema)
446424

447425
self.schema.addField("refMatchId", "L", "unique id of reference catalog match")
@@ -716,8 +694,6 @@ def processResults(self, science, matchedTemplate, difference, sources, idFactor
716694

717695
if self.config.doForcedMeasurement:
718696
self.measureForcedSources(diaSources, science, difference.getWcs())
719-
self.measureForcedSources(diaSources, matchedTemplate, difference.getWcs(),
720-
template=True)
721697

722698
measurementResults.subtractedMeasuredExposure = difference
723699

@@ -881,42 +857,35 @@ def measureDiaSources(self, diaSources, science, difference, matchedTemplate):
881857
apCorrMap=apCorrMap,
882858
)
883859

884-
def measureForcedSources(self, diaSources, image, wcs, template=False):
885-
"""Perform forced measurement of the diaSources on a direct image.
860+
def measureForcedSources(self, diaSources, science, wcs):
861+
"""Perform forced measurement of the diaSources on the science image.
886862
887863
Parameters
888864
----------
889865
diaSources : `lsst.afw.table.SourceCatalog`
890866
The catalog of detected sources.
891-
image: `lsst.afw.image.ExposureF`
892-
Exposure that the forced measurement is being performed on
867+
science : `lsst.afw.image.ExposureF`
868+
Science exposure that the template was subtracted from.
893869
wcs : `lsst.afw.geom.SkyWcs`
894870
Coordinate system definition (wcs) for the exposure.
895-
template : `bool`
896-
Is the forced measurement being performed on the template?
897871
"""
898-
# Run forced psf photometry on the image at the diaSource locations.
872+
# Run forced psf photometry on the PVI at the diaSource locations.
899873
# Copy the measured flux and error into the diaSource.
900-
forcedSources = self.forcedMeasurement.generateMeasCat(image, diaSources, wcs)
901-
self.forcedMeasurement.run(forcedSources, image, diaSources, wcs)
902-
903-
if template:
904-
base_key = 'ip_diffim_forced_template_PsfFlux'
905-
else:
906-
base_key = 'ip_diffim_forced_PsfFlux'
874+
forcedSources = self.forcedMeasurement.generateMeasCat(science, diaSources, wcs)
875+
self.forcedMeasurement.run(forcedSources, science, diaSources, wcs)
907876
mapper = afwTable.SchemaMapper(forcedSources.schema, diaSources.schema)
908877
mapper.addMapping(forcedSources.schema.find("base_PsfFlux_instFlux")[0],
909-
f"{base_key}_instFlux", True)
878+
"ip_diffim_forced_PsfFlux_instFlux", True)
910879
mapper.addMapping(forcedSources.schema.find("base_PsfFlux_instFluxErr")[0],
911-
f"{base_key}_instFluxErr", True)
880+
"ip_diffim_forced_PsfFlux_instFluxErr", True)
912881
mapper.addMapping(forcedSources.schema.find("base_PsfFlux_area")[0],
913-
f"{base_key}_area", True)
882+
"ip_diffim_forced_PsfFlux_area", True)
914883
mapper.addMapping(forcedSources.schema.find("base_PsfFlux_flag")[0],
915-
f"{base_key}_flag", True)
884+
"ip_diffim_forced_PsfFlux_flag", True)
916885
mapper.addMapping(forcedSources.schema.find("base_PsfFlux_flag_noGoodPixels")[0],
917-
f"{base_key}_flag_noGoodPixels", True)
886+
"ip_diffim_forced_PsfFlux_flag_noGoodPixels", True)
918887
mapper.addMapping(forcedSources.schema.find("base_PsfFlux_flag_edge")[0],
919-
f"{base_key}_flag_edge", True)
888+
"ip_diffim_forced_PsfFlux_flag_edge", True)
920889
for diaSource, forcedSource in zip(diaSources, forcedSources):
921890
diaSource.assign(forcedSource, mapper)
922891

tests/test_detectAndMeasure.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,7 @@ def test_raise_bad_psf(self):
211211
def test_measurements_finite(self):
212212
"""Measured fluxes and centroids should always be finite.
213213
"""
214-
columnNames = ["coord_ra", "coord_dec", "ip_diffim_forced_PsfFlux_instFlux",
215-
"ip_diffim_forced_template_PsfFlux_instFlux"]
214+
columnNames = ["coord_ra", "coord_dec", "ip_diffim_forced_PsfFlux_instFlux"]
216215

217216
# Set up the simulated images
218217
noiseLevel = 1.
@@ -756,8 +755,7 @@ def test_detection_xy0(self):
756755
def test_measurements_finite(self):
757756
"""Measured fluxes and centroids should always be finite.
758757
"""
759-
columnNames = ["coord_ra", "coord_dec", "ip_diffim_forced_PsfFlux_instFlux",
760-
"ip_diffim_forced_template_PsfFlux_instFlux"]
758+
columnNames = ["coord_ra", "coord_dec", "ip_diffim_forced_PsfFlux_instFlux"]
761759

762760
# Set up the simulated images
763761
noiseLevel = 1.

0 commit comments

Comments
 (0)