nxswriter package¶
Submodules¶
nxswriter.ClientSource module¶
Definitions of CLIENT datasource
- class nxswriter.ClientSource.ClientSource(streams=None, name=None)[source]¶
Bases:
DataSourceClient data source
constructor
- Brief:
It sets all member variables to None
- Parameters:
streams (
StreamSetortango.LatestDeviceImpl) – tango-like steamset classname (
str) – datasource name
- setup(xml)[source]¶
sets the parrameters up from xml
- Parameters:
xml (
str) – datasource parameters- Raises:
nxswriter.Errors.DataSourceSetupError: ifnameis not defined
nxswriter.DBaseSource module¶
Definitions of DB datasource
- class nxswriter.DBaseSource.DBaseSource(streams=None, name=None)[source]¶
Bases:
DataSourceDataBase data source
constructor
- Brief:
It sets all member variables to None
- Parameters:
streams (
StreamSetortango.LatestDeviceImpl) – tango-like steamset classname (
str) – datasource name
nxswriter.DataHolder module¶
definition of a data holder with casting methods
- class nxswriter.DataHolder.DataHolder(rank, value, tangoDType, shape, encoding=None, decoders=None, streams=None)[source]¶
Bases:
objectHolder for passing data
constructor
- Parameters:
rank (
str) – format of the data, i.e. SCALAR, SPECTRUM, IMAGE, VERTEXvalue (any) – value of the data. It may be also 1D and 2D array
tangoDType (
str) – type of the dataencoding (
str) – encoding type of Tango DevEncoded variblesdecoders (
nxswriter.DecoderPool.DecoderPool) – poll with decoding classesstreams (
StreamSetortango.LatestDeviceImpl) – tango-like steamset class
- cast(dtype)[source]¶
casts the data into given type
- Parameters:
dtype (
str) – given type of data- Returns:
numpy array of defined type or list for strings or value for SCALAR
- Return type:
- decoders¶
pool with decoding algorithm
- value¶
(any) data value
nxswriter.DataSourceFactory module¶
factory with datasources
- class nxswriter.DataSourceFactory.DataSourceFactory(attrs, last, streams=None)[source]¶
Bases:
ElementData source creator
constructor
- Parameters:
attrs (
dict<str,str>) – dictionary with the tag attributeslast (
nxswriter.Element.Element) – the last element on the stackstreams (
StreamSetortango.LatestDeviceImpl) – tango-like steamset class
- setDataSources(datasources)[source]¶
sets the used datasources
- Parameters:
datasources (
nxswriter.DataSourcePool.DataSourcePool) – pool to be set
- setDecoders(decoders)[source]¶
sets the used decoders
- Parameters:
decoders (
nxswriter.DecoderPool.DecoderPool) – pool to be set
nxswriter.DataSourcePool module¶
pool with datasource evaluation classes
- class nxswriter.DataSourcePool.DataSourcePool(configJSON=None)[source]¶
Bases:
objectDataSource pool
constructor
- Brief:
It creates know datasources
- Parameters:
configJSON (:
dict<str,dict<str, any>>) – JSON dictionary with datasources
- append(datasource, name)[source]¶
adds additional datasource
- Parameters:
name (
str) – name of the adding datasourcedatasource (
nxswriter.DataSources.DataSource) – instance of the adding datasource
- Returns:
name of datasource
- Return type:
- get(datasource)[source]¶
checks it the datasource is registered
- Parameters:
datasource (
str) – the given datasource name- Returns:
datasource type if it the datasource is registered
- Return type:
- lock¶
(
threading.Lock) pool lock
- nxroot¶
(
nxswriter.FileWriter.FTGroup) H5 file handle
nxswriter.DataSources module¶
Definitions of various datasources
- class nxswriter.DataSources.DataSource(streams=None, name=None)[source]¶
Bases:
objectData source
constructor
- Brief:
It cleans all member variables
- Parameters:
streams (
StreamSetortango.LatestDeviceImpl) – tango-like steamset classname (
str) – datasource name
nxswriter.DecoderPool module¶
Provides a pool with data decoders
- class nxswriter.DecoderPool.DATAARRAYdecoder[source]¶
Bases:
objectDATA ARRAY LIMA decoder
constructor
- Brief:
It clears the local variables
- decode()[source]¶
provides the decoded data
- Returns:
the decoded data if data was loaded
- Return type:
- class nxswriter.DecoderPool.DecoderPool(configJSON=None)[source]¶
Bases:
objectDecoder pool
constructor
- Brief:
It creates know decoders
- Parameters:
configJSON (:
dict<str,dict<str, any>>) – string with decoders
- class nxswriter.DecoderPool.UINT32decoder[source]¶
Bases:
objectINT decoder
constructor
- Brief:
It clears the local variables
- class nxswriter.DecoderPool.UTF8decoder[source]¶
Bases:
objectUTF8 decoder
constructor
- Brief:
It clears the local variables
nxswriter.EAttribute module¶
Definitions of attribute tag evaluation classes
- class nxswriter.EAttribute.EAttribute(attrs, last, streams=None)[source]¶
Bases:
FElementattribute tag element
constructor
- Parameters:
last (
nxswriter.Element.Element) – the last element from the stackstreams (
StreamSetortango.LatestDeviceImpl) – tango-like steamset class
- markFailed(error=None)[source]¶
marks the field as failed
- Brief:
It marks the field as failed
- Parameters:
error (
str) – error string
nxswriter.EField module¶
Definitions of field tag evaluation classes
- class nxswriter.EField.EField(attrs, last, streams=None, reloadmode=False)[source]¶
Bases:
FElementWithAttrfield H5 tag element
constructor
- Parameters:
last (
nxswriter.Element.Element) – the last element from the stackstreams (
StreamSetortango.LatestDeviceImpl) – tango-like steamset classreloadmode (
bool) – reload mode
- filters¶
(
dict<int, (int,str,str,str) >) index filter lists, i.e. {index: (filter_id, name, id, cd_values, availability)}
- markFailed(error=None)[source]¶
marks the field as failed
- Brief:
It marks the field as failed
- Parameters:
error (
str) – error string
nxswriter.EGroup module¶
Definitions of group tag evaluation classes
- class nxswriter.EGroup.EGroup(attrs, last, streams=None, reloadmode=False)[source]¶
Bases:
FElementWithAttrgroup H5 tag element
constructor
- Parameters:
last (
nxswriter.Element.Element) – the last element from the stackstreams (
StreamSetortango.LatestDeviceImpl) – tango-like steamset classreloadmode (
bool) – reload mode
nxswriter.ELink module¶
Definitions of link tag evaluation classes
- class nxswriter.ELink.ELink(attrs, last, streams=None)[source]¶
Bases:
FElementlink H5 tag element
constructor
- Parameters:
last (
nxswriter.Element.Element) – the last element from the stackstreams (
StreamSetortango.LatestDeviceImpl) – tango-like steamset class
- h5Object¶
(
nxswriter.FileWriter.FTLink) stored H5 file object (defined in base class)
nxswriter.EStrategy module¶
Definitions of strategy evaluation classes
- class nxswriter.EStrategy.EStrategy(attrs, last, streams=None)[source]¶
Bases:
Elementstrategy tag element
constructor
- Parameters:
last (
nxswriter.Element.Element) – the last element from the stackstreams (
StreamSetortango.LatestDeviceImpl) – tango-like steamset class
nxswriter.Element module¶
Provides the base class Element for xml tags
- class nxswriter.Element.Element(name, attrs, last=None, streams=None)[source]¶
Bases:
objectTag element stored on our stack
constructor
- Parameters:
name (
str) – tag namelast (
nxswriter.Element.Element) – the last element from the stackstreams (
StreamSetortango.LatestDeviceImpl) – tango-like steamset class
- last¶
(
nxswriter.Element.Element) the previous element
nxswriter.ElementThread module¶
Implementation of element thread for tag evaluation
- class nxswriter.ElementThread.ElementThread(index, queue)[source]¶
Bases:
Threadsingle thread element
constructor
- Brief:
It creates ElementThread from the runnable element
- Parameters:
index (
int) – the current thread indexqueue (
Queue.Queue) – queue with tasks
nxswriter.Errors module¶
Tango Data Writer errors
- exception nxswriter.Errors.CorruptedFieldArrayError[source]¶
Bases:
Exceptionexception for corrupted FieldArray
- exception nxswriter.Errors.DataSourceError[source]¶
Bases:
Exceptionexception for fetching data from data source
- exception nxswriter.Errors.DataSourceSetupError[source]¶
Bases:
Exceptionexception for setting data source
- exception nxswriter.Errors.PackageError[source]¶
Bases:
Exceptionexception for fetching data from data source
nxswriter.FElement module¶
Definitions of file tag evaluation classes
- class nxswriter.FElement.FElement(name, attrs, last, h5object=None, streams=None)[source]¶
Bases:
ElementNeXuS runnable tag element tag element corresponding to one of H5 objects
constructor
- Parameters:
name – tag name
last (
nxswriter.Element.Element) – the last element from the stackh5object (
nxswriter.FileWriter.FTObject) – H5 file objectstreams (
StreamSetortango.LatestDeviceImpl) – tango-like steamset class
- h5Object¶
(
nxswriter.FileWriter.FTObject) stored H5 file object
- source¶
(
nxswriter.DataSources.DataSource) data source
- class nxswriter.FElement.FElementWithAttr(name, attrs, last, h5object=None, streams=None, reloadmode=False)[source]¶
Bases:
FElementNeXuS runnable tag element with attributes tag element corresponding to one of H5 objects with attributes
constructor
- Parameters:
name (
str) – tag namelast (
nxswriter.Element.Element) – the last element from the stackh5object (
nxswriter.FileWriter.FTObject) – H5 file objectstreams (
StreamSetortango.LatestDeviceImpl) – tango-like steamset classreloadmode (
bool) – reload mode
nxswriter.FetchNameHandler module¶
SAX parser for fetching name attributes of tags
- class nxswriter.FetchNameHandler.FetchNameHandler(streams=None)[source]¶
Bases:
ContentHandlerSAX2 parser
constructor
- Brief:
It constructs parser handler for fetching group names
- Parameters:
streams (
StreamSetortango.LatestDeviceImpl) – tango-like steamset class
- class nxswriter.FetchNameHandler.TNObject(name='root', nxtype=None, parent=None)[source]¶
Bases:
objectType Name object
constructor
- Brief:
It sets default values of TNObject
- Parameters:
name (
str) – name of the objectnxtype (
str) – Nexus type of the objectparent (
nxswriter.Element.Element) – object parent
- child(name='', nxtype='')[source]¶
get child by name or nxtype
- Parameters:
- Returns:
child instance
- Return type:
- children¶
(:obj`:list` <
nxswriter.Element.Element>) object children
- parent¶
(
nxswriter.Element.Element) object parent
nxswriter.H5Elements module¶
Definitions of tag evaluation classes
- class nxswriter.H5Elements.EDim(attrs, last, streams=None)[source]¶
Bases:
Elementdim tag element
constructor
- Parameters:
last (
nxswriter.Element.Element) – the last element from the stackstreams (
StreamSetortango.LatestDeviceImpl) – tango-like steamset class
- source¶
(
nxswriter.DataSources.DataSource) data source
- class nxswriter.H5Elements.EDimensions(attrs, last, streams=None)[source]¶
Bases:
Elementdimensions tag element
constructor
- Parameters:
last (
nxswriter.Element.Element) – the last element from the stackstreams (
StreamSetortango.LatestDeviceImpl) – tango-like steamset class
- class nxswriter.H5Elements.EDoc(attrs, last, streams=None)[source]¶
Bases:
Elementdoc tag element
constructor
- Parameters:
last (
nxswriter.Element.Element) – the last element from the stackstreams (
StreamSetortango.LatestDeviceImpl) – tango-like steamset class
- class nxswriter.H5Elements.EFile(attrs, last, h5fileObject, streams=None)[source]¶
Bases:
FElementfile H5 element
constructor
- Parameters:
last (
nxswriter.Element.Element) – the last element from the stackh5fileObject (
nxswriter.FileWriter.FTfile) – H5 file objectstreams (
StreamSetortango.LatestDeviceImpl) – tango-like steamset class
- class nxswriter.H5Elements.EFilter(attrs, last, streams=None)[source]¶
Bases:
Elementfilter tag element
constructor
- Parameters:
last (
nxswriter.Element.Element) – the last element from the stackstreams (
StreamSetortango.LatestDeviceImpl) – tango-like steamset class
- class nxswriter.H5Elements.ESelection(attrs, last, streams=None)[source]¶
Bases:
Elementselection tag element
constructor
- Parameters:
last (
nxswriter.Element.Element) – the last element from the stackstreams (
StreamSetortango.LatestDeviceImpl) – tango-like steamset class
- class nxswriter.H5Elements.ESlab(attrs, last, streams=None)[source]¶
Bases:
Elementslab tag element
constructor
- Parameters:
last (
nxswriter.Element.Element) – the last element from the stackstreams (
StreamSetortango.LatestDeviceImpl) – tango-like steamset class
- source¶
(
nxswriter.DataSources.DataSource) data source
- class nxswriter.H5Elements.ESlice(attrs, last, streams=None)[source]¶
Bases:
Elementslice tag element
constructor
- Parameters:
last (
nxswriter.Element.Element) – the last element from the stackstreams (
StreamSetortango.LatestDeviceImpl) – tango-like steamset class
- source¶
(
nxswriter.DataSources.DataSource) data source
- class nxswriter.H5Elements.ESymbol(attrs, last, streams=None)[source]¶
Bases:
Elementsymbol tag element
constructor
- Parameters:
last (
nxswriter.Element.Element) – the last element from the stackstreams (
StreamSetortango.LatestDeviceImpl) – tango-like steamset class
nxswriter.InnerXMLParser module¶
SAX parser for taking XML string inside specified tag
- class nxswriter.InnerXMLParser.InnerXMLHandler(xmlReader, contentHandler, name, attrs)[source]¶
Bases:
ContentHandlerInner SAX2 parser
constructor
- Brief:
It constructs parser handler for taking xml of datasources
- Parameters:
xmlReader (
xml.sax.xmlreader.XMLReader) – NeXus xml sax readercontentHandler (
nxswriter.NexusXMLHandler.NexusXMLHandler) – NeXus XML content handlername (
str) – tag name
- characters(content)[source]¶
adds the tag content
- Parameters:
content (
str) – partial content of the tag
nxswriter.NXSWriter module¶
Nexus Data Writer - Tango Server
- class nxswriter.NXSWriter.CommandThread(server, command, finalState, args=None)[source]¶
Bases:
Threadthread with server command
constructor
- Parameters:
server (
tango.LatestDeviceImpl) – Tango server implementationcommand (
str) – Thread commandfinalState (
tango.DevState) – Final State Code
- command¶
(
__callable__) command
- estate¶
(
tango.DevState) error state
- fstate¶
(
tango.DevState) final state
- server¶
(
tango.LatestDeviceImpl) tango server
- class nxswriter.NXSWriter.NXSDataWriter(cl, name)[source]¶
Bases:
LatestDeviceImplTango Server to store data in H5 files
- Brief:
Device States Description: DevState.ON : NeXuS Data Server is switch on DevState.OFF : NeXuS Data Writer is switch off DevState.EXTRACT : H5 file is open DevState.OPEN : XML configuration is initialized DevState.RUNNING : NeXus Data Server is writing DevState.FAULT : Error state
Device constructor
- OpenEntryAsynch()[source]¶
OpenEntryAsynch command
- Brief:
Creates the new entry in asynchronous mode
- Record(argin)[source]¶
Record command
- Brief:
Records data for one scan step
- Parameters:
argin (
str) – JSON string with data
- RecordAsynch(argin)[source]¶
RecordAsynch command
- Brief:
Records data for one scan step in asynchronous mode
- Parameters:
argin (
str) – DevString JSON string with data
- cthread¶
(
CommandThread) closentry thread
- dev_status()[source]¶
Status command
- Brief:
This command gets the device status (stored in its <i>device_status</i> data member) and returns it to the caller.
- Returns:
Status description
- Return type:
- errors¶
(
list`<:obj:`str>) list with errors
- is_CanFail_allowed(_)[source]¶
CanFail attribute State Machine
- Returns:
True if the operation allowed
- Return type:
- is_CanFail_write_allowed()[source]¶
CanFail attribute Write State Machine
- Returns:
True if the operation allowed
- Return type:
- is_CloseEntryAsynch_allowed()[source]¶
CloseEntryAsynch command State Machine
- Returns:
True if the operation allowed
- Return type:
- is_CloseEntry_allowed()[source]¶
CloseEntry command State Machine
- Returns:
True if the operation allowed
- Return type:
- is_CloseFile_allowed()[source]¶
CloseFile command State Machine
- Returns:
True if the operation allowed
- Return type:
- is_FileName_allowed(_)[source]¶
FileName attribute State Machine
- Returns:
True if the operation allowed
- Return type:
- is_FileName_write_allowed()[source]¶
FileName attribute Write State Machine
- Returns:
True if the operation allowed
- Return type:
- is_JSONRecord_allowed(_)[source]¶
JSONRecord attribute State Machine
- Returns:
True if the operation allowed
- Return type:
- is_OpenEntryAsynch_allowed()[source]¶
OpenEntryAsynch command State Machine
- Returns:
True if the operation allowed
- Return type:
- is_OpenEntry_allowed()[source]¶
OpenEntry command State Machine
- Returns:
True if the operation allowed
- Return type:
- is_OpenFile_allowed()[source]¶
OpenFile command State Machine
- Returns:
True if the operation allowed
- Return type:
- is_RecordAsynch_allowed()[source]¶
RecordAsynch command State Machine
- Returns:
True if the operation allowed
- Return type:
- is_Record_allowed()[source]¶
Record command State Machine
- Returns:
True if the operation allowed
- Return type:
- is_SkipAcquisition_allowed(_)[source]¶
SkipAcquisition attribute State Machine
- Returns:
True if the operation allowed
- Return type:
- is_SkipAcquisition_write_allowed()[source]¶
SkipAcquisition attribute Write State Machine
- Returns:
True if the operation allowed
- Return type:
- is_StepsPerFile_allowed(_)[source]¶
StepsPerFile attribute State Machine
- Returns:
True if the operation allowed
- Return type:
- is_StepsPerFile_write_allowed()[source]¶
StepsPerFile attribute Write State Machine
- Returns:
True if the operation allowed
- Return type:
- is_XMLSettings_allowed(_)[source]¶
XMLSettings attribute State Machine
- Returns:
True if the operation allowed
- Return type:
- lock¶
(
threading.Lock) thread lock
- othread¶
(
CommandThread) openentry thread
- read_CanFail(attr)[source]¶
Read CanFail attribute
- Parameters:
attr (
tango.Attribute) – attribute object
- read_CurrentFileId(attr)[source]¶
Read CurrentFileId
- Parameters:
attr (
tango.Attribute) – attribute object
- read_Errors(attr)[source]¶
Read Errors attribute
- Parameters:
attr (
tango.Attribute) – attribute object
- read_FileName(attr)[source]¶
Read FileName attribute
- Parameters:
attr (
tango.Attribute) – attribute object
- read_JSONRecord(attr)[source]¶
Read JSONRecord attribute
- Parameters:
attr (
tango.Attribute) – attribute object
- read_SkipAcquisition(attr)[source]¶
Read SkipAcquisition attribute
- Parameters:
attr (
tango.Attribute) – attribute object
- read_StepsPerFile(attr)[source]¶
Read StepsPerFile attribute
- Parameters:
attr (
tango.Attribute) – attribute object
- read_XMLSettings(attr)[source]¶
Read XMLSettings attribute
- Parameters:
attr (
tango.Attribute) – attribute object
- rthread¶
(
CommandThread) record thread
- set_state(state)[source]¶
set_state method
- Parameters:
state (
tango.DevState) – State Code
- state_flag¶
(
tango.DevState) state flag
- tdw¶
(
nxswriter.TangoDataWriter.TangoDataWriter) Tango Data Writer
- write_CanFail(attr)[source]¶
Write CanFail attribute
- Parameters:
attr (
tango.Attribute) – attribute object
- write_FileName(attr)[source]¶
Write FileName attribute
- Parameters:
attr (
tango.Attribute) – attribute object
- write_JSONRecord(attr)[source]¶
Write JSONRecord attribute
- Parameters:
attr (
tango.Attribute) – attribute object
- write_SkipAcquisition(attr)[source]¶
Write SkipAcquisition attribute
- Parameters:
attr (
tango.Attribute) – attribute object
- write_StepsPerFile(attr)[source]¶
Write StepsPerFile attribute
- Parameters:
attr (
tango.Attribute) – attribute object
- write_XMLSettings(attr)[source]¶
Write XMLSettings attribute
- Parameters:
attr (
tango.Attribute) – attribute object
- class nxswriter.NXSWriter.NXSDataWriterClass(name)[source]¶
Bases:
DeviceClassNXSDataWriterClass class definition
NXSDataWriterClass Constructor
- attr_list = {'CanFail': [[tango._tango.CmdArgType.DevBoolean, tango._tango.AttrDataFormat.SCALAR, tango._tango.AttrWriteType.READ_WRITE], {'label': 'Can fail', 'description': 'Global can fail flag. By default it is False'}], 'CurrentFileId': [[tango._tango.CmdArgType.DevLong, tango._tango.AttrDataFormat.SCALAR, tango._tango.AttrWriteType.READ], {'label': 'Current file id', 'description': 'current file id'}], 'Errors': [[tango._tango.CmdArgType.DevString, tango._tango.AttrDataFormat.SPECTRUM, tango._tango.AttrWriteType.READ, 1000], {'label': 'List of errors', 'description': 'list of errors'}], 'FileName': [[tango._tango.CmdArgType.DevString, tango._tango.AttrDataFormat.SCALAR, tango._tango.AttrWriteType.READ_WRITE], {'label': 'Output file with its path', 'description': 'A name of H5 output file with its full path'}], 'JSONRecord': [[tango._tango.CmdArgType.DevString, tango._tango.AttrDataFormat.SCALAR, tango._tango.AttrWriteType.READ_WRITE], {'label': 'JSON string with client data', 'description': 'A JSON string with global client data.', 'Display level': tango._tango.DispLevel.EXPERT}], 'SkipAcquisition': [[tango._tango.CmdArgType.DevBoolean, tango._tango.AttrDataFormat.SCALAR, tango._tango.AttrWriteType.READ_WRITE], {'label': 'Skip acquisition', 'description': 'Skip acquisition. It is set to default False value after excuting the OpenEntry, Record or CloseEntry'}], 'StepsPerFile': [[tango._tango.CmdArgType.DevLong, tango._tango.AttrDataFormat.SCALAR, tango._tango.AttrWriteType.READ_WRITE], {'label': 'Steps per file', 'description': 'Number of steps per file', 'Memorized': 'true'}], 'XMLSettings': [[tango._tango.CmdArgType.DevString, tango._tango.AttrDataFormat.SCALAR, tango._tango.AttrWriteType.READ_WRITE], {'label': 'XML Configuration', 'description': 'An XML string with Nexus configuration.', 'Display level': tango._tango.DispLevel.EXPERT}]}¶
(
dict<str, [[tango.CmdArgType,tango.AttrDataFormat,tango.AttrWriteType],dict<str, any> ] > ) Attribute definitions
- class_property_list = {}¶
(
dict<str, [str,tango.CmdArgType, [list<int> ] ] > ) Class Properties
- cmd_list = {'CloseEntry': [[tango._tango.CmdArgType.DevVoid, ''], [tango._tango.CmdArgType.DevVoid, '']], 'CloseEntryAsynch': [[tango._tango.CmdArgType.DevVoid, ''], [tango._tango.CmdArgType.DevVoid, '']], 'CloseFile': [[tango._tango.CmdArgType.DevVoid, ''], [tango._tango.CmdArgType.DevVoid, '']], 'OpenEntry': [[tango._tango.CmdArgType.DevVoid, ''], [tango._tango.CmdArgType.DevVoid, '']], 'OpenEntryAsynch': [[tango._tango.CmdArgType.DevVoid, ''], [tango._tango.CmdArgType.DevVoid, '']], 'OpenFile': [[tango._tango.CmdArgType.DevVoid, ''], [tango._tango.CmdArgType.DevVoid, '']], 'Record': [[tango._tango.CmdArgType.DevString, 'JSON string with data'], [tango._tango.CmdArgType.DevVoid, '']], 'RecordAsynch': [[tango._tango.CmdArgType.DevString, 'JSON string with data'], [tango._tango.CmdArgType.DevVoid, '']]}¶
(
dict<str, [[tango.CmdArgType,str]] >) Command definitions
- device_property_list = {'AddingLogs': [tango._tango.CmdArgType.DevBoolean, 'Add XML logs', [True]], 'DefaultCanFail': [tango._tango.CmdArgType.DevBoolean, 'Default value of CanFail attribute', [True]], 'MaxElementRuntime': [tango._tango.CmdArgType.DevDouble, 'maximal runtime for a thread element in seconds', [0.0]], 'MaxRecordRuntime': [tango._tango.CmdArgType.DevDouble, 'maximal runtime for a record command in seconds', [0.0]], 'MetadataOutput': [tango._tango.CmdArgType.DevString, 'metadata output', ['']], 'NumberOfThreads': [tango._tango.CmdArgType.DevLong, 'maximal number of threads', [100]], 'Writer': [tango._tango.CmdArgType.DevString, 'writer module', ['']]}¶
(
dict<str, [str,tango.CmdArgType, [list<int> ] ] > ) Device Properties
nxswriter.NexusXMLHandler module¶
SAX parser for interpreting content of XML configuration string
- class nxswriter.NexusXMLHandler.NexusXMLHandler(fileElement, datasources=None, decoders=None, groupTypes=None, parser=None, globalJSON=None, streams=None, reloadmode=False)[source]¶
Bases:
ContentHandlerSAX2 parser
constructor
- Brief:
It constructs parser and defines the H5 output file
- Parameters:
fileElement (
nxswriter.H5Elements.EFile) – file elementdecoders (
nxswriter.DecoderPool.DecoderPool) – decoder pooldatasources (
nxswriter.DataSourcePool.DataSourcePool) – datasource poolgroupTypes (
nxswriter.FetchNameHandler.TNObject) – map of NXclass : nameparser (
xml.sax.xmlreader.XMLReader) – instance of sax.xmlreaderglobalJSON (:
dict<str,dict<str, any>>) – global json stringstreams (
StreamSetortango.LatestDeviceImpl) – tango-like steamset classreloadmode – reload mode
- characters(content)[source]¶
adds the tag content
- Parameters:
content (
str) – partial content of the tag
- finalPool¶
(
nxswriter.ThreadPool.ThreadPool) thread pool with FINAL elements
- initPool¶
(
nxswriter.ThreadPool.ThreadPool) thread pool with INIT elements
- stepPool¶
(
nxswriter.ThreadPool.ThreadPool) thread pool with STEP elements
- triggerPools¶
(
dict<str,nxswriter.ThreadPool.ThreadPool> ) collection of thread pool with triggered STEP elements
- withXMLinput¶
(
dict<str:nxswriter.Element.Element> ) tags with inner xml as its input
nxswriter.PyEvalSource module¶
Definitions of PYEVAL datasource
- class nxswriter.PyEvalSource.PyEvalSource(streams=None, name=None)[source]¶
Bases:
DataSourcePython Eval data source
constructor
- Brief:
It cleans all member variables
- Parameters:
streams (
StreamSetortango.LatestDeviceImpl) – tango-like steamset classname (
str) – datasource name
- setDataSources(pool)[source]¶
sets the datasources
- Parameters:
pool (
nxswriter.DataSourcePool.DataSourcePool) – datasource pool
- setDecoders(decoders)[source]¶
sets the used decoders
- Parameters:
decoders (
nxswriter.DecoderPool.DecoderPool) – pool to be set
nxswriter.StreamSet module¶
labels to Tango Streams
- class nxswriter.StreamSet.StreamSet(streams)[source]¶
Bases:
objectstreamset constractor
- Parameters:
streams (
StreamSetortango.LatestDeviceImpl) – tango-like steamset class
- log_debug¶
(
tango.log4tango.TangoStream) Tango debug log stream
- log_error¶
(
tango.log4tango.TangoStream) Tango error log stream
- log_fatal¶
(
tango.log4tango.TangoStream) Tango fatal log stream
- log_info¶
(
tango.log4tango.TangoStream) Tango info log stream
- log_warn¶
(
tango.log4tango.TangoStream) Tango warn log stream
nxswriter.TangoDataWriter module¶
Tango Data Writer implementation
- nxswriter.TangoDataWriter.PYTG_BUG_213 = False¶
(
bool) tango bug #213 flag related to EncodedAttributes in python3
- class nxswriter.TangoDataWriter.TangoDataWriter(server=None)[source]¶
Bases:
objectNeXuS data writer
constructor
- Brief:
It initialize the data writer for the H5 output file
- Parameters:
server (
tango.LatestDeviceImpl) – Tango server
- property canfail¶
the global can fail flag
- closeEntry()[source]¶
closes the data entry
- Brief:
It runs threads from the FINAL pool and removes the thread pools
- property currentfileid¶
the json data string
- property defaultCanFail¶
the global can fail flag
- property fileName¶
the parent nexus path
- getFile()[source]¶
the H5 file handle
- Returns:
the H5 file handle
- Return type:
nxswriter.FileWriter.FTFile
- property jsonrecord¶
the json data string
- openEntry()[source]¶
opens the data entry corresponding to a new XML settings
- Brief:
It parse the XML settings, creates thread pools and runs the INIT pool.
- record(jsonstring=None)[source]¶
runs threads form the STEP pool
- Brief:
It runs threads from the STEP pool
- Parameters:
jsonstring (
str) – local JSON string with data records
- property xmlsettings¶
the xmlsettings
nxswriter.TangoSource module¶
Definitions of TANGO datasource
- class nxswriter.TangoSource.ProxyTools[source]¶
Bases:
objecttools for proxy
- classmethod isProxyValid(proxy)[source]¶
checks if proxy is valid
- Parameters:
proxy (
tango.DeviceProxy) – tango proxy- Returns:
True if proxy is valid else false
- Return type:
- classmethod proxySetup(device, streams=None, maxcount=10)[source]¶
sets the Tango proxy up
- Parameters:
device (
str) – tango devicestreams (
StreamSetortango.LatestDeviceImpl) – tango-like steamset classmaxcount (
int) – a number of tries
- Returns:
proxy if proxy is set up
- Return type:
- class nxswriter.TangoSource.TangoSource(streams=None, name=None)[source]¶
Bases:
DataSourceTango data source
constructor
- Brief:
It cleans all member variables
- Parameters:
streams (
StreamSetortango.LatestDeviceImpl) – tango-like steamset classname (
str) – datasource name
- setDataSources(pool)[source]¶
sets the datasources
- Parameters:
pool (
nxswriter.DataSourcePool.DataSourcePool) – datasource pool
- setDecoders(decoders)[source]¶
sets the used decoders
- Parameters:
decoders (
nxswriter.DecoderPool.DecoderPool) – pool to be set
- class nxswriter.TangoSource.TgDevice(device, proxy=None, streams=None)[source]¶
Bases:
objecttango device
default constructor
- Parameters:
device (
str) – tango device nameproxy (
tango.DeviceProxy) – device proxystreams (
StreamSetortango.LatestDeviceImpl) – tango-like steamset class
- proxy¶
(
tango.DeviceProxy) device proxy
- class nxswriter.TangoSource.TgGroup(counter=0, streams=None)[source]¶
Bases:
objectGroup of tango devices
default constructor
- Parameters:
counter (
int) – counts of stepsstreams (
StreamSetortango.LatestDeviceImpl) – tango-like steamset class
- getData(counter, proxy=None, member=None)[source]¶
reads data from device proxy
- Parameters:
counter (
int) – counts of scan stepsproxy (
tango.DeviceProxy) – device proxymember (
TgMember) – required member
- lock¶
(
threading.Lock) threading lock
- class nxswriter.TangoSource.TgMember(name, memberType='attribute', encoding=None, streams=None)[source]¶
Bases:
objecttango device member
default constructor
- Parameters:
name (
str) – name of data recordmemberType (
str) – member type of the dataencoding (
str) – encoding type of Tango DevEncoded variablesstreams (
StreamSetortango.LatestDeviceImpl) – tango-like steamset class
- getData(proxy)[source]¶
reads data from device proxy
- Parameters:
proxy (
tango.DeviceProxy) – device proxy
- getValue(decoders=None)[source]¶
provides value of tango member
- Parameters:
decoders (
nxswriter.DecoderPool.DecoderPool) – decoder pool- Returns:
dictionary with {“rank”:, “value”:, “tangoDType”:, “shape”:, “encoding”:, “decoders”:}
- Returns:
dictionary with collected data
- Return type:
{‘rank’:
str, ‘value’: any, ‘tangoDType’:str, : ‘shape’:list<int>, ‘encoding’:str, : ‘decoders’:str}
- setData(data, cmd=None)[source]¶
sets tango data
- Parameters:
data (
tango.DeviceAttribute) – output tango datacmd (
tango.CommandInfo) – input command data
nxswriter.ThreadPool module¶
Provides a pool with element threads
- class nxswriter.ThreadPool.ThreadPool(numberOfThreads=None, streams=None, maxruntime=0)[source]¶
Bases:
objectPool with threads
constructor
- Brief:
It cleans the member variables
- Parameters:
numberOfThreads (
int) – number of threadsstreams (
StreamSetortango.LatestDeviceImpl) – tango-like steamset classmaxruntime (
int) – maxruntime
- append(elem)[source]¶
appends the thread element
- Parameters:
elem (
nxswriter.Element.Element) – the thread element
nxswriter.Types module¶
Types converters
- class nxswriter.Types.NTP[source]¶
Bases:
objecttype converter
- aTn = {'axis': 'NX_INT', 'file_time': 'NX_DATE_TIME', 'file_update_time': 'NX_DATE_TIME', 'ignoreExtraAttributes': 'NX_BOOLEAN', 'ignoreExtraFields': 'NX_BOOLEAN', 'ignoreExtraGroups': 'NX_BOOLEAN', 'maxOccus': 'NX_INT', 'minOccus': 'NX_INT', 'offset': 'NX_INT', 'primary': 'NX_INT32', 'restricts': 'NX_INT', 'signal': 'NX_INT', 'stride': 'NX_INT'}¶
- arrayRank(array)[source]¶
array rank
- Brief:
It calculates the rank of the array
- Parameters:
array (any) – given array
- Returns:
rank
- Return type:
- convert = {'bool': <bound method Converters.toBool of <class 'nxswriter.Types.Converters'>>, 'float': <class 'float'>, 'float16': <class 'float'>, 'float32': <class 'float'>, 'float64': <class 'float'>, 'int': <class 'int'>, 'int16': <class 'int'>, 'int32': <class 'int'>, 'int64': <class 'int'>, 'int8': <class 'int'>, 'str': <class 'str'>, 'string': <class 'str'>, 'uint': <class 'int'>, 'uint16': <class 'int'>, 'uint32': <class 'int'>, 'uint64': <class 'int'>, 'uint8': <class 'int'>}¶
(
dict<str,typeortypes.MethodType>) map of type : converting function
- createArray(value, fun=None)[source]¶
- creates python array from the given array with applied
the given function to it elements
- Parameters:
value – given array
fun (
typeortypes.MethodType) – applied function
- Returns:
created array
- Return type:
list<any>
- nTnp = {'ISO8601': 'string', 'NX_BOOLEAN': 'bool', 'NX_CHAR': 'string', 'NX_DATE_TIME': 'string', 'NX_FLOAT': 'float64', 'NX_FLOAT32': 'float32', 'NX_FLOAT64': 'float64', 'NX_INT': 'int64', 'NX_INT16': 'int16', 'NX_INT32': 'int32', 'NX_INT64': 'int64', 'NX_INT8': 'int8', 'NX_NUMBER': 'float64', 'NX_POSINT': 'uint64', 'NX_UINT': 'uint64', 'NX_UINT16': 'uint16', 'NX_UINT32': 'uint32', 'NX_UINT64': 'uint64', 'NX_UINT8': 'uint8'}¶
- pTt = {'bool': 'DevBoolean', 'float': 'DevDouble', 'float16': 'DevFloat', 'float32': 'DevFloat', 'float64': 'DevDouble', 'int': 'DevLong64', 'int16': 'DevShort', 'int32': 'DevLong', 'int64': 'DevLong64', 'int8': 'DevUChar', 'long': 'DevLong64', 'str': 'DevString', 'string': 'DevString', 'uint': 'DevULong64', 'uint16': 'DevUShort', 'uint32': 'DevULong', 'uint64': 'DevULong64', 'uint8': 'DevUChar', 'unicode': 'DevString'}¶
Module contents¶
Tango Data Writer
- nxswriter.globallock = <unlocked _thread.lock object>¶
(
threading.Lock) global lock