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

Compare with Current View Page History

« Previous Version 48 Next »



Package pyana

This package collects code which deals with various aspects of the analysis tasks.



Module event

This module is a collection of classes and methods to deal with the event data and everything related to it.


Class Event

Instance of this class contains all event data.


Construction

Usage: evt = pyana.event.Event(dg)

Creates event object from the corresponding XTC datagram object.

Parameters:


Method seq()

Usage: s = evt.seq()

Returns _pdsdata.xtc.Sequence object, equivalent to dg.seq


Method getTime()

Usage: t = evt.getTime()

Returns _pdsdata.xtc.ClockTime object, equivalent to dg.seq.clock()


Method find()

Usage: objects = evt.find(...)

Returns possibly empty list of data objects contained in the event. This method accepts a number of arguments, but all arguments are optional. If no arguments are given then a list of all data objects is returned. If some arguments are given then only those objects that satisfy a particular criteria are returned. The list of possible keyword arguments:

  • typeId – accepts enum xtc.TypeId.Type, only return objects which have that TypeId
  • version – accepts number, only return objects whose type version number is equal to number
  • level – accepts one of xtc.Level values, only returns objects originated at that level
  • detector – accepts enum xtc.DetInfo.Detector values, only returns objects produced by this detector
  • detId – accepts number, only returns objects produced by this detector ID
  • device – accepts enum xtc.DetInfo.Device values, only returns objects produced by this device
  • devId – accepts number, only returns objects produced by this device ID
  • addressxtc.DetInfo object or an address string (see User Manual)

The parameters address and any of the detector, detId, device, devId are incompatible, specify only one or another.


Method findFirst()

Usage: object = evt.findFirst(...)

Accepts the same set of arguments as find() methods but instead of list of objects returns fist object found. If no object is satisfying all selection criteria then None is returned.


Method getAcqConfig()

Usage: acqConfig = evt.getAcqConfig(address)

Returns Acqiris configuration data of type acqiris.ConfigV* for specific device. If address given is not very specific then the first matching object is returned.

Parameters:

Ordinary configuration objects are contained in a Configure type datagrams only. For client code that means that this method can be used in beginjob() or beginrun() methods only. Note also that configuration objects are stored in the Pyana environment and preferred way to access configuration information is through the environment. This makes this method of little utility to end users.


Method getOpal1kConfig()

Usage: opalConfig = evt.getOpal1kConfig(address)

Returns Opal1k configuration data of type opal1k.ConfigV* for specific device. If address given is not very specific then the first matching object is returned.

Parameters:

  • addressxtc.DetInfo object or an address string (see User Manual)

Same caveats apply as for getAcqConfig() method.


Method getAcqValue()

Usage: acqData = evt.getAcqValue(address, channel, env)

Returns Acqiris data object of type acqiris.DataDescV* for specific device and channel. If address given is not very specific then the first matching object is returned.

Parameters:

  • addressxtc.DetInfo object or an address string (see User Manual)
  • channel – channel number from 0 to max number of channels
  • env – environment object containing Acqiris configuration object

Channel number is an integer number, total number of channels can be extracted from the Acqiris configuration object.


Method getPnCcdValue()

Usage: frame = evt.getPnCcdValue(address, env)

returns pnCCD data object of type pnccd.FrameV* for specific device and channel. If address given is not very specific then the first matching object is returned.

Parameters:

  • addressxtc.DetInfo object or an address string (see User Manual)
  • env – environment object containing pnCCD configuration object

Method getFeeGasDet()

Usage: array = evt.getFeeGasDet()

Returns the list of 4 numbers [f_11_ENRC, f_12_ENRC, f_21_ENRC, f_22_ENRC] obtained from bld.BldDataFEEGasDetEnergy object.


Method getPhaseCavity()

Usage: obj = evt.getPhaseCavity()

Returns data object of type bld.BldDataPhaseCavity.


Method getEBeam()

Usage: obj = evt.getEBeam()

Returns data object of type bld.BldDataEBeam or bld.BldDataEBeamV0 whichever is present in the event.


Class 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 jobName()

Usage: jobName = env.jobName()

Returns analysis job name string.


Method hmgr()

Usage: hmgr = env.hmgr()

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


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 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 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 getAcqConfig()

Usage: acqConfig = env.getAcqConfig(...)

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.

Keyword arguments:

  • detector – accepts enum xtc.DetInfo.Detector values, only returns objects produced by this detector
  • detId – accepts number, only returns objects produced by this detector ID
  • device – accepts enum xtc.DetInfo.Device values, only returns objects produced by this device
  • devId – accepts number, only returns objects produced by this device ID
  • addressxtc.DetInfo object or an address string (see User Manual)

Method getPnCCDConfig()

Usage: pnccdConfig = env.getPnCCDConfig(...)

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.

Accepts the same keyword arguments as the getAcqConfig() method.


Method getOpal1kConfig()

Usage: opalConfig = env.getOpal1kConfig(...)

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.

Accepts the same keyword arguments as the getAcqConfig() method.


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.


Class 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.



Module histo

This module is a collection classes and methods to create and manage histograms from user analysis modules.


Class HistoMgrRoot

This class represents histogram manager implementation based on ROOT library. Histograms that are created by this manager reside either in memory or in a ROOT file.


Construction

Usage: hmgr = pyana.histo.HistoMgrRoot(...)

Creates new histogram manager object. Users should not instantiate new objects, instead the environment method hmgr() should be used to obtain existing manager object.

Keyword arguments:

  • file – name of the ROOT file to store histograms, if missing then histograms will be memory-resident

Method h1d()

Usage: hist = hmgr.h1d(...)

Creates 1-dimensional histogram with bin contents stored as double precision numbers.

Method accepts the same arguments as the constructors of the corresponding C++ ROOT class TH1D. The returned object also inherits most of the methods of the C++ class.


Method h1f()

Usage: hist = hmgr.h1f(...)

Creates 1-dimensional histogram with bin contents stored as single precision numbers.

Method accepts the same arguments as the constructors of the corresponding C++ ROOT class TH1F. The returned object also inherits most of the methods of the C++ class.


Method h1i()

Usage: hist = hmgr.h1i(...)

Creates 1-dimensional histogram with bin contents stored as integer numbers.

Method accepts the same arguments as the constructors of the corresponding C++ ROOT class TH1I. The returned object also inherits most of the methods of the C++ class.


Method h2d()

Usage: hist = hmgr.h2d(...)

Creates 2-dimensional histogram with bin contents stored as double precision numbers.

Method accepts the same arguments as the constructors of the corresponding C++ ROOT class TH2D. The returned object also inherits most of the methods of the C++ class.


Method h2f()

Usage: hist = hmgr.h2f(...)

Creates 2-dimensional histogram with bin contents stored as single precision numbers.

Method accepts the same arguments as the constructors of the corresponding C++ ROOT class TH2F. The returned object also inherits most of the methods of the C++ class.


Method h2i()

Usage: hist = hmgr.h2i(...)

Creates 2-dimensional histogram with bin contents stored as integer numbers.

Method accepts the same arguments as the constructors of the corresponding C++ ROOT class TH2F. The returned object also inherits most of the methods of the C++ class.


Method prof()

Usage: hist = hmgr.prof(...)

Creates 1-dimensional profile histogram with bin contents stored as double precision numbers.

Method accepts the same arguments as the constructors of the corresponding C++ ROOT class TProfile. The returned object also inherits most of the methods of the C++ class.


Method prof2d()

Usage: hist = hmgr.prof2d(...)

Creates 2-dimensional profile histogram with bin contents stored as double precision numbers.

Method accepts the same arguments as the constructors of the corresponding C++ ROOT class TProfile2D. The returned object also inherits most of the methods of the C++ class.


Function HistoMgr()

Usage: hmgr = HistoMgr(...)

Do not call it, it's for pyana internal use.



Module _pdsdata

This is a Python extension module which provides Python interface for all pdsdata classes and functions. It is implemented in C++ and exists as a loadable module (library). The Python classes in this module try to mimic the interfaces and behavior of their corresponding C++ classes as closely as possible. In many cases this is trivial to achieve, but there may be few differences which are noted explicitly in every case. One notable difference is C++ enums which define symbolic names for integral constants. Python emulation of enums is complicated for a number of reasons such as absence of true enum type in Python and dynamic nature of language. The implementation of the enums in Python in this case is done through the introduction of special new type with the static members whose names and values correspond to C++ enums. It is better explained with example. Suppose there is a class in C++:

class DetInfo {
  enum Detector{ NoDetector, AmoIms, AmoGasdet, ... };
};

Then the corresponding construct in Python can be expressed approximately like this:

class DetInfo :
  class Detector (int): 
    NoDetector = Detector(0)
    AmoIms = Detector(1)
    AmoGasdet = Detector(2)

The main difference in use is that in C++ to get enum value one needs to write DetInfo.AmoIms when in Python it needs to be DetInfo.Detector.AmoIms.


Class Error

This is the type for the exception generated by few methods in _pdsdata package.


Construction

Usage: raise Error(message)

Arguments:

  • message – string describing the error

Module _pdsdata.xtc

This module contains classes corresponding to those in C++ pdsdata/xtc package.

Class BldInfo

Python wrapper for pdsdata/xtc/BldInfo class. Unlike C++ this class does not inherit from Src class (Src class does not exist in this module) but uses dynamic Python features to implement the same interface as in Src class. In addition to methods described here the class also defines __hash__ and __cmp__ methods based on the content of the object and can be used as a key in the dictionaries.


Enum Type

This enum is an embedded type of BldInfo class. Following enum members are defined currently:

  • BldInfo.Type.EBeam
  • BldInfo.Type.PhaseCavity
  • BldInfo.Type.FEEGasDetEnergy
  • BldInfo.Type.NumberOf

Construction

Usage: bld = xtc.BldInfo(processId, type)

Arguments:

  • processId – integer number
  • type – one of the BldInfo.Type enum values

Method level()

Usage: lvl = bld.level()

Returns enum value of type xtc.Level which defines source level.


Method log()

Usage: log = bld.log()

Returns logical address of data source as integer number.


Method phy()

Usage: phy = bld.phy()

Returns physical address of data source as integer number.


Method processId()

Usage: processId = bld.processId()

Returns process ID as integer number.


Method type()

Usage: type = bld.type()

Returns BldInfo type which is a value of BldInfo.Type.


Class ClockTime

Python wrapper for pdsdata/xtc/ClockTime class. In addition to methods described here the class also defines __hash__ and __cmp__ methods based on the content of the object and can be used as a key in the dictionaries.


Construction

Usage: clock = xtc.ClockTime([seconds, [nanoseconds]])

Creates new instance of type.

Arguments:

  • seconds – seconds since UNIX epoch
  • nanosecods – nanoseconds within second

If any argument is missing it is assumed to be 0.


Method seconds()

Usage: sec = clock.seconds()

Returns the number of seconds as integer number.


Method nanoseconds()

Usage: nsec = clock.nanoseconds()

Returns the number of nanoseconds as integer number.


Class Damage

Python wrapper for pdsdata/xtc/Damage class.


Enum Value

This enum is an internal type of Damage class. Following enum members are defined currently:

  • Damage.Value.DroppedContribution
  • Damage.Value.OutOfOrder
  • Damage.Value.OutOfSynch
  • Damage.Value.UserDefined
  • Damage.Value.IncompleteContribution
  • Damage.Value.ContainsIncomplete

The values of enum constants define the bit number in the damage mask.


Enum Mask

Python Only

This enum does not exist in C++ class, has been added to Python for convenience

This enum is an internal type of Damage class. Following enum members are defined currently:

  • Damage.Mask.DroppedContribution
  • Damage.Mask.OutOfOrder
  • Damage.Mask.OutOfSynch
  • Damage.Mask.UserDefined
  • Damage.Mask.IncompleteContribution
  • Damage.Mask.ContainsIncomplete

The values of enum constants define the bit mask in the damage mask. Mask enum is equivalent to 1<<Value enum.


Construction

Usage: dmg = xtc.Damage([value])

Arguments:

  • value – complete damage mask as an integer number, if missing then assumed 0

Method value()

Usage: mask = dmg.value()

Returns complete damage mask as integer number.


Method hasDamage()

Usage: result = dmg.hasDamage(value)

Returns true if the corresponding damage bit is set.

Arguments:

  • value – bit number of the damage mask, one of the Damage.Value enums

Class DetInfo

Python wrapper for pdsdata/xtc/DetInfo class. Unlike C++ this class does not inherit from Src class (Src class does not exist in this module) but uses dynamic Python features to implement the same interface as in Src class. In addition to methods described here the class also defines __hash__ and __cmp__ methods based on the content of the object and can be used as a key in the dictionaries.


Enum Detector

This enum is an embedded type of DetInfo class. Following enum members are defined currently:

  • DetInfo.Detector.NoDetector
  • DetInfo.Detector.AmoIms
  • DetInfo.Detector.AmoGasdet
  • DetInfo.Detector.AmoETof
  • DetInfo.Detector.AmoITof
  • DetInfo.Detector.AmoMbes
  • DetInfo.Detector.AmoVmi
  • DetInfo.Detector.AmoBps
  • DetInfo.Detector.Camp
  • DetInfo.Detector.EpicsArch
  • DetInfo.Detector.BldEb
  • DetInfo.Detector.NumDetector

Enum Device

This enum is an embedded type of DetInfo class. Following enum members are defined currently:

  • DetInfo.Device.NoDevice
  • DetInfo.Device.Evr
  • DetInfo.Device.Acqiris
  • DetInfo.Device.Opal1000
  • DetInfo.Device.TM6740
  • DetInfo.Device.pnCCD
  • DetInfo.Device.NumDevice

Construction

Usage: det = xtc.DetInfo(processId, detector, detId, device, devId)

Arguments:

  • processId – integer number
  • detector – one of the DetInfo.Detector enum values
  • detId – detector ID as integer number
  • device – one of the DetInfo.Device enum values
  • devId – device ID as integer number

Method level()

Usage: lvl = det.level()

Returns enum value of type xtc.Level which defines source level.


Method log()

Usage: log = det.log()

Returns logical address of data source as integer number.


Method phy()

Usage: phy = det.phy()

Returns physical address of data source as integer number.


Method processId()

Usage: processId = det.processId()

Returns process ID as integer number.


Method detector()

Usage: detector = det.detector()

Returns detector enum which is a value of DetInfo.Detector.


Method device()

Usage: device = det.device()

Returns device enum which is a value of DetInfo.Device.


Method detId()

Usage: detId = det.detId()

Returns detector ID as integer number.


Method devId()

Usage: devId = det.devId()

Returns device ID as integer number.


Class Dgram

Python wrapper for pdsdata/xtc/Dgram class.


Construction

Usage: dg = xtc.Dgram(buffer)

One of the ways to create Dgram objects is from a Python buffer objects.

Arguments:

  • buffer – any object that implements buffer interface

Property env

Usage: env = dg.env

Returns the env field as an integer number.


Property seq

Usage: seq = dg.seq

Returns the seq field as an object of type xtc.Seq.


Property xtc

Usage: x = dg.xtc

Returns top-level Xtc as object of type xtc.Xtc.


Class Level

Python wrapper for pdsdata/xtc/Level class. C++ class does not define any data members or methods, it only defines single enum type. C++ cannot be instantiated in any meaningful way. Python class in addition to defining corresponding enum constants can also be instantiated, the instances are regular integer numbers with additional printing enhancements.


Enum Type

Unlike other enum types which create separate new type inside original Python type, the enums in Level class are defined directly in the class. Known enums:

  • Level.Control
  • Level.Source
  • Level.Segment
  • Level.Event
  • Level.Recorder
  • Level.Observer
  • Level.Reporter
  • Level.NumberOfLevels

Construction

Usage: lvl = xtc.Level(number)

Arguments:

  • number – any of the above enums can be used

Method __str__

Usage: s = str(lvl)

Returns a name of the corresponding enum.


Method __repr__

Usage: s = repr(lvl)

Returns a string in the form "<Level(num):name>" where num and name are the value and the name of the corresponding enum.


Class ProcInfo

Python wrapper for pdsdata/xtc/ProcInfo class. Unlike C++ this class does not inherit from Src class (Src class does not exist in this module) but uses dynamic Python features to implement the same interface as in Src class. In addition to methods described here the class also defines __hash__ and __cmp__ methods based on the content of the object and can be used as a key in the dictionaries.


Construction

Usage: proc = xtc.ProcInfo(level, processId, ipAddr)

Arguments:

  • level – instance of xtc.Level type
  • processId – integer number
  • ipAddr – IP address of the host as integer number

Method level()

Usage: lvl = proc.level()

Returns enum value of type xtc.Level which defines source level.


Method log()

Usage: log = proc.log()

Returns logical address of data source as integer number.


Method phy()

Usage: phy = proc.phy()

Returns physical address of data source as integer number.


Method processId()

Usage: processId = proc.processId()

Returns process ID as integer number.


Method ipAddr()

Usage: ipAddr = proc.ipAddr()

Returns host IP address as an integer number.


Class Sequence

Python wrapper for pdsdata/xtc/Sequence class.


Enum Type

This enum is an embedded type of Sequence class. Following enum members are defined currently:

  • Sequence.Type.Event
  • Sequence.Type.Occurrence
  • Sequence.Type.Marker

Construction

This class cannot be instantiated directly, it is instantiated by some other classes, e.g. by Dgram.seq property.


Method type()

Usage: type = seq.type()

Returns the type of this sequence, one of Sequence.Type values.


Method service()

Usage: svc = seq.service()

Returns the transition type as object of xtc.TransitionId type.


Method isExtended()

Usage: val = seq.isExtended()

Returns True for extended sequence.


Method isEvent()

Usage: val = seq.isEvent()

Returns True for event sequence.


Method clock()

Usage: clock = seq.clock()

Returns clock value for sequence as an object of xtc.ClockTime type.


Method stamp()

Usage: stamp = seq.stamp()

Returns timestamp value for sequence as an object of xtc.TimeStamp type.


Class TimeStamp

Python wrapper for pdsdata/xtc/TimeStamp class. In addition to methods described here the class also defines __hash__ and __cmp__ methods based on the content of the object and can be used as a key in the dictionaries.


Construction

Usage: ts = xtc.TimeStamp(ticks, fiducials, vector, [control])

Creates new instance of this type. All arguments are of integer type and have the same meaning as in corresponding C++ constructor.


Method ticks()

Usage: ticks = ts.ticks()

Returns the ticks value as integer number.


Method fiducials()

Usage: fiducials = ts.fiducials()

Returns the fiducials value as integer number.


Method control()

Usage: control = ts.control()

Returns the control value as integer number.


Method vector()

Usage: vector = ts.vector()

Returns the vector value as integer number.


Class TransitionId

Python wrapper for pdsdata/xtc/TransitionId class. C++ class does not define any data members or methods, it only defines single enum type. C++ cannot be instantiated in any meaningful way. Python class in addition to defining corresponding enum constants can also be instantiated, the instances are regular integer numbers with additional printing enhancements.


Enum Value

Unlike other enum types which create separate new type inside original Python type, the enums in TransitionId class are defined directly in the class. Known enums:

  • TransitionId.
  • TransitionId.Unknown
  • TransitionId.Reset
  • TransitionId.Map
  • TransitionId.Unmap
  • TransitionId.Configure
  • TransitionId.Unconfigure
  • TransitionId.BeginRun
  • TransitionId.EndRun
  • TransitionId.BeginCalibCycle
  • TransitionId.EndCalibCycle
  • TransitionId.Enable
  • TransitionId.Disable
  • TransitionId.L1Accept
  • TransitionId.NumberOf

Construction

Usage: transId = xtc.TransitionId(number)

Arguments:

  • number – any of the above enums can be used

Method __str__

Usage: s = str(transId)

Returns a name of the corresponding enum.


Method __repr__

Usage: s = repr(transId)

Returns a string in the form "<TransitionId(num):name>" where num and name are the value and the name of the corresponding enum.


Class TypeId

Python wrapper for pdsdata/xtc/TypeId class. In addition to methods described here the class also defines __hash__ and __cmp__ methods based on the content of the object and can be used as a key in the dictionaries.


Enum Type

This enum is an embedded type of TypeId class. Following enum members are defined currently:

  • TypeId.Type.Any
  • TypeId.Type.Id_Xtc
  • TypeId.Type.Id_Frame
  • TypeId.Type.Id_AcqWaveform
  • TypeId.Type.Id_AcqConfig
  • TypeId.Type.Id_TwoDGaussian
  • TypeId.Type.Id_Opal1kConfig
  • TypeId.Type.Id_FrameFexConfig
  • TypeId.Type.Id_EvrConfig
  • TypeId.Type.Id_TM6740Config
  • TypeId.Type.Id_ControlConfig
  • TypeId.Type.Id_pnCCDframe
  • TypeId.Type.Id_pnCCDconfig
  • TypeId.Type.Id_Epics
  • TypeId.Type.Id_FEEGasDetEnergy
  • TypeId.Type.Id_EBeam
  • TypeId.Type.Id_PhaseCavity
  • TypeId.Type.NumberOf

Construction

Usage: typeId = xtc.TypeId([type, [version]])

Arguments:

  • type – one of the ebove enum values, if missing then Any assumed
  • version – version number, if missing then assumed to be 0

Method value()

Usage: val = typeId.value()

Returns the whole type ID number including version as integer number.


Method id()

Usage: id = typeId.id()

Returns the type ID number without version as enum object of TypeId.Type type.


Method version()

Usage: vers = typeId.version()

Returns the type ID version number as integer number.


Class Xtc

Python wrapper for pdsdata/xtc/Xtc class. In addition to methods described below this class implements Python iterator interface. Instance can be used as iterator only when its contains type is TypeId.Type.Id_Xtc.


Construction

This class cannot be instantiated directly, methods of other classes return instances of this type.


Property damage

Usage: dmg = xtcObj.damage

Returns damage bitmask as an object of xtc.Damage type.


Property src

Usage: src = xtcObj.src

Returns data source object. Depending on the source level the type of the returned object will be one of xtc.BldInfo, xtc.DetInfo, or xtc.ProcInfo.


Property contains

Usage: typeId = xtcObj.contains

Returns the type of the object contained in XTC as object od xtc.TypeId type.


Property extent

Usage: size = xtcObj.extent

Returns the extent (total size) of the XTC.


Method sizeofPayload()

Usage: size = xtcObj.sizeofPayload()

Returns the size of payload object.


Method payload()

Usage: obj = xtcObj.payload()

Returns data object. If contains is TypeId.Type.Any it returns None. If contains is TypeId.Type.Id_Xtc it returns xtc.XtcIterator object. For other values it returns one of the specific types such as acqiris.ConfigV1.


Class XtcFileIterator

Unlike its C++ counterpart class pdsdata/xtc/XtcFileIterator this Python class implements true Python iterator interface. Like the C++ class it also returns objects of type xtc.Dgram. It does not have any special methods besides what is need for iterator. Typical use of this class is like this:

    # iterate over all datagrams in a file
    for dg in xtc.XtcFileIterator(file):
        # do something with datagram
        xtcObj = dg.xtc

Construction

Usage: iter = XtcFileIterator(file)

Arguments:

  • file – regular Python file object, for example created with open() function

Class XtcIterator

This class is not like its C++ counterpart pdsdata/xtc/XtcIterator. It implements true Python iterator interface, the return type for the iterator is xtc.Xtc. Typical use of this class is like this:

    if xtcObj.contains == xtc.TypeId.Type.Id_Xtc:
        for subXtc in xtc.XtcIterator(xtcObj):
            ..................

    # which is identical to this
    if xtcObj.contains == xtc.TypeId.Type.Id_Xtc:
        for subXtc in xtcObj.payload():
            ..................

    # and also identical to this
    if xtcObj.contains == xtc.TypeId.Type.Id_Xtc:
        for subXtc in xtcObj:
            ..................

Construction

Usage: iter = xtc.XtcIterator(xtcObj)

Arguments:

  • xtcObj – XTC object whose contains type is Id_Xtc, otherwise an exception will be thrown.

Module _pdsdata.acqiris

This module contains classes corresponding to those in C++ pdsdata/acqiris package.

Class ConfigV1

Python wrapper for pdsdata/acqiris/ConfigV1 class.


Construction

This class cannot be instantiated directly, methods of other classes return instances of this type.


Method nbrConvertersPerChannel()

Usage: num = cfg.nbrConvertersPerChannel()

Returns integer number.


Method channelMask()

Usage: mask = cfg.channelMask()

Returns integer number.


Method nbrChannels()

Usage: num = cfg.nbrChannels()

Returns integer number.


Method nbrBanks()

Usage: num = cfg.nbrBanks()

Returns integer number.


Method horiz()

Usage: hconfig = cfg.horiz()

Returns object of acqiris.HorizV1 type.


Method trig()

Usage: trig = cfg.trig()

Returns object of acqiris.TrigV1 type.


Method vert()

Usage: vconfig = cfg.vert(channel)

Returns object of acqiris.VertV1 type.

Arguments:

  • channel – channel number

Class DataDescV1

Python wrapper for pdsdata/acqiris/DataDescV1 class.


Construction

This class cannot be instantiated directly, methods of other classes return instances of this type.


Method nbrSamplesInSeg()

Usage: nsampl = dd.nbrSamplesInSeg()

Returns integer number.


Method nbrSegments()

Usage: nseg = dd.nbrSegments()

Returns integer number.


Method indexFirstPoint()

Usage: idx = dd.indexFirstPoint()

Returns integer number.


Method timestamp()

Usage: ts = dd.timestamp(segment)

Returns object of acqiris.TimestampV1 type.

Arguments:

  • segment - segment number

Method waveform()

Usage: wf = dd.waveform(hconfig)

Returns waveform array of numpy.ndarray type.

Arguments:


Method nextChannel()

Usage: nextdd = dd.nextChannel(hconfig)

Returns data object of acqiris.DataDescV1 type for next channel or None after the last channel.

Arguments:


Class HorizV1

Python wrapper for pdsdata/acqiris/HorizV1 class.


Construction

This class cannot be instantiated directly, methods of other classes return instances of this type.


Method sampInterval()

Usage: interval = hconfig.sampInterval()

Returns floating number.


Method delayTime()

Usage: delay = hconfig.delayTime()

Returns floating number.


Method nbrSamples()

Usage: nsampl = hconfig.nbrSamples()

Returns integer number.


Method nbrSegments()

Usage: nseg = hconfig.nbrSegments()

Returns integer number.


Class TimestampV1

Python wrapper for pdsdata/acqiris/TimestampV1 class.


Construction

This class cannot be instantiated directly, methods of other classes return instances of this type.


Method pos()

Usage: pos= ts.pos()

Returns floating number.


Method value()

Usage: value = ts.value()

Returns integer number.


Class TrigV1

Python wrapper for pdsdata/acqiris/TrigV1 class.


Construction

This class cannot be instantiated directly, methods of other classes return instances of this type.


Enum Coupling

This enum is an embedded type of TrigV1 class. Following enum members are defined currently:

  • TrigV1.Coupling.DC
  • TrigV1.Coupling.AC
  • TrigV1.Coupling.HFreject
  • TrigV1.Coupling.DC50ohm
  • TrigV1.Coupling.AC50ohm

Enum Slope

This enum is an embedded type of TrigV1 class. Following enum members are defined currently:

  • TrigV1.Slope.Positive
  • TrigV1.Slope.Negative
  • TrigV1.Slope.OutOfWindow
  • TrigV1.Slope.IntoWindow
  • TrigV1.Slope.HFDivide
  • TrigV1.Slope.SpikeStretcher

Enum Source

This enum is an embedded type of TrigV1 class. Following enum members are defined currently:

  • TrigV1.Source.Internal
  • TrigV1.Source.External

Method coupling()

Usage: coupling = trig.coupling()

Returns enum of TrigV1.Coupling type.


Method input()

Usage: input = trig.input()

Returns enum of TrigV1.Source type.


Method slope()

Usage: slope = trig.slope()

Returns enum of TrigV1.Slope type.


Method level()

Usage: level = trig.level()

Returns floating number.


Module _pdsdata.bld

This module contains classes corresponding to those in C++ pdsdata/bld package.

Class BldDataEBeam

Python wrapper for pdsdata/bld/BldDataEBeam class.


Construction

This class cannot be instantiated directly, methods of other classes return instances of this type.


Property uDamageMask

Usage: mask = ebeam.uDamageMask

Returns integer number.


Property fEbeamCharge

Usage: val = ebeam.fEbeamCharge

Returns floating number.


Property fEbeamL3Energy

Usage: val = ebeam.fEbeamL3Energy

Returns floating number.


Property fEbeamLTUPosX

Usage: val = ebeam.fEbeamLTUPosX

Returns floating number.


Property fEbeamLTUPosY

Usage: val = ebeam.fEbeamLTUPosY

Returns floating number.


Property fEbeamLTUAngX

Usage: val = ebeam.fEbeamLTUAngX

Returns floating number.


Property fEbeamLTUAngY

Usage: val = ebeam.fEbeamLTUAngY

Returns floating number.


Property fEbeamPkCurrBC2

Usage: val = ebeam.fEbeamPkCurrBC2

Returns floating number.


Class BldDataEBeamV0

Python wrapper for pdsdata/bld/BldDataEBeamV0 class.


Construction

This class cannot be instantiated directly, methods of other classes return instances of this type.


Property uDamageMask

Usage: mask = ebeam.uDamageMask

Returns integer number.


Property fEbeamCharge

Usage: val = ebeam.fEbeamCharge

Returns floating number.


Property fEbeamL3Energy

Usage: val = ebeam.fEbeamL3Energy

Returns floating number.


Property fEbeamLTUPosX

Usage: val = ebeam.fEbeamLTUPosX

Returns floating number.


Property fEbeamLTUPosY

Usage: val = ebeam.fEbeamLTUPosY

Returns floating number.


Property fEbeamLTUAngX

Usage: val = ebeam.fEbeamLTUAngX

Returns floating number.


Property fEbeamLTUAngY

Usage: val = ebeam.fEbeamLTUAngY

Returns floating number.


Class BldDataFEEGasDetEnergy

Python wrapper for pdsdata/bld/BldDataFEEGasDetEnergy class.


Construction

This class cannot be instantiated directly, methods of other classes return instances of this type.


Property f_11_ENRC

Usage: val = fee.f_11_ENRC

Returns floating number.


Property f_12_ENRC

Usage: val = fee.f_12_ENRC

Returns floating number.


Property f_21_ENRC

Usage: val = fee.f_21_ENRC

Returns floating number.


Property f_22_ENRC

Usage: val = fee.f_22_ENRC

Returns floating number.


Class BldDataPhaseCavity

Python wrapper for pdsdata/bld/BldDataPhaseCavity class.


Construction

This class cannot be instantiated directly, methods of other classes return instances of this type.


Property fFitTime1

Usage: val = phase.fFitTime1

Returns floating number.


Property fFitTime2

Usage: val = phase.fFitTime2

Returns floating number.


Property fCharge1

Usage: val = phase.fCharge1

Returns floating number.


Property fCharge2

Usage: val = phase.fCharge2

Returns floating number.


Module _pdsdata.camera

This module contains classes corresponding to those in C++ pdsdata/camera package.

Class FrameCoord

Python wrapper for pdsdata/camera/FrameCoord class.


Construction

This class cannot be instantiated directly, methods of other classes return instances of this type.


Property column

Usage: x = coord.column

Returns integer number.


Property column

Usage: y = coord.row

Returns integer number.


Property x

Usage: x = coord.x

Returns integer number, this is equivalent to column property.


Property y

Usage: y = coord.y

Returns integer number, this is equivalent to row property.


Class FrameFexConfigV1

Python wrapper for pdsdata/camera/FrameFexConfigV1 class.


Enum Forwarding

This enum is an embedded type of FrameFexConfigV1 class. Following enum members are defined currently:

  • FrameFexConfigV1.Forwarding.NoFrame
  • FrameFexConfigV1.Forwarding.FullFrame
  • FrameFexConfigV1.Forwarding.RegionOfInterest

Enum Processing

This enum is an embedded type of FrameFexConfigV1 class. Following enum members are defined currently:

  • FrameFexConfigV1.Processing.NoProcessing
  • FrameFexConfigV1.Forwarding.GssFullFrame
  • {{FrameFexConfigV1.Forwarding.GssRegionOfInterest
  • FrameFexConfigV1.Forwarding.GssThreshold

Construction

This class cannot be instantiated directly, methods of other classes return instances of this type.


Method forwarding()

Usage: val = config.forwarding()

Returns forwarding policy for frame data as enum FrameFexConfigV1.Forwarding.


Method forward_prescale()

Usage: val = config.forward_prescale()

Returns prescale of events with forwarded frames as integer number.


Method processing()

Usage: val = config.processing()

Returns algorithm to apply to frames to produce processed output as enum FrameFexConfigV1.Processing.


Method roiBegin()

Usage: coord = config.roiBegin()

Returns coordinates of start of rectangular region of interest (inclusive) as camera.FrameCoord.


Method roiEnd()

Usage: coord = config.roiEnd()

Returns coordinates of finish of rectangular region of interest (exclusive) as camera.FrameCoord.


Method threshold()

Usage: val = config.threshold()

Returns pixel data threshold value to apply in processing as integer number.


Method number_of_masked_pixels()

Usage: val = config.number_of_masked_pixels()

Returns count of masked pixels to exclude from processing as integer number.


Method masked_pixel_coordinates()

Usage: list = config.masked_pixel_coordinates()

Returns Python list of masked pixel coordinates, items in the list have type camera.FrameCoord.


Method size()

Usage: size = config.size()

Returns size of this structure (including appended masked pixel coordinates).


Class FrameV1

Python wrapper for pdsdata/camera/FrameV1 class.


Construction

This class cannot be instantiated directly, methods of other classes return instances of this type.


Method width()

Usage: val = frame.width()

Returns number of pixels in a row.


Method height()

Usage: val = frame.height()

Returns number of pixels in a column.


Method depth()

Usage: val = frame.depth()

Returns number of bits per pixel.


Method depth_bytes()

Usage: val = frame.depth_bytes()

Returns number of bytes per pixel.


Method offset()

Usage: val = frame.offset()

Returns fixed offset/pedestal value of pixel data.


Method data_size()

Usage: val = frame.data_size()

Returns fixed offset/pedestal value of pixel data.


Method data()

Usage: val = frame.data([writable=False])

Returns pixel data as NumPy array, if optional argument is True then array is writable.

Arguments:

  • writable - if True then returned data can be updated in-place

Method pixel()

Usage: val = frame.pixel(x, y)

Returns individual pixel datum given coordinates (x, y).


Class TwoDGaussianV1

Python wrapper for pdsdata/camera/TwoDGaussianV1 class.


Construction

This class cannot be instantiated directly, methods of other classes return instances of this type.


Method integral()

Usage: val = gauss.integral()

Returns integral statistics as integer number.


Method xmean()

Usage: val = gauss.xmean()

Returns mean X value as floating number.


Method ymean()

Usage: val = gauss.ymean()

Returns mean Y value as floating number.


Method major_axis_width()

Usage: val = gauss.major_axis_width()

Returns width of major axis as floating number.


Method minor_axis_width()

Usage: val = gauss.minor_axis_width()

Returns width of minor axis as floating number.


Method major_axis_tilt()

Usage: val = gauss.major_axis_tilt()

Returns tilt of major axis as floating number.


Module _pdsdata.control

This module contains classes corresponding to those in C++ pdsdata/control package.

Class ConfigV1

Python wrapper for pdsdata/control/ConfigV1 class.


Construction

This class cannot be instantiated directly, methods of other classes return instances of this type.


Method uses_duration()

Usage: val = config.uses_duration()

Returns Boolean value.


Method uses_events()

Usage: val = config.uses_events()

Returns Boolean value.


Method duration()

Usage: clock = config.duration()

Returns value of xtc.ClockTime type.


Method events()

Usage: val = config.events()

Returns number of events.


Method npvControls()

Usage: val = config.npvControls()

Returns number of PVControls.


Method npvMonitors()

Usage: val = config.npvMonitors()

Returns number of PVMonitors.


Method size()

Usage: val = config.size()

Returns total data size.


Method pvControl()

Usage: val = config.pvControl(index)

Returns PVControl for a given index.


Method pvMonitor()

Usage: val = config.pvMonitor(index)

Returns PVMonitor for a given index.


Class PVControl

Python wrapper for pdsdata/control/PVControl class.


Construction

This class cannot be instantiated directly, methods of other classes return instances of this type.


Method name()

Usage: val = control.name()

Returns name of the monitoring channel.


Method array()

Usage: val = control.array()

Returns true if the channel is an array.


Method index()

Usage: val = control.index()

Returns index in the array.


Method value()

Usage: val = control.value()

Returns value as floating number.


Class PVMonitor

Python wrapper for pdsdata/control/PVMonitor class.


Construction

This class cannot be instantiated directly, methods of other classes return instances of this type.


Method name()

Usage: val = control.name()

Returns name of the monitoring channel.


Method array()

Usage: val = control.array()

Returns true for array.


Method index()

Usage: val = control.index()

Returns index in the array.


Method loValue()

Usage: val = control.loValue()

Returns low value as floating number.


Method hiValue()

Usage: val = control.hiValue()

Returns high value as floating number.

  • No labels