Skip to content

Commit

Permalink
implement getUnit, getDescription
Browse files Browse the repository at this point in the history
  • Loading branch information
rdemaria committed Jun 29, 2017
1 parent 2e10410 commit f26d747
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
21 changes: 16 additions & 5 deletions pytimber/pytimber.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,14 +137,25 @@ def toTimescale(self, timescale_list):
except Exception as e:
self._log.warning('exception in timescale:{}'.format(e))

def search(self, pattern):
"""Search for parameter names. Wildcard is '%'."""
def getVariables(self,pattern):
"""Get Variable from pattern. Wildcard is '%'."""
VariableDataType = (jpype.JPackage('cern').accsoft.cals.extr.domain
.core.constants.VariableDataType)
types = VariableDataType.ALL
v = self._md.getVariablesOfDataTypeWithNameLikePattern(pattern, types)
return v.toString()[1:-1].split(', ')

v=self._md.getVariablesOfDataTypeWithNameLikePattern(pattern, types)
return list(v.getVariables())
def search(self, pattern):
"""Search for parameter names. Wildcard is '%'."""
return [vv.getVariableName() for vv in self.getVariables(pattern)]

def getDescription(self,pattern):
"""Get Variable Description from pattern. Wildcard is '%'."""
return dict([(vv.getVariableName(),vv.getDescription())
for vv in self.getVariables(pattern)])
def getUnit(self,pattern):
"""Get Variable Unit from pattern. Wildcard is '%'."""
return dict([(vv.getVariableName(),vv.getUnit())
for vv in self.getVariables(pattern)])
def getFundamentals(self, t1, t2, fundamental):
self._log.info(
'Querying fundamentals (pattern: {0}):'.format(fundamental)
Expand Down
6 changes: 6 additions & 0 deletions tests/test_ldb.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,9 @@
print(dir(ldb.tree.LHC.Collimators.BPM.bpmColl)[:10])

print('------------------------------------------------------------------------')

print(ldb.getUnit('%:LUMI_TOT_INST'))
print(ldb.getDescription('%:LUMI_TOT_INST'))



0 comments on commit f26d747

Please sign in to comment.