Versions Compared

Key

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

...

Is reserved to support common methods of all project classes. For now it stands for manipulations with tags but not limited to.

Code Block
DCBaseo - base class for this project
===================================== DCBase()

# acess methods
tags = objo.tags()                    # returns (dict) dictionary of tags associated with each object
tag  = objo.tag(k)                    # returns tag value for key k
log  = objo.history(fmt)              # returns (str) history records preceded by the time stamp (default fmt='%Y-%m-%dT%H:%M:%S%Z') as a text 
d    = objo.histdict()                # returns (dict) history dictionary associated with current object

obj# management methods
o.set_tags(d)                      # set (dict) dictionary of tags for object
objo.add_tag(k,v)                     # add (k,v) tag to the dictionary of tags for object
objo.del_tags()                       # delete all tags from the dictionary
objo.del_tag(k)                       # delete tag with key k
objo.set_history(d)                   # set (dict) as a history dictionary of the current object
objo.add_history(rec, ts)             # add (str) record with (float) time stamp to the history dictionary (ts:rec). If ts is None - call current time is used as a key. 

Class DCStore

Code Block
cs = DCStore(cpath, detname) acess methods
=====================
tscfile     =# cs.tscfile(str) path to calib directory or file, (str) detector name

# (int) time stamp of the file creation
dettype     = cs.dettype()    acess methods
nda   = cs.get(ctype, tsp, vers)   # (str) ctype - calibration type
     # (str) detector type
detid       = cs.detid()           # (str) detector id
detname     =# cs(...detname() tsp - parameter to get time stamp (evt, # (strrunnum, ts_sec) detector
 name of self object
predecessor = cs.predecessor()     # (str) detname of predecessor or None
successor                = cs.successor()       # (strint) detnamevers - version of successor or None
ctypes calibration, None - use default 
tscfile     = cs.ctypestscfile()          # (listint) calibrationtime typesstamp inof the file creation
ctodettype         = cs.ctypeobjdettype(ctype)         # (DCType ~ h5py.Groupstr) calibrationdetector type object
___________________________________
nda
detid       = cs.get(ctype, tsp, versdetid()   # (str) ctype - calibration type
   # (str) detector id
detname     = cs.detname()         # (str) detector name of self object
predecessor = cs.predecessor()      # (...str) detname tspof -predecessor parameteror toNone
successor get time stamp= (evt, runnum, ts_sec) 
___________________________________# (int) vers - version of calibration, None - use default 

DCStore management methods
==========================cs.successor()       # (str) detname of successor or None
ctypes      = cs.ctypes()          # (list) calibration types in the file
cto         = cs.ctypeobj(ctype)   # (DCType ~ h5py.Group) calibration type object

# management methods
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.add_ctype(ctype)                # add (str) calibration type to the DCStore object
cs.del_ctype(ctype)                # delete ctype (str) from the DCStore object
cs.save(path)                      # save current calibration in the file specified by path, if path is Null - update current file.

Class DCType

Code Block
cto = DCType(dettype)   acess methods
====================           # (str) detector type

# acess methods
ctype      = cto.ctype()           # (str) of ctype name
tsranges   = cto.ranges()          # (list) of time ranges for ctype
tsro       = cto.rangeobj(tsrange) # (DCRange ~ h5py.Group) time stamp validity range object

DCType management methods
=========================validity range object

# management methods
cto.add_range(tsr)                 # add (str) of time ranges for ctype
cto.del_range(tsr)                 # delete range from the DCType object

Class DCRange

Code Block
tsro = DCRange(tsrange)            # (str) time stamp validity range
tsro = DCRange(tsbegin, tsend)      # delete range from the DCType object

Class DCRange

Code Block
DCRange acess methods
=====================(int,int) time stamp validity range

# acess methods
tsbegin     = tsro.begin()         # (int) time stamp beginning validity range
tsend       = tsro.end()           # (int) time stamp ending validity range
versions    = tsro.versions()      # (list of float) versions of calibrations
versodef    = tsro.versdef()       # (DCVersion ~ h5py.Group) reference to the default version in the time-range object
verso       = tsro.versobj(vers)   # (DCVersion ~ h5py.Group) specified version in the time-range object

DCRange# management methods
==========================
tsro.set_begin(tsbegin)            # set (int) time stamp beginning validity range
tsro.set_end(tsend)                # set (int) time stamp ending validity range
tsro.add_version(vers)             # set (DCVersion ~ h5py.Group) versions of calibrations
tsro.set_versdef(vers)             # set (DCVersion ~ h5py.Group) versions of calibrations
tsro.del_version(vers)             # delete version

Class DCVersion

Code Block
verso = DCVersion(vers)            # (str) version name

# acess methods
=======================
tsvers      = verso.tsprod()       # (int) time stamp of the version production
calibdata   = verso.calib()        # (np.array) calibration array

DCVersion# management methods
============================
verso.set_tsprod(tsprod)           # set (int) time stamp of the version production
verso.add_calib(nda)               # set (np.array) calibration array

...