Skip to content
Merged
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
20 changes: 13 additions & 7 deletions python/lsst/ip/diffim/detectAndMeasure.py
Original file line number Diff line number Diff line change
Expand Up @@ -750,17 +750,17 @@ def processResults(self, science, matchedTemplate, difference, sources, idFactor

self.measureDiaSources(initialDiaSources, science, difference, matchedTemplate)

# Add a column for glint trail diaSources, but do not remove them
initialDiaSources, trail_parameters = self._find_glint_trails(initialDiaSources)
if self.config.writeGlintInfo:
measurementResults.mergeItems(trail_parameters, 'glintTrailInfo')

# Remove unphysical diaSources per config.badSourceFlags
diaSources = self._removeBadSources(initialDiaSources)

if self.config.run_sattle:
diaSources = self.filterSatellites(diaSources, science)

# Flag diaSources in glint trails, but do not remove them
diaSources, trail_parameters = self._find_glint_trails(diaSources)
if self.config.writeGlintInfo:
measurementResults.mergeItems(trail_parameters, 'glintTrailInfo')

if self.config.doForcedMeasurement:
self.measureForcedSources(diaSources, science, difference.getWcs())

Expand Down Expand Up @@ -899,9 +899,15 @@ def _find_glint_trails(self, diaSources):
trail_parameters : `dict`
Parameters of all the trails that were found.
"""
trailed_glints = self.findGlints.run(diaSources)
if self.config.doSkySources:
# Do not include sky sources in glint detection
candidateDiaSources = diaSources[~diaSources["sky_source"]].copy(deep=True)
else:
candidateDiaSources = diaSources
trailed_glints = self.findGlints.run(candidateDiaSources)
glint_mask = [True if id in trailed_glints.trailed_ids else False for id in diaSources['id']]
diaSources['glint_trail'] = np.array(glint_mask)
if np.any(glint_mask):
diaSources['glint_trail'] = np.array(glint_mask)
Comment on lines +909 to +910
Copy link
Contributor

Choose a reason for hiding this comment

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

If there are in fact diaSources, and glint_mask is full of False, wouldn't this leave the column empty?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, diaSources['glint_trail'] is all False before this line, not empty.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah ok, so self.schema.addField("glint_trail", "Flag", "DiaSource is part of a glint trail.") creates the column AND sets it default False? The more you know 🌈


slopes = np.array([trail.slope for trail in trailed_glints.parameters])
intercepts = np.array([trail.intercept for trail in trailed_glints.parameters])
Expand Down