Skip to content

Commit

Permalink
Fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
abudlong committed Sep 20, 2024
1 parent 2548d0b commit e02711f
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions python/lsst/ap/association/diaPipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,8 @@ def run(self,
The band in which the new DiaSources were detected.
idGenerator : `lsst.meas.base.IdGenerator`
Object that generates source IDs and random number generator seeds.
solarSystemObjectTable : `pandas.DataFrame`
Preloaded Solar System objects expected to be visible in the image.
Returns
-------
Expand Down Expand Up @@ -499,7 +501,7 @@ def run(self,
diaForcedSources = makeEmptyForcedSourceTable(self.schema)

# Write results to Alert Production Database (APDB)
self.writeToApdb(associatedDiaSources, diaForcedSources, diaCalResult.updatedDiaObjects)
self.writeToApdb(diaCalResult.updatedDiaObjects, associatedDiaSources, diaForcedSources)

# Package alerts
if self.config.doPackageAlerts:
Expand Down Expand Up @@ -638,6 +640,11 @@ def associateDiaSources(self, diaSourceTable, solarSystemObjectTable, diffIm, di
createResults.nNewDiaObjects,
nTotalSsObjects,
nAssociatedSsObjects)
self.log.info("%i updated and %i unassociated diaObjects. Creating %i new diaObjects",
assocResults.nUpdatedDiaObjects,
assocResults.nUnassociatedDiaObjects,
createResults.nNewDiaObjects,
)
return (associatedDiaSources, createResults.newDiaObjects)

@timeMethod
Expand Down Expand Up @@ -749,30 +756,28 @@ def runForcedMeasurement(self, diaObjects, updatedDiaObjects, exposure, diffIm,
exposure,
diffIm,
idGenerator=idGenerator)
# columns "ra" and "dec" are required for spatial sharding in Cassandra
diaForcedSources.rename(columns={"coord_ra": "ra", "coord_dec": "dec"}, inplace=True)
self.log.info(f"Updating {len(diaForcedSources)} diaForcedSources in the APDB")
diaForcedSources = convertTableToSdmSchema(self.schema, diaForcedSources,
tableName="DiaForcedSource",
)
return diaForcedSources

@timeMethod
def writeToApdb(self, associatedDiaSources, diaForcedSources, updatedDiaObjects):
def writeToApdb(self, updatedDiaObjects, associatedDiaSources, diaForcedSources):
"""Write to the Alert Production Database (Apdb).
Store DiaSources, updated DiaObjects, and DiaForcedSources in the
Alert Production Database (Apdb).
Parameters
----------
updatedDiaObjects : `pandas.DataFrame`
Catalog of updated DiaObjects.
associatedDiaSources : `pandas.DataFrame`
Associated DiaSources with DiaObjects.
diaForcedSources : `pandas.DataFrame`
Catalog of calibrated forced photometered fluxes on both the
difference and direct images at DiaObject locations.
updatedDiaObjects : `pandas.DataFrame`
Catalog of updated DiaObjects.
"""
# Store DiaSources, updated DiaObjects, and DiaForcedSources in the
# Apdb.
Expand Down

0 comments on commit e02711f

Please sign in to comment.