ApdbPostgresQuery¶
- class lsst.analysis.ap.ApdbPostgresQuery(namespace, url='rubin@usdf-prompt-processing-dev.slac.stanford.edu/lsst-devl', instrument=None, **kwargs)¶
- Bases: - DbSqlQuery- Connect to a running postgres APDB instance and load data from it. - This class connects to the database only when the - connectioncontext manager is entered, and closes the connection after it exits.- Parameters:
- namespacestr
- Database namespace to load from. Called “schema” in postgres docs. 
- urlstr
- Complete url to connect to postgres database, without prepended - postgresql://.
- instrumentstr
- Short name (e.g. “DECam”) of instrument to make a dataId unpacker and to add to the table columns; supports any gen3 instrument. To be deprecated once this information is in the database. 
 
- namespace
 - Attributes Summary - Context manager for database connections. - Methods Summary - Load one diaForcedSource. - load_forced_sources([limit])- Load all diaForcedSources. - load_forced_sources_for_object(dia_object_id)- Load diaForcedSources for a single diaObject. - load_object(id)- Load the most-recently updated version of one diaObject. - load_objects([limit, latest])- Load all diaObjects. - load_source(id)- Load one diaSource. - load_sources([exclude_flagged, limit])- Load diaSources. - load_sources_for_object(dia_object_id[, ...])- Load diaSources for a single diaObject. - set_excluded_diaSource_flags(flag_list)- Set flags of diaSources to exclude when loading diaSources. - Attributes Documentation - connection¶
 - Methods Documentation - load_forced_source(id)¶
- Load one diaForcedSource. - Parameters:
- idint
- The diaForcedSourceId to load data for. 
 
- id
- Returns:
- datapandas.Series
- The requested forced source. 
 
- data
 
 - load_forced_sources(limit=100000)¶
- Load all diaForcedSources. - Parameters:
- limitint
- Maximum number of rows to return. 
 
- limit
- Returns:
- datapandas.DataFrame
- All available diaForcedSources. 
 
- data
 
 - load_forced_sources_for_object(dia_object_id, exclude_flagged=False, limit=100000)¶
- Load diaForcedSources for a single diaObject. - Parameters:
- dia_object_idint
- Id of object to load sources for. 
- exclude_flaggedbool, optional
- Exclude sources that have selected flags set. Use - set_excluded_diaSource_flagsto configure which flags are excluded.
- limitint
- Maximum number of rows to return. 
 
- dia_object_id
- Returns:
- datapandas.DataFrame
- A data frame of diaSources for the specified diaObject. 
 
- data
 
 - load_object(id)¶
- Load the most-recently updated version of one diaObject. - Parameters:
- idint
- The diaObjectId to load data for. 
 
- id
- Returns:
- datapandas.Series
- The requested object. 
 
- data
 
 - load_objects(limit=100000, latest=True)¶
- Load all diaObjects. - Parameters:
- Returns:
- datapandas.DataFrame
- All available diaObjects. 
 
- data
 
 - load_source(id)¶
- Load one diaSource. - Parameters:
- idint
- The diaSourceId to load data for. 
 
- id
- Returns:
- datapandas.Series
- The requested diaSource. 
 
- data
 
 - load_sources(exclude_flagged=False, limit=100000)¶
- Load diaSources. - Parameters:
- exclude_flaggedbool, optional
- Exclude sources that have selected flags set. Use - set_excluded_diaSource_flagsto configure which flags are excluded.
- limitint
- Maximum number of rows to return. 
 
- exclude_flagged
- Returns:
- datapandas.DataFrame
- All available diaSources. 
 
- data
 
 - load_sources_for_object(dia_object_id, exclude_flagged=False, limit=100000)¶
- Load diaSources for a single diaObject. - Parameters:
- dia_object_idint
- Id of object to load sources for. 
- exclude_flaggedbool, optional
- Exclude sources that have selected flags set. Use - set_excluded_diaSource_flagsto configure which flags are excluded.
- limitint
- Maximum number of rows to return. 
 
- dia_object_id
- Returns:
- datapandas.DataFrame
- A data frame of diaSources for the specified diaObject. 
 
- data
 
 - set_excluded_diaSource_flags(flag_list)¶
- Set flags of diaSources to exclude when loading diaSources. - Any diaSources with configured flags are not returned when calling - load_sources_for_objector- load_sourceswith- exclude_flagged = True.