From 5fb9b7c4c097d68cc436bc3e4115c4df2639d8d3 Mon Sep 17 00:00:00 2001 From: Brianna Smart Date: Thu, 29 Jun 2023 11:37:55 -0700 Subject: [PATCH] Update Docstrings --- python/lsst/ap/association/association.py | 8 ++--- .../ap/association/trailedSourceFilter.py | 30 ++++++++----------- 2 files changed, 15 insertions(+), 23 deletions(-) diff --git a/python/lsst/ap/association/association.py b/python/lsst/ap/association/association.py index a40efa05..a2d4ae0d 100644 --- a/python/lsst/ap/association/association.py +++ b/python/lsst/ap/association/association.py @@ -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 ------- @@ -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: diff --git a/python/lsst/ap/association/trailedSourceFilter.py b/python/lsst/ap/association/trailedSourceFilter.py index f116a047..a53423dd 100644 --- a/python/lsst/ap/association/trailedSourceFilter.py +++ b/python/lsst/ap/association/trailedSourceFilter.py @@ -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? ) @@ -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 ------- @@ -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) @@ -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