Utilities¶
-
lfd.gui.imagechecker.utils.
create_imageDB
(filenamestr, saveURI, echo=False)[source]¶ Finds all paths to matching files given by filenamestr, extracts their frame identifiers and stores them in a database given by saveURI.
Examples
Filenamestr can contain wildcards, f.e.:
>>> create_imageDB("/path/to/dir_containing_subdirs/*/*.png", "sqlite:///foo.db")
will find all /path/to/dir/subdirs/frame-run-camcol-filter-frame.png styled filenames and add their frame identifiers and paths to foo DB.
Parameters: - filenamestr (str) – wildcarded string that will be used to match all desired image files
- saveURI (str) – URI containing type and location of the images database
-
lfd.gui.imagechecker.utils.
eventId2Filename
(eventid, type='.png')[source]¶ From an event id constructs a SDSS styled filename via frameId2Filename function.
Parameters: - eventid (int) – unique Event identifier
- type (str) – file extension (.png, .jpeg etc…)
-
lfd.gui.imagechecker.utils.
eventId2FrameId
(eventid)[source]¶ Returns frame identifiers (run, camcol, filter, field) for an Event identified by given event id.
Parameters: eventid (int) – unique Event identifier
-
lfd.gui.imagechecker.utils.
filename2frameId
(filename)[source]¶ From an SDSS style filename of the:
frame-{filter}-{run:06d}-{camcol}-{field:04}.fits.{type}
format extracts frame identifiers (run, camcol, filter, field).
Parameters: filename (str) – just the filename, no prepended path
-
lfd.gui.imagechecker.utils.
filepath2frameId
(filepath)[source]¶ From a filepath extracts SDSS frame identifiers. Filepath must be of the followng format:
/path/to/frame-{filter}-{run:06d}-{camcol}-{field:04}.fits.{type}
Parameters: filepath (str) – path-like string
-
lfd.gui.imagechecker.utils.
frameId2Filename
(run, camcol, filter, field, type='.png')[source]¶ Translates between frame identifiers and SDSS style filename of the:
frame-{filter}-{run:06d}-{camcol}-{field:04}.fits.{type}
format, where type represents the .png, .jpg or other extensions.
Parameters: - run (int) – run identifier
- camcol (int) – camcol identifier
- filter (str) – string identifier
- field (int) – field identifier
- type (str) – file extension (.png, .jpeg etc…)