| The Gaudi Framework v28r2-patches (bc4ad17a)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Namespace List
- Namespace Members

Functions | Variables
GaudiPython.Pythonizations Namespace Reference

## Functions
def | _printHisto1D (h)
def | _contentsHisto1D (h)
def | _printHisto2D (h)
def | _printStatusCode (s)
def | _printBitReference (b)
def | _printFillStream (o)
def | _container__getitem__ (self, k)
def | _container__len__ (self)
def | _container__iter__ (self)
def | _draw_aida_ (self, args)
def | __mapbase_iter__ (self)
| # decorate some map-like objects The iterator for MapBase class More...
def | __mapbase_iteritems__ (self)
| The iterator for MapBase class. More...
def | __mapbase_keys__ (self)
| Get the list of keys for the map. More...
def | __mapbase_items__ (self)
| Get the list of items for the map. More...
def | __mapbase_values__ (self)
| Get the list of values for the map. More...
def | __mapbase_contains__ (self, key)
| Check if the certain key is in the map. More...
def | __mapbase_get__ (self, key, value=None)
| Get the value for certain key, return predefined value otherwise. More...
def | __mapbase_str__ (self)
| Representation of MapBase-based maps. More...
def | __mapbase_setitem__ (self, key, value)
| "Setitem" for MapBase-based maps: More...
def | __mapbase_delitem__ (self, key)
| "Del-item" for MapBase-based maps: More...

## Variables
list | __all__ = [ ]
| Draw
| plot
| __repr__
| __getitem__
| __len__
| __iter__
| update
| invalidate
| SUCCESS
| FAILURE
| _eq = gbl.Gaudi.StringKey.__cpp_eq__
| _ne = gbl.Gaudi.StringKey.__cpp_ne__

## Function Documentation

def GaudiPython.Pythonizations.__mapbase_contains__ | ( |  | self,
|  |  | key
| ) |  |

Check if the certain key is in the map.

1 >>> m = ... ## the map
2 >>> if 'a' in m : print 'key is in the map!'

See also
  Gaudi::Utils::MapBase
  GaudiUtils::Map
  GaudiUtils::HashMap
  GaudiUtils::VectorMap
  GaudiUtils::Map::count
  GaudiUtils::HashMap::count @ see GaudiUtils::VectorMap::count

Author
  Vanya BELYAEV Ivan..nosp@m.BEly.nosp@m.aev@i.nosp@m.tep..nosp@m.ru

Date
  2010-02-20

      Check if the certainkey is in the map

      >>> m     = ...        ## the map
      >>> if 'a' in m : ...  ##  chekc the presence of the key in the map

Definition at line 305 of file Pythonizations.py.

305 def __mapbase_contains__ ( self , key ) :
306 """
307 Check if the certainkey is in the map
308
309 >>> m = ... ## the map
310 >>> if 'a' in m : ... ## chekc the presence of the key in the map
311
312 """
313 _num = self.count ( key )
314 return False if 0 == _num else True
315
316 # ============================================
GaudiPython.Pythonizations.__mapbase_contains__
def __mapbase_contains__(self, key)
Check if the certain key is in the map.
Definition: Pythonizations.py:305

def GaudiPython.Pythonizations.__mapbase_delitem__ | ( |  | self,
|  |  | key
| ) |  |

"Del-item" for MapBase-based maps:

1 >>> m = ... ## the map
2 >>> del m [ key] ## del th eitem

See also
  Gaudi::Utils::MapBase
  GaudiUtils::Map
  GaudiUtils::HashMap
  GaudiUtils::VectorMap
  GaudiUtils::Map::erase
  GaudiUtils::HashMap::erase
  GaudiUtils::VectorMap::erase

Author
  Vanya BELYAEV Ivan..nosp@m.BEly.nosp@m.aev@i.nosp@m.tep..nosp@m.ru

Date
  2010-02-20

      'Del-item' for MapBase-based maps:

      >>> m      = ...        ## the map
      >>> del m[key]

Definition at line 428 of file Pythonizations.py.

428 def __mapbase_delitem__ ( self , key ) :
429 """
430 'Del-item' for MapBase-based maps:
431
432 >>> m = ... ## the map
433 >>> del m[key]
434
435 """
436 _erased = True if key in self else False
437 self.erase ( key )
438 return _erased
439
440 gbl.Gaudi.Utils.MapBase . __len__ = lambda s : s.size()
441 gbl.Gaudi.Utils.MapBase . __iter__ = __mapbase_iter__
442 gbl.Gaudi.Utils.MapBase . keys = __mapbase_keys__
443 gbl.Gaudi.Utils.MapBase . __iteritems__ = __mapbase_iteritems__
444 gbl.Gaudi.Utils.MapBase . iteritems = __mapbase_iteritems__
445 gbl.Gaudi.Utils.MapBase . items = __mapbase_items__
446 gbl.Gaudi.Utils.MapBase . values = __mapbase_values__
447 gbl.Gaudi.Utils.MapBase . __contains__ = __mapbase_contains__
448 gbl.Gaudi.Utils.MapBase . has_key = __mapbase_contains__
449 gbl.Gaudi.Utils.MapBase . get = __mapbase_get__
450 gbl.Gaudi.Utils.MapBase . __str__ = __mapbase_str__
451 gbl.Gaudi.Utils.MapBase . __repr__ = __mapbase_str__
452 gbl.Gaudi.Utils.MapBase . __setitem__ = __mapbase_setitem__
453 gbl.Gaudi.Utils.MapBase . __delitem__ = __mapbase_delitem__
454 gbl.Gaudi.Utils.MapBase . __getitem__ = lambda s,key : s.at ( key )
455
GaudiPython.Pythonizations.__mapbase_delitem__
def __mapbase_delitem__(self, key)
"Del-item" for MapBase-based maps:
Definition: Pythonizations.py:428

def GaudiPython.Pythonizations.__mapbase_get__ | ( |  | self,
|  |  | key,
|  |  | value = `None`
| ) |  |

Get the value for certain key, return predefined value otherwise.

1 >>> m = ... ## the map
2 >>> v = m.get( key , 15 ) ## return the value[key] for existing key, else 15

See also
  Gaudi::Utils::MapBase
  GaudiUtils::Map
  GaudiUtils::HashMap
  GaudiUtils::VectorMap
  GaudiUtils::Map::count
  GaudiUtils::HashMap::count @ see GaudiUtils::VectorMap::count

Author
  Vanya BELYAEV Ivan..nosp@m.BEly.nosp@m.aev@i.nosp@m.tep..nosp@m.ru

Date
  2010-02-20

      Get the value for the certain key, or 'value' otherwise

      >>> m     = ...        ## the map
      >>> v = m.get ( key , 15 )

Definition at line 335 of file Pythonizations.py.

335 def __mapbase_get__ ( self , key , value = None ) :
336 """
337 Get the value for the certain key, or 'value' otherwise
338
339 >>> m = ... ## the map
340 >>> v = m.get ( key , 15 )
341
342 """
343 if key in self : return self.at( key )
344 return value
345
346 # ============================================
GaudiPython.Pythonizations.__mapbase_get__
def __mapbase_get__(self, key, value=None)
Get the value for certain key, return predefined value otherwise.
Definition: Pythonizations.py:335

def GaudiPython.Pythonizations.__mapbase_items__ | ( |  | self | ) |

Get the list of items for the map.

1 >>> m = ... ## the map
2 >>> items = m.items() ## get the list of items

See also
  Gaudi::Utils::MapBase
  GaudiUtils::Map
  GaudiUtils::HashMap
  GaudiUtils::VectorMap
  GaudiUtils::Map::key_at
  GaudiUtils::HashMap::key_at @ see GaudiUtils::VectorMap::key_at

Author
  Vanya BELYAEV Ivan..nosp@m.BEly.nosp@m.aev@i.nosp@m.tep..nosp@m.ru

Date
  2010-02-20

      Get the list of items

      >>> m     = ...        ## the map
      >>> items = m.keys()   ## get the list of items

Definition at line 238 of file Pythonizations.py.

238 def __mapbase_items__ ( self ) :
239 """
240 Get the list of items
241
242 >>> m = ... ## the map
243 >>> items = m.keys() ## get the list of items
244
245 """
246 _size = len ( self )
247 _items = []
248 for i in range ( 0 , _size ) :
249 _key = self.key_at ( i )
250 _value = self.at ( _key )
251 _items.append ( ( _key , _value ) )
252 return _items
253
254 # ============================================
GaudiPython.Pythonizations.__mapbase_items__
def __mapbase_items__(self)
Get the list of items for the map.
Definition: Pythonizations.py:238

def GaudiPython.Pythonizations.__mapbase_iter__ | ( |  | self | ) |

# decorate some map-like objects

The iterator for MapBase class
1 >>> m = ... ## the map
2 >>> for key in m : print key , m[key]

See also
  Gaudi::Utils::MapBase
  GaudiUtils::Map
  GaudiUtils::HashMap
  GaudiUtils::VectorMap
  GaudiUtils::Map::key_at
  GaudiUtils::HashMap::key_at
  GaudiUtils::VectorMap::key_at

Author
  Vanya BELYAEV Ivan..nosp@m.Bely.nosp@m.aev@i.nosp@m.tep..nosp@m.ru

Date
  2010-02-20

      The iterator for MapBase-based containers

      >>> m = ...  ## the map
      >>> for key in m : print key , m[key]

Definition at line 139 of file Pythonizations.py.

139 def __mapbase_iter__ ( self ) :
140 """
141 The iterator for MapBase-based containers
142
143 >>> m = ... ## the map
144 >>> for key in m : print key , m[key]
145
146 """
147 _size = len ( self )
148 _index = 0
149 while _index < _size :
150 yield self.key_at ( _index )
151 _index +=1
152
153 # =============================================================================
GaudiPython.Pythonizations.__mapbase_iter__
def __mapbase_iter__(self)
decorate some map-like objects The iterator for MapBase class
Definition: Pythonizations.py:139

def GaudiPython.Pythonizations.__mapbase_iteritems__ | ( |  | self | ) |

The iterator for MapBase class.

1 >>> m = ... ## the map
2 >>> for key,value in m.iteritems() : print key , value

See also
  Gaudi::Utils::MapBase
  GaudiUtils::Map
  GaudiUtils::HashMap
  GaudiUtils::VectorMap
  GaudiUtils::Map::key_at
  GaudiUtils::HashMap::key_at
  GaudiUtils::VectorMap::key_at
  GaudiUtils::Map::value_at
  GaudiUtils::HashMap::value_at
  GaudiUtils::VectorMap::value_at

Author
  Vanya BELYAEV Ivan..nosp@m.Bely.nosp@m.aev@i.nosp@m.tep..nosp@m.ru

Date
  2010-02-20

      The iterator for MapBase-based containers

      >>> m = ...  ## the map
      >>> for key,value in m.iteritems() : print key, value

Definition at line 174 of file Pythonizations.py.

174 def __mapbase_iteritems__ ( self ) :
175 """
176 The iterator for MapBase-based containers
177
178 >>> m = ... ## the map
179 >>> for key,value in m.iteritems() : print key, value
180
181 """
182 _size = len ( self )
183 _index = 0
184 while _index < _size :
185 _key = self.key_at ( _index )
186 yield ( _key , self.at ( _key ) )
187 _index +=1
188
189 # ============================================
GaudiPython.Pythonizations.__mapbase_iteritems__
def __mapbase_iteritems__(self)
The iterator for MapBase class.
Definition: Pythonizations.py:174

def GaudiPython.Pythonizations.__mapbase_keys__ | ( |  | self | ) |

Get the list of keys for the map.

1 >>> m = ... ## the map
2 >>> keys = m.keys() ## get the list of keys

See also
  Gaudi::Utils::MapBase
  GaudiUtils::Map
  GaudiUtils::HashMap
  GaudiUtils::VectorMap
  GaudiUtils::Map::key_at
  GaudiUtils::HashMap::key_at @ see GaudiUtils::VectorMap::key_at

Author
  Vanya BELYAEV Ivan..nosp@m.BEly.nosp@m.aev@i.nosp@m.tep..nosp@m.ru

Date
  2010-02-20

      Get the list of keys

      >>> m = ...           ## the map
      >>> keys = m.keys()   ## get the list of keys

Definition at line 207 of file Pythonizations.py.

207 def __mapbase_keys__ ( self ) :
208 """
209 Get the list of keys
210
211 >>> m = ... ## the map
212 >>> keys = m.keys() ## get the list of keys
213
214 """
215 _size = len ( self )
216 _keys = []
217 for i in range ( 0 , _size ) : _keys.append ( self.key_at ( i ) )
218 return _keys
219
220 # ============================================
GaudiPython.Pythonizations.__mapbase_keys__
def __mapbase_keys__(self)
Get the list of keys for the map.
Definition: Pythonizations.py:207

def GaudiPython.Pythonizations.__mapbase_setitem__ | ( |  | self,
|  |  | key,
|  |  | value
| ) |  |

"Setitem" for MapBase-based maps:

1 >>> m = ... ## the map
2 >>> m [ key] = value ## set the item

See also
  Gaudi::Utils::MapBase
  GaudiUtils::Map
  GaudiUtils::HashMap
  GaudiUtils::VectorMap
  GaudiUtils::Map::update
  GaudiUtils::HashMap::update
  GaudiUtils::VectorMap::update

Author
  Vanya BELYAEV Ivan..nosp@m.BEly.nosp@m.aev@i.nosp@m.tep..nosp@m.ru

Date
  2010-02-20

      'Set-item' for MapBase-based maps:

      >>> m      = ...        ## the map
      >>> m[key] = value     ## set the item

Definition at line 397 of file Pythonizations.py.

397 def __mapbase_setitem__ ( self , key , value ) :
398 """
399 'Set-item' for MapBase-based maps:
400
401 >>> m = ... ## the map
402 >>> m[key] = value ## set the item
403
404 """
405 _replaced = True if key in self else False
406 self.update ( key , value )
407 return _replaced
408
409 # ============================================
GaudiPython.Pythonizations.__mapbase_setitem__
def __mapbase_setitem__(self, key, value)
"Setitem" for MapBase-based maps:
Definition: Pythonizations.py:397

def GaudiPython.Pythonizations.__mapbase_str__ | ( |  | self | ) |

Representation of MapBase-based maps.

1 >>> m = ... ## the map
2 >>> print m

See also
  Gaudi::Utils::MapBase
  GaudiUtils::Map
  GaudiUtils::HashMap
  GaudiUtils::VectorMap

Author
  Vanya BELYAEV Ivan..nosp@m.BEly.nosp@m.aev@i.nosp@m.tep..nosp@m.ru

Date
  2010-02-20

      Representation of MapBase-based maps:

      >>> m     = ...        ## the map
      >>> print map

Definition at line 361 of file Pythonizations.py.

361 def __mapbase_str__ ( self ) :
362 """
363 Representation of MapBase-based maps:
364
365 >>> m = ... ## the map
366 >>> print map
367
368 """
369 _result = ' { '
370 _size = len ( self )
371 for i in range ( 0 , _size ) :
372 _key = self.key_at ( i )
373 _val = self.at ( _key )
374 if 0 != i : _result += ' , '
375 _result += " %s : %s " % ( str ( _key ) , str ( _val ) )
376 _result += ' } '
377 return _result
378
379 # ============================================
GaudiPython.Pythonizations.__mapbase_str__
def __mapbase_str__(self)
Representation of MapBase-based maps.
Definition: Pythonizations.py:361

def GaudiPython.Pythonizations.__mapbase_values__ | ( |  | self | ) |

Get the list of values for the map.

1 >>> m = ... ## the map
2 >>> values = m.values () ## get the list of values

See also
  Gaudi::Utils::MapBase
  GaudiUtils::Map
  GaudiUtils::HashMap
  GaudiUtils::VectorMap
  GaudiUtils::Map::value_at
  GaudiUtils::HashMap::value_at @ see GaudiUtils::VectorMap::value_at

Author
  Vanya BELYAEV Ivan..nosp@m.Bely.nosp@m.aev@i.nosp@m.tep..nosp@m.ru

Date
  2010-02-20

      Get the list of values

      >>> m      = ...          ## the map
      >>> values = m.values()   ## get the list of values

Definition at line 272 of file Pythonizations.py.

272 def __mapbase_values__ ( self ) :
273 """
274 Get the list of values
275
276 >>> m = ... ## the map
277 >>> values = m.values() ## get the list of values
278
279 """
280 _size = len ( self )
281 _values = []
282 for i in range ( 0 , _size ) :
283 _value = self.value_at ( i )
284 _values.append ( _value )
285 return _values
286
287 # ============================================
GaudiPython.Pythonizations.__mapbase_values__
def __mapbase_values__(self)
Get the list of values for the map.
Definition: Pythonizations.py:272

def GaudiPython.Pythonizations._container__getitem__ | ( |  | self,
|  |  | k
| ) |  |
| private

Definition at line 48 of file Pythonizations.py.

48 def _container__getitem__(self, k) :
49 return self.containedObject(k)
GaudiPython.Pythonizations._container__getitem__
def _container__getitem__(self, k)
Definition: Pythonizations.py:48

def GaudiPython.Pythonizations._container__iter__ | ( |  | self | ) |
| private

Definition at line 52 of file Pythonizations.py.

52 def _container__iter__(self) :
53 if hasattr(self,'containedObjects') : sequential = self.containedObjects()
54 else : sequential = self
55 count = 0
56 limit = self.__len__()
57 while count < limit :
58 yield sequential.__getitem__(count)
59 count += 1
60
GaudiPython.Pythonizations._container__iter__
def _container__iter__(self)
Definition: Pythonizations.py:52

def GaudiPython.Pythonizations._container__len__ | ( |  | self | ) |
| private

Definition at line 50 of file Pythonizations.py.

50 def _container__len__(self) :
51 return self.numberOfObjects()
GaudiPython.Pythonizations._container__len__
def _container__len__(self)
Definition: Pythonizations.py:50

def GaudiPython.Pythonizations._contentsHisto1D | ( |  | h | ) |
| private

Definition at line 24 of file Pythonizations.py.

24 def _contentsHisto1D(h) :
25 x = h.axis()
26 return map(h.binEntries, range(x.bins()))
Gaudi::Functional::details::zip::range
decltype(auto) range(Args &&...args)
Zips multiple containers together to form a single range.
Definition: FunctionalDetails.h:57
Containers::map
struct GAUDI_API map
Parametrisation class for map-like implementation.
Definition: KeyedObjectManager.h:25
GaudiPython.Pythonizations._contentsHisto1D
def _contentsHisto1D(h)
Definition: Pythonizations.py:24

def GaudiPython.Pythonizations._draw_aida_ | ( |  | self,
|  |  | args
| ) |  |
| private

    Draw AIDA histogram (through access to internal ROOT histogram

    >>> aida = ...    # get the historgam
    >>> aida.Draw()

Definition at line 61 of file Pythonizations.py.

61 def _draw_aida_ ( self , *args ) :
62 """
63 Draw AIDA histogram (through access to internal ROOT histogram
64
65 >>> aida = ... # get the historgam
66 >>> aida.Draw()
67
68 """
69 _fun = gbl.Gaudi.Utils.Aida2ROOT.aida2root
70 _root = _fun ( self )
71 return _root.Draw( *args )
72
73 gbl.AIDA.IHistogram1D.__repr__ = _printHisto1D
74 gbl.AIDA.IHistogram1D.contents = _contentsHisto1D
75 gbl.AIDA.IHistogram2D.__repr__ = _printHisto2D
GaudiPython.Pythonizations._draw_aida_
def _draw_aida_(self, args)
Definition: Pythonizations.py:61

def GaudiPython.Pythonizations._printBitReference | ( |  | b | ) |
| private

Definition at line 34 of file Pythonizations.py.

34 def _printBitReference(b) :
35 return str(1==b.bool())
GaudiPython.Pythonizations._printBitReference
def _printBitReference(b)
Definition: Pythonizations.py:34

def GaudiPython.Pythonizations._printFillStream | ( |  | o | ) |
| private

Definition at line 36 of file Pythonizations.py.

36 def _printFillStream(o) :
37 if o :
38 s = gbl.stringstream()
39 o.fillStream(s)
40 out = str(s.str())
41 if out == '' :
42 out = o.__class__.__name__ + ' object'
43 if hasattr( o, 'hasKey') and o.hasKey() :
44 out += ' key = '+ str(o.key())
45 else :
46 out = o.__class__.__name__ + ' NULL object'
47 return out
GaudiPython.Pythonizations._printFillStream
def _printFillStream(o)
Definition: Pythonizations.py:36

def GaudiPython.Pythonizations._printHisto1D | ( |  | h | ) |
| private

Definition at line 21 of file Pythonizations.py.

21 def _printHisto1D(h) :
22 x = h.axis()
23 return 'Histogram 1D "%s" %d bins [%f,%f]' % (h.title(), x.bins(), x.lowerEdge(), x.upperEdge())
GaudiPython.Pythonizations._printHisto1D
def _printHisto1D(h)
Definition: Pythonizations.py:21

def GaudiPython.Pythonizations._printHisto2D | ( |  | h | ) |
| private

Definition at line 27 of file Pythonizations.py.

27 def _printHisto2D(h) :
28 x,y = h.xAxis(),h.yAxis()
29 return 'Histogram 2D "%s" %d xbins [%f,%f], %d ybins [%f,%f]' % \
30 (h.title(), x.bins(), x.lowerEdge(), x.upperEdge(), y.bins(), y.lowerEdge(), y.upperEdge() )
GaudiPython.Pythonizations._printHisto2D
def _printHisto2D(h)
Definition: Pythonizations.py:27

def GaudiPython.Pythonizations._printStatusCode | ( |  | s | ) |
| private

Definition at line 31 of file Pythonizations.py.

31 def _printStatusCode(s) :
32 if s.isSuccess() : return 'SUCCESS'
33 else : return 'FAILURE'
GaudiPython.Pythonizations._printStatusCode
def _printStatusCode(s)
Definition: Pythonizations.py:31

## Variable Documentation

list GaudiPython.Pythonizations.__all__ = [ ]
| private

Definition at line 8 of file Pythonizations.py.

GaudiPython.Pythonizations.__getitem__
| private

Definition at line 90 of file Pythonizations.py.

GaudiPython.Pythonizations.__iter__
| private

Definition at line 92 of file Pythonizations.py.

GaudiPython.Pythonizations.__len__
| private

Definition at line 91 of file Pythonizations.py.

GaudiPython.Pythonizations.__repr__
| private

Definition at line 85 of file Pythonizations.py.

GaudiPython.Pythonizations._eq = gbl.Gaudi.StringKey.__cpp_eq__
| private

Definition at line 105 of file Pythonizations.py.

GaudiPython.Pythonizations._ne = gbl.Gaudi.StringKey.__cpp_ne__
| private

Definition at line 110 of file Pythonizations.py.

GaudiPython.Pythonizations.Draw

Definition at line 82 of file Pythonizations.py.

GaudiPython.Pythonizations.FAILURE

Definition at line 101 of file Pythonizations.py.

GaudiPython.Pythonizations.invalidate

Definition at line 95 of file Pythonizations.py.

GaudiPython.Pythonizations.plot

Definition at line 83 of file Pythonizations.py.

GaudiPython.Pythonizations.SUCCESS

Definition at line 100 of file Pythonizations.py.

GaudiPython.Pythonizations.update

Definition at line 94 of file Pythonizations.py.