Versions Compared

Key

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

...

Panel

Anchor
pyana.event.Env
pyana.event.Env

Class pyana.event.Env

Instance of this class is a container for all sorts of environment data.


Construction

Usage: env = pyana.event.Env(jobName="pyana", hmgr=None, subproc=False)

Creates environment object.

Parameters:

  • jobName – analysis job name, arbitrary string
  • hmgr – histogram manager object
  • subproc – flag which must be set to true when running in pyana sub-process

Objects of this type are created by pyana itself and end users do not need to create new instances.


Method epicsStore()

Usage: store = env.epicsStore()

This is the primary method for user code to access EPICS data. It returns event.EpicsStore object which can be used to retrieve the state of the individual EPICS channels.


Method getAcqConfig()

Usage: acqConfig = env.getAcqConfig(address)

Returns Acqiris configuration object for a given device address. If more than one object is matched by the parameters then first arbitrary object is returned. None is returned if no object is found.

Parameters:


Method getControlConfig()

Usage: opalConfig = env.getControlConfig()

Returns control.Config configuration object or None.


Method getOpal1kConfig()

Usage: opalConfig = env.getOpal1kConfig(address)

Returns Opal1k configuration object for a given device address. If more than one object is matched by the parameters then first arbitrary object is returned. None is returned if no object is found.

Parameters:


Method getPnCCDConfig()

Usage: pnccdConfig = env.getPnCCDConfig(address)

Returns pnCCD configuration object for a given device address. If more than one object is matched by the parameters then first arbitrary object is returned. None is returned if no object is found.

Parameters:


Method hmgr()

Usage: hmgr = env.hmgr()

Returns histogram manager object of type pyana.histo.HistoManager*.


Method jobName()

Usage: jobName = env.jobName()

Returns analysis job name string.


Method jobNameSub()

Usage: jobName = env.jobNameSub()

Returns process-specific analysis job name string. In case of multi-processing job it will a string in format "jobName-procNum" where procNum is a number returned by subprocess(). In case of single-process job it will return the same string as jobName().


Method mkfile()

Usage: file = env.mkfile(filename, mode='w', bufsize=-1)

Opens file for writing output data. This is pyana's alternative for Python open() function which supports multi-processing. If user needs the data in this file to be merged with the files produced by other processes then mkfile() has to be used in place of open().

Parameters:

  • filename – output file name
  • mode – open mode, currently any "w*" modes are supported
  • bufsize – output buffer size, default is to use Python's default

In case of single-process job this method is equivalent to a regular Python open() method. In case of multi-processing when this method is called from a sub-process then the file is created somewhere in a temporary location (with unique name). At the end of the job files from all sub-processes are merged into one file with name filename and the temporary files are deleted.


Method subprocess()

Usage: num = env.subprocess()

Returns sub-process number. In case of multi-processing job it will be a non-negative number ranging from 0 to a total number of sub-processes. In case of single-process job it will return -1.


Method result()

Usage: data = env.result()

Method used by pyana to extract the data produced by a single sub-process in multi-processing setup. Not to be used by end users.

...

Method update()

Usage: env.update(evt)

This method updates environment contents with selected data from event object. This is equivalent to calling env.updateEpics() and env.updateConfig().

Parameters:

  • evt – event object of type event.Event

This method is not supposed to be called from user code, pyana takes care of all updates itself.

...

Method updateEpics()

Usage: env.updateEpics(evt)

This method updates environment EPICS data from event object.

Parameters:

This method is not supposed to be called from user code, pyana takes care of all updates itself.

...

Method updateConfig()

Usage: env.updateConfig(evt)

This method copies configuration objects from event object into environment.

Parameters:

  • evt – event object of type event.Event

This method is not supposed to be called from user code, pyana takes care of all updates itself

...

Method result()

Usage: data = env.result()

...

.

...

Panel

Anchor
pyana.event.EpicsStore
pyana.event.EpicsStore

Class pyana.event.EpicsStore

Instance of this class contains current status of all EPICS channels. It is updated from event data on every new event.


Construction

Usage: store = pyana.event.EpicsStore()

Creates EPICS store object.

Objects of this type are created by pyana itself and end users do not need to create new instances.


Method update()

Usage: store.update(evt)

This method updates environment EPICS data from event object.

Parameters:

This method is not supposed to be called from user code, pyana takes care of all updates itself.


Method value()

Usage epics = store.value(name)

Returns current value of the EPICS channel with the given name. The type of returned data is either epics.EpicsPvCtrl or epics.EpicsPvTime.

Parameters:

  • name – name of the EPICS channel

This is the primary method to access EPICS information in pyana jobs.

...