22 """Contains convenience functions for accessing data from the Ppdb for use in 26 __all__ = [
"countUnassociatedObjects",
"isVisitProcessed"]
28 from sqlalchemy
import (func, sql)
32 """Return the number of DiaObjects that have only one DiaSource associated 37 ppdb : `lsst.dax.ppdb.Ppdb` 38 Ppdb object connected to an instantiated database. 43 Number of DiaObjects with exactly one associated DiaSource. 46 table = ppdb._schema.objects
49 stmt = sql.select([func.count()]).select_from(table).where(table.c.nDiaSources == 1)
50 stmt = stmt.where(table.c.validityEnd ==
None)
53 count = ppdb._engine.scalar(stmt)
59 """Test whether data from an image has been loaded into the database. 63 ppdb : `lsst.dax.ppdb.Ppdb` 64 Ppdb object connected to an instantiated database. 65 visitInfo : `lsst.afw.image.VisitInfo` 66 The metadata for the image of interest. 71 `True` if the data are present, `False` otherwise. 73 id = visitInfo.getExposureId()
74 table = ppdb._schema.sources
75 idField = table.c.ccdVisitId
78 query = sql.select([idField]).select_from(table) \
79 .where(idField == id).limit(1)
81 return ppdb._engine.scalar(query)
is not None def countUnassociatedObjects(ppdb)
def isVisitProcessed(ppdb, visitInfo)