Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • Detector name consists of a common part <dettype> and unique part <detid>.
  • Alias to the detector name should be kept in separate dictionary outside the scheme.
  • Each detector may have optional predecessor, successor, and other tags in the dictionary.
  • Calibration type folders contain info about calibrations of particular type, ex: pedestals, rms, status, mask, background, etc.
  • Each calibration type contains a set of time stamp ranges defining calibration validity range. If the second time stamp of the range is missing it is considered as infinity (by the end).
  • The time stamp range folder contains tstamp_begin, tstamp_end (int) values, dictionary of tags associated with this folder, reference to the default calibration, and folders with calibration versions, distinguished by there production time stamp.
  • The number of calibration versions for each time stamp range is not limited. Default calibration is defined by the reference default_version.

*

Management Access / management methods

Code Block
tscfile     = cs.tscfile()               # (int) time stamp of the file creation
dettype     = cs.dettype()               # (str) detector type
detid       = cs.detid()                 # (str) detector id
detname     = cs.detname()               # (str) detector name of self object
predecessor = cs.predecessor()           # (str) detname of predecessor or None
successor   = cs.successor()             # (str) detname of successor or None
tags        = cs.tags()                  # (dict) dictionary of tags associated with this detector
ctypes      = cs.ctypes()                # (list) calibration types in the file

tsrangesctg    = cs.ctyperanges(ctype)      # (list) of time ranges for ctype
ctypegrp    = cs.ctypegrp(ctype)         # (DCType ~ h5py.Group)  path to the calibration tyoetype group.object

tags        = csctg.ctypetagstags(ctype)                 # (dict) dictionary of tags associated with this detector

tsrgrp  tsranges    = cs.tsrgrp(ctype, ctg.ranges()               # (list) of time ranges for ctype
tsrg        = ctg.rangegrp(tsrange)      # (strDCRange ~ h5py.Group) time stamp validity range group object

tags        = tsrg.tags()                # (dict) dictionary of tags associated with time stamp range
tsbegin     = cstsrg.tsrbeginbegin(tsrgrp)               # (int) time stamp beginning validity range
tsend       = cstsrg.tsrend(tsrgrp)end()                 # (int) time stamp beginningending validity range
versdefversions     = cstsrg.tsrversdefversions(tsrgrp)      # (h5py.Group) reference to the default version# in(list) theversions time-rangeof groupcalibrations
tagsversdef        = cstsrg.tsrtagsversdef(ctype)             # (dictDCVersion ~ h5py.Group) dictionary of tags associated with time stamp range

versgrpreference to the default version in the time-range group
versg       = cstsrg.versgrp(vers)         # (DCVersion #~ (h5py.Group) reference to the default specified version in the time-range group
tsversprod

tags        = csversg.verstsprodtags(versgrp)               # (intdict) time stampdictionary of the version production
tags associated with time stamp range
tsversprod   = csversg.verstagstsprod(versgrp)       #  (dict) dictionary of tags associated# with(int) time stamp rangeof the version production
calibdata   = csversg.verscalibcalib(versgrp)              # (np.array) calibration array
_____________________

tsr = tsrange(tsbegin, tsend)            # string <tsbegin-tsend>
cs.addcalib(ctype, nda, tsr)
cs.delete(ctype, tsr)
cdic = cs.getdict(ctype)

...

Code Block
# Import
from PSCalib.CalibStoreDCStore import CalibStore DCStore       # inport DCStore (Detector Calibration Store) object 

# Initialization
CPATH_DEF = '/reg/g/psdm/detector/calib'  # default calib directory
cpath = '<path>/calib'                    # local calib directory
cpath = '<path>/<dettype>-<detid>.h5'     # direct to file
cpath = env.calibDir()                    # '/reg/d/psdm/<INS>/<experiment>/calib' - accept current directory

detname = 'pnccd-12345678'                # standard name includes detector type, dash, and n-digit id number
detname = 'Camera1'                       # alias

cs = CalibStoreDCStore(cpath, detname)              # creates a CalibStoreDCStore object.
""" get calibration store object
    Input parameters:
    cpath [str] - path to the hdf5 file or calibration directory. 
                  If cpath is a path to hdf5 file - next parameter is ignored.
                  If cpath=None - default path is used.
                  If cpath is specified as a path to directory (or default) then detname can be an alias.  
    detname [str] - name/alias of the detector 
"""

...

Code Block
p = tstamp parameter to identify constants, which can be retrieved from evt.run() - run number, evt

nda = cs.get(ctype, p) # where ctype stands for pedestals, status, rms, geometry, etc.

# or specific access methods:
nda = cs.pedestals(p)
nda = cs.pixel_status(p)
nda = cs.pixel_rms(p)
nda = cs.pixel_mask(p)
nda = cs.pixel_gain(p)
nda = cs.pixel_bkgd(p)
nda = cs.common_mode(p)

geo = cs.geometry(p)




 

TBD

Open questions

  • What is included in the detector Id version?  FEE version, controller version, etc?
  • when constants are updated (file open to write) they are not available... Lock to resolve.

...