00001
00002
00003 """ CalibPars - abstract interface for access to calibration parameters.
00004
00005 Methods of this class should be re-implemented in derived classes with name pattern CalibPars<Detector>
00006 for different type of detectore. For example, CSPAD can be implemented in class :py:class:`PSCalib.CalibParsCspadV1`
00007 which enherits from :py:class:`PSCalib.CalibPars`, etc.
00008 Currently implementation of this interface for all detectors is done in class :py:class:`PSCalib.GenericCalibPars`.
00009 Access to all detectors is available through the factory method in class :py:class:`PSCalib.CalibParsStore`.
00010
00011 Usage of (implemented) interface methods::
00012
00013 from PSCalib.CalibPars import CalibPars
00014 import PSCalib.GlobalUtils as gu
00015
00016 cp = CalibPars()
00017 cp.print_attrs()
00018
00019 size = cp.pedestals()
00020 size = cp.pixel_status()
00021 size = cp.pixel_rms()
00022 size = cp.pixel_gain()
00023 size = cp.pixel_mask()
00024 size = cp.pixel_bkgd()
00025 size = cp.common_mode()
00026
00027 ctype = gu.PEDESTALS # ex.: gu.PIXEL_STATUS, gu.PIXEL_RMS, gu.PIXEL_MASK, etc.
00028 size = cp.ndim(ctype)
00029 size = cp.size(ctype)
00030 size = cp.shape(ctype)
00031 size = cp.status(ctype)
00032
00033 @see :py:class:`GenericCalibPars`, :py:class:`PSCalib.CalibParsStore`
00034
00035 This software was developed for the SIT project.
00036 If you use all or part of it, please give an appropriate acknowledgment.
00037
00038 Revision: $Revision: 10647 $
00039
00040 @version $Id: CalibPars.py 10647 2015-09-09 15:20:25Z dubrovin@SLAC.STANFORD.EDU $
00041
00042 @author Mikhail S. Dubrovin
00043 """
00044
00045 __version__ = "$Revision: 10647 $"
00046
00047
00048 import sys
00049
00050
00051
00052 import PSCalib.GlobalUtils as gu
00053
00054
00055
00056 class CalibPars :
00057
00058
00059
00060 def __init__(self) :
00061 """ Constructor
00062 """
00063 self.wmsg = 'WARNING! %s.%s' % (self.__class__.__name__,\
00064 '%s - interface method from the base class needs to be re-implemented in the derived class.')
00065 pass
00066
00067
00068
00069 def print_attrs(self) :
00070 """ Prints attributes
00071 """
00072 print self.wmsg % 'print_attrs()'
00073
00074
00075
00076 def pedestals(self) :
00077 """ Returns pedestals
00078 """
00079 print self.wmsg % 'pedestals()'
00080
00081
00082
00083 def pixel_status(self) :
00084 """ Returns pixel_status
00085 """
00086 print self.wmsg % 'pixel_status()'
00087
00088
00089
00090 def pixel_rms(self) :
00091 """ Returns pixel_rms
00092 """
00093 print self.wmsg % 'pixel_rms()'
00094
00095
00096
00097 def pixel_gain(self) :
00098 """ Returns pixel_gain
00099 """
00100 print self.wmsg % 'pixel_gain()'
00101
00102
00103
00104 def pixel_mask(self) :
00105 """ Returns pixel_mask
00106 """
00107 print self.wmsg % 'pixel_mask()'
00108
00109
00110
00111 def pixel_bkgd(self) :
00112 """ Returns pixel_bkgd
00113 """
00114 print self.wmsg % 'pixel_bkgd()'
00115
00116
00117
00118 def common_mode(self) :
00119 """ Returns common_mode
00120 """
00121 print self.wmsg % 'common_mode()'
00122
00123
00124
00125
00126
00127
00128 def ndim(self, ctype=gu.PEDESTALS) :
00129 """ Returns ndim
00130 """
00131 print self.wmsg % 'ndim(ctype)'
00132
00133
00134
00135 def shape(self, ctype=gu.PEDESTALS) :
00136 """ Returns shape
00137 """
00138 print self.wmsg % 'shape(ctype)'
00139
00140
00141
00142 def size(self, ctype=gu.PEDESTALS) :
00143 """ Returns size
00144 """
00145 print self.wmsg % 'size(ctype)'
00146
00147
00148
00149 def status(self, ctype=gu.PEDESTALS) :
00150 """ Returns status
00151 """
00152 print self.wmsg % 'size(status)'
00153
00154
00155
00156
00157
00158
00159 if __name__ == "__main__" :
00160 print 'Module %s describes interface methods to access calibration parameters' % sys.argv[0]
00161
00162 cp = CalibPars()
00163 cp.print_attrs()
00164 size = cp.size()
00165 size = cp.shape()
00166 size = cp.status()
00167 sys.exit ('End of %s' % sys.argv[0])
00168
00169
00170
00171
00172
00173
00174