CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes | Static Public Attributes
python.rootplot.core.Options Class Reference

Classes #############################################################. More...

Inheritance diagram for python.rootplot.core.Options:

Public Member Functions

def __getattr__ (self, key)
 
def __init__ (self, options, arguments, scope='global')
 
def __setattr__ (self, key, value)
 
def append_from_package (self, package, scope)
 
def arguments (self)
 
def clean_targets (self)
 
def kwarg_list (self)
 
def process_configs (self, scope)
 

Public Attributes

 configs
 
 filenames
 
 targets
 

Static Public Attributes

 config_template
 Templates ###########################################################. More...
 

Detailed Description

Classes #############################################################.

Definition at line 89 of file core.py.

Constructor & Destructor Documentation

def python.rootplot.core.Options.__init__ (   self,
  options,
  arguments,
  scope = 'global' 
)

Definition at line 90 of file core.py.

References dir.

90  def __init__(self, options, arguments, scope='global'):
91  for opt in dir(options):
92  value = getattr(options, opt)
93  if (not opt.startswith('__') and
94  type(value) in [int, float, str, bool, type(None)]):
95  self[opt] = value
96  self.filenames = [x for x in arguments if x.endswith('.root')]
97  self.configs = [x for x in arguments if x.endswith('.py')]
98  self.targets = [x for x in arguments if not (x.endswith('.py') or
99  x.endswith('.root'))]
100  self.process_configs(scope)
def __init__(self, options, arguments, scope='global')
Definition: core.py:90
def process_configs(self, scope)
Definition: core.py:126
dbl *** dir
Definition: mlp_gen.cc:35

Member Function Documentation

def python.rootplot.core.Options.__getattr__ (   self,
  key 
)

Definition at line 103 of file core.py.

103  def __getattr__(self, key):
104  return self[key]
def __getattr__(self, key)
Definition: core.py:103
def python.rootplot.core.Options.__setattr__ (   self,
  key,
  value 
)

Definition at line 101 of file core.py.

Referenced by GenObject.GenObject.setValue().

101  def __setattr__(self, key, value):
102  self[key] = value
def __setattr__(self, key, value)
Definition: core.py:101
def python.rootplot.core.Options.append_from_package (   self,
  package,
  scope 
)

Definition at line 119 of file core.py.

References dir.

Referenced by python.rootplot.core.Options.process_configs().

119  def append_from_package(self, package, scope):
120  for attribute in dir(package):
121  if '__' not in attribute:
122  if ((scope == 'global' and attribute in global_opts) or
123  (scope == 'plot' and attribute not in global_opts)):
124  value = getattr(package, attribute)
125  self[attribute] = value
dbl *** dir
Definition: mlp_gen.cc:35
def append_from_package(self, package, scope)
Definition: core.py:119
def python.rootplot.core.Options.arguments (   self)
def python.rootplot.core.Options.clean_targets (   self)

Definition at line 105 of file core.py.

References ProcMLP.targets, and python.rootplot.core.Options.targets.

Referenced by python.rootplot.core.Options.process_configs().

105  def clean_targets(self):
106  for i in range(len(self.targets)):
107  if self.targets[i][-1] == '/':
108  self.targets[i] = self.targets[i][:-1]
def python.rootplot.core.Options.kwarg_list (   self)

Definition at line 111 of file core.py.

References PixelDCSObject< T >.items, Items.items(), EcalContainer< DetIdT, T >.items(), EcalContainer< EcalTrigTowerDetId, Item >.items(), EcalContainer< DetId, T >.items(), EcalContainer< EBDetId, EcalTPGPedestal >.items(), EcalContainer< EBDetId, EcalPulseSymmCovariance >.items(), EcalContainer< EcalScDetId, EcalDAQStatusCode >.items(), EcalContainer< EBDetId, float >.items(), EcalContainer< EBDetId, EcalPulseCovariance >.items(), EcalContainer< EBDetId, EcalPulseShape >.items(), EcalContainer< EEDetId, EcalMGPAGainRatio >.items(), EcalContainer< EEDetId, EcalLaserAPDPNRatios::EcalLaserAPDPNpair >.items(), EcalContainer< EcalTrigTowerDetId, EcalChannelStatusCode >.items(), EcalContainer< EBDetId, EcalXtalGroupId >.items(), EcalContainer< EEDetId, EcalTPGCrystalStatusCode >.items(), EcalContainer< EBDetId, EcalTPGCrystalStatusCode >.items(), EcalContainer< EcalTrigTowerDetId, EcalDAQStatusCode >.items(), EcalContainer< EEDetId, EcalChannelStatusCode >.items(), EcalContainer< EcalScDetId, EcalDQMStatusCode >.items(), EcalContainer< ESDetId, Item >.items(), EcalContainer< EBDetId, EcalChannelStatusCode >.items(), EcalContainer< EcalTrigTowerDetId, EcalDQMStatusCode >.items(), EcalContainer< EcalScDetId, Item >.items(), EcalContainer< EEDetId, EcalPulseCovariance >.items(), EcalContainer< EEDetId, EcalDQMStatusCode >.items(), EcalContainer< EBDetId, EcalMGPAGainRatio >.items(), EcalContainer< EEDetId, EcalPedestal >.items(), EcalContainer< EBDetId, EcalTPGLinearizationConstant >.items(), EcalContainer< EEDetId, Item >.items(), EcalContainer< EBDetId, EcalMappingElement >.items(), EcalContainer< EcalScDetId, EcalChannelStatusCode >.items(), EcalContainer< EBDetId, Item >.items(), EcalContainer< EEDetId, EcalPulseSymmCovariance >.items(), EcalContainer< EBDetId, EcalTimeDependentCorrections::Values >.items(), EcalContainer< EEDetId, EcalTimeDependentCorrections::Values >.items(), EcalContainer< EEDetId, EcalMappingElement >.items(), EcalContainer< EBDetId, EcalPedestal >.items(), EcalContainer< EEDetId, EcalPulseShape >.items(), EcalContainer< EBDetId, EcalLaserAPDPNRatios::EcalLaserAPDPNpair >.items(), EcalContainer< EEDetId, EcalXtalGroupId >.items(), EcalContainer< EBDetId, EcalDQMStatusCode >.items(), EcalContainer< EEDetId, float >.items(), EcalContainer< EEDetId, EcalTPGPedestal >.items(), EcalContainer< EEDetId, EcalTPGLinearizationConstant >.items(), DictTypes.SortedKeysDict.items(), betterConfigParser.AdaptedDict.items(), AlignmentSurfaceDeformations.items(), edm::ErrorObj.items(), FWTableViewManager.items(), tensorflow::NTSession::ExecutorsAndKeys.items, tensorflow::TBBSession::ExecutorsAndKeys.items, betterConfigParser.BetterConfigParser.items(), svgfig.SVG.items(), and python.rootplot.core.parse_arguments().

111  def kwarg_list(self):
112  diffs = {}
113  defaults = parse_arguments([])
114  for key, value in self.items():
115  if (key not in ['filenames', 'targets', 'configs'] and
116  defaults[key] != value):
117  diffs[key] = value
118  return diffs
def parse_arguments(argv, scope='global')
Definition: core.py:1816
def python.rootplot.core.Options.process_configs (   self,
  scope 
)

Definition at line 126 of file core.py.

References python.rootplot.core.Options.append_from_package(), python.rootplot.core.Options.clean_targets(), python.rootplot.core.config_string(), PhysicsTools::VarProcessor::ConfigCtx.configs, python.rootplot.core.Options.configs, pos::PixelConfigList.configs, edm.print(), and python.rootplot.core.write_to_file().

126  def process_configs(self, scope):
127  #### Load variables from configs; scope is 'global' or 'plot'
128  configdir = tempfile.mkdtemp()
129  sys.path.insert(0, '')
130  sys.path.insert(0, configdir)
132  joined(configdir, 'default_config.py'))
133  configs = ['default_config.py']
134  for i, c in enumerate(self.configs):
135  shutil.copy(c, joined(configdir, 'rpconfig%i.py' % i))
136  configs.append('rpconfig%i.py' % i)
137  rc_name = use_mpl and 'rootplotmplrc' or 'rootplotrc'
138  rc_path = os.path.expanduser('~/.%s' % rc_name)
139  if os.path.exists(rc_path):
140  print("Using styles and options from ~/.%s" % rc_name)
141  shutil.copy(rc_path, joined(configdir, '%s.py' % rc_name))
142  configs.insert(1, '%s.py' % rc_name)
143  for f in configs:
144  myconfig = __import__(f[:-3])
145  self.append_from_package(myconfig, scope)
146  self.clean_targets()
147  shutil.rmtree(configdir)
148 
149 
def process_configs(self, scope)
Definition: core.py:126
S & print(S &os, JobReport::InputFile const &f)
Definition: JobReport.cc:66
def write_to_file(script, destination)
Implementation ######################################################.
Definition: core.py:778
def config_string()
Definition: core.py:798
def append_from_package(self, package, scope)
Definition: core.py:119

Member Data Documentation

python.rootplot.core.Options.config_template
static

Templates ###########################################################.

Definition at line 153 of file core.py.

python.rootplot.core.Options.configs
python.rootplot.core.Options.filenames

Definition at line 96 of file core.py.

Referenced by python.rootplot.core.Options.arguments().

python.rootplot.core.Options.targets