Skip to content

Commit

Permalink
Switch to astropy.time in calls to Apdb methods (DM-43509)
Browse files Browse the repository at this point in the history
APDB interface replaced the use of daf_base.DateTime with astropy Time,
this patch updates client code to convert DateTtime to astropy Time
when passing arguments to Apdb.
  • Loading branch information
andy-slac committed Mar 27, 2024
1 parent 0542d4b commit 4065207
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion python/lsst/ap/association/diaPipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ def run(self,
# Store DiaSources, updated DiaObjects, and DiaForcedSources in the
# Apdb.
self.apdb.store(
DateTime.now(),
DateTime.now().toAstropy(),
diaCalResult.updatedDiaObjects,
associatedDiaSources,
diaForcedSources)
Expand Down
4 changes: 2 additions & 2 deletions python/lsst/ap/association/loadDiaCatalogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ def loadDiaSources(self, diaObjects, region, dateTime, apdb):
"band",
"diaSourceId"])
else:
diaSources = apdb.getDiaSources(region, diaObjects.loc[:, "diaObjectId"], dateTime)
diaSources = apdb.getDiaSources(region, diaObjects.loc[:, "diaObjectId"], dateTime.toAstropy())

diaSources.set_index(["diaObjectId", "band", "diaSourceId"],
drop=False,
Expand Down Expand Up @@ -231,7 +231,7 @@ def loadDiaForcedSources(self, diaObjects, region, dateTime, apdb):
diaForcedSources = apdb.getDiaForcedSources(
region,
diaObjects.loc[:, "diaObjectId"],
dateTime)
dateTime.toAstropy())

diaForcedSources.set_index(["diaObjectId", "diaForcedSourceId"],
drop=False,
Expand Down
2 changes: 1 addition & 1 deletion tests/test_loadDiaCatalogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def setUp(self):
self.exposure)

self.dateTime = self.exposure.visitInfo.date
self.apdb.store(self.dateTime,
self.apdb.store(self.dateTime.toAstropy(),
self.diaObjects,
self.diaSources,
self.diaForcedSources)
Expand Down
4 changes: 2 additions & 2 deletions tests/test_packageAlerts.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def _roundTripThroughApdb(objects, sources, forcedSources, dateTime):
Set of test DiaSources to round trip.
forcedSources : `pandas.DataFrame`
Set of test DiaForcedSources to round trip.
dateTime : `lsst.daf.base.DateTime`
dateTime : `astropy.time.Time`
Time for the Apdb.
Returns
Expand Down Expand Up @@ -200,7 +200,7 @@ def setUp(self):
diaObjects,
diaSourceHistory,
diaForcedSources,
self.exposure.visitInfo.date)
self.exposure.visitInfo.date.toAstropy())
self.diaObjects.replace(to_replace=[None], value=np.nan, inplace=True)
diaSourceHistory.replace(to_replace=[None], value=np.nan, inplace=True)
self.diaForcedSources.replace(to_replace=[None], value=np.nan,
Expand Down

0 comments on commit 4065207

Please sign in to comment.