Loading [MathJax]/extensions/tex2jax.js
LSST Applications g04a91732dc+cc8870d3f5,g07dc498a13+5aa0b8792f,g0fba68d861+80045be308,g1409bbee79+5aa0b8792f,g1a7e361dbc+5aa0b8792f,g1fd858c14a+f64bc332a9,g208c678f98+1ae86710ed,g35bb328faa+fcb1d3bbc8,g4d2262a081+47ad8a29a8,g4d39ba7253+9633a327c1,g4e0f332c67+5d362be553,g53246c7159+fcb1d3bbc8,g60b5630c4e+9633a327c1,g668ecb457e+25d63fd678,g78460c75b0+2f9a1b4bcd,g786e29fd12+cf7ec2a62a,g7b71ed6315+fcb1d3bbc8,g8852436030+8b64ca622a,g89139ef638+5aa0b8792f,g89e1512fd8+04325574d3,g8d6b6b353c+9633a327c1,g9125e01d80+fcb1d3bbc8,g989de1cb63+5aa0b8792f,g9f33ca652e+b196626af7,ga9baa6287d+9633a327c1,gaaedd4e678+5aa0b8792f,gabe3b4be73+1e0a283bba,gb1101e3267+71e32094df,gb58c049af0+f03b321e39,gb90eeb9370+2807b1ad02,gcf25f946ba+8b64ca622a,gd315a588df+a39986a76f,gd6cbbdb0b4+c8606af20c,gd9a9a58781+fcb1d3bbc8,gde0f65d7ad+4e42d81ab7,ge278dab8ac+932305ba37,ge82c20c137+76d20ab76d,gfe73954cf8+a1301e4c20,w.2025.11
LSST Data Management Base Package
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
lsst.dax.apdb.apdb.Apdb Class Reference
Inheritance diagram for lsst.dax.apdb.apdb.Apdb:
lsst.dax.apdb.cassandra.apdbCassandra.ApdbCassandra lsst.dax.apdb.sql.apdbSql.ApdbSql

Public Member Functions

Apdb from_config (cls, ApdbConfig config)
 
Apdb from_uri (cls, ResourcePathExpression uri)
 
Table|None tableDef (self, ApdbTables table)
 
pandas.DataFrame getDiaObjects (self, Region region)
 
pandas.DataFrame|None getDiaSources (self, Region region, Iterable[int]|None object_ids, astropy.time.Time visit_time)
 
pandas.DataFrame|None getDiaForcedSources (self, Region region, Iterable[int]|None object_ids, astropy.time.Time visit_time)
 
bool containsVisitDetector (self, int visit, int detector, Region region, astropy.time.Time visit_time)
 
pandas.DataFrame getSSObjects (self)
 
None store (self, astropy.time.Time visit_time, pandas.DataFrame objects, pandas.DataFrame|None sources=None, pandas.DataFrame|None forced_sources=None)
 
None storeSSObjects (self, pandas.DataFrame objects)
 
None reassignDiaSources (self, Mapping[int, int] idMap)
 
None dailyJob (self)
 
int countUnassociatedObjects (self)
 
ApdbMetadata metadata (self)
 

Detailed Description

Abstract interface for APDB.

Definition at line 44 of file apdb.py.

Member Function Documentation

◆ containsVisitDetector()

bool lsst.dax.apdb.apdb.Apdb.containsVisitDetector ( self,
int visit,
int detector,
Region region,
astropy.time.Time visit_time )
Test whether any sources for a given visit-detector are present in
the APDB.

Parameters
----------
visit, detector : `int`
    The ID of the visit-detector to search for.
region : `lsst.sphgeom.Region`
    Region corresponding to the visit/detector combination.
visit_time : `astropy.time.Time`
    Visit time (as opposed to visit processing time). This can be any
    timestamp in the visit timespan, e.g. its begin or end time.

Returns
-------
present : `bool`
    `True` if at least one DiaSource or DiaForcedSource record
    may exist for the specified observation, `False` otherwise.

Reimplemented in lsst.dax.apdb.cassandra.apdbCassandra.ApdbCassandra, and lsst.dax.apdb.sql.apdbSql.ApdbSql.

Definition at line 207 of file apdb.py.

213 ) -> bool:
214 """Test whether any sources for a given visit-detector are present in
215 the APDB.
216
217 Parameters
218 ----------
219 visit, detector : `int`
220 The ID of the visit-detector to search for.
221 region : `lsst.sphgeom.Region`
222 Region corresponding to the visit/detector combination.
223 visit_time : `astropy.time.Time`
224 Visit time (as opposed to visit processing time). This can be any
225 timestamp in the visit timespan, e.g. its begin or end time.
226
227 Returns
228 -------
229 present : `bool`
230 `True` if at least one DiaSource or DiaForcedSource record
231 may exist for the specified observation, `False` otherwise.
232 """
233 raise NotImplementedError()
234

◆ countUnassociatedObjects()

int 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.

Notes
-----
This method can be very inefficient or slow in some implementations.

Reimplemented in lsst.dax.apdb.cassandra.apdbCassandra.ApdbCassandra, and lsst.dax.apdb.sql.apdbSql.ApdbSql.

Definition at line 332 of file apdb.py.

332 def countUnassociatedObjects(self) -> int:
333 """Return the number of DiaObjects that have only one DiaSource
334 associated with them.
335
336 Used as part of ap_verify metrics.
337
338 Returns
339 -------
340 count : `int`
341 Number of DiaObjects with exactly one associated DiaSource.
342
343 Notes
344 -----
345 This method can be very inefficient or slow in some implementations.
346 """
347 raise NotImplementedError()
348

◆ dailyJob()

None lsst.dax.apdb.apdb.Apdb.dailyJob ( self)
Implement daily activities like cleanup/vacuum.

What should be done during daily activities is determined by
specific implementation.

Reimplemented in lsst.dax.apdb.cassandra.apdbCassandra.ApdbCassandra, and lsst.dax.apdb.sql.apdbSql.ApdbSql.

Definition at line 323 of file apdb.py.

323 def dailyJob(self) -> None:
324 """Implement daily activities like cleanup/vacuum.
325
326 What should be done during daily activities is determined by
327 specific implementation.
328 """
329 raise NotImplementedError()
330

◆ from_config()

Apdb lsst.dax.apdb.apdb.Apdb.from_config ( cls,
ApdbConfig config )
Create Ppdb instance from configuration object.

Parameters
----------
config : `ApdbConfig`
    Configuration object, type of this object determines type of the
    Apdb implementation.

Returns
-------
apdb : `apdb`
    Instance of `Apdb` class.

Definition at line 48 of file apdb.py.

48 def from_config(cls, config: ApdbConfig) -> Apdb:
49 """Create Ppdb instance from configuration object.
50
51 Parameters
52 ----------
53 config : `ApdbConfig`
54 Configuration object, type of this object determines type of the
55 Apdb implementation.
56
57 Returns
58 -------
59 apdb : `apdb`
60 Instance of `Apdb` class.
61 """
62 return make_apdb(config)
63

◆ from_uri()

Apdb lsst.dax.apdb.apdb.Apdb.from_uri ( cls,
ResourcePathExpression uri )
Make Apdb instance from a serialized configuration.

Parameters
----------
uri : `~lsst.resources.ResourcePathExpression`
    URI or local file path pointing to a file with serialized
    configuration, or a string with a "label:" prefix. In the latter
    case, the configuration will be looked up from an APDB index file
    using the label name that follows the prefix. The APDB index file's
    location is determined by the ``DAX_APDB_INDEX_URI`` environment
    variable.

Returns
-------
apdb : `apdb`
    Instance of `Apdb` class, the type of the returned instance is
    determined by configuration.

Definition at line 65 of file apdb.py.

65 def from_uri(cls, uri: ResourcePathExpression) -> Apdb:
66 """Make Apdb instance from a serialized configuration.
67
68 Parameters
69 ----------
70 uri : `~lsst.resources.ResourcePathExpression`
71 URI or local file path pointing to a file with serialized
72 configuration, or a string with a "label:" prefix. In the latter
73 case, the configuration will be looked up from an APDB index file
74 using the label name that follows the prefix. The APDB index file's
75 location is determined by the ``DAX_APDB_INDEX_URI`` environment
76 variable.
77
78 Returns
79 -------
80 apdb : `apdb`
81 Instance of `Apdb` class, the type of the returned instance is
82 determined by configuration.
83 """
84 config = ApdbConfig.from_uri(uri)
85 return make_apdb(config)
86

◆ getDiaForcedSources()

pandas.DataFrame | None lsst.dax.apdb.apdb.Apdb.getDiaForcedSources ( self,
Region region,
Iterable[int] | None object_ids,
astropy.time.Time visit_time )
Return catalog of DiaForcedSource instances from a given region.

Parameters
----------
region : `lsst.sphgeom.Region`
    Region to search for DIASources.
object_ids : iterable [ `int` ], optional
    List of DiaObject IDs to further constrain the set of returned
    sources. If list is empty then empty catalog is returned with a
    correct schema. If `None` then returned sources are not
    constrained. Some implementations may not support latter case.
visit_time : `astropy.time.Time`
    Time of the current visit.

Returns
-------
catalog : `pandas.DataFrame`, or `None`
    Catalog containing DiaSource records. `None` is returned if
    ``read_forced_sources_months`` configuration parameter is set to 0.

Raises
------
NotImplementedError
    May be raised by some implementations if ``object_ids`` is `None`.

Notes
-----
This method returns DiaForcedSource catalog for a region with
additional filtering based on DiaObject IDs. Only a subset of DiaSource
history is returned limited by ``read_forced_sources_months`` config
parameter, w.r.t. ``visit_time``. If ``object_ids`` is empty then an
empty catalog is always returned with the correct schema
(columns/types). If ``object_ids`` is `None` then no filtering is
performed and some of the returned records may be outside the specified
region.

Reimplemented in lsst.dax.apdb.cassandra.apdbCassandra.ApdbCassandra, and lsst.dax.apdb.sql.apdbSql.ApdbSql.

Definition at line 165 of file apdb.py.

167 ) -> pandas.DataFrame | None:
168 """Return catalog of DiaForcedSource instances from a given region.
169
170 Parameters
171 ----------
172 region : `lsst.sphgeom.Region`
173 Region to search for DIASources.
174 object_ids : iterable [ `int` ], optional
175 List of DiaObject IDs to further constrain the set of returned
176 sources. If list is empty then empty catalog is returned with a
177 correct schema. If `None` then returned sources are not
178 constrained. Some implementations may not support latter case.
179 visit_time : `astropy.time.Time`
180 Time of the current visit.
181
182 Returns
183 -------
184 catalog : `pandas.DataFrame`, or `None`
185 Catalog containing DiaSource records. `None` is returned if
186 ``read_forced_sources_months`` configuration parameter is set to 0.
187
188 Raises
189 ------
190 NotImplementedError
191 May be raised by some implementations if ``object_ids`` is `None`.
192
193 Notes
194 -----
195 This method returns DiaForcedSource catalog for a region with
196 additional filtering based on DiaObject IDs. Only a subset of DiaSource
197 history is returned limited by ``read_forced_sources_months`` config
198 parameter, w.r.t. ``visit_time``. If ``object_ids`` is empty then an
199 empty catalog is always returned with the correct schema
200 (columns/types). If ``object_ids`` is `None` then no filtering is
201 performed and some of the returned records may be outside the specified
202 region.
203 """
204 raise NotImplementedError()
205

◆ getDiaObjects()

pandas.DataFrame lsst.dax.apdb.apdb.Apdb.getDiaObjects ( self,
Region region )
Return catalog of DiaObject instances from a given region.

This method returns only the last version of each DiaObject,
and may return only the subset of the DiaObject columns needed
for AP association. Some
records in a returned catalog may be outside the specified region, it
is up to a client to ignore those records or cleanup the catalog before
futher use.

Parameters
----------
region : `lsst.sphgeom.Region`
    Region to search for DIAObjects.

Returns
-------
catalog : `pandas.DataFrame`
    Catalog containing DiaObject records for a region that may be a
    superset of the specified region.

Reimplemented in lsst.dax.apdb.cassandra.apdbCassandra.ApdbCassandra, and lsst.dax.apdb.sql.apdbSql.ApdbSql.

Definition at line 105 of file apdb.py.

105 def getDiaObjects(self, region: Region) -> pandas.DataFrame:
106 """Return catalog of DiaObject instances from a given region.
107
108 This method returns only the last version of each DiaObject,
109 and may return only the subset of the DiaObject columns needed
110 for AP association. Some
111 records in a returned catalog may be outside the specified region, it
112 is up to a client to ignore those records or cleanup the catalog before
113 futher use.
114
115 Parameters
116 ----------
117 region : `lsst.sphgeom.Region`
118 Region to search for DIAObjects.
119
120 Returns
121 -------
122 catalog : `pandas.DataFrame`
123 Catalog containing DiaObject records for a region that may be a
124 superset of the specified region.
125 """
126 raise NotImplementedError()
127

◆ getDiaSources()

pandas.DataFrame | None lsst.dax.apdb.apdb.Apdb.getDiaSources ( self,
Region region,
Iterable[int] | None object_ids,
astropy.time.Time visit_time )
Return catalog of DiaSource instances from a given region.

Parameters
----------
region : `lsst.sphgeom.Region`
    Region to search for DIASources.
object_ids : iterable [ `int` ], optional
    List of DiaObject IDs to further constrain the set of returned
    sources. If `None` then returned sources are not constrained. If
    list is empty then empty catalog is returned with a correct
    schema.
visit_time : `astropy.time.Time`
    Time of the current visit.

Returns
-------
catalog : `pandas.DataFrame`, or `None`
    Catalog containing DiaSource records. `None` is returned if
    ``read_sources_months`` configuration parameter is set to 0.

Notes
-----
This method returns DiaSource catalog for a region with additional
filtering based on DiaObject IDs. Only a subset of DiaSource history
is returned limited by ``read_sources_months`` config parameter, w.r.t.
``visit_time``. If ``object_ids`` is empty then an empty catalog is
always returned with the correct schema (columns/types). If
``object_ids`` is `None` then no filtering is performed and some of the
returned records may be outside the specified region.

Reimplemented in lsst.dax.apdb.cassandra.apdbCassandra.ApdbCassandra, and lsst.dax.apdb.sql.apdbSql.ApdbSql.

Definition at line 129 of file apdb.py.

131 ) -> pandas.DataFrame | None:
132 """Return catalog of DiaSource instances from a given region.
133
134 Parameters
135 ----------
136 region : `lsst.sphgeom.Region`
137 Region to search for DIASources.
138 object_ids : iterable [ `int` ], optional
139 List of DiaObject IDs to further constrain the set of returned
140 sources. If `None` then returned sources are not constrained. If
141 list is empty then empty catalog is returned with a correct
142 schema.
143 visit_time : `astropy.time.Time`
144 Time of the current visit.
145
146 Returns
147 -------
148 catalog : `pandas.DataFrame`, or `None`
149 Catalog containing DiaSource records. `None` is returned if
150 ``read_sources_months`` configuration parameter is set to 0.
151
152 Notes
153 -----
154 This method returns DiaSource catalog for a region with additional
155 filtering based on DiaObject IDs. Only a subset of DiaSource history
156 is returned limited by ``read_sources_months`` config parameter, w.r.t.
157 ``visit_time``. If ``object_ids`` is empty then an empty catalog is
158 always returned with the correct schema (columns/types). If
159 ``object_ids`` is `None` then no filtering is performed and some of the
160 returned records may be outside the specified region.
161 """
162 raise NotImplementedError()
163

◆ getSSObjects()

pandas.DataFrame lsst.dax.apdb.apdb.Apdb.getSSObjects ( self)
Return catalog of SSObject instances.

Returns
-------
catalog : `pandas.DataFrame`
    Catalog containing SSObject records, all existing records are
    returned.

Reimplemented in lsst.dax.apdb.cassandra.apdbCassandra.ApdbCassandra, and lsst.dax.apdb.sql.apdbSql.ApdbSql.

Definition at line 236 of file apdb.py.

236 def getSSObjects(self) -> pandas.DataFrame:
237 """Return catalog of SSObject instances.
238
239 Returns
240 -------
241 catalog : `pandas.DataFrame`
242 Catalog containing SSObject records, all existing records are
243 returned.
244 """
245 raise NotImplementedError()
246

◆ metadata()

ApdbMetadata lsst.dax.apdb.apdb.Apdb.metadata ( self)
Object controlling access to APDB metadata (`ApdbMetadata`).

Reimplemented in lsst.dax.apdb.cassandra.apdbCassandra.ApdbCassandra, and lsst.dax.apdb.sql.apdbSql.ApdbSql.

Definition at line 351 of file apdb.py.

351 def metadata(self) -> ApdbMetadata:
352 """Object controlling access to APDB metadata (`ApdbMetadata`)."""
353 raise NotImplementedError()

◆ reassignDiaSources()

None lsst.dax.apdb.apdb.Apdb.reassignDiaSources ( self,
Mapping[int, int] idMap )
Associate DiaSources with SSObjects, dis-associating them
from DiaObjects.

Parameters
----------
idMap : `Mapping`
    Maps DiaSource IDs to their new SSObject IDs.

Raises
------
ValueError
    Raised if DiaSource ID does not exist in the database.

Reimplemented in lsst.dax.apdb.cassandra.apdbCassandra.ApdbCassandra, and lsst.dax.apdb.sql.apdbSql.ApdbSql.

Definition at line 306 of file apdb.py.

306 def reassignDiaSources(self, idMap: Mapping[int, int]) -> None:
307 """Associate DiaSources with SSObjects, dis-associating them
308 from DiaObjects.
309
310 Parameters
311 ----------
312 idMap : `Mapping`
313 Maps DiaSource IDs to their new SSObject IDs.
314
315 Raises
316 ------
317 ValueError
318 Raised if DiaSource ID does not exist in the database.
319 """
320 raise NotImplementedError()
321

◆ store()

None lsst.dax.apdb.apdb.Apdb.store ( self,
astropy.time.Time visit_time,
pandas.DataFrame objects,
pandas.DataFrame | None sources = None,
pandas.DataFrame | None forced_sources = None )
Store all three types of catalogs in the database.

Parameters
----------
visit_time : `astropy.time.Time`
    Time of the visit.
objects : `pandas.DataFrame`
    Catalog with DiaObject records.
sources : `pandas.DataFrame`, optional
    Catalog with DiaSource records.
forced_sources : `pandas.DataFrame`, optional
    Catalog with DiaForcedSource records.

Notes
-----
This methods takes DataFrame catalogs, their schema must be
compatible with the schema of APDB table:

  - column names must correspond to database table columns
  - 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 catalog
  - this method knows how to fill interval-related columns of DiaObject
    (validityStart, validityEnd) they do not need to appear in a
    catalog
  - source catalogs have ``diaObjectId`` column associating sources
    with objects

This operation need not be atomic, but DiaSources and DiaForcedSources
will not be stored until all DiaObjects are stored.

Reimplemented in lsst.dax.apdb.cassandra.apdbCassandra.ApdbCassandra, and lsst.dax.apdb.sql.apdbSql.ApdbSql.

Definition at line 248 of file apdb.py.

254 ) -> None:
255 """Store all three types of catalogs in the database.
256
257 Parameters
258 ----------
259 visit_time : `astropy.time.Time`
260 Time of the visit.
261 objects : `pandas.DataFrame`
262 Catalog with DiaObject records.
263 sources : `pandas.DataFrame`, optional
264 Catalog with DiaSource records.
265 forced_sources : `pandas.DataFrame`, optional
266 Catalog with DiaForcedSource records.
267
268 Notes
269 -----
270 This methods takes DataFrame catalogs, their schema must be
271 compatible with the schema of APDB table:
272
273 - column names must correspond to database table columns
274 - types and units of the columns must match database definitions,
275 no unit conversion is performed presently
276 - columns that have default values in database schema can be
277 omitted from catalog
278 - this method knows how to fill interval-related columns of DiaObject
279 (validityStart, validityEnd) they do not need to appear in a
280 catalog
281 - source catalogs have ``diaObjectId`` column associating sources
282 with objects
283
284 This operation need not be atomic, but DiaSources and DiaForcedSources
285 will not be stored until all DiaObjects are stored.
286 """
287 raise NotImplementedError()
288

◆ storeSSObjects()

None lsst.dax.apdb.apdb.Apdb.storeSSObjects ( self,
pandas.DataFrame objects )
Store or update SSObject catalog.

Parameters
----------
objects : `pandas.DataFrame`
    Catalog with SSObject records.

Notes
-----
If SSObjects with matching IDs already exist in the database, their
records will be updated with the information from provided records.

Reimplemented in lsst.dax.apdb.cassandra.apdbCassandra.ApdbCassandra, and lsst.dax.apdb.sql.apdbSql.ApdbSql.

Definition at line 290 of file apdb.py.

290 def storeSSObjects(self, objects: pandas.DataFrame) -> None:
291 """Store or update SSObject catalog.
292
293 Parameters
294 ----------
295 objects : `pandas.DataFrame`
296 Catalog with SSObject records.
297
298 Notes
299 -----
300 If SSObjects with matching IDs already exist in the database, their
301 records will be updated with the information from provided records.
302 """
303 raise NotImplementedError()
304

◆ tableDef()

Table | None lsst.dax.apdb.apdb.Apdb.tableDef ( self,
ApdbTables table )
Return table schema definition for a given table.

Parameters
----------
table : `ApdbTables`
    One of the known APDB tables.

Returns
-------
tableSchema : `.schema_model.Table` or `None`
    Table schema description, `None` is returned if table is not
    defined by this implementation.

Reimplemented in lsst.dax.apdb.cassandra.apdbCassandra.ApdbCassandra, and lsst.dax.apdb.sql.apdbSql.ApdbSql.

Definition at line 88 of file apdb.py.

88 def tableDef(self, table: ApdbTables) -> Table | None:
89 """Return table schema definition for a given table.
90
91 Parameters
92 ----------
93 table : `ApdbTables`
94 One of the known APDB tables.
95
96 Returns
97 -------
98 tableSchema : `.schema_model.Table` or `None`
99 Table schema description, `None` is returned if table is not
100 defined by this implementation.
101 """
102 raise NotImplementedError()
103

The documentation for this class was generated from the following file: