Skip to content

psana.psexp.step

Step is the object yielded by run.steps(), one for each BeginStep transition. step.evt is the BeginStep event, and step.events() yields the L1Accept events until the matching EndStep. The other transitions inside the step are not yielded; they update the run's env store (EPICS and scan values) when the run passed one (esm). A scan or EPICS detector accepts a Step directly: run.Detector('motor2')(step) reads the value at step.evt (see EnvImpl.__call__ in psana.detector.envstore).

See DataSource, Run and the event loop.

psana.psexp.step

Define Step, which iterates over the events of one scan step.

Step

Step(step_evt, evt_iter, run_ctx, proxy_events=None, esm=None, run=None, callback_run_state=None)

Bases: object

One step of a run: the BeginStep event (evt) and an iterator over the step's events.

Parameters:

Name Type Description Default
step_evt Event

The step transition event, stored as evt.

required
evt_iter iterator

Iterator of dgram lists, or of (dgrams, proxy event) tuples when proxy_events is given; shared with the run that created the step.

required
run_ctx RunCtx or None

Passed as run to every Event created.

required
proxy_events list

List to which the proxy events of non-L1Accept transitions are appended.

None
esm EnvStoreManager

Updated with every non-L1Accept transition.

None
run RunDrp

When given, each dgram is wrapped in a DgramEdit stored as run.curr_dgramedit and saved to run.dm.shm_res_mv.

None
callback_run_state CallbackRunState

Its step state is cleared at EndStep.

None

events

events()

Yield the L1Accept events of this step as Event objects, stopping at EndStep.

Other transitions are not yielded: they update esm, are saved to DRP shared memory and have their proxy event appended to proxy_events (each only when set), and EndStep also clears the step state in callback_run_state and ends the iteration. With run set, each L1Accept is saved to shared memory when the caller resumes the iteration.

Notes

After an L1Accept whose loop index is a multiple of 1000, the "psana_bd_ana_rate" gauge is set to 1000 / seconds since the last update.