.

Average: 0
Rating Count: 0

Development status: Released, Release: v2.11.1
Information status: Updated
Repository: https://github.com/nexdatas/writer
Contact:



Class Description


NXSDataWriter is a Tango server which allows to store NeXuS Data in H5 files.

The server provides storing data from other Tango devices, various databases as well as passed by a user client via JSON strings.

Source code: https://github.com/nexdatas/writer Project Web page: https://nexdatas.github.io/writer NexDaTaS Web page: https://nexdatas.github.io

Families: Acquisition

Key words:

Platform: All Platforms

Language: Python

License: GPL

Contact:

Hardware


Manufacturer: DESY

Bus: Not Applicable

Class interface


Attributes:

Name Description
XMLSettingsScalar: DevString An XML string with Nexus configuration.
JSONRecordScalar: DevString A JSON string with global client data.
FileNameScalar: DevString A name of H5 output file with its full path
CurrentFileIdScalar: DevLong Current file id
StepsPerFileScalar: DevLong Steps per file
ErrorsSpectrum: DevString list of errors

Commands:

Name Description
StateInput: DevVoid
Output: State
Device state
This command gets the device state (stored in its device_state data member) and returns it to the caller.
StatusInput: DevVoid
Output: ConstDevString
Device status
This command gets the device status (stored in its device_status data member) and returns it to the caller.
OpenFileInput: DevVoid
Output: DevVoid
Opens the H5 file
OpenEntryInput: DevVoid
Output: DevVoid
Creates the new entry
RecordInput: DevString
JSON string with data
Output: DevVoid
Records data for one scan step
CloseEntryInput: DevVoid
Output: DevVoid
Closes the entry
OpenEntryAsynchInput: DevVoid
Output: DevVoid
Creates the new entry in asynchronous mode
RecordAsynchInput: DevString
JSON string with data
Output: DevVoid
Records data for one scan step in asynchronous mode
CloseEntryAsynchInput: DevVoid
Output: DevVoid
Closes the entry is asynchronous mode
CloseFileInput: DevVoid
Output: DevVoid
Closes the H5 file

Pipes:

Properties:

Name Description
NumberOfThreadsDevLong maximal number of threads
WriterDevString writer module: `pni` or `h5py`


Please log in to comment.

README

b'Welcome to NXSDataWriter\'s documentation!\n=========================================\n\nAuthors: Jan Kotanski, Eugen Wintersberger, Halil Pasic\n\n------------\nIntroduction\n------------\n\nNXSDataWriter is a Tango server which allows to store NeXuS Data in H5 files.\n\nThe server provides storing data from other Tango devices,\nvarious databases as well as passed by a user client via JSON strings.\n\nTango Server API: https://nexdatas.github.io/writer/doc_html\n\n| Source code: https://github.com/nexdatas/writer\n| Project Web page: https://nexdatas.github.io/writer\n| NexDaTaS Web page: https://nexdatas.github.io\n\n------------\nInstallation\n------------\n\nInstall the dependencies:\n\n| pni-libraries, PyTango, numpy\n\nFrom sources\n""""""""""""\n\nDownload the latest NexDaTaS version from\n\n| https://github.com/nexdatas/writer\n\nExtract sources and run\n\n.. code-block:: console\n\t \n\t $ python setup.py install\n\nDebian packages\n"""""""""""""""\n\nDebian Jessie (and Wheezy) packages can be found in the HDRI repository.\n\nTo install the debian packages, add the PGP repository key\n\n.. code-block:: console\n\n\t $ sudo su\n\t $ wget -q -O - http://repos.pni-hdri.de/debian_repo.pub.gpg | apt-key add -\n\nand then download the corresponding source list\n\n.. code-block:: console\n\n\t $ cd /etc/apt/sources.list.d\n\t $ wget http://repos.pni-hdri.de/jessie-pni-hdri.list\n\nFinally,\n\n.. code-block:: console\n\n\t $ apt-get update\n\t $ apt-get install python-nxswriter\n\nTo instal other NexDaTaS packages\t \n\n.. code-block:: console\n\t \n\t $ apt-get install python-nxstools nxsconfigserver-db python-nxsconfigserver nxsconfigtool\n\nand \n\n.. code-block:: console\n\n\t $ apt-get install python-nxsrecselector nxselector python-sardana-nxsrecorder\n\nfor Component Selector and Sardana related packages.\n\nSetting NeXus Writer Server\n"""""""""""""""""""""""""""\n\nTo set up NeXus Writer Server run\n\n.. code-block:: console\n\n $ nxsetup -x NXSDataWriter\n\nThe nxsetup command comes from the python-nxstools package.\n\t \n-------------------------\nInstallation from sources\n-------------------------\n\n\nExtract sources and run\n\n.. code-block:: console\n\n $ python setup.py install\n\n-----------\nClient code\n-----------\n\nIn order to use Nexus Data Server one has to write a client code. Some simple client codes\nare in the nexdatas repository. In this section we add some\ncomments related to the client code.\n\n.. code-block:: python\n\n # To use the Tango Server we must import the PyTango module and\n # create DeviceProxy for the server.\n\n import PyTango\n\n device = "p09/tdw/r228"\n dpx = PyTango.DeviceProxy(device)\n dpx.set_timeout_millis(10000)\n\n dpx.Init()\n\n # Here device corresponds to a name of our Nexus Data Server.\n # The Init() method resets the state of the server.\n\n dpx.FileName = "test.h5"\n dpx.OpenFile()\n\n # We set the name of the output HDF5 file and open it.\n\n # Now we are ready to pass the XML settings describing a structure of \n # the output file as well as defining a way of data storing.\n # Examples of the XMLSettings can be found in the XMLExamples directory.\n\n xml = open("test.xml", \'r\').read()\n dpx.XMLSettings = xml\n\n dpx.JSONRecord = \'{"data": {"parameterA":0.2},\n\t\t\t "decoders":{"DESY2D":"desydecoders.desy2Ddec.desy2d"},\n\t\t\t "datasources":{\n\t\t "MCLIENT":"sources.DataSources.LocalClientSource"}\n }\'\n\n dpx.OpenEntry()\n\n # We read our XML settings settings from a file and pass them to the server via\n # the XMLSettings attribute. Then we open an entry group related to the XML\n # configuration. Optionally, we can also set JSONRecord, i.e. an attribute\n # which contains a global JSON string with data needed to store during opening\n # the entry and also other stages of recording. If external decoder for\n # DevEncoded data is need one can registred it passing its packages and\n # class names in JSONRecord,\n # e.g. "desy2d" class of "DESY2D" label in "desydecoders.desy2Ddec" package.\n # Similarly making use of "datasources" records of the JSON string one can\n # registred additional datasources. The OpenEntry method stores data defined\n # in the XML string with strategy=INIT.\n # The JSONRecord attribute can be changed during recording our data.\n\n # After finalization of the configuration process we can start recording\n # the main experiment data in a STEP mode.\n\n dpx.Record(\'{"data": {"p09/counter/exp.01":0.1, "p09/counter/exp.02":1.1}}\')\n\n # Every time we call the Record method all nexus fields defined with\n # strategy=STEP are extended by one record unit and the assigned to them data\n # is stored. As the method argument we pass a local JSON string with the client\n # data. To record the client data one can also use the global JSONRecord string.\n # Contrary to the global JSON string the local one is only\n # valid during one record step.\n\n dpx.Record(\'{"data": {"emittance_x": 0.1}, "triggers":["trigger1", "trigger2"] }\')\n\n # If you denote in your XML configuration string some fields by additional\n # trigger attributes you may ask the server to store your data only in specific\n # record steps. This can be helpful if you want to store your data in\n # asynchronous mode. To this end you define in the local JSON string a list of\n # triggers which are used in the current record step.\n\n dpx.JSONRecord = \'{"data": {"parameterB":0.3}}\'\n dpx.CloseEntry()\n\n # After scanning experiment data in \'STEP\' mode we close the entry.\n # To this end we call the CloseEntry method which also stores data defined\n # with strategy=FINAL. Since our HDF5 file can contain many entries we can again\n # open the entry and repeat our record procedure. If we define more than one entry\n # in one XML setting string the defined entries are recorded parallel\n # with the same steps.\n\n # Finally, we can close our output file by\n\n dpx.CloseFile()\n\nAdditionally, one can use asynchronous versions of OpenEntry, Record, CloseEntry, i.e.\nOpenEntryAsynch, RecordAsynch, CloseEntryAsynch. In this case data is stored\nin a background thread and during this writing Tango Data Server has a state RUNNING.\n\nIn order to build the XML configurations in the easy way the authors of the server provide\nfor this purpose a specialized GUI tool, Component Designer.\nThe attached to the server XML examples\nwas created by XMLFile class defined in XMLCreator/simpleXML.py.\n'

8 Jun 2017, Jan Kotanski
Updated:
The device class has been updated.
You can see previous version here .



8 Jun 2017, Jan Kotanski
Created:
The device class has been added to catalogue.
Added by:jkotanski on:8 Jun 2017, 9:36 a.m.