Skip to content

Commit

Permalink
Update Docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
bsmartradio committed Jun 29, 2023
1 parent 8052e0c commit 5fb9b7c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 23 deletions.
8 changes: 3 additions & 5 deletions python/lsst/ap/association/association.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ def run(self,
New DIASources to be associated with existing DIAObjects.
diaObjects : `pandas.DataFrame`
Existing diaObjects from the Apdb.
exposure : `pandas.DataFrame`
Calibrated exposure differenced with a template image during
image differencing.
Returns
-------
Expand All @@ -117,19 +120,14 @@ def run(self,
nUpdatedDiaObjects=0,
nUnassociatedDiaObjects=0)

print(" doLongTrailFilter is equal to: ", self.config.doLongTrailFilter)
if self.config.doLongTrailFilter:
diaTrailedResult = self.trailedSourceFilter.run(diaSources, exposure)

if len(diaTrailedResult.trailedDiaSources) > 0:
print("Trailed sources cleaned.")
print(len(diaTrailedResult.trailedDiaSources))
else:
print("No trailed sources to clean.")

if len(diaTrailedResult.diaSources) > 0:
print(len(diaSources))

matchResult = self.associate_sources(diaObjects, diaTrailedResult.diaSources)

else:
Expand Down
30 changes: 12 additions & 18 deletions python/lsst/ap/association/trailedSourceFilter.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class TrailedSourceFilterConfig(pexConfig.Config):
maxTrailLength = pexConfig.Field(
dtype=float,
doc='Maximum trail length permitted is less than 10 degrees/day. This is a rate '
'of 0.0416 arcseconds per second.As trail length is measured in '
'of 0.416 arcseconds per second.As trail length is measured in '
'arcseconds, it is dependant on the length of the exposure.',
default=0.416, # HSC Default. Should Decam and LSST defaults be passed? Does it change possibly?
)
Expand All @@ -63,8 +63,11 @@ def run(self,
Parameters
----------
diaSources : `pandas.DataFrame`
dia_sources : `pandas.DataFrame`
New DIASources to be checked for trailed sources.
exposure : `pandas.DataFrame`
Calibrated exposure differenced with a template image during
image differencing.
Returns
-------
Expand All @@ -75,7 +78,7 @@ def run(self,
trailed sources (`pandas.DataFrame`)
- ``"trailed_dia_sources"`` : DiaSources that have trailed more than
65 pixels in length (`pandas.DataFrame`)
0.416 arcseconds/second*exposure_time(`pandas.DataFrame`)
"""
trail_mask = self.check_dia_source_trail(dia_sources, exposure)

Expand All @@ -86,31 +89,22 @@ def run(self,
def check_dia_source_trail(self, dia_sources, exposure):
"""Check that all DiaSources have trails.
If one or more DiaSources are found to have trails with lengths greater than 65 pixels (roughly 10.4
arcseconds), throw a warning to the log with the ids of the offending sources. Add to separate table
and remove from DiaSource Table.
Creates a mask for sources with lengths greater than 0.416 arcseconds/second*exposure time.
Parameters
----------
dia_sources : `pandas.DataFrame`
Input DiaSources to check for trail lengths.
exposure : `pandas.DataFrame`
Calibrated exposure differenced with a template image during
image differencing.
Returns
-------
trimmed_sources : `pandas.DataFrame`
DataFrame of DiaSources trimmed of all entries with tail values greater than 65 arcseconds.
trail_mask : `pandas.DataFrame`
Boolean mask for dia_sources which are greater than the cuttoff length.
"""
exposure_time = exposure.getInfo().getVisitInfo().getExposureTime()
print(" Exposure time ", exposure_time)
trail_mask = (dia_sources.loc[:, "trailLength"].values[:] >= self.config.maxTrailLength*exposure_time)
print("Max length in arcseconds ", self.config.maxTrailLength*exposure_time)
# trail_idxs = np.argwhere(trail_mask.to_numpy()).flatten()
# for trail_idx in trail_idxs:
# self.log.warning(
# "DiaSource %i has a tail greater than 5 arcseconds, "
# "dropping from association." %
# dia_sources.loc[trail_idx, "diaSourceId"])
# dia_sources = dia_sources[~trail_mask]
# trailed_dia_sources = dia_sources[trail_mask]

return trail_mask

0 comments on commit 5fb9b7c

Please sign in to comment.