You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 6 Next »

This note is composed from Igor's e-mail from 2013-08-14.

Add package (if necessary)

  addpkg RegDB V00-01-16
  scons

Run simple test:

 % python RegDB/src/experiment_info.py

From Python code:

  from RegDB import experiment_info
  detectors = experiment_info.detectors('XPP','xppa4513',1)
  print detectors

['BldEb-0|NoDevice-0',
 'EpicsArch-0|NoDevice-0',
 'NoDetector-0|Evr-0',
 'XppEndstation-0|Opal1000-2',
 'XppGon-0|Cspad-0',
 'XppSb4Pim-1|Tm6740-1']

To get info which runs (and WHAT kind of runs) exist for the specified experiment do:

  runs = experiment_info.experiment_runs('XPP','xppa4513')
  print runs

[{'begin_time': 1375417636042155759L,
  'begin_time_unix': 1375417636,
  'end_time': 1375417646535192694L,
  'end_time_unix': 1375417646,
  'exper_id': 329L,
  'id': 69762L,
  'num': 1L,
  'type': 'DATA'},
 {'begin_time': 1375437784068608263L,
  'begin_time_unix': 1375437784,
  'end_time': 1375437816700510685L,
  'end_time_unix': 1375437816,
  'exper_id': 329L,
  'id': 69763L,
  'num': 2L,
  'type': 'DATA'},
  ..
{'begin_time': 1375806447772306081L,
  'begin_time_unix': 1375806447,
  'end_time': 1375806491980944918L,
  'end_time_unix': 1375806491,
  'exper_id': 329L,
  'id': 70074L,
  'num': 189L,
  'type': 'DATA'}]

The run number is given by key:

  'num': 189L

The last key of the dictionary:

  'type': 'DATA'

That is for normal data runs. A guess the idea is that people were able to change that to specify:

  'type': 'CALIB'

This is already supported by I don't think we have any experiment where they're using it.

To access tags associated with run use method run_attributes(instr_name, exper_name, runnum):

instr_name = 'CXI'
exper_name = 'cxic0213'
runnum     = 215

for attr in experiment_info.run_attributes(instr_name, exper_name, runnum):
    print 'class:',attr['class']
    print 'name:',attr['name']
    print 'type (of the value):',attr['type']
    print 'value (optional):',attr['val']
    print 'description (optional):',attr['descr']

The value of an attribute is optional. If no value is set then you'll see None. The default description is the
empty string

  • No labels