Versions Compared

Key

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

...

*

Access methods

Code Block
DCStore methods
DCBase - base class for this project
==================
tscfile==================
tags        = csobj.tscfiletags()                 # (intdict) timedictionary of stamptags ofassociated thewith fileeach creation
dettypeobject
tag         = csobj.dettypetag(k)                 # (str)returns detector type
detid  tag value for key k


DCStore methods
===============
tscfile     = cs.detidtscfile()                 # (str) detector id
detnameint) time stamp of the file creation
dettype     = cs.detnamedettype()               # (str) detector type
detid  name  of self object
predecessor = cs.predecessordetid()                 # (str) detector id
detname  of predecessor or None
successor   = cs.successordetname()               # (str) detnamedetector name of successor or None
tags self object
predecessor = cs.predecessor()           =# cs.tags(str) detname of predecessor or None
successor   = cs.successor()             # (dictstr) dictionarydetname of tagssuccessor associated with this detectoror None
ctypes      = cs.ctypes()                # (list) calibration types in the file
ctg         = cs.ctypegrp(ctype)         # (DCType ~ h5py.Group) calibration type object


DCType methods
==============
tags tsranges       = ctg.tagsranges()                 # (dict) dictionary of tags associated with this detector
tsranges    = ctg.ranges()               # (list) list) of time ranges for ctype
tsrg        = ctg.rangegrp(tsrange)      # (DCRange ~ h5py.Group) time stamp validity range object


DCRange methods
===============
tagstsbegin        = tsrg.tagsbegin()                # (dictint) dictionarytime ofstamp tagsbeginning associatedvalidity with time stamp range
tsbeginrange
tsend       = tsrg.beginend()                 # (int) time stamp beginningending validity range
tsend       = tsrg.end()                 # (int) time stamp ending validity range
versions    versions    = tsrg.versions()            # (list) versions of calibrations
versdef     = tsrg.versdef()             # (DCVersion ~ h5py.Group) reference to the default version in the time-range group
versg       = tsrg.versgrp(vers)         # (DCVersion ~ h5py.Group) specified version in the time-range group


DCVersion methods
=================
tagstsversprod        = versg.tagstsprod()               # (dictint) dictionarytime stamp of tagsthe associatedversion withproduction
calibdata time stamp range
tsversprod  = versg.tsprod()             # (int) time stamp of the version production
calibdata   = = versg.calib()              # (np.array) calibration array

...

Management methods

Code Block
DCStore methodsDCBase - base class for this project
===============
cs.set_tscfile(ts)                 # set (int) time stamp of the file creation  
cs.set_dettype(dettype)            # set (str) detector type
cs.set_detid(detid)                # set (str) detector id
cs.set_detname(detname)            # set (str) detector name of self object
cs.set_predecessor(pred)           # set (str) detname of predecessor or None
cs.set_successor(succ)             # set (str) detname of successor or None
cs.set_tags(d)                     # set (dict) dictionary of tags associated with this detector
cs.add_tag(k,v)                    # add (k,v) add tag to the dictionary of tags associated with this detector
cs.add_ctype(ctype)                # add (str) calibration type to the DCStore object
cs.del_tags()                      # delete tags
cs.del_tag(k)                      # delete tag with key k
cs.del_ctype(ctype)                # delete ctype from the DCStore object


DCType methods
==============
ctg.set_tags(d)                    # set (dict) dictionary of tags for DCType object
ctg.add_tag(k,v)                   # add (k,v) tag to the dictionary of tags for DCType object
ctg.add_range(tsr=====================
obj.set_tags(d)                    # addset (strdict) dictionary of timetags ranges for ctypeobject
ctgobj.deladd_tagstag(k,v)                   # add (k,v) tag to the #dictionary deleteof tags for object
ctgobj.del_tagtags(k)                     # delete tagall tags withfrom keythe kdictionary
ctgobj.del_rangetag(tsrk)                     # delete ctype fromtag thewith DCTypekey objectk


DCRangeDCStore methods
===============
tsrgcs.set_tagstscfile(dts)                   # set (dictint) dictionarytime stamp of tagsthe associatedfile withcreation time stamp range
tsrgcs.addset_tagdettype(k,vdettype)            # set (str) detector   # add (k,v) tag to the dictionary of tags for DCType object
tsrg.set_begin(tsbegintype
cs.set_detid(detid)                # set (str) detector id
cs.set_detname(detname)            # set (intstr) timedetector stampname beginningof validityself rangeobject
tsrgcs.set_endpredecessor(tsendpred)                # set (intstr) timedetname stampof endingpredecessor validityor rangeNone
tsrgcs.addset_versionsuccessor(verssucc)             # set (DCVersionstr) ~ h5py.Group) versions of calibrations
tsrg.set_versdef(vers)detname of successor or None
cs.add_ctype(ctype)                # setadd (DCVersion ~ h5py.Group) versions of calibrations
tsrgstr) calibration type to the DCStore object
cs.del_versionctype(versctype)                # delete version
tsrg.del_tags() ctype from the DCStore object


DCType methods
==============
ctg.add_range(tsr)                 # add (str) of time #ranges deletefor tagsctype
tsrgctg.del_tagrange(ktsr)                    # delete tagctype from withthe keyDCType kobject


DCVersionDCRange methods
=================
versgtsrg.set_tags(d)     begin(tsbegin)            # set (int) time stamp beginning validity range
tsrg.set_end(tsend)                # set (dictint) dictionarytime ofstamp tagsending associated with DCVersion object
versgvalidity range
tsrg.add_tagversion(k,vvers)                 # addset (k,v) tag to the dictionary of tags for DCVersion object
versg.set_tsprod(tsprod)DCVersion ~ h5py.Group) versions of calibrations
tsrg.set_versdef(vers)             # set (intDCVersion ~ h5py.Group) time stampversions of the version production
versg.add_calib(nda)  calibrations
tsrg.del_version(vers)             # set (np.array) calibration array
versg.del_tags(delete version


DCVersion methods
=================
versg.set_tsprod(tsprod)           # set (int) time stamp of the version # delete tagsproduction
versg.deladd_tagcalib(knda)                   # delete tag with key kset (np.array) calibration array

*

 

Data and metadata in tags

...

cpath (str) - path to the calibration directory (ex: cpath='<path>/calib') or direct hdf5 file name (ex: cpath='<path>/<detname>-<detid>.h5'). Default calibration directory CPATH_DEF='/reg/g/psdm/detector/calib'.

 version (int) - time stamp of the version creation

 

Initialization

Code Block
# Import
from PSCalib.DCStore import 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 = DCStore(cpath, detname)              # creates a DCStore 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 
"""

...