Page History
...
This reference manual describes various modules available to Python code in Pyana jobs and their complete API. It contains complete technical description, but has very few examples. For more user-oriented description with examples and detailed explanations consult Pyana User Manual.
...
Anchor | ||||
---|---|---|---|---|
|
Package pyana
This package collects code which deals with various aspects of the analysis tasks.
...
Anchor | ||||
---|---|---|---|---|
|
Module event
This module is a collection of classes and methods to deal with the event data and everything related to it.
...
Panel | ||||||||
---|---|---|---|---|---|---|---|---|
Class EventInstance of this class contains all event data. ConstructionUsage: Creates event object from the corresponding XTC datagram object. Parameters:
Method seq()Usage: Returns Method getTime()Usage: Returns Method find()Usage: 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:
The parameters Method findFirst()Usage: Accepts the same set of arguments as Method getAcqConfig()Usage: Returns Acqiris configuration data of type Parameters:
Ordinary configuration objects are contained in a Method getOpal1kConfig()Usage: Returns Opal1k configuration data of type Parameters:
Same caveats apply as for Method getAcqValue()Usage: Returns Acqiris data object of type Parameters:
Channel number is an integer number, total number of channels can be extracted from the Acqiris configuration object. Method getPnCcdValue()Usage: returns pnCCD data object of type Parameters:
Method getFeeGasDet()Usage:
Method getPhaseCavity()Usage: Returns data object of type Method getEBeam()Usage: Returns data object of type |
...
Panel | ||||||
---|---|---|---|---|---|---|
Class EnvInstance of this class is a container for all sorts of environment data. ConstructionUsage: Creates environment object. Parameters:
Objects of this type are created by pyana itself and end users do not need to create new instances. Method jobName()Usage: Returns analysis job name string. Method hmgr()Usage: Returns histogram manager object of type Method mkfile()Usage: 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:
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: This is the primary method for user code to access EPICS data. It returns Method update()Usage: This method updates environment contents with selected data from event object. This is equivalent to calling env.updateEpics() and env.updateConfig(). Parameters:
This method is not supposed to be called from user code, pyana takes care of all updates itself. Method updateEpics()Usage: 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: This method copies configuration objects from event object into environment. Parameters:
This method is not supposed to be called from user code, pyana takes care of all updates itself. Method getAcqConfig()Usage: 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:
Method getPnCCDConfig()Usage: 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: 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: 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. |
...
Panel | ||||||
---|---|---|---|---|---|---|
Class EpicsStoreInstance of this class contains current status of all EPICS channels. It is updated from event data on every new event. ConstructionUsage: 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: 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 Returns current value of the EPICS channel with the given name. The type of returned data is either Parameters:
This is the primary method to access EPICS information in pyana jobs. |
...
Anchor | ||||
---|---|---|---|---|
|
Module histo
This module is a collection classes and methods to create and manage histograms from user analysis modules.
...
Panel | ||||||
---|---|---|---|---|---|---|
Class HistoMgrRootThis 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. ConstructionUsage: Creates new histogram manager object. Users should not instantiate new objects, instead the environment method Keyword arguments:
Method h1d()Usage: 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: 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: 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: 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: 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: 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: 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: 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. |
...
Panel | ||||||
---|---|---|---|---|---|---|
Function HistoMgr()Usage: Do not call it, it's for pyana internal use. |
...
Anchor | ||||
---|---|---|---|---|
|
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++:
...
Panel | ||||||
---|---|---|---|---|---|---|
Class ErrorThis is the type for the exception generated by few methods in _pdsdata package. ConstructionUsage: Arguments:
|
Anchor | ||||
---|---|---|---|---|
|
Module _pdsdata.xtc
This module contains classes corresponding to those in C++ pdsdata/xtc package.
...
Panel | |||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Class DamagePython wrapper for pdsdata/xtc/Damage class.
Enum ValueThis enum is an internal type of
The values of enum constants define the bit number in the damage mask.
Enum Mask
This enum is an internal type of
The values of enum constants define the bit mask in the damage mask. Mask enum is equivalent to 1<<Value enum. Construction
Arguments:
Method value()Usage: Returns complete damage mask as integer number. Method hasDamage()Usage: Returns true if the corresponding damage bit is set. Arguments:
|
...
Panel | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||
Panel | ||||||||||||
Class DetInfoPython 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
Enum DetectorThis enum is an embedded type of
Enum DeviceThis enum is an embedded type of
ConstructionUsage: Arguments:
Method level()Usage: Returns enum value of type Method log()Usage: Returns logical address of data source as integer number. Method phy()Usage: Returns physical address of data source as integer number. Method processId()Usage: Returns process ID as integer number. Method detector()Usage: Returns detector enum which is a value of Method device()Usage: Returns device enum which is a value of Method detId()Usage: Returns detector ID as integer number. Method devId()Usage: Returns device ID as integer number. |
...
Panel | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Class XtcIteratorThis class is not like its C++ counterpart pdsdata/xtc/XtcIterator. It implements true Python iterator interface, the return type for the iterator is
ConstructionUsage: Arguments:
|
...
Anchor | ||||
---|---|---|---|---|
|
Module _pdsdata.acqiris
This module contains classes corresponding to those in C++ pdsdata/acqiris package.
...
Panel | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Class TrigV1Python wrapper for pdsdata/acqiris/TrigV1 class. ConstructionThis class cannot be instantiated directly, methods of other classes return instances of this type.
Enum CouplingThis enum is an embedded type of
Enum SlopeThis enum is an embedded type of
Enum SourceThis enum is an embedded type of
Method coupling()Usage: Returns enum of Method input()Usage: Returns enum of Method slope()Usage: Returns enum of Method level()Usage: Returns floating number. |
...
Anchor | ||||
---|---|---|---|---|
|
Module _pdsdata.bld
This module contains classes corresponding to those in C++ pdsdata/bld package.
...
Panel | ||||||
---|---|---|---|---|---|---|
Class BldDataPhaseCavityPython wrapper for pdsdata/bld/BldDataPhaseCavity class. ConstructionThis class cannot be instantiated directly, methods of other classes return instances of this type. Property fFitTime1Usage: Returns floating number. Property fFitTime2Usage: Returns floating number. Property fCharge1Usage: Returns floating number. Property fCharge2Usage: Returns floating number. |
...
Anchor | ||||
---|---|---|---|---|
|
Module _pdsdata.camera
This module contains classes corresponding to those in C++ pdsdata/camera package.
...
Panel | ||||||
---|---|---|---|---|---|---|
Class TwoDGaussianV1Python wrapper for pdsdata/camera/TwoDGaussianV1 class. ConstructionThis class cannot be instantiated directly, methods of other classes return instances of this type. Method integral()Usage: Returns integral statistics as integer number. Method xmean()Usage: Returns mean X value as floating number. Method ymean()Usage: Returns mean Y value as floating number. Method major_axis_width()Usage: Returns width of major axis as floating number. Method minor_axis_width()Usage: Returns width of minor axis as floating number. Method major_axis_tilt()Usage: Returns tilt of major axis as floating number. |
...
Anchor | ||||
---|---|---|---|---|
|
Module _pdsdata.control
This module contains classes corresponding to those in C++ pdsdata/control package.
...
Panel | ||||||
---|---|---|---|---|---|---|
Class PVMonitorPython wrapper for pdsdata/control/PVMonitor class. ConstructionThis class cannot be instantiated directly, methods of other classes return instances of this type. Method name()Usage: Returns name of the monitoring channel. Method array()Usage: Returns true for array. Method index()Usage: Returns index in the array. Method loValue()Usage: Returns low value as floating number. Method hiValue()Usage: Returns high value as floating number. |
...
Anchor | ||||
---|---|---|---|---|
|
Module _pdsdata.epics
This module contains classes corresponding to those in C++ pdsdata/epics package. The module reuses different bits and pieces, such as data type constants, from the underlying EPICS library. Complete EPICS documentation is available at main EPICS site.
...
Panel | ||||||||
---|---|---|---|---|---|---|---|---|
Class epicsTimeStampPython wrapper for pdsdata/epics/epicsTimeStamp class. In addition to methods described here the class also defines Construction
Arguments:
Property secPastEpochUsage: Returns number of seconds since Jan 1, 1990 00:00. Property nsecUsage: Returns nanoseconds within second. |
...
Anchor | ||||
---|---|---|---|---|
|
Module _pdsdata.evr
This module contains classes corresponding to those in C++ pdsdata/evr package.
...
Panel | ||||||
---|---|---|---|---|---|---|
Class PulseConfigPython wrapper for pdsdata/evr/PulseConfig class. ConstructionThis class cannot be instantiated directly, methods of other classes return instances of this type. Method pulse()Usage: Returns internal pulse generation channel as integer number. Method trigger()Usage: Returns integer number. Method set()Usage: Returns integer number. Method clear()Usage: Returns integer number. Method polarity()Usage: Returns Boolean value. Method map_set_enable()Usage: Returns Boolean value. Method map_reset_enable()Usage: Returns Boolean value. Method map_trigger_enable()Usage: Returns Boolean value. Method prescale()Usage: Returns integer number. Method delay()Usage: Returns integer number. Method width()Usage: Returns integer number. |
...
Anchor | ||||
---|---|---|---|---|
|
Module _pdsdata.opal1k
This module contains classes corresponding to those in C++ pdsdata/opal1k package.
Panel | ||||||||
---|---|---|---|---|---|---|---|---|
Class ConfigV1Python wrapper for pdsdata/opal1k/ConfigV1 class. Constants
Enum DepthThis enum is an embedded type of
Enum BinningThis enum is an embedded type of
Enum MirroringThis enum is an embedded type of
ConstructionThis class cannot be instantiated directly, methods of other classes return instances of this type. Method black_level()Usage: Returns offset/pedestal setting for camera (before gain) as integer number. Method gain_percent()Usage:
Method output_offset()Usage: Returns offset/pedestal value in pixel counts as integer number. Method output_resolution()Usage: Returns bit-depth of pixel counts as enum Method output_resolution_bits()Usage: Returns bit-depth of pixel counts (in actual bits). Method vertical_binning()Usage: Returns vertical re-binning of output (consecutive rows summed) as enum Method output_mirroring()Usage: Returns geometric transformation of the image as enum Method vertical_remapping()Usage: Returns Boolean, true: remap the pixels to appear in natural geometric order (left->right, top->bottom), false: pixels appear on dual taps from different rows (left->right, top->bottom) alternated with (left->right, bottom->top) pixel by pixel. Method defect_pixel_correction_enabled()Usage: Returns Boolean value. Method output_lookup_table_enabled()Usage: Returns Boolean value. Method output_lookup_table()Usage: Returns output lookup table as NumPy array, elements of array are unsigned numbers. Method number_of_defect_pixels()Usage: Returns defective pixel count. Method defect_pixel_coordinates()Usage: Returns list of defective pixel coordinates, elements of the list have type Method size()Usage: Returns total size of this structure. |
...
Anchor | ||||
---|---|---|---|---|
|
Module _pdsdata.pnccd
This module contains classes corresponding to those in C++ pdsdata/pnCCD package.
...
Panel | ||||||
---|---|---|---|---|---|---|
Class FrameV1Python wrapper for pdsdata/pnCCD/FrameV1 class. ConstructionThis class cannot be instantiated directly, methods of other classes return instances of this type. Method specialWord()Usage: Returns integer number. Method frameNumber()Usage: Returns integer number. Method timeStampHi()Usage: Returns integer number. Method timeStampLo()Usage: Returns integer number. Method next()Usage: Returns next frame object or None. Arguments:
Method data()Usage: Returns frame data as NumPy 2-dimensional array of integers of size 512x512. Arguments:
Method sizeofData()Usage: Returns integer number. Arguments:
|
...
Anchor | ||||
---|---|---|---|---|
|
Module _pdsdata.pulnix
This module contains classes corresponding to those in C++ pdsdata/pulnix package.
Panel | ||||||
---|---|---|---|---|---|---|
Class TM6740ConfigV1Python wrapper for pdsdata/pulnix/TM6740ConfigV1 class. Constants
Enum DepthThis enum is an embedded type of
Enum BinningThis enum is an embedded type of
Enum LookupTableThis enum is an embedded type of
ConstructionThis class cannot be instantiated directly, methods of other classes return instances of this type. Method vref()Usage: Returns integer number. Method gain_a()Usage: Returns integer number. Method gain_b()Usage: Returns integer number. Method gain_balance()Usage: Returns Boolean value. Method shutter_width()Usage: Returns integer number. Method output_resolution()Usage: Returns bit-depth of pixel counts as enum Method output_resolution_bits()Usage: Returns bit-depth of pixel counts (in actual bits). Method horizontal_binning()Usage: Returns horizontal re-binning of output (consecutive columns summed) as enum Method vertical_binning()Usage: Returns vertical re-binning of output (consecutive rows summed) as enum Method lookuptable_mode()Usage: Returns output lookup table corrections as enum |
...
Anchor | ||||
---|---|---|---|---|
|
Package pypdsdata
This package is a user-level interface to lower-level _pdsdata
package. It repeats the module structure of _pdsdata
and defines the same classes but shields user from unnecessary details present in _pdsdata
. In many cases pypdsdata
imports the class from _pdsdata
without any changes. Documentation below only describes cases when pypdsdata
changes or extends the corresponding _pdsdata
types, for unchanged types consult corresponding _pdsdata
documentation.
Anchor | ||||
---|---|---|---|---|
|
Module pypdsdata.acqiris
Panel | ||||||
---|---|---|---|---|---|---|
Class DataDescV1This class overrides several methods in the corresponding ConstructionUsage: Arguments:
Method nbrSamplesInSeg()Usage: Returns integer number. Method nbrSegments()Usage: Returns integer number. Method timestamp()Usage: Returns object of Arguments:
Method waveform()Usage: Returns waveform array of Method timestamps()Usage: Returns NumPy array of timestamps (floating numbers). First element of array is always 0, other elements are equidistant with the distance and number of intervals determined by |
--------------
Anchor | ||||
---|---|---|---|---|
|
Module pypdsdata.pnccd
Panel | ||||||
---|---|---|---|---|---|---|
Class FrameV1This class overrides several methods in the corresponding ConstructionUsage: Arguments:
Method specialWord()Usage: Returns integer number. Method frameNumber()Usage: Returns integer number. Method timeStampHi()Usage: Returns integer number. Method timeStampLo()Usage: Returns integer number. Method data()Usage: Returns frame data as NumPy 2-dimensional array of integers of size 1024x1024. Method sizeofData()Usage: Returns integer number. |