00001
00002
00003
00004
00005
00006
00007
00008 """DCConfigParameters - class supporting configuration parameters for application.
00009
00010 @see base class :py:class:`CalibManager.ConfigParameters`
00011
00012 @see project modules
00013 * :py:class:`PSCalib.DCStore`
00014 * :py:class:`PSCalib.DCType`
00015 * :py:class:`PSCalib.DCRange`
00016 * :py:class:`PSCalib.DCVersion`
00017 * :py:class:`PSCalib.DCBase`
00018 * :py:class:`PSCalib.DCInterface`
00019 * :py:class:`PSCalib.DCUtils`
00020 * :py:class:`PSCalib.DCDetectorId`
00021 * :py:class:`PSCalib.DCConfigParameters`
00022 * :py:class:`PSCalib.DCFileName`
00023 * :py:class:`PSCalib.DCLogger`
00024 * :py:class:`PSCalib.DCMethods`
00025 * :py:class:`PSCalib.DCEmail`
00026
00027
00028 This software was developed for the SIT project.
00029 If you use all or part of it, please give an appropriate acknowledgment.
00030
00031 @version $Id:DCConfigParameters.py 11923 2016-05-17 21:14:33Z dubrovin@SLAC.STANFORD.EDU $
00032
00033 @author Mikhail S. Dubrovin
00034 """
00035
00036 __version__ = "$Revision: 12777 $"
00037 __author__ = "Mikhail S. Dubrovin"
00038
00039
00040 from PSCalib.DCLogger import log
00041 from CalibManager.ConfigParameters import ConfigParameters
00042
00043
00044
00045 class DCConfigParameters(ConfigParameters) :
00046 """A storage of configuration parameters for Detector Calibration Store (DCS) project.
00047 """
00048
00049 def __init__(self, fname=None) :
00050 """Constructor.
00051 - fname the file name with configuration parameters, if not specified then default value.
00052 """
00053 ConfigParameters.__init__(self)
00054 self.name = self.__class__.__name__
00055 self.fname_cp = 'confpars-dcs.txt'
00056 log.info('In %s c-tor', self.name)
00057
00058 self.declareParameters()
00059 self.readParametersFromFile(fname)
00060
00061
00062
00063 def declareParameters(self) :
00064
00065
00066 self.log_level = self.declareParameter(name='LOG_LEVEL_OF_MSGS', val_def='info', type='str' )
00067 self.log_file = self.declareParameter(name='LOG_FILE_NAME', val_def='./log.txt', type='str' )
00068 self.dir_repo = self.declareParameter(name='CDS_DIR_REPO', val_def='/reg/g/psdm/detector/calib', type='str' )
00069
00070
00071
00072 cp = DCConfigParameters()
00073
00074
00075
00076 def test_DCConfigParameters() :
00077 log.setPrintBits(0377)
00078 cp.readParametersFromFile()
00079 cp.printParameters()
00080 cp.log_level.setValue('debug')
00081 cp.saveParametersInFile()
00082
00083
00084
00085 if __name__ == "__main__" :
00086 import sys
00087 test_DCConfigParameters()
00088 sys.exit(0)
00089
00090