Indexers¶
Indexers establish order amongs items
-
class
lfd.gui.imagechecker.indexers.
EventIndexer
(URI=None)[source]¶ Indexes Events database providing a convenient way to establish order among the items.
-
_getFromFrameId
(run, camcol, filter, field, which=0)[source]¶ Queries the database for the Event and returns it. In case multiple Events correspond to the same frame identifier, supplying which selects one of the returned results.
The returned Event is expunged from the database session.
Parameters: - run (int) – run identifier
- camcol (int) – camcol identifier
- filter (str) – string identifier
- field (int) – field identifier
- which (int) – if multiple Events are returned, which one in particular is wanted
-
_getFromItemId
(eventid)[source]¶ Given an unique Event id queries the database for the row and returns it as an appropriate object. The returned object is expunged from the database session.
Parameters: eventid (int) – unique id of the desired Event
-
event
¶ Returns the event pointed to by the current index.
-
-
class
lfd.gui.imagechecker.indexers.
ImageIndexer
(URI=None)[source]¶ Indexes Image database providing a convenient way to establish order among the items.
-
_getFromFrameId
(run, camcol, filter, field, which=0)[source]¶ Queries the database for the Image and returns it. In case multiple Imagess correspond to the same frame identifier, supplying which selects one of the returned results.
The returned Image is expunged from the database session.
Parameters: - run (int) – run identifier
- camcol (int) – camcol identifier
- filter (str) – string identifier
- field (int) – field identifier
- which (int) – if multiple items are returned, which one in particular is wanted
-
_getFromItemId
(imageid)[source]¶ Given an unique image id queries the database for the row and returns it as an appropriate object. The returned object is expunged from the database session.
Parameters: eventid (int) – unique id of the desired Event
-
image
¶ Returns the image pointed to by the current index.
-
-
class
lfd.gui.imagechecker.indexers.
Indexer
(items=None)[source]¶ Generic indexer of items in a database. Given a list of items or a database connection, session and table will produce an order-maintained list of item ids. Indexer allows us to move through the rows of the db in sequentiall or non-sequential manner while loading the currently pointed to object dynamically from the database.
Parameters: items (list, tuple) – list of unique ids of the objects from the db -
current
¶ current position of the index
Type: int
-
maxindex
¶ the maximal value of the index
Type: int
-
items
¶ unique ids of DB rows, the item[current] points to the currently selected row of the DB
Type: list
-
item
¶ currently selected dynamically loaded from the DB as an object
Type: object
-
_Indexer__step
(step)¶ Makes a positive (forward) or negative (backwards) step in the list of items and loads the newly pointed to object.
-
_getFromFrameId
(*args, **kwargs)[source]¶ Given a frame identifier (run, camcol, filter, field), and possibly which, queries the database for the object and returns it. Should be implementation specific perogative of classes that inehrit from Indexer
-
_getFromItemId
(*args, **kwargs)[source]¶ Given an unique object id queries the database for the row and returns it as an appropriate object. The returned object is expunged from the database session.
-
get
(run=None, camcol=None, filter=None, field=None, which=0, itemid=None)[source]¶ If nothing is provided, jumps to the current index and loads the db row into item. If frame identifiers (run, camcol, filter, field) are given loads the object from the database and jumps the index to its position. If itemid is provided, loads the desired object and jumps to its index.
In some cases the frame identifiers can be shared among multiple rows (i.e. multiple Events on a Frame) in which case providing ‘which’ makes it possible to select a particular item from the returned set.
The selected item is expunged from the session.
Parameters: - run (int) – run identifier
- camcol (int) – camcol identifier
- filter (str) – string identifier
- field (int) – field identifier
- which (int) – if multiple items are returned, which one in particular is wanted
- itemid (int) – unique id of the desired item
-