lsst.dax.apdb
19.0.0-3-gbea416a+3
|
Public Member Functions | |
def | __init__ (self, config, afw_schemas=None) |
def | lastVisit (self) |
def | saveVisit (self, visitId, visitTime) |
def | tableRowCount (self) |
def | getDiaObjects (self, pixel_ranges, return_pandas=False) |
def | getDiaSourcesInRegion (self, pixel_ranges, dt, return_pandas=False) |
def | getDiaSources (self, object_ids, dt, return_pandas=False) |
def | getDiaForcedSources (self, object_ids, dt, return_pandas=False) |
def | storeDiaObjects (self, objs, dt) |
def | storeDiaSources (self, sources) |
def | storeDiaForcedSources (self, sources) |
def | countUnassociatedObjects (self) |
def | isVisitProcessed (self, visitInfo) |
def | dailyJob (self) |
def | makeSchema (self, drop=False, mysql_engine='InnoDB', oracle_tablespace=None, oracle_iot=False) |
Public Attributes | |
config | |
Interface to L1 database, hides all database access details. The implementation is configured via standard ``pex_config`` mechanism using `ApdbConfig` configuration class. For an example of different configurations check config/ folder. Parameters ---------- config : `ApdbConfig` afw_schemas : `dict`, optional Dictionary with table name for a key and `afw.table.Schema` for a value. Columns in schema will be added to standard APDB schema.
def lsst.dax.apdb.apdb.Apdb.countUnassociatedObjects | ( | self | ) |
Return the number of DiaObjects that have only one DiaSource associated with them. Used as part of ap_verify metrics. Returns ------- count : `int` Number of DiaObjects with exactly one associated DiaSource.
def lsst.dax.apdb.apdb.Apdb.dailyJob | ( | self | ) |
Implement daily activities like cleanup/vacuum. What should be done during daily cleanup is determined by configuration/schema.
def lsst.dax.apdb.apdb.Apdb.getDiaForcedSources | ( | self, | |
object_ids, | |||
dt, | |||
return_pandas = False |
|||
) |
Returns catalog of DiaForcedSource instances matching given DiaObjects. This method returns :doc:`/modules/lsst.afw.table/index` catalog with schema determined by the schema of L1 database table. Re-mapping of the column names may be done for some columns (based on column map passed to constructor) but types or units are not changed. Parameters ---------- object_ids : Collection of DiaObject IDs dt : `datetime.datetime` Time of the current visit return_pandas : `bool` Return a `pandas.DataFrame` instead of `lsst.afw.table.SourceCatalog`. Returns ------- catalog : `lsst.afw.table.SourceCatalog` or `None` Catalog contaning DiaForcedSource records. `None` is returned if ``read_sources_months`` configuration parameter is set to 0 or when ``object_ids`` is empty.
def lsst.dax.apdb.apdb.Apdb.getDiaObjects | ( | self, | |
pixel_ranges, | |||
return_pandas = False |
|||
) |
Returns catalog of DiaObject instances from given region. Objects are searched based on pixelization index and region is determined by the set of indices. There is no assumption on a particular type of index, client is responsible for consistency when calculating pixelization indices. This method returns :doc:`/modules/lsst.afw.table/index` catalog with schema determined by the schema of APDB table. Re-mapping of the column names is done for some columns (based on column map passed to constructor) but types or units are not changed. Returns only the last version of each DiaObject. Parameters ---------- pixel_ranges : `list` of `tuple` Sequence of ranges, range is a tuple (minPixelID, maxPixelID). This defines set of pixel indices to be included in result. return_pandas : `bool` Return a `pandas.DataFrame` instead of `lsst.afw.table.SourceCatalog`. Returns ------- catalog : `lsst.afw.table.SourceCatalog` or `pandas.DataFrame` Catalog containing DiaObject records.
def lsst.dax.apdb.apdb.Apdb.getDiaSources | ( | self, | |
object_ids, | |||
dt, | |||
return_pandas = False |
|||
) |
Returns catalog of DiaSource instances given set of DiaObject IDs. This method returns :doc:`/modules/lsst.afw.table/index` catalog with schema determined by the schema of APDB table. Re-mapping of the column names is done for some columns (based on column map passed to constructor) but types or units are not changed. Parameters ---------- object_ids : Collection of DiaObject IDs dt : `datetime.datetime` Time of the current visit return_pandas : `bool` Return a `pandas.DataFrame` instead of `lsst.afw.table.SourceCatalog`. Returns ------- catalog : `lsst.afw.table.SourceCatalog`, `pandas.DataFrame`, or `None` Catalog contaning DiaSource records. `None` is returned if ``read_sources_months`` configuration parameter is set to 0 or when ``object_ids`` is empty.
def lsst.dax.apdb.apdb.Apdb.getDiaSourcesInRegion | ( | self, | |
pixel_ranges, | |||
dt, | |||
return_pandas = False |
|||
) |
Returns catalog of DiaSource instances from given region. Sources are searched based on pixelization index and region is determined by the set of indices. There is no assumption on a particular type of index, client is responsible for consistency when calculating pixelization indices. This method returns :doc:`/modules/lsst.afw.table/index` catalog with schema determined by the schema of APDB table. Re-mapping of the column names is done for some columns (based on column map passed to constructor) but types or units are not changed. Parameters ---------- pixel_ranges : `list` of `tuple` Sequence of ranges, range is a tuple (minPixelID, maxPixelID). This defines set of pixel indices to be included in result. dt : `datetime.datetime` Time of the current visit return_pandas : `bool` Return a `pandas.DataFrame` instead of `lsst.afw.table.SourceCatalog`. Returns ------- catalog : `lsst.afw.table.SourceCatalog`, `pandas.DataFrame`, or `None` Catalog containing DiaSource records. `None` is returned if ``read_sources_months`` configuration parameter is set to 0.
def lsst.dax.apdb.apdb.Apdb.isVisitProcessed | ( | self, | |
visitInfo | |||
) |
Test whether data from an image has been loaded into the database. Used as part of ap_verify metrics. Parameters ---------- visitInfo : `lsst.afw.image.VisitInfo` The metadata for the image of interest. Returns ------- isProcessed : `bool` `True` if the data are present, `False` otherwise.
def lsst.dax.apdb.apdb.Apdb.lastVisit | ( | self | ) |
Returns last visit information or `None` if visits table is empty. Visits table is used by ap_proto to track visit information, it is not a part of the regular APDB schema. Returns ------- visit : `Visit` or `None` Last stored visit info or `None` if there was nothing stored yet.
def lsst.dax.apdb.apdb.Apdb.makeSchema | ( | self, | |
drop = False , |
|||
mysql_engine = 'InnoDB' , |
|||
oracle_tablespace = None , |
|||
oracle_iot = False |
|||
) |
Create or re-create all tables. Parameters ---------- drop : `bool` If True then drop tables before creating new ones. mysql_engine : `str`, optional Name of the MySQL engine to use for new tables. oracle_tablespace : `str`, optional Name of Oracle tablespace. oracle_iot : `bool`, optional Make Index-organized DiaObjectLast table.
def lsst.dax.apdb.apdb.Apdb.saveVisit | ( | self, | |
visitId, | |||
visitTime | |||
) |
Store visit information. This method is only used by ``ap_proto`` script from ``l1dbproto`` and is not intended for production pipelines. Parameters ---------- visitId : `int` Visit identifier visitTime : `datetime.datetime` Visit timestamp.
def lsst.dax.apdb.apdb.Apdb.storeDiaForcedSources | ( | self, | |
sources | |||
) |
Store a set of DIAForcedSources from current visit. This methods takes :doc:`/modules/lsst.afw.table/index` catalog, its schema must be compatible with the schema of L1 database table: - column names must correspond to database table columns - some columns names may be re-mapped based on column map passed to constructor - types and units of the columns must match database definitions, no unit conversion is performed presently - columns that have default values in database schema can be omitted from afw schema Parameters ---------- sources : `lsst.afw.table.BaseCatalog` or `pandas.DataFrame` Catalog containing DiaForcedSource records
def lsst.dax.apdb.apdb.Apdb.storeDiaObjects | ( | self, | |
objs, | |||
dt | |||
) |
Store catalog of DiaObjects from current visit. This methods takes :doc:`/modules/lsst.afw.table/index` catalog, its schema must be compatible with the schema of APDB table: - column names must correspond to database table columns - some columns names are re-mapped based on column map passed to constructor - types and units of the columns must match database definitions, no unit conversion is performed presently - columns that have default values in database schema can be omitted from afw schema - this method knows how to fill interval-related columns (validityStart, validityEnd) they do not need to appear in afw schema Parameters ---------- objs : `lsst.afw.table.BaseCatalog` or `pandas.DataFrame` Catalog with DiaObject records dt : `datetime.datetime` Time of the visit
def lsst.dax.apdb.apdb.Apdb.storeDiaSources | ( | self, | |
sources | |||
) |
Store catalog of DIASources from current visit. This methods takes :doc:`/modules/lsst.afw.table/index` catalog, its schema must be compatible with the schema of L1 database table: - column names must correspond to database table columns - some columns names may be re-mapped based on column map passed to constructor - types and units of the columns must match database definitions, no unit conversion is performed presently - columns that have default values in database schema can be omitted from afw schema Parameters ---------- sources : `lsst.afw.table.BaseCatalog` or `pandas.DataFrame` Catalog containing DiaSource records
def lsst.dax.apdb.apdb.Apdb.tableRowCount | ( | self | ) |
Returns dictionary with the table names and row counts. Used by ``ap_proto`` to keep track of the size of the database tables. Depending on database technology this could be expensive operation. Returns ------- row_counts : `dict` Dict where key is a table name and value is a row count.