nxsblisswriter package

Submodules

nxsblisswriter.NXSFile module

Provides the access to a database with NDTS configuration files

class nxsblisswriter.NXSFile.NXSFile(scan, fpath, streams, default_nexus_path='/scan{serialno}:NXentry/instrument:NXinstrument/collection', max_write_interval=1)[source]

Bases: object

constructor

Parameters:
  • scan (blissdata.redis_engine.scan.Scan) – blissdata scan

  • fpath (pathlib.Path) – nexus file path

  • streams (StreamSet or tango.LatestDeviceImpl) – tango-like steamset class

  • default_nexus_path (str) – default nexus path

  • max_write_interval (int) – max write interval

add_attributes(dataset, item)[source]

add dataset attribute

Parameters:
  • dataset (pninexus.h5cpp.node.Dataset) – h5cpp dataset

  • item (dict <str, any>) – channel descrition

add_vmap(vfl, vmap)[source]

create field

Parameters:
  • n (str) – group name

  • type_code (str) – nexus field type

  • shape (list < int >) – shape

Returns:

file tree field

Return type:

pninexus.h5cpp.node.Dataset

property channels

returns a list of channels with description

Returns:

list of channels descriptions

Return type:

list <:obj: dict >

close()[source]

close file

create_field(grp, name, dtype, value=None, shape=None, chunk=None)[source]

create field

Parameters:
  • grp (pninexus.h5cpp.node.Group) – nexus group

  • name (str) – group name

  • dtype (str) – nexus field type

  • shape (list < int >) – shape

  • chunk (list < int >) – chunk

Returns:

file tree field

Return type:

pninexus.h5cpp.node.Dataset

create_file_structure()[source]

create nexus structure

create_groupfield(root, lnxpath, dtype, value=None, shape=None, chunk=None)[source]

create field

Parameters:
  • root (pninexus.h5cpp.node.Group) – root object

  • lnxpath (list <str>) – nexus path list

  • dtype (str) – nexus field type

  • value (any) – field value

  • shape (list < int >) – shape

  • chunk (list < int >) – chunk

Returns:

nexus field

Return type:

pninexus.h5cpp.node.Dataset

create_groupvds(root, lnxpath, dtype, shape, vmaps)[source]

create field

Parameters:
  • root (nxgroup) – root object

  • lnxpath (list <str>) – nexus path list

  • dtype (str) – nexus field type

  • shape (list < int >) – shape

Returns:

nexus field

Return type:

pninexus.h5cpp.node.Dataset

create_vds(grp, name, dtype, shape, vmaps, fillvalue=0)[source]

create field

Parameters:
  • n (str) – group name

  • type_code (str) – nexus field type

  • shape (list < int >) – shape

  • vmaps – virtual map list

  • fillvalue – vds file value

Type:

list <dict>

Returns:

file tree field

Return type:

pninexus.h5cpp.node.Dataset

generate_vmaps(shape, frame_per_acquisition, file_offset, file_format, file_pattern, data_path, frame_per_file)[source]

generate virtual map list

Parameters:
  • shape (list < int >) – shape

  • frame_per_acquisition (int) – frame per acquisition

  • file_offset (int) – file offset

  • file_format (str) – file format

  • file_pattern (str) – file pattern

  • data_path (str) – nexus data path

  • frame_per_file (int) – frame per file

Returns:

virtual map list

Return type:

list <dict>

property labels

returns a list of channels with description

Returns:

list of channel labels

Return type:

list <:obj: str >

prepareChannels()[source]

prepare cursors

write_attr(am, name, dtype, value, item=None)[source]

write attribute

Parameters:
  • am (pninexus.h5cpp.attribute.AttributeManager) – attribute manager

  • name (str) – attribute name

  • name – attribute type

  • name – attribute value

  • item (dict) – element description

write_final_snapshot()[source]

write final data

write_init_snapshot()[source]

write init data

write_scan_points()[source]

write step data

write_snapshot_item(root, item, default_nexus_path=None)[source]

write snapshot item

Parameters:
  • root (pninexus.h5cpp.node.Group) – nexus root group

  • item (dict) – element description

  • default_nexus_path (str) – default nexus path

nxsblisswriter.NXSFile.create_nexus_file(scan, streams, default_nexus_path='/scan{serialno}:NXentry/instrument:NXinstrument/collection')[source]

open nexus file

Parameters:
  • scan (blissdata.redis_engine.scan.Scan) – blissdata scan

  • streams (StreamSet or tango.LatestDeviceImpl) – tango-like steamset class

  • default_nexus_path (str) – default nexus path

Returns:

nexus file object

Return type:

NXSFile

nxsblisswriter.NXSFile.first(array)[source]

get first element if the only

Parameters:

array (any) – numpy array

Returns:

first element of the array

nxsblisswriter.Release module

release version module

nxsblisswriter.NXSBlissWriter module

NeXus Bliss Writer

NeXus Bliss Writer stores (meta)data from blissdata provided by NXSDataWriter

class nxsblisswriter.NXSBlissWriter.NXSBlissWriter(cl, name)[source]

Bases: Device

NeXus Bliss Writer stores (meta)data from blissdata provided by NXSDataWriter

Properties:

  • Device Property
    RedisUrl
    • Dlissdata redis url

    • Type:’str’

    Session
    • session to be recorder

    • Type:’str’

    NextScanTimeout
    • timeout for next scan writing

    • Type:’int’

    DefaultNeXusPath
    • default NeXus path

    • Type:’str’

    PointSleepTime
    • sleep time between write_point command calls

    • Type:’float’

DefaultNeXusPath

default NeXus path

Errors

list of errors

NextScanTimeout

timeout for next scan writing

PointSleepTime

sleep time between write_point command calls

RedisUrl

Blissdata redis url

Session

session to be recorder

Start()[source]

‘Start’ TANGO command

Parameters:

arg (DevVoid) – (not documented)

Returns:

(not documented)

Return type:

DevVoid

Stop()[source]

‘Stop’ TANGO command

Parameters:

arg (DevVoid) – (not documented)

Returns:

(not documented)

Return type:

DevVoid

TangoClassClass

alias of NXSBlissWriterClass

TangoClassName = 'NXSBlissWriter'
delete_device()[source]

Destructs the attributes and properties of the NXSBlissWriter.

dev_status(self) str[source]

Get device status.

Default method to get device status. It returns the contents of the device dev_status field. If the device state is ALARM, alarm messages are added to the device status. This method can be redefined in sub-classes in case of the default behaviour does not fullfill the needs.

Returns:

the device status

Return type:

str

Raises:

DevFailed – If it is necessary to read attribute(s) and a problem occurs during the reading

init_device()[source]

Initializes the attributes and properties of the NXSBlissWriter.

read_Errors()[source]

nxsblisswriter.NXSWriterService module

Provides the access to a database with NDTS configuration files

class nxsblisswriter.NXSWriterService.NXSWriterService(redis_url, session, next_scan_timeout, default_nexus_path='/scan{serialno}:NXentry/instrument:NXinstrument/collection', point_sleep_time=0.01, server=None)[source]

Bases: object

constructor

Parameters:
  • redis_url (str) – blissdata redis url

  • session (str) – blissdata session name

  • next_scan_timeout (int) – timeout between the scans in seconds

  • default_nexus_path (str) – default nexus path

  • point_sleep_time (float) – sleep time between write point calls

  • server (tango.LatestDeviceImpl) – NXSConfigServer instance

errors()[source]

list of errors

get_status()[source]

get writer service status

join_scans(stop=False)[source]

join scans which are stopped

Parameters:

stop (bool) – stop all scans flag

start()[source]

start writer service

stop()[source]

stop writer service

class nxsblisswriter.NXSWriterService.ScanWriter(scan, streams, next_scan_timeout, default_nexus_path='/scan{serialno}:NXentry/instrument:NXinstrument/collection', point_sleep_time=0.01)[source]

Bases: Thread

constructor

Parameters:
  • scan (Scan) – blissdata redis url

  • streams (StreamSet or tango.LatestDeviceImpl) – tango streams

  • next_scan_timeout (int) – timeout between the scans in seconds

  • default_nexus_path (str) – default nexus path

  • point_sleep_time (float) – sleep time between write point calls

error

(bool) service error flag

error_lock

(threading.Lock) threading lock

errors

(list`<:obj:`str>) error list

run()[source]

write scan data

running

(bool) service running flag

nxsblisswriter.NXSWriterService.main()[source]

main function

Module contents

Implementation of NexDaTaS Configuration Server