Versions Compared

Key

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

...

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.

...

Panel

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.

Panel

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.

...

Panel

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

Wiki Markup
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.

...

Panel

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

Note
titlePython 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

Wiki Markup
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

...

Panel

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.

...

Panel

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.

...

Panel

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.

...

Panel

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 class
  • 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.

...

Panel

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.

...

Panel

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

Wiki Markup
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.

...

Panel

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.

...

Panel

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

Wiki Markup
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.

...

Panel

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.

...

Panel

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:

Code Block
none
none
    # 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

...

Panel

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:

Code Block
none
none
    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.XtciteratorXtcIterator(xtcObj)

Arguments:

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