Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

The purpose of environment store (EnvStore) is to keep records of all transitions so that they can be retrieved later using the timestamp of an event. There are three two types of EnvStore:

  • epics
  • scansscan 
  • step

EnvStore epics and scan are created by default when "epics" or "scan" keyword is found in the configs. The variables and values are stored as a dictionary in this format:

Storing Variable Names

For 'epics' and 'scan', to be able to access the value quickly, the structure (d.detname[seg_id].alg.var_name) that we learn from configs is stored in a dictionary as:

env_variables = {alg: {segment_id: {var_name: var_type, }, }, }

We don't need to this for step.

Storing Transition Events

For 'epics' envstore, we store all events with TransiontId = SlowUpdate. 

For 'scan' and 'step', we store all events with TransitionId = BeginStep (they are reference to each other).

Retrieve the Values

For 'epics' and 'scan', we can retrieve a value of any of their variables by creating a detector with the variable name:To retrieve a value,

edet = run.Detector('epix_variable_name')

scandet = run.Detector('motor1')

step_value_det = run.Detector('step_value')


You can then retrieve the value by calling

val = edetxxxdet(evt)


This is done by first location locating alg and segment which _id that store this variable then matching dgram(s) in the EnvStore is retrieved by searching with timestamp. We then get the value from dgram.epics.alg[segment_id].var_name.EnvStore step is created when "config" is found as an attribute of a detector in config(s) e.g. configs[0].tmoopal[0].config.user.black_level. The store will have the detector name as its env_name. We can retrieve the value and step event by

sdet = run.Detector('tmoopal')

step_value = sdet.step.step_value(evt) # this will fail if this detector doesn't have "config" as its attribute in configs – see above

step_docstring = sdet.step.step_docstring(evt)

step_evt = sdet.step.evt(evt)