nxsrecconfig package

Submodules

nxsrecconfig.Backends module

scan backends: sardana, bliss and null

The sardana backend uses the Sardana MacroServer and its pools. The null backend runs without any scan control system, e.g. to select components for scans of other systems: it has no channels and no measurement groups, and keeps its scan environment in memory. The bliss backend uses BLISS sessions published in Redis, see nxsrecconfig.BlissBackend.

nxsrecconfig.Backends.BACKENDS = {'bliss': <class 'nxsrecconfig.BlissBackend.BlissBackend'>, 'null': <class 'nxsrecconfig.Backends.NullBackend'>, 'sardana': <class 'nxsrecconfig.Backends.SardanaBackend'>}

(dict <str, ScanBackend>) scan backends by name

nxsrecconfig.Backends.DEFAULTBACKEND = 'sardana'

(str) default scan backend

class nxsrecconfig.Backends.NullBackend(numberOfThreads=None)[source]

Bases: ScanBackend

scan backend without scan control system

constructor

Parameters:

numberOfThreads (str) – number of threads

channelSource(name)[source]

provides the tango source of a channel

Parameters:

name (str) – channel name

Returns:

None, sources are not known

Return type:

str

createMntGrp(*args, **kwargs)

measurement groups are not supported

Raises:

NotImplementedError

defaultDoor(db)[source]

provides the default target

Parameters:

db (tango.Database) – tango database

Returns:

empty string, there are no doors

Return type:

str

deleteMntGrp(*args, **kwargs)

measurement groups are not supported

Raises:

NotImplementedError

property environment

scan environment variables

Returns:

a copy of the scan environment variables

Return type:

dict <str, any>

getEnv(var, ms=None)[source]

provides a scan environment variable

Parameters:
  • var (str) – variable name

  • ms (str) – scan server name (not used)

Returns:

variable value or None

Return type:

any

getMacroServer(door)[source]

provides the scan server name

Parameters:

door (str) – target name

Returns:

empty string, there is no scan server

Return type:

str

getPools(door)[source]

provides channel sources

Parameters:

door (str) – target name

Returns:

an empty list, there are no pools

Return type:

list

getScanEnv(door)[source]

provides scan file variables of the scan environment

Parameters:

door (str) – target name (not used)

Returns:

JSON string with the variables

Return type:

str

getSelectorEnv(door, names, data)[source]

provides selector variables from the scan environment

Parameters:
  • door (str) – target name (not used)

  • names (list <str>) – names of variables

  • data (dict <str, any>) – dictionary to be filled with the variables

isDoorRunning(ms)[source]

checks if a scan is running

Parameters:

ms (str) – scan server name

Returns:

False, scans are not known

Return type:

bool

isDoorValid(door)[source]

checks if the target is valid

Parameters:

door (str) – target name

Returns:

True, any target is valid

Return type:

bool

mntGrpConfiguration(*args, **kwargs)

measurement groups are not supported

Raises:

NotImplementedError

name = 'null'

(str) backend name

nonExistingChannels(door, channels)[source]

provides the channels which are not known to the backend

Channels cannot be checked without a control system, so all of them are taken as existing.

Parameters:
  • door (str) – target name

  • channels (list <str>) – channel names

Returns:

an empty list

Return type:

list <str>

setEnv(var, value, ms=None)[source]

sets a scan environment variable

Parameters:
  • var (str) – variable name

  • value (any) – variable value

  • ms (str) – scan server name (not used)

setEnvs(varvalues, ms=None)[source]

sets scan environment variables

Parameters:
  • varvalues (dict <str, any>) – variable names and values

  • ms (str) – scan server name (not used)

setMntGrpConfiguration(*args, **kwargs)

measurement groups are not supported

Raises:

NotImplementedError

setScanEnv(door, jdata)[source]

sets scan file variables of the scan environment

Parameters:
  • door (str) – target name (not used)

  • jdata (str) – JSON string with the variables

Returns:

scan id or -1

Return type:

int

setSelectorEnv(door, data, cmddata=None)[source]

stores selector variables in the scan environment

Parameters:
  • door (str) – target name (not used)

  • data (dict <str, any>) – variables

  • cmddata (dict <str, any>) – command variables

supportsMntGrps = False

(bool) the backend provides measurement group devices

testMntGrpConfiguration(*args, **kwargs)

measurement groups are not supported

Raises:

NotImplementedError

updateMacroServer(door)[source]

updates the scan server for given target

Parameters:

door (str) – target name

Returns:

empty string, there is no scan server

Return type:

str

usetEnv(var, ms=None)[source]

unsets a scan environment variable

Parameters:
  • var (str) – variable name

  • ms (str) – scan server name (not used)

class nxsrecconfig.Backends.SardanaBackend(numberOfThreads)[source]

Bases: MacroServerPools

sardana scan backend, i.e. macroserver and pools

constructor

Parameters:

numberOfThreads (str) – number of threads

nxsrecconfig.Backends.createBackend(name=None, numberOfThreads=None)[source]

creates a scan backend

Parameters:
  • name (str) – backend name, the default backend if None or empty

  • numberOfThreads (str) – number of threads

Returns:

scan backend

Return type:

ScanBackend

nxsrecconfig.BlissBackend module

bliss scan backend

The selector exchanges data with BLISS sessions through Redis, so it does not need BLISS itself. A BLISS session publishes its channels, motors and measurement groups with nxsrecconfig.BlissSession.NXSBlissSession and applies the channels selected by the selector to its measurement groups.

The target (Door) of the selector is the BLISS session name. The Redis database is given by the NXSBLISS_REDIS_URL environment variable or provided by Beacon, i.e. by the BEACON_HOST variable.

Redis keys of a session:

  • nxsselector:<session>:elements: published elements, i.e. JSON lists of AcqChannelList, ExpChannelList, MotorList and MeasurementGroupList in the format of Sardana pools

  • nxsselector:<session>:env: scan environment variables in JSON

  • nxsselector:<session>:mntgrps: BLISS full names of channels selected for measurement groups, in JSON

  • nxsselector:<session>:changed: Redis channel notifying the session about changes of the selector, see nxsrecconfig.BlissSession.NXSBlissWatcher

  • nxsselector:<session>:datasources: descriptions of STEP datasources without BLISS counters selected for measurement groups, i.e. their XML definitions, NeXus types and ranks, in JSON, see nxsrecconfig.BlissDataSources

class nxsrecconfig.BlissBackend.BlissBackend(numberOfThreads=None, redis=None, notify=True, datastore=None)[source]

Bases: ScanBackend

scan backend of BLISS sessions

constructor

Parameters:
  • numberOfThreads (str) – number of threads

  • redis (redis.Redis) – Redis connection, see redisConnection()

  • notify (bool) – notify sessions about changes

  • datastore (blissdata.redis_engine.store.DataStore) – blissdata data store checking scan states, created from redisURL() if None

channelSource(name)[source]

provides the tango source of a channel

BLISS channels are written from scan data, i.e. by CLIENT datasources

Parameters:

name (str) – channel name

Returns:

None

Return type:

str

createMntGrp(*args, **kwargs)

measurement group devices are not supported

Raises:

NotImplementedError

dataSourceTypes = ['TANGO', 'DB', 'PYEVAL', 'CLIENT']

(list <str>) types of STEP datasources without BLISS counters which are read by BLISS sessions

defaultDoor(db)[source]

provides the default target, i.e. the first published session

Parameters:

db (tango.Database) – tango database

Returns:

session name

Return type:

str

deleteMntGrp(*args, **kwargs)

measurement group devices are not supported

Raises:

NotImplementedError

elements(session)[source]

provides the published elements of a session

Parameters:

session (str) – session name

Returns:

element lists

Return type:

dict <str, list <dict>>

getEnv(var, ms)[source]

provides a scan environment variable

Parameters:
  • var (str) – variable name

  • ms (str) – session name

Returns:

variable value or None

Return type:

any

getMacroServer(door)[source]

provides the scan server, i.e. the session

Parameters:

door (str) – session name

Returns:

session name

Return type:

str

getPools(door)[source]

provides the elements of the session as a pool

Parameters:

door (str) – session name

Returns:

list with the session pool

Return type:

list <BlissPool>

getScanEnv(door)[source]

provides scan file variables of the scan environment

Parameters:

door (str) – session name

Returns:

JSON string with the variables

Return type:

str

getSelectorEnv(door, names, data)[source]

provides selector variables from the scan environment

Parameters:
  • door (str) – session name

  • names (list <str>) – names of variables

  • data (dict <str, any>) – dictionary to be filled with the variables

isDoorRunning(ms)[source]

checks if a scan is running

The session publishes its running scan, i.e. ScanRunning with the session name and the scan number. Scans which are closed in blissdata are not running, e.g. after a session crash.

Parameters:

ms (str) – session name

Returns:

True if the session runs a scan

Return type:

bool

isDoorValid(door)[source]

checks if the session is published

Parameters:

door (str) – session name

Returns:

True if the session is published

Return type:

bool

mntGrpConfiguration(*args, **kwargs)

measurement group devices are not supported

Raises:

NotImplementedError

name = 'bliss'

(str) backend name

nonExistingChannels(door, channels)[source]

provides the channels which are not published by the session

Parameters:
  • door (str) – session name

  • channels (list <str>) – channel names

Returns:

channels which do not exist

Return type:

list <str>

notify

(bool) notify sessions about changes

notifySession(ms, kind)[source]

notifies a session about a change of the selector

Parameters:
  • ms (str) – session name

  • kind (str) – kind of the change, e.g. env or mntgrps

property redis

Redis connection

Returns:

Redis connection

Return type:

redis.Redis

scanStates(session, number)[source]

provides blissdata states of scans

Parameters:
  • session (str) – session name

  • number (int) – scan number

Returns:

states of the scans, i.e. CREATED: 0, PREPARED: 1, STARTED: 2, STOPPED: 3, CLOSED: 4, or None if blissdata is not available

Return type:

list <int>

selectChannels(ms, mntgrp, channels)[source]

requests channels of a measurement group of the session

Motors and unknown channels are skipped. The session applies the request, see nxsrecconfig.BlissSession.NXSBlissSession.apply()

Parameters:
  • ms (str) – session name

  • mntgrp (str) – measurement group name

  • channels (list <str>) – ordered channel names

selectDataSources(ms, mntgrp, datasources)[source]
requests STEP datasources without BLISS counters

to be read in scans of a measurement group of the session

The session creates BLISS counters of the datasources, see nxsrecconfig.BlissSession.NXSBlissSession.apply()

Parameters:
  • ms (str) – session name

  • mntgrp (str) – measurement group name

  • datasources (dict <str, dict>) – datasource descriptions by datasource names, i.e. dictionaries with xml definitions, nxtype NeXus types and rank

selectsChannels = True

(bool) the backend selects channels of its measurement groups

sessions()[source]

provides names of the published sessions

Returns:

session names

Return type:

list <str>

setEnv(var, value, ms)[source]

sets a scan environment variable

Parameters:
  • var (str) – variable name

  • value (any) – variable value

  • ms (str) – session name

setEnvs(varvalues, ms)[source]

sets scan environment variables

Parameters:
  • varvalues (dict <str, any>) – variable names and values

  • ms (str) – session name

setMntGrpConfiguration(*args, **kwargs)

measurement group devices are not supported

Raises:

NotImplementedError

setScanEnv(door, jdata)[source]

sets scan file variables of the scan environment

Parameters:
  • door (str) – session name

  • jdata (str) – JSON string with the variables

Returns:

scan id or -1

Return type:

int

setSelectorEnv(door, data, cmddata=None)[source]

stores selector variables in the scan environment

Parameters:
  • door (str) – session name

  • data (dict <str, any>) – variables

  • cmddata (dict <str, any>) – command variables

supportsMntGrps = False

(bool) the backend provides measurement group devices

testMntGrpConfiguration(*args, **kwargs)

measurement group devices are not supported

Raises:

NotImplementedError

updateMacroServer(door)[source]

updates the scan server, i.e. the session

Parameters:

door (str) – session name

Returns:

session name

Return type:

str

usetEnv(var, ms)[source]

unsets a scan environment variable

Parameters:
  • var (str) – variable name

  • ms (str) – session name

class nxsrecconfig.BlissBackend.BlissPool(session, elements)[source]

Bases: object

elements of a BLISS session in the format of Sardana pools, used by nxsrecconfig.Utils.PoolUtils

constructor

Parameters:
  • session (str) – session name

  • elements (dict <str, list>) – element lists, i.e. lists of dictionaries

name()[source]

provides the pool name

Returns:

session name

Return type:

str

session

(str) session name

nxsrecconfig.BlissBackend.ELEMENTLISTS = ['AcqChannelList', 'ExpChannelList', 'MotorList', 'MeasurementGroupList']

(list <str>) element lists of the sessions

nxsrecconfig.BlissBackend.PREFIX = 'nxsselector'

(str) Redis key prefix

nxsrecconfig.BlissBackend.channelName(fullname)[source]

provides a selector channel name of a BLISS channel

NeXus names and datasource names cannot contain : or .

Parameters:

fullname (str) – BLISS full name, e.g. diode:diode

Returns:

channel name, e.g. diode_diode

Return type:

str

nxsrecconfig.BlissBackend.redisConnection(url=None)[source]

opens the Redis connection of BLISS

Parameters:

url (str) – Redis URL, from NXSBLISS_REDIS_URL or Beacon if None

Returns:

Redis connection

Return type:

redis.Redis

nxsrecconfig.BlissBackend.redisURL(url=None)[source]

provides the URL of the BLISS Redis database

Parameters:

url (str) – Redis URL, from NXSBLISS_REDIS_URL or Beacon if None

Returns:

Redis URL

Return type:

str

nxsrecconfig.BlissBackend.sessionKey(session, kind)[source]

provides a Redis key of a session

Parameters:
  • session (str) – session name

  • kind (str) – key kind, i.e. elements, env or mntgrps

Returns:

Redis key

Return type:

str

nxsrecconfig.BlissDataSources module

BLISS counters of NeXus configuration datasources

STEP datasources selected in NXSRecSelector which are not BLISS counters, i.e. TANGO, DB, PYEVAL or CLIENT datasources of the configuration server, are read in BLISS scans by counters of NXSDataSourceController. The datasources are evaluated by nxswriter datasources, i.e. in the same way as by NXSDataWriter.

  • numeric and boolean datasources of any rank are BLISS channels with the type of their NeXus fields and free dimensions,

  • string datasources are collected at each scan point and stored as scan metadata of the controller at the end of the scan,

  • CLIENT datasources are read from user data, they are skipped if their records are not in the user data,

  • datasources which cannot be read are filled with NaN for floats, the maximal value for integers, False for booleans or an empty string, or the scan is stopped if canfail is False.

The controller is created and updated by nxsrecconfig.BlissSession.NXSBlissSession.

nxsrecconfig.BlissDataSources.BLISS_AVAILABLE = False

(bool) BLISS is available

nxsrecconfig.BlissDataSources.CONTROLLER = 'nxsds'

(str) default name of the datasource counter controller

class nxsrecconfig.BlissDataSources.DataSourceReader(userdata=None, log=None)[source]

Bases: object

reads NeXus configuration datasources by nxswriter datasources

constructor

Parameters:
  • userdata (dict <str, any> or callable) – user data of CLIENT datasources or a function returning them

  • log (logging.Logger or any) – logger with debug, info and warning methods

description(name)[source]

provides a datasource description

Parameters:

name (str) – datasource name

Returns:

datasource description with xml, nxtype and rank

Return type:

dict <str, any>

errors

(dict <str, str>) errors of the last reading

log

(logging.Logger or any) logger

names()[source]

provides names of the datasources

Returns:

datasource names

Return type:

list <str>

read(names)[source]

reads datasource values

Parameters:

names (list <str>) – datasource names

Returns:

values, None for datasources which cannot be read, their errors are in errors

Return type:

list any

setDataSources(datasources)[source]

sets the datasources

Datasources which cannot be set up and CLIENT datasources without user data are skipped.

Parameters:

datasources (dict <str, dict>) – datasource descriptions or XML definitions by datasource names

userdata

(dict or callable) user data

class nxsrecconfig.BlissDataSources.NXSDataSourceAcquisitionSlave(*counters, ctrl_params=None, count_time=None, npoints=1)[source]

Bases: object

BLISS acquisition object of datasource counters, it reads all datasources once per scan point

constructor

Parameters:
  • counters (list) – counter controller and counters

  • ctrl_params (dict) – controller parameters

  • count_time (float) – count time

  • npoints (int) – number of points, 0 for endless acquisition

get_acquisition_metadata(timing=None)[source]

provides string datasource values at the end of the scan

Parameters:

timing (bliss.scanning.scan_meta.META_TIMING) – metadata timing

Returns:

metadata

Return type:

dict

prepare()[source]

prepares the acquisition

reading()[source]

the datasources are read by trigger()

start()[source]

starts the acquisition

stop()[source]

stops the acquisition

strings

(dict <str, list>) string values

trigger()[source]

reads the datasources of one scan point

class nxsrecconfig.BlissDataSources.NXSDataSourceController(name='nxsds', reader=None, canfail=True)[source]

Bases: object

BLISS counter controller of NeXus configuration datasources

constructor

Parameters:
  • name (str) – controller name

  • reader (DataSourceReader) – datasource reader

  • canfail (bool) – fill values of datasources which cannot be read, stop the scan otherwise

canfail

(bool) fill values of datasources which cannot be read

get_acquisition_object(acq_params, ctrl_params, parent_acq_params)[source]

provides the acquisition object

Parameters:
  • acq_params (dict) – acquisition parameters

  • ctrl_params (dict) – controller parameters

  • parent_acq_params (dict) – parent acquisition parameters

Returns:

acquisition object

Return type:

NXSDataSourceAcquisitionSlave

get_default_chain_parameters(scan_params, acq_params)[source]

provides default acquisition parameters

Parameters:
  • scan_params (dict) – scan parameters

  • acq_params (dict) – acquisition parameters

Returns:

acquisition parameters

Return type:

dict

read_all(*counters)[source]

reads the datasources of the counters

Parameters:

counters (list <NXSDataSourceCounter>) – counters

Returns:

values converted to the counter types and ranks

Return type:

list any

Raises:

RuntimeError if a datasource cannot be read and canfail is False

reader

(DataSourceReader) datasource reader

setDataSources(datasources)[source]

sets the datasources and creates their counters

Parameters:

datasources (dict <str, dict>) – datasource descriptions or XML definitions by datasource names

Returns:

full names of the counters

Return type:

list <str>

startScan()[source]

resets error reports at the scan start

class nxsrecconfig.BlissDataSources.NXSDataSourceCounter(name, controller, dtype='float64', rank=0)[source]

Bases: object

BLISS counter of a NeXus configuration datasource

constructor

Parameters:
  • name (str) – datasource name

  • controller (NXSDataSourceController) – counter controller

  • dtype (str) – numpy type name, str for strings

  • rank (int) – field rank

property isstring

string datasource flag

Returns:

True for string datasources stored as scan metadata

Return type:

bool

rank

(int) field rank

property shape

data shape with free dimensions

Returns:

shape

Return type:

tuple <int>

typename

(str) numpy type name

nxsrecconfig.BlissDataSources.NXTYPES = {'ISO8601': 'str', 'NX_BOOLEAN': 'bool', 'NX_CHAR': 'str', 'NX_DATE_TIME': 'str', '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'}

(dict <str, str>) numpy types of NeXus types

nxsrecconfig.BlissDataSources.convert(value, dtype, rank)[source]

converts a datasource value to the type and rank of its field

Parameters:
  • value (any) – datasource value

  • dtype (str) – numpy type name

  • rank (int) – field rank

Returns:

converted value

Return type:

numpy.ndarray or str

Raises:

ValueError if the value cannot be converted

nxsrecconfig.BlissDataSources.description(value)[source]

provides a datasource description

Parameters:

value (dict <str, any> or str) – datasource description or its XML definition

Returns:

datasource description with xml, nxtype and rank

Return type:

dict <str, any>

nxsrecconfig.BlissDataSources.fillValue(dtype)[source]

provides the fill value of data which cannot be read

Parameters:

dtype (str) – numpy type name

Returns:

NaN for floats, the maximal value for integers, False for booleans and an empty string for strings

Return type:

any

nxsrecconfig.BlissDataSources.numpyType(nxtype)[source]

provides the numpy type of a NeXus type

Parameters:

nxtype (str) – NeXus type, e.g. NX_INT32

Returns:

numpy type name, float64 for unknown types

Return type:

str

nxsrecconfig.BlissH5Map module

NeXus structure of selector profiles in BLISS HDF5 mappings

BLISS describes its scan files by h5maps of blissdata, generated by scan_info_to_h5map of blisswriter at the start and at the end of each scan. The hook of this module adds the STEP fields of the NeXus configuration, at their NeXus paths, to the scan entry as soft links to the datasets written by BLISS, i.e. the scan file has the NeXus structure of the profile as with NXSDataWriter, and the BLISS one.

The hook is added by add_h5map_hook of bliss.scanning.h5map_hooks if BLISS provides it. Otherwise scan_info_to_h5map of bliss.scanning.scan is wrapped by the hook.

The STEP fields are provided by nxsrecconfig.BlissScanMeta.NXSScanMeta registered with links=True, which also provides INIT and FINAL fields:

from nxsrecconfig.BlissScanMeta import NXSScanMeta
nxsmeta = NXSScanMeta("p09/nxsrecselector/1")
nxsmeta.register(links=True)

Overlays are trees of h5map-like dictionaries with groups and {"type": "step", "stream": <stream name>} items.

class nxsrecconfig.BlissH5Map.DictItems[source]

Bases: object

creates h5map items as dictionaries

group(attributes)[source]

creates a group

Parameters:

attributes (dict <str, any>) – group attributes

Returns:

h5map group

Return type:

dict <str, any>

creates a soft link

Parameters:

target (str) – target path

Returns:

h5map soft link

Return type:

dict <str, any>

nxsrecconfig.BlissH5Map.H5TYPES = {'dataset', 'external_binary_dataset', 'external_link', 'group', 'soft_link', 'virtual_dataset'}

(set <str>) types of h5map items which are not datasets given by their values

class nxsrecconfig.BlissH5Map.ModelItems(module=None)[source]

Bases: object

creates h5map items as blissdata.h5map models

constructor

Parameters:

module (module) – h5map model module, blissdata.h5map if None

group(attributes)[source]

creates a group

Parameters:

attributes (dict <str, any>) – group attributes

Returns:

h5map group

Return type:

blissdata.h5map.Group

creates a soft link

Parameters:

target (str) – target path

Returns:

h5map soft link

Return type:

blissdata.h5map.SoftLink

module

(module) h5map model module

class nxsrecconfig.BlissH5Map.NXSH5MapHook(log=None)[source]

Bases: object

hook of the BLISS h5map generation

constructor

Parameters:

log (logging.Logger) – logger

apply(scan_info, mappings, end=None)[source]

adds profile links to the h5maps of a scan

Parameters:
  • scan_info (dict <str, any>) – scan info

  • mappings (dict <str, any>) – h5map models or dictionaries by file names, updated in place

  • end (bool) – the last h5maps of the scan, the scan info with end_reason if None

Returns:

updated mappings

Return type:

dict <str, any>

blissHook(scan, mappings, timing)[source]
adds profile links to the h5maps of a scan,

called by bliss.scanning.h5map_hooks

Parameters:
  • scan (bliss.scanning.scan.Scan) – BLISS scan

  • mappings (dict <str, blissdata.h5map.Group>) – h5maps by file names, updated in place

  • timing (bliss.scanning.scan_meta.META_TIMING) – META_TIMING.START or META_TIMING.END

Returns:

updated mappings

Return type:

dict <str, blissdata.h5map.Group>

log

(logging.Logger) logger

module

(module) module of the h5map generator

original

(callable) the original h5map generator

overlays

(dict <tuple, dict>) overlays by scans

registry

(module) module of the BLISS h5map hooks, i.e. bliss.scanning.h5map_hooks

setOverlay(scan_info, overlay)[source]

sets the overlay of a scan

Parameters:
  • scan_info (dict <str, any>) – scan info

  • overlay (dict <str, any>) – overlay of the entry content or None

adds STEP fields of a profile to NXentry groups of an h5map

Parameters:
Returns:

number of added links

Return type:

int

nxsrecconfig.BlissH5Map.applyOverlay(group, overlay, streams, datasets, path='', log=None, items=None)[source]

adds overlay fields as soft links to an h5map group

Existing items of the group are kept.

Parameters:
Returns:

number of added links

Return type:

int

nxsrecconfig.BlissH5Map.attributeValue(value)[source]

provides a plain value of an h5map attribute

Parameters:

value (any) – h5map attribute value

Returns:

plain value

Return type:

any

nxsrecconfig.BlissH5Map.installHook(module=None, log=None, registry=None)[source]

installs the h5map hook in BLISS

The hook is added to the BLISS h5map hooks if BLISS provides them, otherwise scan_info_to_h5map of the BLISS scan module is wrapped.

Parameters:
  • module (module) – module with scan_info_to_h5map to be wrapped, bliss.scanning.scan if None

  • log (logging.Logger) – logger

  • registry (module) – module with add_h5map_hook and remove_h5map_hook, bliss.scanning.h5map_hooks if available and module is None

Returns:

the installed hook

Return type:

NXSH5MapHook

nxsrecconfig.BlissH5Map.itemPaths(group, path='')[source]

provides paths of streams and of other datasets of an h5map group

Parameters:
  • group (dict or pydantic.BaseModel) – h5map group

  • path (str) – group path

Returns:

dataset paths by stream names, paths of other datasets

Return type:

(dict <str, str>, list <str>)

nxsrecconfig.BlissH5Map.itemType(item)[source]

provides the type of an h5map item

Datasets without attributes can be given by their values.

Parameters:

item (dict or pydantic.BaseModel or any) – h5map item

Returns:

item type, e.g. group, dataset or soft_link

Return type:

str

nxsrecconfig.BlissH5Map.scanKey(scan_info)[source]

provides the key of a scan

Parameters:

scan_info (dict <str, any>) – scan info

Returns:

file name and scan number

Return type:

(str, int)

nxsrecconfig.BlissH5Map.stepOverlay(h5map)[source]

provides the overlay of STEP stream fields of NXentry groups

Links to STEP fields are STEP fields of the same streams.

Parameters:

h5map (dict <str, any>) – h5map of a file root exported by the nxstools h5map writer with stream names of STEP fields

Returns:

overlay of the entry content, None without STEP fields

Return type:

dict <str, any>

nxsrecconfig.BlissH5Map.streamNames(channels, controller='nxsds')[source]

provides stream names of selector channels and datasources

Parameters:
  • channels (list <str>) – full names of BLISS scan channels

  • controller (str) – name of the datasource counter controller

Returns:

stream names by selector names

Return type:

dict <str, str>

nxsrecconfig.BlissH5Map.targetPath(stream, streams, datasets)[source]

provides the path of a BLISS dataset of a stream

Datasets of streams are looked for first, then datasets of the stream controller with the stream short name, e.g. string datasource values stored as scan metadata of the datasource counter controller.

Parameters:
  • stream (str) – stream name

  • streams (dict <str, str>) – dataset paths by stream names

  • datasets (list <str>) – paths of other datasets

Returns:

dataset path or None

Return type:

str

nxsrecconfig.BlissH5Map.uninstallHook()[source]

removes the h5map hook from BLISS

nxsrecconfig.BlissScanMeta module

NeXus metadata of selector profiles for BLISS scans

The descriptive part of the NeXus configuration selected by NXSRecSelector, i.e. its INIT and FINAL fields, is added to BLISS scans as user scan metadata, so the BLISS writer stores it in the scan entry. STEP fields are not written, the scan data are stored by BLISS itself.

In a BLISS session:

from nxsrecconfig.BlissScanMeta import NXSScanMeta
nxsmeta = NXSScanMeta()     # the selector module with the null backend
nxsmeta.register()

The profile of the active BLISS measurement group is used by default.

The INIT fields are evaluated when the scan starts and the FINAL fields when the scan ends, by NXSDataWriter (nxswriter) with the h5map writer of nxstools, which builds the NeXus tree in memory. Links to the written fields are kept, links to STEP fields are dropped.

With nxsmeta.register(links=True) the STEP fields are added at their NeXus paths as links to the datasets of the BLISS channels, see nxsrecconfig.BlissH5Map.

nxsrecconfig.BlissScanMeta.END_SKIP = ['STEP', 'INIT']

(list <str>) fields exported at the end of the scan

class nxsrecconfig.BlissScanMeta.NXSScanMeta(selector=None, profile=None, userdata=None, writerproperties=None, log=None, session=None)[source]

Bases: object

BLISS user scan metadata of NXSRecSelector profiles

constructor

Parameters:
  • selector (str or any) – NXSRecSelector device name or proxy, or nxsrecconfig.Settings.Settings, the selector module with the null backend if None

  • profile (str or callable) – profile name or a function of a scan returning it, the active BLISS measurement group if None

  • userdata (dict <str, any> or callable) – user data or a function of a scan returning them, added to the UserData of the profile

  • writerproperties (dict <str, any>) – properties of NXSDataWriter, e.g. {"addingLogs": False}

  • log (logging.Logger or any) – logger with debug, info and warning methods

  • session (nxsrecconfig.BlissSession.NXSBlissSession) – BLISS session of the selector publishing running scans

configuration(scan_info, profile=None, userdata=None)[source]

creates the NXSDataWriter configuration and its INIT record

Parameters:
  • scan_info (dict <str, any>) – scan info

  • profile (str) – profile name, the current profile if None

  • userdata (dict <str, any>) – user data

Returns:

XML configuration and the INIT record

Return type:

(str, dict <str, any>)

end(scan)[source]

closes the entry and provides its FINAL fields

Parameters:

scan (bliss.scanning.scan.Scan) – BLISS scan

Returns:

NeXus dictionary

Return type:

dict <str, any>

log

(logging.Logger or any) logger

profile

(str or callable) profile name

register(scanmeta=None, category='', name='nexdatas', links=False)[source]

registers the metadata in the BLISS user scan metadata

The empty category merges the metadata into the scan entry.

Parameters:
  • scanmeta (bliss.scanning.scan_meta.ScanMeta) – scan metadata, the user scan metadata if None

  • category (str) – metadata category

  • name (str) – metadata name in the category

  • links (bool) – add STEP fields of the profile as links to the scan data, see nxsrecconfig.BlissH5Map

property selector

NXSRecSelector device or module

Returns:

selector

Return type:

tango.DeviceProxy or nxsrecconfig.Settings.Settings

session

(nxsrecconfig.BlissSession.NXSBlissSession) session

start(scan)[source]

opens the entry and provides its INIT fields

Parameters:

scan (bliss.scanning.scan.Scan) – BLISS scan

Returns:

NeXus dictionary

Return type:

dict <str, any>

unregister()[source]

removes the metadata from the BLISS user scan metadata

userdata

(dict or callable) user data

writerproperties

(dict <str, any>) NXSDataWriter properties

nxsrecconfig.BlissScanMeta.START_SKIP = ['STEP', 'FINAL']

(list <str>) fields exported at the start of the scan

nxsrecconfig.BlissScanMeta.STEP_SKIP = ['INIT', 'FINAL']

(list <str>) fields exported as links to scan data

nxsrecconfig.BlissScanMeta.entry_metadata(h5map)[source]

provides the content of the NXentry groups of an h5map

Parameters:

h5map (dict <str, any>) – h5map of the file root

Returns:

NeXus dictionary with the content of the entries

Return type:

dict <str, any>

nxsrecconfig.BlissScanMeta.h5map_to_nxdict(group)[source]

converts an h5map group to a silx-like NeXus dictionary

Group attributes are stored as @name keys, dataset attributes as dataset@name keys and links as >name keys.

Parameters:

group (dict <str, any>) – h5map group

Returns:

NeXus dictionary

Return type:

dict <str, any>

nxsrecconfig.BlissScanMeta.h5map_value(value)[source]

converts an h5map data item to a value of the BLISS metadata

Parameters:

value (any) – h5map data item

Returns:

value or None for streams and virtual datasets

Return type:

any

nxsrecconfig.BlissSession module

BLISS session side of the bliss scan backend

It publishes channels, motors and measurement groups of a BLISS session for the selector and applies the channels selected by the selector to the BLISS measurement groups. In a BLISS session:

from nxsrecconfig.BlissSession import NXSBlissSession
nxsbliss = NXSBlissSession()
nxsbliss.sync()      # after changes in the selector or the session

The selector has to use the bliss backend with the session name as its Door.

Selected STEP datasources which are not BLISS counters, i.e. TANGO, DB, PYEVAL or CLIENT datasources, are read by counters of nxsrecconfig.BlissDataSources.NXSDataSourceController which are added to the measurement groups. CLIENT datasources are read from userdata, e.g.:

nxsbliss = NXSBlissSession(userdata=lambda: {"energy": mono.energy})

setup_nexdatas() sets up everything in the session setup, i.e. the session, the BLISS scan metadata of the selector profiles and a watcher which applies changes of the selector automatically:

from nxsrecconfig.BlissSession import setup_nexdatas
nexdatas = setup_nexdatas("p09/nxsrecselector/1", links=True)

The scan directory and file of the selector, i.e. ScanDir and ScanFile, follow SCAN_SAVING of BLISS. They can be changed by the selector unless the session uses the ESRF data policy.

class nxsrecconfig.BlissSession.BlissAPI(controller='nxsds', userdata=None, canfail=True)[source]

Bases: object

access to the current BLISS session

constructor

Parameters:
  • controller (str) – name of the datasource counter controller

  • userdata (dict <str, any> or callable) – user data of CLIENT datasources or a function returning them

  • canfail (bool) – fill values of datasources which cannot be read, stop the scan otherwise

activeMntGrp()[source]

provides the active measurement group name

Returns:

measurement group name

Return type:

str

axes()[source]

provides the axis names of the session

Returns:

axis names

Return type:

list <str>

canfail

(bool) fill values of datasources which cannot be read

controller

(str) name of the datasource counter controller

counters()[source]

provides the counters of the session

Returns:

counters, i.e. dictionaries with fullname, controller, shape and dtype

Return type:

list <dict <str, any>>

mntgrps()[source]

provides the measurement groups of the session

Returns:

{name: {"available": [...], "enabled": [...]}}

Return type:

dict <str, dict>

scanSaving()[source]

provides the scan directory and file of SCAN_SAVING

Returns:

dictionary with ScanDir, ScanFile and data_policy

Return type:

dict <str, any>

selectChannels(name, fullnames)[source]
enables only the given counters of a measurement group,

the group is created if it does not exist

Parameters:
  • name (str) – measurement group name

  • fullnames (list <str>) – counter full names

session()[source]

provides the session name

Returns:

session name

Return type:

str

setActiveMntGrp(name)[source]

activates a measurement group

Parameters:

name (str) – measurement group name

setDataSources(datasources)[source]

sets the datasources read by the datasource counters

Parameters:

datasources (dict <str, dict>) – datasource descriptions by datasource names

Returns:

full names of the datasource counters by datasource names

Return type:

dict <str, str>

setScanSaving(scandir=None, scanfile=None)[source]

sets the scan directory and file of SCAN_SAVING

Parameters:
  • scandir (str) – scan directory

  • scanfile (str) – scan file name, its extension is skipped

Raises:

PermissionError for the ESRF data policy

userdata

(dict or callable) user data

class nxsrecconfig.BlissSession.NXSBlissSession(session=None, redis=None, api=None, userdata=None, canfail=True, log=None)[source]

Bases: object

publishes a BLISS session for the selector and applies the selected channels

constructor

Parameters:
  • session (str) – session name, the current session if None

  • redis (redis.Redis) – Redis connection, see nxsrecconfig.BlissBackend.redisConnection()

  • api (BlissAPI) – BLISS session access

  • userdata (dict <str, any> or callable) – user data of CLIENT datasources read by datasource counters or a function returning them

  • canfail (bool) – fill values of datasources which cannot be read, stop the scan otherwise

  • log (logging.Logger) – logger

api

(BlissAPI) BLISS session access

apply()[source]
applies the selected channels and datasources to

the measurement groups and activates the measurement group of the selector

Returns:

names of updated measurement groups

Return type:

list <str>

applyPaths()[source]
applies the scan directory and file changed by the selector

to SCAN_SAVING

Returns:

True if SCAN_SAVING was changed

Return type:

bool

backend

(nxsrecconfig.BlissBackend.BlissBackend) environment of the session, without notifications of the session

elements()[source]

provides the session elements in the format of Sardana pools

Returns:

element lists

Return type:

dict <str, list <dict>>

log

(logging.Logger) logger

pending()[source]

provides measurement groups with selections not applied

Returns:

measurement group names

Return type:

list <str>

publish()[source]

publishes the session elements and its active measurement group

publishPaths()[source]

publishes the scan directory and file of SCAN_SAVING

redis

(redis.Redis) Redis connection

scanEnded(scan_info=None)[source]

publishes the end of a scan

Parameters:

scan_info (dict <str, any>) – scan info

property scanRunning

the session runs a scan

Returns:

True if a scan is running

Return type:

bool

scanStarted(scan_info)[source]

publishes a started scan

Parameters:

scan_info (dict <str, any>) – scan info

session

(str) session name

signature()[source]

provides a signature of the session elements

Returns:

signature changed by changes of counters, axes and measurement groups

Return type:

str

sync()[source]

applies the selection and publishes the session

Returns:

names of updated measurement groups

Return type:

list <str>

class nxsrecconfig.BlissSession.NXSBlissWatcher(session, interval=2.0, log=None)[source]

Bases: object

applies changes of the selector to a BLISS session

The selector notifies the session by the Redis channel nxsselector:<session>:changed. Changes are applied when no scan is running. Changes of the session elements, i.e. counters, axes and measurement groups, are published.

constructor

Parameters:
changed

(bool) changes of the selector to be applied

interval

(float) interval of checks in seconds

log

(logging.Logger) logger

poll(timeout=0.0)[source]

checks notifications and session changes once

Parameters:

timeout (float) – time to wait for notifications in seconds

Returns:

True if the session was synchronized

Return type:

bool

run()[source]

checks notifications and session changes until stopped

session

(NXSBlissSession) session

signature

(str) signature of the published elements

start()[source]

starts the watcher in a greenlet, or a thread without gevent

stop()[source]

stops the watcher

subscribe()[source]

subscribes the notifications of the selector

unsubscribe()[source]

unsubscribes the notifications of the selector

class nxsrecconfig.BlissSession.NXSNexDatas(session, meta=None, watcher=None)[source]

Bases: object

NeXus profiles of the selector in a BLISS session, see setup_nexdatas()

constructor

Parameters:
meta

(nxsrecconfig.BlissScanMeta.NXSScanMeta) scan metadata

session

(NXSBlissSession) session

stop()[source]

stops the watcher and unregisters the scan metadata

sync()[source]

applies the selection and publishes the session

Returns:

names of updated measurement groups

Return type:

list <str>

watcher

(NXSBlissWatcher) watcher

nxsrecconfig.BlissSession.setup_nexdatas(selector=None, links=False, userdata=None, canfail=True, profile=None, session=None, watch=True, interval=2.0, scanmeta=True, redis=None, api=None, log=None)[source]

sets up NeXus profiles of the selector in a BLISS session

It synchronizes the session with the selector, registers the scan metadata of the profiles and starts a watcher of the selector.

Parameters:
  • selector (str or any) – NXSRecSelector device name or proxy

  • links (bool) – add STEP fields of the profiles as links to scan data

  • userdata (dict <str, any> or callable) – user data of CLIENT datasources or a function without arguments returning them

  • canfail (bool) – fill values of datasources which cannot be read, stop the scan otherwise

  • profile (str or callable) – profile name or a function of a scan returning it, the active measurement group if None

  • session (str) – session name, the current session if None

  • watch (bool) – start the watcher of the selector

  • interval (float) – interval of the watcher checks in seconds

  • scanmeta (bool) – register the scan metadata of the profiles

  • redis (redis.Redis) – Redis connection

  • api (BlissAPI) – BLISS session access

  • log (logging.Logger) – logger

Returns:

NeXus profiles in the session

Return type:

NXSNexDatas

nxsrecconfig.CheckerThread module

Component CheckerThread - thread which checks tango server attributes

nxsrecconfig.CheckerThread.ATTRIBUTESTOCHECK = ['Value', 'Position', 'Counts', 'Data', 'Voltage', 'Energy', 'SampleTime']

(list < str>) default attributes to check

exception nxsrecconfig.CheckerThread.AlarmStateError[source]

Bases: Exception

Alarm State Exception class

class nxsrecconfig.CheckerThread.CheckerItem(name)[source]

Bases: list

Checker list Item

constructor

Parameters:

name (str) – checker item name

active

(bool) enabled flag

errords

(str) datasource with first error

message

(str) first error message

name

(str) checker name

class nxsrecconfig.CheckerThread.CheckerThread(index, queue)[source]

Bases: Thread

Single CheckerThread

constructor

Brief:

It creates ElementThread from the runnable element

Parameters:
  • index (int) – the current thread index

  • queue (Queue.Queue) – queue with tasks

index

(int) thread index

run()[source]

runner

Brief:

It runs the defined thread

tangoSourceErrorStates

(list <str>) tango datasources error states

tangoSourceWarningStates

(list <str>) tango datasources warning states

exception nxsrecconfig.CheckerThread.FaultStateError[source]

Bases: Exception

Fault State Exception class

exception nxsrecconfig.CheckerThread.OffStateError[source]

Bases: Exception

Off State Exception class

class nxsrecconfig.CheckerThread.TangoDSItem(name=None, device=None, attr=None)[source]

Bases: object

Tango DataSource item

constructor

Parameters:
  • name (str) – datasource name

  • device (str) – datasource device

  • attr (str) – device attribute

attr

(str) datasource device attribute

device

(str) datasource device

name

(str) datasource name

nxsrecconfig.Converter module

Selection version converter

class nxsrecconfig.Converter.Converter(ver)[source]

Bases: object

selection version converter

contstructor

Parameters:

ver (str) – the required selection version

allkeys(selection)[source]
Parameters:

selection (nxsrecconfig.Selection.Selection) – selection dictionary object

Returns:

selection keys

Return type:

set

convert(selection)[source]

converts selection from any version to any other

Parameters:

selection (dict <str, any>) – selection dictionary object

down

(list <ConverterXtoY>) converter down sequence

majorversion

(int) major selection version

minorversion

(int) minor selection version

patchversion

(int) patch selection version

up

(list <ConverterXtoY>) converter up sequence

classmethod version(selection)[source]
fetches selection version and converts it

into (major, minor, patch)

Parameters:

selection (nxsrecconfig.Selection.Selection) – selection dictionary object

Returns:

(major, minor, patch) tuple with integers

Return type:

(int , int , int)

class nxsrecconfig.Converter.Converter1to2[source]

Bases: ConverterXtoY

Selection converter from version 1 to 2

constructor

convert(selection)[source]

converts selection from version 1 to 2

Parameters:

selection (dict <str, any>) – selection dictionary object

names

(dict <str, str>) names to convert

pnames

(dict <str, str>) names of properties

class nxsrecconfig.Converter.Converter2to1[source]

Bases: ConverterXtoY

Selection converter from version 2 to 1

constructor

convert(selection)[source]

converts selection from version 2 to 1

Parameters:

selection (dict <str, any>) – selection dictionary object

names

(dict <str, str>) names to convert

pnames

(dict <str, str>) names of properties

class nxsrecconfig.Converter.Converter2to3[source]

Bases: ConverterXtoY

Selection converter from version 2 to 3

converter

convert(selection)[source]

converts selection from version 2 to 3

Parameters:

selection (dict <str, any>) – selection dictionary object

names

(dict <str, str>) names to convert

seltoint(jselelem)[source]

converters list/dict of elements to dictionary with logical values

Parameters:

jselelem (str) – json list or dict selection element

Returns:

json dictionary

Return type:

str

class nxsrecconfig.Converter.Converter3to2[source]

Bases: ConverterXtoY

Selection converter from version 3 to 2

constructor

convert(selection)[source]

converts selection from version 3 to 2

Parameters:

selection (dict <str, any>) – selection dictionary object

names

(dict <str, str>) names to convert

seltobool(jselelem)[source]
converters dictioanry with None/True/False values

to dictionary with True/False values

Parameters:

jselelem (str) – json dictionary selection element

Returns:

converter json dictionary

Return type:

str

seltolist(jselelem)[source]
converters dictioanry with None/True/False values

to list of elementes with walue True

Parameters:

jselelem (str) – json dictionary selection element

Returns:

converter json dictionary

Return type:

str

class nxsrecconfig.Converter.Converter3to4[source]

Bases: ConverterXtoY

constructor

class nxsrecconfig.Converter.Converter4to3[source]

Bases: ConverterXtoY

constructor

class nxsrecconfig.Converter.ConverterXtoY[source]

Bases: object

virtual selection version converter

constructor

convert(selection)[source]

converts selection to the current selector version

Parameters:

selection (dict <str, any>) – selection dictionary object

names

(dict <str, str>) names to convert

nxsrecconfig.Describer module

Component Describer

class nxsrecconfig.Describer.DSItem(name=None, dstype=None, record=None, dsitem=None, parentobj=None)[source]

Bases: object

Basic DataSource item

constructor

Parameters:
  • name (str) – datasource name

  • dstype (str) – datasource type

  • record (str) – datasource record

  • dsitem (DSItem) – datasource item

  • parentobj (str) – datasource parent object

dstype

(str) datasource type

name

(str) datasource name

parentobj

(str) datasource parentobj

record

(str) datasource record

class nxsrecconfig.Describer.Describer(nexusconfig_device, tree=False, pyevalfromscript=False)[source]

Bases: object

Lists datasources, strategy, dstype and record name of given component

constructor

Parameters:
components(components=None, strategy='', dstype='', cfvars=None)[source]

describes given components. If tree = True it returns

[{ cpname : { dsname : [ | (strategy, dstype, record, nxstype, shape), …] } } ]

else

[{“dsname”: dsname, “strategy”: strategy, “dstype”: dstype, | “record”: record, “nxstype”: nxstype, “shape”: shape , | “cpname”: cpname}, …]
Parameters:
  • components (list <str>) – given components. If None all available ones are taken

  • strategy (str) – list datasets only with given strategy. If ‘’ all available ones are taken

  • dstype (str) – list datasets only with given datasource type. If ‘’ all available ones are taken

  • cfvars (str) – configuration variables in JSON dictionary

Returns:

list of dictionary with description of components

Return type:

[dict <str, dict <str, list <(str, str, str, str, list <int>)> > > ] or [{“dsname”: str, “strategy”: str, “dstype”: str, “record”: str, “nxstype”: str, “shape”: list <int> , “cpname”: str}, …]

dataSources(names=None, dstype='')[source]

describes given datasources

Parameters:
  • names (list <str>) – given datasources. If None all available ones are taken

  • dstype (str) – list datasources only with given type. If ‘’ all available ones are taken

Returns:

list of dictionary with description of datasources

Return type:

[dict <str, ExDSDict > ] or [{“dsname”: str, “dstype”: str, “record”: str}, …]

class nxsrecconfig.Describer.ExDSDict(*args, **kw)[source]

Bases: dict

Extended DataSource Dictionary

constructor

Parameters:
  • args (list <any>) – dict args

  • kw (dict <any , any>) – dict kw

appendDSList(dslist, mode, nxtype=None, shape=None)[source]

appends a list of ExDSItem

Parameters:
  • dslist (list <DSItem>) – DSItem list

  • mode (str) – startegy mode

  • nxtype – NeXus type

  • shape (list <int>) – data shape

Returns:

datasource name for first added datasource or None if not appended

Return type:

str

class nxsrecconfig.Describer.ExDSItem(dsitem=None, mode=None, nxtype=None, shape=None)[source]

Bases: DSItem

Extended DataSource item

constructor

Parameters:
  • dsitem (DSItem) – datasource item

  • mode (str) – writing strategy mode

  • nxtype – nexus type

  • shape (list <int>) – datasource shape

mode

(str) writing strategy mode

nxtype

(str) nexus type

shape

(list <int>) datasource shape

nxsrecconfig.DynamicComponent module

Dynamic Component

class nxsrecconfig.DynamicComponent.DynamicComponent(nexusconfig_device, defaultpath="/$var.entryname#'scan'$var.serialno:NXentry/instrument:NXinstrument/collection", defaulttype='NX_CHAR', defaultuserpath="/$var.entryname#'scan'$var.serialno:NXentry/user_data:NXparameters", backend=None)[source]

Bases: object

Creates dynamic component of given component

constructor

Parameters:
create()[source]

creates dynamic component

Returns:

dynanic component name

Return type:

str

remove(name)[source]

removes dynamic component

Parameters:

name (str) – dynamic component name

setDefaultLinkPath(dynamicLinks, dynamicPath, dynamicInitLinks=None)[source]

sets default nexus path and link flag for dynamic components

Brief:

if dynamicPath is None or “” it is reset to default one

Parameters:
  • dynamicPath (str) – nexus default path

  • dynamicLinks (bool) – default link flag

  • dynamicInitLinks (bool) – default link flag

setInitDSources(dsources)[source]

sets init datasources

Parameters:

dsources (list <str>) – list of init datasources

setLabelParams(labels, paths, links, types, shapes)[source]

sets label parameters for specific dynamic components

Parameters:
setStepDSources(dsources)[source]

sets step datasources

Parameters:

dsources (list <str>) – list of step datasources

setStepDictDSources(dctlist)[source]

sets user datasources with type and shape

Parameters:

dctlist (str) – json list of parameter dictionaries [{“name”: <dsname>, “dtype”: <num_type>, “shape”:<list>}, …]

nxsrecconfig.MacroServerPools module

sardana scan backend, i.e. macroserver and pools

class nxsrecconfig.MacroServerPools.MacroServerPools(numberOfThreads)[source]

Bases: ScanBackend

sardana macro server and pools

constructor

Parameters:

numberOfThreads (str) – number of threads

channelSource(name)[source]

provides the tango source of a pool channel

Parameters:

name (str) – channel name

Returns:

tango attribute name or None

Return type:

str

createMntGrp(pool, name, timer)[source]

creates a measurement group in the pool

Parameters:
defaultDoor(db)[source]

provides the default door

Parameters:

db (tango.Database) – tango database

Returns:

door device name

Return type:

str

deleteMntGrp(pool, name)[source]

deletes a measurement group from the pool

Parameters:
getEnv(var, ms)[source]

provides a macroserver environment variable

Parameters:
  • var (str) – variable name

  • ms (str) – macroserver device name

Returns:

variable value

Return type:

any

getMacroServer(door)[source]

door macro server device name

Parameters:

door (str) – door device name

Returns:

macroserver device name

Return type:

str

getPools(door)[source]

door pool device proxies

Parameters:

door (str) – door device name

Returns:

pool device proxies

Return type:

list <tango.DeviceProxy>

getScanEnv(door)[source]

fetches Scan Environment Data

Parameters:

door (str) – door device

Returns:

JSON String with important variables

Return type:

str

getSelectorEnv(door, names, data)[source]

imports Environment Data

Parameters:
  • door (str) – door device

  • names (list <str>) – names of required variables

  • data (dict <str , any>) – dictionary with resulting data

isDoorRunning(ms)[source]

check if any door server is running

Parameters:

ms (str) – macroserver device name

Returns:

if any door running

Return type:

bool

isDoorValid(door)[source]

checks if the door has a macro server

Parameters:

door (str) – door device name

Returns:

True if valid

Return type:

bool

mntGrpConfiguration(device)[source]

provides the measurement group configuration

Parameters:

device (str) – measurement group device name

Returns:

JSON configuration

Return type:

str

name = 'sardana'

(str) backend name

nonExistingChannels(door, channels)[source]

provides the channels which are not found in the pools

Parameters:
  • door (str) – door device name

  • channels (list <str>) – channel names

Returns:

channels not found in the pools

Return type:

list <str>

setEnv(var, value, ms)[source]

sets a macroserver environment variable

Parameters:
  • var (str) – variable name

  • value (any) – variable value

  • ms (str) – macroserver device name

setEnvs(varvalues, ms)[source]

sets macroserver environment variables

Parameters:
  • varvalues (dict <str, any>) – variable names and values

  • ms (str) – macroserver device name

setMntGrpConfiguration(device, conf)[source]

sets the measurement group configuration

Parameters:
  • device (str) – measurement group device name

  • conf (str) – JSON configuration

Returns:

the configuration read back from the device

Return type:

str

setScanEnv(door, jdata)[source]

stores Scan Environment Data

Parameters:
  • door (str) – door device

  • jdata (str) – JSON String with important variables

setSelectorEnv(door, data, cmddata=None)[source]

exports all Environment Data

Parameters:
  • door (str) – door device

  • data (dict <str , any>) – data dictionary

  • cmddata (dict <str , any>) – command data dictionary

supportsMntGrps = True

(bool) the backend provides measurement group devices

testMntGrpConfiguration(device, conf)[source]
provides the configuration the measurement group makes of conf

and restores its current configuration

Parameters:
  • device (str) – measurement group device name

  • conf (str) – JSON configuration

Returns:

the configuration read back from the device

Return type:

str

updateMacroServer(door)[source]

updates MacroServer and sardana pools for given door

Parameters:

door (str) – door device name

Returns:

macroserver device name

Return type:

str

usetEnv(var, ms)[source]

unsets a macroserver environment variable

Parameters:
  • var (str) – variable name

  • ms (str) – macroserver device name

nxsrecconfig.NXSConfig module

Selector Server for NeXus Sardana Recorder

class nxsrecconfig.NXSConfig.NXSRecSelector(cl, name)[source]

Bases: LatestDeviceImpl

NXSRecSelector server interface

Brief:

Tango Server for Nexus Sardana Recorder Settings. Device States Description: DevState.ON - Server is ON, DevState.RUNNING - Performing a query

Device constructor

Parameters:
  • cl (str) – class name

  • name (str) – device name

AddStepDataSources(argin)[source]

AddStepDataSources command

Brief:

switch datasources to step mode

Parameters:

argin (list <str>) – DevVarStringArray list of datasource names

Returns:

DevVarStringArray list of datasources not found in components

Rtypes:

list <str>

AdministratorDataNames()[source]

AdministratorDataNames command

Brief:

Provide Administrator Data Names

Returns:

DevVarStringArray data record names

Return type:

list <str>

AvailableComponents()[source]

AvailableComponents command

Brief:

Return a list of available component names

Returns:

DevVarStringArray list of available component names

Return type:

list <str>

AvailableDataSources()[source]

AvailableDataSources command

Brief:

Return a list of available DataSource names

Returns:

DevVarStringArray list of available DataSource names

Return type:

list <str>

AvailableMntGrps()[source]

AvailableMntGrps command

Brief:

Return a list of available mntgrp names

Returns:

DevVarStringArray list of available mntgrp names

Return type:

list <str>

AvailableProfiles()[source]

AvailableProfiles command

Brief:

Return a list of available selection names

Returns:

DevVarStringArray list of available selection names

Return type:

list <str>

AvailableTimers()[source]

AvailableTimers command

Brief:

Returns a list of available component names

Returns:

DevVarStringArray list of available component names

Return type:

list <str>

CacheWriterConfiguration(argin)[source]

CacheWriterConfiguration command

Brief:

Create configuration from the given components

Parameters:

argin (list <str>) – DevVarStringArray list of component names

Returns:

DevVarString XML configuration string

Return type:

str

ChannelProperties(argin)[source]

ChannelProperties command

Brief:

Provide JSON dictionary with channel properties {channel:property}

Parameters:

argin (str) – DevString property type

Returns:

DevString JSON dictionary with channel properties

Return type:

str

ClearCache()[source]

ClearCache command

Brief:

Fetch server configuration and syncronize snapshot or motor positions

ComponentClientSources(argin)[source]

ComponentClientSources command

Brief:

Describe client datasources from components

Parameters:

argin (list <str>) – DevVarStringArray list of component names

Returns:

DevVarString description of component datasources

Return type:

str

ComponentDataSources()[source]

ComponentDataSources command

Brief:

Provide the component datasources

Returns:

DevVarStringArray component names

Return type:

list <str>

ComponentDescription()[source]

ComponentDescription command

Brief:

Return a list of available component names

Returns:

DevString list of available component names

Return type:

str

ComponentSources(argin)[source]

ComponentSources command

Brief:

Describe datasources from components

Parameters:

argin (list <str>) – DevVarStringArray list of component names

Returns:

DevVarString description of component datasources

Return type:

str

CreateDataSources(argin)[source]

It creates new DataSources on the ConfigServer

Parameters:

argin (str) – JSON dictionary with {dsname: tangosource, …}

CreateDynamicComponent(argin)[source]

CreateDynamicComponent command

Brief:

Create dynamic component

Parameters:

argin (list <str>) – DevVarStringArray list of datasource parameters

Returns:

DevVarString name of created dynamic component

Return type:

str

CreateWriterConfiguration(argin)[source]

CreateWriterConfiguration command

Brief:

Create configuration from the given components

Parameters:

argin (list <str>) – DevVarStringArray list of component names

Returns:

DevVarString XML configuration string

Return type:

str

DataSourceDescription(argin)[source]

DataSourceDescription command

Brief:

Provide datasource description

Parameters:

argin (list <str>) – DevVarStringArray list of datasource names

Returns:

DevVarStringArray description of datasources

Rtypes:

list <str>

DeleteAllProfiles()[source]

DeleteAllProfiles command

Brief:

Delete all profiles from Configuration Server

DeleteProfile(argin)[source]

DeleteProfile command

Brief:

Delete the given mntgrp

Parameters:

argin (str) – DevString measurement group name

ExportEnvProfile()[source]

ExportEnvProfile command

Brief:

Export all environment variables

FetchProfile()[source]

FetchProfile command

Brief:

Fetch server configuration

FullDeviceNames()[source]

FullDeviceNames command

Brief:

Return a JSON with full device names for all aliases

Returns:

DevString JSON dictionary with full device names

Return type:

str

ImportEnvProfile()[source]

ImportEnvProfile command

Brief:

Import all environment variables

ImportMntGrp()[source]

ImportMntGrp command

Brief:

Import active mntgrp configuration

IsMntGrpUpdated()[source]

IsMntGrpUpdated command

Returns:

True if mntgrp was changed

Return type:

bool

LoadProfile()[source]

LoadProfile command

Brief:

Load server configuration

MandatoryComponents()[source]

MandatoryComponents command

Brief:

Set the mandatory components

Returns:

DevVarStringArray component names

Return type:

list <str>

MntGrpConfiguration()[source]

MntGrpConfiguration command

Brief:

returns mntgrp configuration

Returns:

Provide mntgrp configuration in json string

Return type:

str

MutedChannels()[source]

MutedChannels command

Brief:

Return a list of muted channel names

Returns:

DevVarStringArray list of muted channel names

Return type:

list <str>

PoolElementNames(argin)[source]

PoolElementNames command

Brief:

Return a list of available pool channels

Parameters:

argin (str) – DevString name of pool list attribute

Returns:

DevVarStringArray list of available pool elements

Return type:

list <str>

PreselectComponents()[source]

PreselectComponents command

Brief:

Check existing devices of pools

PreselectedComponents()[source]

PreselectedComponents command

Brief:

Provide the preselected components

Returns:

DevVarStringArray component names

Return type:

list <str>

PreselectedDataSources()[source]

PreselectedDataSources command

Brief:

Provide the preselected components

Returns:

DevVarStringArray component names

Return type:

list <str>

RemoveDynamicComponent(argin)[source]

RemoveDynamicComponent command

Brief:

Delete the given dynamic component

Parameters:

argin (str) – DevString dynamic component name

ResetPreselectedComponents()[source]

ResetPreselectedComponents command

Brief:

reset PreselectedComponents to DefaultPreselectedComponents

SaveProfile()[source]

SaveProfile command

Brief:

Save server configuration

ScanEnvVariables()[source]

ScanEnvVariables command

Brief:

Fetch ScanDir, ScanFile, ScanID and NeXusSelectorDevice in environment variables

Returns:

DevString json dictionary with environment data

Return type:

str

SelectedComponents()[source]

SelectedComponents command

Brief:

Provide the selected components

Returns:

DevVarStringArray component names

Return type:

list <str>

SelectedDataSources()[source]

SelectedDataSources command

Brief:

Provide the selected datasources

Returns:

DevVarStringArray component names

Return type:

list <str>

SetChannelProperties(argin)[source]

SetChannelProperties command SetChannelProperties

Brief:

Set Channel Properties of the given type

Parameters:

argin ([str, str]) – DevVarStringArray two element list with a property type and JSON value dictionary {channel:property}

SetScanEnvVariables(argin)[source]

SetScanEnvVariables command

Brief:

Store ScanDir, ScanFile and NeXusSelectorDevice in environment variables

Parameters:

argin (str) – json dictionary with environment data

Returns:

DevLong scan ID

Return type:

int

StoreProfile()[source]

StoreProfile command command

Brief:

Store server configuration

SwitchProfile()[source]

SwitchProfile command

Brief:

Switch mntgrp configuration

SyncProfile()[source]

SyncProfile command

Brief:

Fetch server configuration and syncronize snapshot or motor positions

UpdateConfigVariables()[source]

UpdateConfigVariables command

Brief:

Send ConfigVariables into ConfigServer and update serialno if appendEntry selected

UpdateMntGrp()[source]

UpdateMntGrp command

Brief:

Update mntgrp configuration

Returns:

mntgrp configuration string

Return type:

str

UpdateProfile()[source]

UpdateProfile command

Brief:

Update mntgrp configuration

Returns:

JSON string with mntgrp configuration info

Return type:

str

VariableComponents()[source]

VariableComponents command

Brief:

Returns a list of available component names

Returns:

DevString list of available component names

Return type:

str

always_executed_hook()[source]

Always excuted hook method

delete_device()[source]

Device destructor

init_device()[source]

Device initialization

is_AdministratorDataNames_allowed()[source]

AdministratorDataNames command State Machine

Returns:

True if the operation allowed

Return type:

bool

is_AvailableComponents_allowed()[source]

AvailableComponents command State Machine

Returns:

True if the operation allowed

Return type:

bool

is_AvailableDataSources_allowed()[source]

AvailableDataSources command State Machine

Returns:

True if the operation allowed

Return type:

bool

is_AvailableMntGrps_allowed()[source]

AvailableMntGrps command State Machine

Returns:

True if the operation allowed

Return type:

bool

is_AvailableProfiles_allowed()[source]

AvailableProfiles command State Machine

Returns:

True if the operation allowed

Return type:

bool

is_AvailableTimers_allowed()[source]

AvailableTimers command State Machine

Returns:

True if the operation allowed

Return type:

bool

is_CacheWriterConfiguration_allowed()[source]

CacheWriterConfiguration command State Machine

Returns:

True if the operation allowed

Return type:

bool

is_CanFailDataSources_write_allowed()[source]

CanFailDataSources attribute Write State Machine

Returns:

True if the operation allowed

Return type:

bool

is_ChannelProperties_allowed()[source]

ChannelProperties command State Machine

Returns:

True if the operation allowed

Return type:

bool

is_ClearCache_allowed()[source]

ClearCache command State Machine

Returns:

True if the operation allowed

Return type:

bool

is_ComponentClientSources_allowed()[source]

ComponentClientSources command State Machine

Returns:

True if the operation allowed

Return type:

bool

is_ComponentDataSources_allowed()[source]

ComponentDataSources command State Machine

Returns:

True if the operation allowed

Return type:

bool

is_ComponentDescription_allowed()[source]

ComponentDescription command State Machine

Returns:

True if the operation allowed

Return type:

bool

is_ComponentSources_allowed()[source]

ComponentSources command State Machine

Returns:

True if the operation allowed

Return type:

bool

is_CreateDataSources_allowed()[source]

CreateDataSources command State Machine

Returns:

True if the operation allowed

Return type:

bool

is_CreateDynamicComponent_allowed()[source]

CreateDynamicComponent command State Machine

Returns:

True if the operation allowed

Return type:

bool

is_CreateWriterConfiguration_allowed()[source]

CreateWriterConfiguration command State Machine

Returns:

True if the operation allowed

Return type:

bool

is_DataSourceDescription_allowed()[source]

DataSourceDescription command State Machine

Returns:

True if the operation allowed

Return type:

bool

is_DeleteAllProfiles_allowed()[source]

DeleteAllProfiles command State Machine

Returns:

True if the operation allowed

Return type:

bool

is_DeleteProfile_allowed()[source]

DeleteProfile command State Machine

Returns:

True if the operation allowed

Return type:

bool

is_ExportEnv_allowed()[source]

ExportMntGrp command State Machine

Returns:

True if the operation allowed

Return type:

bool

is_ExtraLinkDataSources_write_allowed()[source]

LinkDataSources attribute Write State Machine

Returns:

True if the operation allowed

Return type:

bool

is_FetchProfile_allowed()[source]

FetchProfile command State Machine

Returns:

True if the operation allowed

Return type:

bool

is_FullDeviceNames_allowed()[source]

FullDeviceNames command State Machine

Returns:

True if the operation allowed

Return type:

bool

is_ImportEnv_allowed()[source]

ImportMntGrp command State Machine

Returns:

True if the operation allowed

Return type:

bool

is_ImportMntGrp_allowed()[source]

ImportMntGrp command State Machine

Returns:

True if the operation allowed

Return type:

bool

is_IsMntGrpUpdated_allowed()[source]

IsMntGrpUpdated command State Machine

Returns:

True if the operation allowed

Return type:

bool

is_LinkDataSources_write_allowed()[source]

LinkDataSources attribute Write State Machine

Returns:

True if the operation allowed

Return type:

bool

is_LoadProfile_allowed()[source]

LoadProfile command State Machine

Returns:

True if the operation allowed

Return type:

bool

is_MandatoryComponents_allowed()[source]

MandatoryComponents command State Machine

Returns:

True if the operation allowed

Return type:

bool

is_MntGrpConfiguration_allowed()[source]

MntGrpConfiguration command State Machine

Returns:

True if the operation allowed

Return type:

bool

is_MutedChannels_allowed()[source]

MutedChannels command State Machine

Returns:

True if the operation allowed

Return type:

bool

is_PoolElementNames_allowed()[source]

PoolElementNames command State Machine

Returns:

True if the operation allowed

Return type:

bool

is_PreselectComponents_allowed()[source]

PreselectComponents command State Machine

Returns:

True if the operation allowed

Return type:

bool

is_PreselectedComponents_allowed()[source]

PreselectedComponents command State Machine

Returns:

True if the operation allowed

Return type:

bool

is_PreselectedDataSources_allowed()[source]

PreselectedDataSources command State Machine

Returns:

True if the operation allowed

Return type:

bool

is_RemoveDynamicComponent_allowed()[source]

RemoveDynamicComponent command State Machine

Returns:

True if the operation allowed

Return type:

bool

is_ResetPreselectedComponents_allowed()[source]

ResetPreselectedComponents command State Machine

Returns:

True if the operation allowed

Return type:

bool

is_SaveProfile_allowed()[source]

SaveProfile command State Machine

Returns:

True if the operation allowed

Return type:

bool

is_ScanEnvVariables_allowed()[source]

ScanEnvVariables command State Machine

Returns:

True if the operation allowed

Return type:

bool

is_SelectedComponents_allowed()[source]

SelectedComponents command State Machine

Returns:

True if the operation allowed

Return type:

bool

is_SelectedDataSources_allowed()[source]

SelectedDataSources command State Machine

is_SetChannelProperties_allowed()[source]

SetChannelProperties command State Machine

Returns:

True if the operation allowed

Return type:

bool

is_SetScanEnvVariables_allowed()[source]

SetScanEnvVariables command State Machine

Returns:

True if the operation allowed

Return type:

bool

is_StepDataSources_write_allowed()[source]

StepDataSources attribute Write State Machine

Returns:

True if the operation allowed

Return type:

bool

is_StoreProfile_allowed()[source]

StoreProfile command State Machine

Returns:

True if the operation allowed

Return type:

bool

is_SwitchProfile_allowed()[source]

SwitchProfile command State Machine

Returns:

True if the operation allowed

Return type:

bool

is_SyncProfile_allowed()[source]

SyncProfile command State Machine

Returns:

True if the operation allowed

Return type:

bool

is_UpdateConfigVariables_allowed()[source]

UpdateConfigVariables command State Machine

Returns:

True if the operation allowed

Return type:

bool

is_UpdateMntGrp_allowed()[source]

UpdateMntGrp command State Machine

Returns:

True if the operation allowed

Return type:

bool

is_UpdateProfile_allowed()[source]

UpdateProfile command State Machine

Returns:

True if the operation allowed

Return type:

bool

is_VariableComponents_allowed()[source]

VariableComponents command State Machine

Returns:

True if the operation allowed

Return type:

bool

read_AppendEntry(attr)[source]

Read AppendEntry attribute

Parameters:

attr (tango.Attribute) – read attribute

read_Backend(attr)[source]

Read Backend attribute

Parameters:

attr (tango.Attribute) – read attribute

read_CacheComponent(attr)[source]

Read CacheComponent attribute

Parameters:

attr (tango.Attribute) – read attribute

read_CanFailDataSources(attr)[source]

Read CanFailDataSources attribute

Parameters:

attr (tango.Attribute) – read attribute

read_Components(attr)[source]

Read Components attribute

Parameters:

attr (tango.Attribute) – read attribute

read_ConfigDevice(attr)[source]

Read ConfigDevice attribute

Parameters:

attr (tango.Attribute) – read attribute

read_ConfigVariables(attr)[source]

Read ConfigVariables attribute

Parameters:

attr (tango.Attribute) – read attribute

read_DataSources(attr)[source]

Read DataSources attribute

Parameters:

attr (tango.Attribute) – read attribute

read_DescriptionErrors(attr)[source]

Read DescriptionErrors attribute

Parameters:

attr (tango.Attribute) – read attribute

read_DeviceGroups(attr)[source]

Read DeviceGroups attribute

Parameters:

attr (tango.Attribute) – read attribute

read_Door(attr)[source]

Read Door attribute

Parameters:

attr (tango.Attribute) – read attribute

read_ExtraLinkDataSources(attr)[source]

Read ExtraLinkDataSources attribute

Parameters:

attr (tango.Attribute) – read attribute

read_LinkDataSources(attr)[source]

Read LinkDataSources attribute

Parameters:

attr (tango.Attribute) – read attribute

read_MacroServer(attr)[source]

Read MacroServer attribute

Parameters:

attr (tango.Attribute) – read attribute

read_MntGrp(attr)[source]

Read MntGrp attribute

Parameters:

attr (tango.Attribute) – read attribute

read_ProfileConfiguration(attr)[source]

Read ProfileConfiguration attribute

Parameters:

attr (tango.Attribute) – read attribute

read_ProfileFile(attr)[source]

Read ProfileFile attribute

Parameters:

attr (tango.Attribute) – read attribute

read_ScanDir(attr)[source]

Read ScanDir attribute

Parameters:

attr (tango.Attribute) – read attribute

read_ScanFile(attr)[source]

Read ScanFile attribute

Parameters:

attr (tango.Attribute) – read attribute

read_ScanID(attr)[source]

Read ScanID attribute

Parameters:

attr (tango.Attribute) – read attribute

read_StepDataSources(attr)[source]

Read StepDataSources attribute

Parameters:

attr (tango.Attribute) – read attribute

read_UserData(attr)[source]

Read UserData attribute

Parameters:

attr (tango.Attribute) – read attribute

read_Version(attr)[source]

Read Version attribute

Parameters:

attr (tango.Attribute) – read attribute

read_WriterDevice(attr)[source]

Read WriterDevice attribute

Parameters:

attr (tango.Attribute) – read attribute

read_attr_hardware(_)[source]

Read Attribute Hardware

write_AppendEntry(attr)[source]

Write AppendEntry attribute

Parameters:

attr (tango.Attribute) – written attribute

write_CanFailDataSources(attr)[source]

Write CanFailDataSources attribute

Parameters:

attr (tango.Attribute) – written attribute

write_ConfigDevice(attr)[source]

Write ConfigDevice attribute

Parameters:

attr (tango.Attribute) – written attribute

write_ConfigVariables(attr)[source]

Write ConfigVariables attribute

Parameters:

attr (tango.Attribute) – written attribute

write_DeviceGroups(attr)[source]

Write DeviceGroups attribute

Parameters:

attr (tango.Attribute) – written attribute

write_Door(attr)[source]

Write Door attribute

Parameters:

attr (tango.Attribute) – written attribute

write_ExtraLinkDataSources(attr)[source]

Write ExtraLinkDataSources attribute

Parameters:

attr (tango.Attribute) – written attribute

write_LinkDataSources(attr)[source]

Write LinkDataSources attribute

Parameters:

attr (tango.Attribute) – written attribute

write_MntGrp(attr)[source]

Write MntGrp attribute

Parameters:

attr (tango.Attribute) – written attribute

write_ProfileConfiguration(attr)[source]

Write ProfileConfiguration attribute

Parameters:

attr (tango.Attribute) – written attribute

write_ProfileFile(attr)[source]

Write ProfileFile attribute

Parameters:

attr (tango.Attribute) – written attribute

write_ScanDir(attr)[source]

Write ScanDir attribute

Parameters:

attr (tango.Attribute) – written attribute

write_ScanFile(attr)[source]

Write ScanFile attribute

Parameters:

attr (tango.Attribute) – written attribute

write_ScanID(attr)[source]

Write ScanID attribute

Parameters:

attr (tango.Attribute) – written attribute

write_StepDataSources(attr)[source]

Write StepDataSources attribute

Parameters:

attr (tango.Attribute) – written attribute

write_UserData(attr)[source]

Write UserData attribute

Parameters:

attr (tango.Attribute) – written attribute

write_WriterDevice(attr)[source]

Write WriterDevice attribute

Parameters:

attr (tango.Attribute) – written attribute

class nxsrecconfig.NXSConfig.NXSRecSelectorClass(name)[source]

Bases: DeviceClass

NXSRecSelectorclass Constructor

attr_list = {'AppendEntry': [[tango._tango.CmdArgType.DevBoolean, tango._tango.AttrDataFormat.SCALAR, tango._tango.AttrWriteType.READ_WRITE], {'description': 'flag for entry appending', 'label': 'Append Entry'}], 'Backend': [[tango._tango.CmdArgType.DevString, tango._tango.AttrDataFormat.SCALAR, tango._tango.AttrWriteType.READ], {'description': 'scan backend, i.e. sardana, bliss or null', 'label': 'Backend'}], 'CacheComponent': [[tango._tango.CmdArgType.DevString, tango._tango.AttrDataFormat.SCALAR, tango._tango.AttrWriteType.READ], {'description': 'current cache compoent name', 'label': 'CacheComponent'}], 'CanFailDataSources': [[tango._tango.CmdArgType.DevString, tango._tango.AttrDataFormat.SCALAR, tango._tango.AttrWriteType.READ_WRITE], {'Display level': tango._tango.DispLevel.EXPERT, 'description': 'list of datasources to be switched into canfail mode', 'label': 'list of datasources to be switch into canfail mode'}], 'Components': [[tango._tango.CmdArgType.DevString, tango._tango.AttrDataFormat.SPECTRUM, tango._tango.AttrWriteType.READ, 10000], {'description': 'list of Selected Components', 'label': 'Selected Components'}], 'ConfigDevice': [[tango._tango.CmdArgType.DevString, tango._tango.AttrDataFormat.SCALAR, tango._tango.AttrWriteType.READ_WRITE], {'Memorized': 'true', 'description': 'Configuration device name', 'label': 'Configuration Device'}], 'ConfigVariables': [[tango._tango.CmdArgType.DevString, tango._tango.AttrDataFormat.SCALAR, tango._tango.AttrWriteType.READ_WRITE], {'Display level': tango._tango.DispLevel.EXPERT, 'description': 'JSON dictionary with configuration variablesfor templated components', 'label': 'Configuration Variables'}], 'DataSources': [[tango._tango.CmdArgType.DevString, tango._tango.AttrDataFormat.SPECTRUM, tango._tango.AttrWriteType.READ, 10000], {'description': 'list of Selected Datasources', 'label': 'Selected Datasources'}], 'DescriptionErrors': [[tango._tango.CmdArgType.DevString, tango._tango.AttrDataFormat.SPECTRUM, tango._tango.AttrWriteType.READ, 10000], {'description': 'list of Descriptive Component Errors', 'label': 'Descriptive Component Errors'}], 'DeviceGroups': [[tango._tango.CmdArgType.DevString, tango._tango.AttrDataFormat.SCALAR, tango._tango.AttrWriteType.READ_WRITE], {'Display level': tango._tango.DispLevel.EXPERT, 'Memorized': 'true', 'description': 'JSON dictionary with device groups', 'label': 'Device groups'}], 'Door': [[tango._tango.CmdArgType.DevString, tango._tango.AttrDataFormat.SCALAR, tango._tango.AttrWriteType.READ_WRITE], {'Memorized': 'true', 'description': 'Door device name', 'label': 'Door'}], 'ExtraLinkDataSources': [[tango._tango.CmdArgType.DevString, tango._tango.AttrDataFormat.SCALAR, tango._tango.AttrWriteType.READ_WRITE], {'Display level': tango._tango.DispLevel.EXPERT, 'description': 'list of datasources to which an extra link will be added', 'label': 'list of datasources to which a extra link will be added'}], 'LinkDataSources': [[tango._tango.CmdArgType.DevString, tango._tango.AttrDataFormat.SCALAR, tango._tango.AttrWriteType.READ_WRITE], {'Display level': tango._tango.DispLevel.EXPERT, 'description': 'list of datasources to which a link will be added', 'label': 'list of datasources to which a link will be added'}], 'MacroServer': [[tango._tango.CmdArgType.DevString, tango._tango.AttrDataFormat.SCALAR, tango._tango.AttrWriteType.READ], {'description': 'Macro Server device name', 'label': 'MacroServer'}], 'MntGrp': [[tango._tango.CmdArgType.DevString, tango._tango.AttrDataFormat.SCALAR, tango._tango.AttrWriteType.READ_WRITE], {'description': ' Measurement Group name', 'label': ' Measurement Group'}], 'ProfileConfiguration': [[tango._tango.CmdArgType.DevString, tango._tango.AttrDataFormat.SCALAR, tango._tango.AttrWriteType.READ_WRITE], {'Display level': tango._tango.DispLevel.EXPERT, 'description': 'JSON dict of server configuration', 'label': 'Profile Configuration'}], 'ProfileFile': [[tango._tango.CmdArgType.DevString, tango._tango.AttrDataFormat.SCALAR, tango._tango.AttrWriteType.READ_WRITE], {'Memorized': 'true', 'description': 'config file with its full path', 'label': 'Profile File with its Path'}], 'ScanDir': [[tango._tango.CmdArgType.DevString, tango._tango.AttrDataFormat.SCALAR, tango._tango.AttrWriteType.READ_WRITE], {'description': 'Scan Directory', 'label': 'Scan Directory'}], 'ScanFile': [[tango._tango.CmdArgType.DevString, tango._tango.AttrDataFormat.SCALAR, tango._tango.AttrWriteType.READ_WRITE], {'description': 'Scan File(s)', 'label': 'Scan File(s)'}], 'ScanID': [[tango._tango.CmdArgType.DevLong, tango._tango.AttrDataFormat.SCALAR, tango._tango.AttrWriteType.READ_WRITE], {'description': 'Scan ID', 'label': 'Scan ID'}], 'StepDataSources': [[tango._tango.CmdArgType.DevString, tango._tango.AttrDataFormat.SCALAR, tango._tango.AttrWriteType.READ_WRITE], {'Display level': tango._tango.DispLevel.EXPERT, 'description': 'list of datasources to be switched into step mode', 'label': 'list of datasources to be switch into step mode'}], 'UserData': [[tango._tango.CmdArgType.DevString, tango._tango.AttrDataFormat.SCALAR, tango._tango.AttrWriteType.READ_WRITE], {'Display level': tango._tango.DispLevel.EXPERT, 'description': 'JSON dictionary with User Data', 'label': 'Client Data'}], 'Version': [[tango._tango.CmdArgType.DevString, tango._tango.AttrDataFormat.SCALAR, tango._tango.AttrWriteType.READ], {'description': 'server version', 'label': 'Version'}], 'WriterDevice': [[tango._tango.CmdArgType.DevString, tango._tango.AttrDataFormat.SCALAR, tango._tango.AttrWriteType.READ_WRITE], {'description': 'Writer device device name', 'label': 'Writer Device'}]}
class_property_list = {}

(dict <str, [ str, tango.CmdArgType, [ list <int> ] ] > ) Class Properties

cmd_list = {'AddStepDataSources': [[tango._tango.CmdArgType.DevVarStringArray, 'list of required datasources'], [tango._tango.CmdArgType.DevVarStringArray, 'list of datasources not found in components']], 'AdministratorDataNames': [[tango._tango.CmdArgType.DevVoid, ''], [tango._tango.CmdArgType.DevVarStringArray, 'administrator data names']], 'AvailableComponents': [[tango._tango.CmdArgType.DevVoid, ''], [tango._tango.CmdArgType.DevVarStringArray, 'list of available component names']], 'AvailableDataSources': [[tango._tango.CmdArgType.DevVoid, ''], [tango._tango.CmdArgType.DevVarStringArray, 'list of available DataSource names']], 'AvailableMntGrps': [[tango._tango.CmdArgType.DevVoid, ''], [tango._tango.CmdArgType.DevVarStringArray, 'list of available mntgrp names']], 'AvailableProfiles': [[tango._tango.CmdArgType.DevVoid, ''], [tango._tango.CmdArgType.DevVarStringArray, 'list of available selection names']], 'AvailableTimers': [[tango._tango.CmdArgType.DevVoid, ''], [tango._tango.CmdArgType.DevVarStringArray, 'list of available timers']], 'CacheWriterConfiguration': [[tango._tango.CmdArgType.DevVarStringArray, 'list of required components'], [tango._tango.CmdArgType.DevString, 'XML Cache']], 'ChannelProperties': [[tango._tango.CmdArgType.DevString, 'property type'], [tango._tango.CmdArgType.DevString, 'JSON dictionary with channel properties {channel:property}']], 'ClearCache': [[tango._tango.CmdArgType.DevVoid, ''], [tango._tango.CmdArgType.DevVoid, '']], 'ComponentClientSources': [[tango._tango.CmdArgType.DevVarStringArray, 'list of component client datasources'], [tango._tango.CmdArgType.DevString, 'JSON with description of component CLIENT Datasources']], 'ComponentDataSources': [[tango._tango.CmdArgType.DevVoid, ''], [tango._tango.CmdArgType.DevVarStringArray, 'profile component datasources']], 'ComponentDescription': [[tango._tango.CmdArgType.DevVoid, ''], [tango._tango.CmdArgType.DevString, 'JSON component description']], 'ComponentSources': [[tango._tango.CmdArgType.DevVarStringArray, 'list of components'], [tango._tango.CmdArgType.DevString, 'JSON with description of component Datasources']], 'CreateDataSources': [[tango._tango.CmdArgType.DevString, 'JSON dictionary with {``dsname``: ``tangosource``, ...}'], [tango._tango.CmdArgType.DevVoid, '']], 'CreateDynamicComponent': [[tango._tango.CmdArgType.DevVarStringArray, 'list of JSON strings with datasource parameters'], [tango._tango.CmdArgType.DevString, 'name of dynamic Component']], 'CreateWriterConfiguration': [[tango._tango.CmdArgType.DevVarStringArray, 'list of required components'], [tango._tango.CmdArgType.DevString, 'XML Settings']], 'DataSourceDescription': [[tango._tango.CmdArgType.DevVarStringArray, 'list of required datasources'], [tango._tango.CmdArgType.DevVarStringArray, 'list of JSON with description of CLIENT Datasources']], 'DeleteAllProfiles': [[tango._tango.CmdArgType.DevVoid, ''], [tango._tango.CmdArgType.DevVoid, '']], 'DeleteProfile': [[tango._tango.CmdArgType.DevString, 'mntgrp name'], [tango._tango.CmdArgType.DevVoid, '']], 'ExportEnvProfile': [[tango._tango.CmdArgType.DevVoid, ''], [tango._tango.CmdArgType.DevVoid, '']], 'FetchProfile': [[tango._tango.CmdArgType.DevVoid, ''], [tango._tango.CmdArgType.DevVoid, '']], 'FullDeviceNames': [[tango._tango.CmdArgType.DevVoid, ''], [tango._tango.CmdArgType.DevString, 'JSON Dictionary with full device names for  all aliases ']], 'ImportEnvProfile': [[tango._tango.CmdArgType.DevVoid, ''], [tango._tango.CmdArgType.DevVoid, '']], 'ImportMntGrp': [[tango._tango.CmdArgType.DevVoid, ''], [tango._tango.CmdArgType.DevVoid, '']], 'IsMntGrpUpdated': [[tango._tango.CmdArgType.DevVoid, ''], [tango._tango.CmdArgType.DevBoolean, 'true if mntgrp changed']], 'LoadProfile': [[tango._tango.CmdArgType.DevVoid, ''], [tango._tango.CmdArgType.DevVoid, '']], 'MandatoryComponents': [[tango._tango.CmdArgType.DevVoid, ''], [tango._tango.CmdArgType.DevVarStringArray, 'component names']], 'MntGrpConfiguration': [[tango._tango.CmdArgType.DevVoid, ''], [tango._tango.CmdArgType.DevString, 'mntgrp configuration string']], 'MutedChannels': [[tango._tango.CmdArgType.DevVoid, ''], [tango._tango.CmdArgType.DevVarStringArray, 'list of muted channels']], 'PoolElementNames': [[tango._tango.CmdArgType.DevString, 'pool list attribute name'], [tango._tango.CmdArgType.DevVarStringArray, 'list of available pool elements']], 'PreselectComponents': [[tango._tango.CmdArgType.DevVoid, ''], [tango._tango.CmdArgType.DevVoid, '']], 'PreselectedComponents': [[tango._tango.CmdArgType.DevVoid, ''], [tango._tango.CmdArgType.DevVarStringArray, 'component names']], 'PreselectedDataSources': [[tango._tango.CmdArgType.DevVoid, ''], [tango._tango.CmdArgType.DevVarStringArray, 'datasources names']], 'RemoveDynamicComponent': [[tango._tango.CmdArgType.DevString, 'name of dynamic Component'], [tango._tango.CmdArgType.DevVoid, '']], 'ResetPreselectedComponents': [[tango._tango.CmdArgType.DevVoid, ''], [tango._tango.CmdArgType.DevVoid, '']], 'SaveProfile': [[tango._tango.CmdArgType.DevVoid, ''], [tango._tango.CmdArgType.DevVoid, '']], 'ScanEnvVariables': [[tango._tango.CmdArgType.DevVoid, ''], [tango._tango.CmdArgType.DevString, 'environment data']], 'SelectedComponents': [[tango._tango.CmdArgType.DevVoid, ''], [tango._tango.CmdArgType.DevVarStringArray, 'component names']], 'SelectedDataSources': [[tango._tango.CmdArgType.DevVoid, ''], [tango._tango.CmdArgType.DevVarStringArray, 'profile datasources']], 'SetChannelProperties': [[tango._tango.CmdArgType.DevVarStringArray, 'a two element list with a property type and JSON value dictionary {channel:property}'], [tango._tango.CmdArgType.DevVoid, '']], 'SetScanEnvVariables': [[tango._tango.CmdArgType.DevString, 'environment data'], [tango._tango.CmdArgType.DevLong, 'scanID']], 'StoreProfile': [[tango._tango.CmdArgType.DevVoid, ''], [tango._tango.CmdArgType.DevVoid, '']], 'SwitchProfile': [[tango._tango.CmdArgType.DevVoid, ''], [tango._tango.CmdArgType.DevVoid, '']], 'SyncProfile': [[tango._tango.CmdArgType.DevVoid, ''], [tango._tango.CmdArgType.DevVoid, '']], 'UpdateConfigVariables': [[tango._tango.CmdArgType.DevVoid, ''], [tango._tango.CmdArgType.DevVoid, '']], 'UpdateMntGrp': [[tango._tango.CmdArgType.DevVoid, ''], [tango._tango.CmdArgType.DevString, 'configuration']], 'UpdateProfile': [[tango._tango.CmdArgType.DevVoid, ''], [tango._tango.CmdArgType.DevString, 'mntgrp configuration string']], 'VariableComponents': [[tango._tango.CmdArgType.DevVoid, ''], [tango._tango.CmdArgType.DevString, 'JSON Dictionary with all Components for   configuration variable']]}

(dict <str, [[ tango.CmdArgType, str]] >) Command definitions

device_property_list = {'AdminDataNames': [tango._tango.CmdArgType.DevVarStringArray, 'list of administrator data names', []], 'Backend': [tango._tango.CmdArgType.DevString, 'scan backend, i.e. sardana, bliss or null (without scan control system)', ['sardana']], 'CacheConfiguration': [tango._tango.CmdArgType.DevBoolean, 'cache writer configuration in configuration server as \n__configuration_<profile_name>__ components', [False]], 'CheckDescription': [tango._tango.CmdArgType.DevBoolean, 'apply checks for preselected components', [True]], 'ClientRecordKeys': [tango._tango.CmdArgType.DevVarStringArray, 'list of record keys for CLIENT datasources', []], 'DefaultCanFailDataSources': [tango._tango.CmdArgType.DevVarStringArray, 'list of default datasources in the CanFail mode', []], 'DefaultMntGrp': [tango._tango.CmdArgType.DevString, 'default measurement group name', ['nxsmntgrp']], 'DefaultNeXusPath': [tango._tango.CmdArgType.DevString, 'default NeXus path', ["/$var.entryname#'scan'$var.serialno:NXentry/instrument:NXinstrument/collection"]], 'DefaultNeXusType': [tango._tango.CmdArgType.DevString, 'default dynamic component NeXus data type', ['NX_CHAR']], 'DefaultPreselectedComponents': [tango._tango.CmdArgType.DevVarStringArray, 'list of default preselected components', []], 'DefaultTimeZone': [tango._tango.CmdArgType.DevString, 'default Time Zone', ['Europe/Berlin']], 'DefaultUserDataPath': [tango._tango.CmdArgType.DevString, 'default NeXus User Data path', ["/$var.entryname#'scan'$var.serialno:NXentry/user_data:NXparameters"]], 'GlobalUserData': [tango._tango.CmdArgType.DevBoolean, 'use global user data dictionary', [False]], 'MasterTimer': [tango._tango.CmdArgType.DevBoolean, 'set the master timer/monitor channel for older MG', [False]], 'MasterTimerFirst': [tango._tango.CmdArgType.DevBoolean, 'the master timer channel of MG with the index: 0', [True]], 'MergeProfilesToMntGrps': [tango._tango.CmdArgType.DevBoolean, 'merge profiles to available measurement groups', [False]], 'MutedChannelFilters': [tango._tango.CmdArgType.DevVarStringArray, 'list of muted channel filters', []], 'MutedMotorFilters': [tango._tango.CmdArgType.DevVarStringArray, 'list of muted motor filters', []], 'MutedPreScanAttrFilters': [tango._tango.CmdArgType.DevVarStringArray, 'list of muted attribute channel filters for PreScanSnapshot', []], 'NumberOfThreads': [tango._tango.CmdArgType.DevLong, 'maximal number of threads', [20]], 'PoolBlacklist': [tango._tango.CmdArgType.DevVarStringArray, 'blacklist of pools', []], 'ResetInvalidDoor': [tango._tango.CmdArgType.DevBoolean, 'reset Door when it is invalid', [True]], 'SyncMntGrp': [tango._tango.CmdArgType.DevBoolean, 'selection merges the current Measurement Group', [False]], 'SyncSnapshot': [tango._tango.CmdArgType.DevBoolean, 'preselection merges the current ScanSnapshot', [False]], 'TangoSourceErrorStates': [tango._tango.CmdArgType.DevVarStringArray, 'list of tango error states for tango datasources', ['OFF', 'INIT', 'INSERT', 'CLOSE', 'UNKNOWN', 'FAULT']], 'TangoSourceWarningStates': [tango._tango.CmdArgType.DevVarStringArray, 'list of tango warning states for tango datasources', ['ALARM', 'DISABLE']], 'TimerFilters': [tango._tango.CmdArgType.DevVarStringArray, 'list of timer device name filters', []], 'WriteAllMotorPositions': [tango._tango.CmdArgType.DevBoolean, 'add dynamic components for all pool motor positions', [False]], 'WritePoolMotorPositions': [tango._tango.CmdArgType.DevBoolean, 'add dynamic components for pool motor positions without any omponent', [False]]}

(dict <str, [ str, tango.CmdArgType, [ list <int> ] ] > ) Device Properties

nxsrecconfig.ProfileManager module

ProfileManager

nxsrecconfig.ProfileManager.DEFAULT_RECORD_KEYS = ['serialno', 'end_time', 'start_time', 'point_nb', 'timestamps', 'scan_title', 'filename', 'end_reason']

(list <str>) default data names

nxsrecconfig.ProfileManager.NXSTOOLS = True

(bool) flag for nxstools installed

class nxsrecconfig.ProfileManager.ProfileManager(selector, syncsnapshot=False, writepoolmotorpositions=False, writeallmotorpositions=False, syncmntgrp=False, checkdescription=True)[source]

Bases: object

Manages Measurement Group and Profile from Selector

constructor

Parameters:
  • selector (nxsrecconfig.Selector.Selector) – selector object

  • syncsnapshot (bool) – preselection merges current ScanSnapshot

  • writepoolmotorpositions (bool) – add dynamic components for pool motor positions without any component

  • writeallmotorpositions (bool) – add dynamic components for all pool motor positions

  • syncmntgrp (bool) – selection merges current Measurement Group

  • checkdescription (bool) – apply checks for preselected components

availableMntGrps()[source]

available mntgrps

Returns:

list of available measurement groups

Return type:

list <str>

checkdescription

(bool) apply checks for preselected components

clientRecordKeys

(list <str>) client record keys

componentDataSources()[source]

provides a list of Component DataSources

Returns:

list of component datasources

Return type:

list <str>

components()[source]

provides selected components

Returns:

list of available selected components

Return type:

list <str>

cpdescription(full=False)[source]

provides description of components

Parameters:

full (bool) – if True describes all available ones are taken otherwise selectect, preselected and mandatory

Returns:

description of required components

Return type:

[dict <str, dict <str, list <(str, str, str, str, list <int>)> > > ] or [{“dsname”: str, “strategy”: str, “dstype”: str, “record”: str, “nxstype”: str, “shape”: list <int> , “cpname”: str}, …]

createDataSources(tangods, dsg=None)[source]

adds known and creates unknown datasources

Parameters:
  • tangods (list < [str , str , str ] >) – tango datasources list with elements (name, label, source)

  • dsg (dict <str, bool or None>) – datasource selection dictionary

Returns:

dictionary with of source alias names

Return type:

dict <str , str >

dataSources()[source]

provides selected datasources

Returns:

list of available selected datasources

Return type:

list <str>

defaultPreselectedComponents

(list <str>) default preselectedComponents

deleteProfile(name)[source]

deletes mntgrp

Parameters:

name (str) – mntgrp name

fetchProfile(sync=False)[source]

fetches the profile configuration

Parameters:

sync (bool) – sync snapshot or motor positions

getPoolMotors()[source]

available mntgrps

Returns:

list of available measurement groups

Return type:

list <str>

importMntGrp()[source]

import setting from active measurement

isMntGrpUpdated()[source]

check if active measurement group was changed

Returns:

True if it is different to the current setting

Return type:

bool

masterTimer

(bool ) set master timer/monitor like for older MGs

masterTimerFirst

(bool ) master timer/monitor with the first index

mntGrpConfiguration()[source]

provides configuration of mntgrp

Returns:

string with mntgrp configuration

Return type:

str

mutedMotorFilters

(list <str>) muted motor filters

mutedPreScanAttrFilters

(list <str>) muted PreScan attribute filters

preselectedComponents()[source]

provides preselected components

Returns:

list of available preselected components

Return type:

list <str>

preselectedDataSources()[source]

provides preselected datasources

Returns:

list of available preselected components

Return type:

list <str>

switchProfile(toActive=True)[source]

switchProfile to active measurement

Parameters:

toActive (bool) – if False update the current profile

timerFilters

(list <str>) timer filters

updateProfile(sync=False, resetDoor=False)[source]

sets active measurement group from components and import setting from active measurement

Parameters:
  • sync (bool) – make profile and mntgrp synchronization

  • sync – reset door device name flag

Returns:

json dictionary with mntgrp configuration information

Return type:

str

writeallmotorpositions

(bool) add dynamic components for all pool motor positions

nxsrecconfig.Release module

NeXus Sardana Recorder Settings - Release

nxsrecconfig.ScanBackend module

scan backend interface, i.e. the control system of the scans

The selector settings access the control system running the scans, e.g. Sardana, only via a scan backend: its scan environment, its channels (given by pools in Sardana), its measurement groups and its targets (doors in Sardana).

class nxsrecconfig.ScanBackend.ScanBackend(numberOfThreads=None)[source]

Bases: object

scan backend interface

constructor

Parameters:

numberOfThreads (str) – number of threads

channelSource(name)[source]

provides the tango source of a channel

Parameters:

name (str) – channel name

Returns:

tango attribute name or None

Return type:

str

checkChannels(door, configdevice, channels, componentgroup, datasourcegroup, channelerrors)[source]

checks component channels

Parameters:
Returns:

json dictionary with selected active components

Return type:

str

createMntGrp(pool, name, timer)[source]

creates a measurement group

Parameters:
dataSourceTypes = []

(list <str>) types of STEP datasources without channels which are read by the scan system via selectDataSources()

defaultDoor(db)[source]

provides the default target of the scans

Parameters:

db (tango.Database) – tango database

Returns:

target name, e.g. door device name

Return type:

str

deleteMntGrp(pool, name)[source]

deletes a measurement group

Parameters:
getEnv(var, ms)[source]

provides a scan environment variable

Parameters:
  • var (str) – variable name

  • ms (str) – scan server name, e.g. macroserver device name

Returns:

variable value

Return type:

any

getMacroServer(door)[source]

provides the scan server name for given target

Parameters:

door (str) – target name, e.g. door device name

Returns:

scan server name, e.g. macroserver device name

Return type:

str

getPools(door)[source]

provides channel sources, i.e. sardana pool proxies

Parameters:

door (str) – target name, e.g. door device name

Returns:

pool proxies, an empty list without pools

Return type:

list <tango.DeviceProxy>

getScanEnv(door)[source]

provides scan file variables of the scan environment

Parameters:

door (str) – target name, e.g. door device name

Returns:

JSON string with the variables

Return type:

str

getSelectorEnv(door, names, data)[source]

provides selector variables from the scan environment

Parameters:
  • door (str) – target name, e.g. door device name

  • names (list <str>) – names of variables

  • data (dict <str, any>) – dictionary to be filled with the variables

isDoorRunning(ms)[source]

checks if a scan is running

Parameters:

ms (str) – scan server name, e.g. macroserver device name

Returns:

True if a scan is running

Return type:

bool

isDoorValid(door)[source]

checks if the target of the scans is valid

Parameters:

door (str) – target name, e.g. door device name

Returns:

True if valid

Return type:

bool

mntGrpConfiguration(device)[source]

provides the measurement group configuration

Parameters:

device (str) – measurement group device name

Returns:

JSON configuration

Return type:

str

name = None

(str) backend name

nonExistingChannels(door, channels)[source]

provides the channels which are not known to the backend

Parameters:
  • door (str) – target name, e.g. door device name

  • channels (list <str>) – channel names

Returns:

channels not provided by the backend

Return type:

list <str>

poolBlacklist

(list <str>) black list of pools

selectChannels(ms, mntgrp, channels)[source]

selects channels of a measurement group of the scan system

It is used by backends without measurement group devices and with selectsChannels

Parameters:
  • ms (str) – scan server name

  • mntgrp (str) – measurement group name

  • channels (list <str>) – ordered channel names

selectDataSources(ms, mntgrp, datasources)[source]
selects STEP datasources without channels of the scan system

to be read in scans of a measurement group

It is used by backends with dataSourceTypes

Parameters:
  • ms (str) – scan server name

  • mntgrp (str) – measurement group name

  • datasources (dict <str, dict>) – datasource descriptions by datasource names, i.e. dictionaries with xml definitions, nxtype NeXus types and rank

selectsChannels = False

(bool) the backend selects channels of its measurement groups by selectChannels() for backends without measurement group devices

setEnv(var, value, ms)[source]

sets a scan environment variable

Parameters:
  • var (str) – variable name

  • value (any) – variable value

  • ms (str) – scan server name, e.g. macroserver device name

setEnvs(varvalues, ms)[source]

sets scan environment variables

Parameters:
  • varvalues (dict <str, any>) – variable names and values

  • ms (str) – scan server name, e.g. macroserver device name

setMntGrpConfiguration(device, conf)[source]

sets the measurement group configuration

Parameters:
  • device (str) – measurement group device name

  • conf (str) – JSON configuration

Returns:

the configuration read back from the device

Return type:

str

setScanEnv(door, jdata)[source]

sets scan file variables of the scan environment

Parameters:
  • door (str) – target name, e.g. door device name

  • jdata (str) – JSON string with the variables

Returns:

scan id

Return type:

int

setSelectorEnv(door, data, cmddata=None)[source]

stores selector variables in the scan environment

Parameters:
  • door (str) – target name, e.g. door device name

  • data (dict <str, any>) – variables

  • cmddata (dict <str, any>) – command variables

supportsMntGrps = False

(bool) the backend provides measurement group devices

tangoSourceErrorStates

(list <str>) tango datasources off states

tangoSourceWarningStates

(list <str>) tango datasources warning states

testMntGrpConfiguration(device, conf)[source]
provides the configuration the measurement group makes of conf

and restores its current configuration

Parameters:
  • device (str) – measurement group device name

  • conf (str) – JSON configuration

Returns:

the configuration read back from the device

Return type:

str

updateMacroServer(door)[source]

updates the scan server and its channel sources for given target

Parameters:

door (str) – target name, e.g. door device name

Returns:

scan server name, e.g. macroserver device name

Return type:

str

usetEnv(var, ms)[source]

unsets a scan environment variable

Parameters:
  • var (str) – variable name

  • ms (str) – scan server name, e.g. macroserver device name

nxsrecconfig.Selection module

Selection state

class nxsrecconfig.Selection.Selection(*args, **kw)[source]

Bases: dict

Selection Dictionary which contains the following records: { “Timer”: ‘[]’, “OrderedChannels”: ‘[]’, “ComponentSelection”: ‘{}’, “DataSourceSelection”: ‘{}’, “DataSourcePreselection”: ‘{}’, “ComponentPreselection”: ‘{}’, “PreselectingDataSources”: ‘[]’, “OptionalComponents”: ‘[]’, “AppendEntry”: False, “ComponentsFromMntGrp”: False, “ConfigVariables”: ‘{}’, “UserData”: ‘{}’, “ChannelProperties”: ‘{}’, “UnplottedComponents”: ‘[]’, “DynamicComponents”: True, “DefaultDynamicLinks”: True, “DefaultDynamicPath”: ‘/$var.entryname#’scan’$var.serialno:NXentry’ ‘/instrument:NXinstrument/collection’, “TimeZone”: self.__defaultzone, “ConfigDevice”: ‘’, “WriterDevice”: ‘’, “Door”: ‘’, “MntGrp”: ‘’, “Version”: self.__version, “MntGrpConfiguration”: ‘’ }

constructor

Parameters:
  • args (list <any>) – dictionary args

  • kw (dict <str, any>) – dictionary kw

deselect()[source]

deselects components and datasources

reset()[source]

resets dictionary to default value

resetMntGrp()[source]

reset method for mntGrp attribute

Brief:

If MntGrp not defined set it to default value

resetPreselectedComponents(components)[source]

resets Preselected Components with given components and set them to not active :param components: list of components to be set :type components: list <str>

resetTimeZone()[source]

reset method for timeZone attribute

Brief:

If TimeZone not defined set it to default value

updateChannelProperties(devicecontrollers, triggergate)[source]

update method for orderedChannels attribute

Brief:

sets pool channels in order defined by OrderedChannels

Parameters:
  • devicecontrollers (dict <str, str>) – device controller dictionary

  • triggergate (list <str>) – trigger gate list

updateComponentSelection()[source]

update method for componentGroup attribute

Brief:

It removes datasource components from component group

updateDataSourceSelection(channels, datasources)[source]

update method for dataSourceGroup attribute

Brief:

It removes datasources from DataSourceSelection if they are neither in poolchannels nor in avaiblable datasources It adds new channels to DataSourceSelection

Parameters:
  • channels (list <str>) – pool channels

  • datasources (list <str>) – available datasources

updateOrderedChannels(channels)[source]

update method for orderedChannels attribute

Brief:

sets pool channels in order defined by OrderedChannels

Parameters:

channels (list <str>) – pool channels

updatePreselectingDataSources(datasources)[source]

update method for Preselected DataSources

Brief:

appends new datasources to Preselected DataSources

Parameters:

datasources (list <str>) – list of datasources

nxsrecconfig.Selector module

Selection state

class nxsrecconfig.Selector.Selector(macroserverpools, version, defaultpath="/$var.entryname#'scan'$var.serialno:NXentry/instrument:NXinstrument/collection", defaulttimezone='Europe/Berlin', defaultmntgrp='nxsmntgrp')[source]

Bases: object

access class to Selection dictionary and Config Device

constructor

Parameters:
  • macroserverpools (nxsrecconfig.MacroServerPools.MacroServerPools) – MacroServerPools object

  • version (str) – selector version

  • defaultpath (str) – default dynamic component path

  • defaultpath – default dynamic component path

  • defaulttimezone (str) – default time zone

  • defaultmntgrp (str) – default measurement group name

property backend

scan backend

Returns:

scan backend

Return type:

nxsrecconfig.ScanBackend.ScanBackend

configCommand(command, *var)[source]

executes command on configuration server

Parameters:
  • command (str) – command name

  • var ([ any ]) – parameter list

Returns:

command result

Return type:

any

descErrors

(list <str>) error descriptions

deselect()[source]

deselects all seleciton elements

exportEnv(data=None, cmddata=None)[source]

exports Selector Environment Data

Parameters:
  • data (dict <str , any>) – dictionary with input data

  • cmddata (dict <str , any>) – dictionary with command input data

fetchSelection()[source]

fetch configuration

Returns:

if configuration was fetched

Return type:

bool

get()[source]

provides selection data

Returns:

selection data

Return type:

dict <str, any>

getMacroServer()[source]

provides MacroServer name

Returns:

MacroServer name

Return type:

str

getPools()[source]

provides pool proxies

Returns:

list of pool proxies

Return type:

list <tango.DeviceProxy>

getScanEnvVariables()[source]

gets Scan Environment Data

Returns:

JSON String with important variables

Return type:

str

importEnv(names=None, data=None)[source]

imports Selector Environment Data

Parameters:
  • names (list <str>) – names of required variables

  • data (dict <str , any>) – dictionary with resulting data

isDoorValid()[source]

checks if Door valid

Returns:

valid Door device flag

Return type:

bool

keys()[source]

provides all names of variables

Returns:

selection keys

Return type:

list <str>

moduleLabel

(str) module label

poolElementNames(listattr)[source]

provides names from the given pool listattr

Parameters:

listattr (str) – pool attribute with list

Returns:

names from given pool listattr

Return type:

list <str>

preselect()[source]

updates active state of preselected components

Brief:

It provides new group of preselected components

reset()[source]

resets seleciton except Door and ConfigDevice

resetPreselectedComponents(components)[source]

resets preselected components to set of given components

Parameters:

components (list <str>) – new selection preselected components

set(state)[source]

sets selection from state data

Parameters:

state (dict <str, any>) – state data

setConfigInstance()[source]

sets config instances

Returns:

set config instance

Return type:

tango.DeviceProxy or nxsconfigserver.XMLConfigurator.XMLConfigurator

setScanEnvVariables(jdata)[source]

sets Scan Environment Data

Parameters:

jdata (str) – JSON String with important variables

storeSelection()[source]

saves configuration

nxsrecconfig.Settings module

NeXus Sardana Recorder Settings implementation

class nxsrecconfig.Settings.Settings(server=None, numberofthreads=None, defaultnexuspath=None, defaulttimezone=None, defaultmntgrp=None, syncsnapshot=False, writepoolmotorpositions=False, writeallmotorpositions=False, defaultnexustype=None, defaultudatapath=None, globaluserdata=False, cacheconfiguration=False, syncmntgrp=False, checkdescription=True, backend=None)[source]

Bases: object

NeXus Sardana Recorder settings

contructor

Parameters:
  • server (nxsrecconfig.NXSConfig.NXSRecSelector) – NXSRecSelector server

  • numberofthreads (str) – number of threads used to check device state

  • defaultnexuspath (str) – default dynamic component path

  • syncsnapshot (bool) – preselection merges current ScanSnapshot

  • writepoolmotorpositions (bool) – add dynamic components for all pool motor positions

  • defaultnexustype (str) – default dynamic component nexus type

  • defaultudatapath (str) – default user data dynamic component path

  • globaluserdata (bool) – global user data flag

  • cacheconfiguration (bool) – cache writer configuration in configServer

  • syncmntgrp (bool) – selection merges current Measurement Group

  • checkdescription (bool) – apply checks for preselected components

  • backend (str) – scan backend name, i.e. sardana, bliss or null, sardana if None

addStepDataSources(datasources)[source]

describe datasources

Parameters:

datasources (list <str>) – list for datasource names

Returns:

list of datasources not found in components

Return type:

list <str>

adminDataNames

(list <str>) administator data

administratorDataNames()[source]

provides administrator data names

Returns:

list of provides administrator data names

Return type:

list <str>

property appendEntry

(bool) the json data string

availableComponents()[source]

available components

Returns:

list of available components

Return type:

list <str>

availableDataSources()[source]

available datasources

Returns:

list of available datasources

Return type:

list <str>

availableMntGrps()[source]

available mntgrps

Returns:

list of available measurement groups

Return type:

list <str>

availableProfiles()[source]

available selections

Returns:

list of available selections

Return type:

list <str>

availableTimers()[source]

provides available Timers from MacroServer pools

Returns:

available Timers from MacroServer pools

Return type:

list <str>

property backend

(str) scan backend name

property cacheComponent

(str) server version

cacheConfiguration

(bool) cache writer configuration in configServer

cacheWriterConfiguration(cps)[source]

create cache and clean stepdatasources and linkdatasources

Parameters:

cps (list <str>) – component names

Returns:

JSON string with description of client datasources

Return type:

str

property canfaildatasources

(str) the json data string

channelProperties(ptype)[source]

provides channel properties of the given type

Parameters:

ptype (str) – property type

Returns:

json dictionary with channel properties

Return type:

str

clearCache()[source]

clear Cache

property clientRecordKeys

(list <str>) client record keys

componentClientSources(cps)[source]

provides description of client datasources

Parameters:

cps (list <str>) – component names

Returns:

JSON string with description of client datasources

Return type:

str

componentDataSources()[source]

provides a list of profile component DataSources

Returns:

list of profile component datasources

Return type:

list <str>

componentDescription()[source]

provides description of all components

Returns:

JSON string with description of all components

Return type:

str

componentSources(cps)[source]

provides description of datasources

Parameters:

cps (list <str>) – component names

Returns:

JSON string with description of client datasources

Return type:

str

property components

(list <str>) provides selected components

property configDevice

(str) the json data string

property configVariables

(str) the json variables string

createDataSources(datasources)[source]

describe datasources

Parameters:

datasources (str) – JSON dictionary with {dsname: tangosource, …}

createDynamicComponent(params)[source]

creates dynamic component

Parameters:

params (list <str>) – datasource parameters

Returns:

dynamic component name

Return type:

str

createWriterConfiguration(cps)[source]

create configuration and clean stepdatasources and linkdatasources

Parameters:

cps (list <str>) – component names

Returns:

JSON string with description of client datasources

Return type:

str

dataSourceDescription(datasources)[source]

describe datasources

Parameters:

datasources (list <str>) – list for datasource names

Returns:

list of dictionary with description of datasources

Return type:

[{“dsname”: str, “dstype”: str, “record”: str}, …]

property dataSources

(list <str>) provides all selected data sources

defaultCanFailDataSources

(list <str>) default CanFail DataSources

defaultMntGrp

(str) default measurement group

defaultNeXusPath

(str) default NeXus path

defaultNeXusType

(str) default NeXus type

property defaultPreselectedComponents

(list <str>) default PreselectedComponents

defaultTimeZone

(str) default time zone

defaultUserDataPath

(str) default NeXus path

deleteAllProfiles()[source]

clear all selections

deleteProfile(name)[source]

deletes mntgrp

Parameters:

name (str) – mntgrp name

property descriptionErrors

(list <str>) provides preselected components

property deviceGroups

(str) the json data string

property door

(str) the json data string

exportEnvProfile()[source]

exports all Enviroutment Data

property extralinkdatasources

(str) the json data string

fetchProfile()[source]

fetch configuration

fullDeviceNames()[source]

provides full names of pool devices

Returns:

JSON string with full names of pool devices

Return type:

str

globalUserData

(bool) global user data flag

importEnvProfile()[source]

imports all Enviroutment Data

importMntGrp()[source]

import setting from active measurement

isMntGrpUpdated()[source]

check if active measurement group was changed

Returns:

True if it is different to the current setting

Return type:

bool

property linkdatasources

(str) the json data string

loadProfile()[source]

loads configuration

property macroServer

(str) the json data string

mandatoryComponents()[source]

mandatory components

Returns:

list of mandatory components

Return type:

list <str>

property masterTimer

(bool) set master channels

property masterTimerFirst

(bool) master channels with the 0 index

mergeProfilesToMntGrps

(bool) merge profiles to available measurement groups

property mntGrp

(str) the json data string

mntGrpConfiguration()[source]

provides configuration of mntgrp

Returns:

string with mntgrp configuration

Return type:

str

mutedChannelFilters

(list <str>) muted channel filters

mutedChannels()[source]

provides muted channels from pool

Returns:

muted channels from pool

Return type:

list <str>

property mutedMotorFilters

(list <str>) muted motor filters

property mutedPreScanAttrFilters

(list <str>) muted prescan attribute filters

names()[source]

provides names of variables

Returns:

all names of variables

Rtypes:

list <str>

numberOfThreads

(int) number of threads

property poolBlacklist

(list <str>) black list of pools

poolElementNames(listattr)[source]

provides names from given pool listattr

Parameters:

listattr (str) – name of pool attribute with a element list

Returns:

names from given pool listattr

Return type:

list <str>

preselectComponents()[source]

checks existing controllers of pools

preselectedComponents()[source]

provides preselected components

Returns:

list of available preselected components

Return type:

list <str>

preselectedDataSources()[source]

provides preselected datasources

Returns:

list of available preselected datasources

Return type:

list <str>

property profileConfiguration

(str) the json data string

profileFile

(str) configuration file

removeDynamicComponent(name)[source]

removes dynamic component

Parameters:

name (str) – dynamic component name

resetInvalidDoor

(bool) reset Door when it is invalid

resetPreselectedComponents()[source]

reset preselected Components to defaultPreselectedComponents

saveProfile()[source]

saves configuration

property scanDir

the json data string

scanEnvVariables()[source]

gets Scan Environment Data

Returns:

JSON String with important variables

Return type:

str

property scanFile

(str) the json data string

property scanID

(int) the json data string

selectedComponents()[source]

provides user selected components

Returns:

list of available selected components

Return type:

list <str>

selectedDataSources()[source]

provides selected datasources

Returns:

list of available selected datasources

setChannelProperties(typeandvariables)[source]

sets channel properties of the given type

Parameters:

typeandvariables ((str, str)) – (property type, json dictionary of channel propertie values)

setScanEnvVariables(jdata)[source]

sets Scan Environment Data

Parameters:

jdata (str) – JSON String with important variables

property stepdatasources

(str) the json data string

storeProfile()[source]

saves configuration

switchProfile(toActive=True)[source]

switch to active measurement

Parameters:

toActive (bool) – if False update the current profile

syncMntGrp

(bool) selection merges current Measurement Group

syncProfile()[source]

fetch configuration

syncSnapshot

(bool) preselection merges current ScanSnapshot

property tangoSourceErrorStates

(list <str>) tango source fault state

property tangoSourceWarningStates

(list <str>) tango source alarm state

property timerFilters

(list <str>) timer filters

updateConfigVariables()[source]

sends ConfigVariables into ConfigServer and updates serialno if appendEntry selected

updateMntGrp()[source]

set active measurement group from components

Returns:

string with mntgrp configuration

Return type:

str

updateProfile()[source]

update profile and measurement group

Returns:

string with mntgrp configuration

Return type:

str

property userData

(str) the json data string

value(name)[source]

provides values of the required variable

Parameters:

name (str) – name of the required variable

Returns:

values of the required variable

Return type:

any

variableComponents()[source]

provides components for all variables

Returns:

json dictionary with components for all variables

Return type:

str

property version

(str) server version

writeallmotorpositions

(bool) add dynamic components for all pool motor positions

writepoolmotorpositions

(bool) add dynamic components for pool motor positions without any component

property writerDevice

(str) the json data string

nxsrecconfig.StreamSet module

labels to Tango Streams

class nxsrecconfig.StreamSet.StreamSet(streams)[source]

Bases: object

streamset constractor

Parameters:

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

debug(message, std=None)[source]

writes debug message

Parameters:
  • message (str) – debug message

  • std (bool) – True if it writes to sys stream when log stream does not exist

error(message, std=None)[source]

writes error message

Parameters:
  • message (str) – error message

  • std (bool) – True if it writes to sys stream when log stream does not exist

fatal(message, std=None)[source]

writes fatal error message

Parameters:
  • message (str) – error message

  • std (bool) – True if it writes to sys stream when log stream does not exist

info(message, std=None)[source]

writes info message

Parameters:
  • message (str) – info message

  • std (bool) – True if it writes to sys stream when log stream does not exist

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

warn(message, std=None)[source]

writes warning message

Parameters:
  • message (str) – warning message

  • std (bool) – True if it writes to sys stream when log stream does not exist

nxsrecconfig.Utils module

Tango Utilities

class nxsrecconfig.Utils.MSUtils[source]

Bases: object

MacroServer Utilities

classmethod getEnv(var, ms)[source]

provides environment variable value

Parameters:
  • var (str) – variable name

  • ms (str) – macroserver

Returns:

environment variable value

Return type:

any

classmethod getMacroServer(db, door, find=True)[source]

provides macro server of given door

Parameters:
  • db (tango.Database) – tango database

  • door (str) – given door

  • find (bool) – find new macroserver if door does not exist

Returns:

first MacroServer of the given door

Return type:

str

classmethod setEnv(var, value, ms)[source]

sets environment variable value

Parameters:
  • var (str) – variable name

  • value (any) – variable value

  • ms (str) – macroserver

classmethod setEnvs(varvalues, ms)[source]

sets environment variable value

Parameters:
  • varvalues (dict <str , any>) – variable value dictionary

  • ms (str) – macroserver

classmethod usetEnv(var, ms)[source]

unsets environment variable

Parameters:
  • var (str) – variable name

  • ms (str) – macroserver

classmethod writeEnvAttr(value, dp)[source]

sets environment variable value

Parameters:
  • value (dict <str , any> or any) – variable value dictionary

  • dp (str) – macroserver

exception nxsrecconfig.Utils.OldTangoError[source]

Bases: Exception

Old Tango version Exception class

nxsrecconfig.Utils.PYTG_BUG_213 = False

(bool) tango bug #213 flag related to EncodedAttributes in python3

class nxsrecconfig.Utils.PoolUtils[source]

Bases: object

Pool Utilities

classmethod filterNames(pools, filters=None, lst=None)[source]

provides channels of given pools

Parameters:
Returns:

list of channel names

Return type:

list <str>

classmethod filterOutTango(lst, filters=None)[source]

provides channels of given pools

Parameters:
  • lst (list <str or (str, str)>) – list of strings to filter out

  • filters (list <str>) – device name filter list

Returns:

list of channel names

Return type:

list <str>

classmethod getAliases(pools, names=None)[source]

find aliases from fullnames

Parameters:
Returns:

full device name

Return type:

dict <str, str>

classmethod getChannelSources(pools, devices)[source]

provides channel sources

Parameters:
Returns:

device sources

Return type:

dict <str, str>

classmethod getDeviceControllers(pools, devices=None)[source]

provides device controller full names

Parameters:
Returns:

device controller full names

Return type:

dict <str, str>

classmethod getElementNames(pools, listattr, typefilter=None)[source]

provides experimental Channels

Parameters:
  • pools (list <tango.DeviceProxy>) – list of pool devices

  • listattr (str) – pool attribute with list

  • typefilter (list <str>) – pool attribute with list

Returns:

names from given pool listattr

Return type:

list <str>

classmethod getFullDeviceNames(pools, names=None, listattr='AcqChannelList', lastsubterm=-1)[source]

find device names from aliases

Parameters:
  • pools (list <tango.DeviceProxy>) – list of pool devices

  • names (list <str>) – alias names if None returns name for all aliases

  • listattr (str) – pool attribute with list

  • lastsubterm (int) – last subterm of full_name separated by ‘/’ e.g. -1 or None

Returns:

full device name

Return type:

dict <str, str>

classmethod getMntGrpName(pools, alias)[source]

find measurement group name from alias

Parameters:
Returns:

full name of the measurement group alias

Return type:

str

classmethod getMotorPositionAttributes(pools, filters=None)[source]

find motor names

Parameters:

pools (list <tango.DeviceProxy>) – list of pool devices

Returns:

full name of the measurement group alias

Return type:

str

Returns:

(name , name , motor position attribute)

Return type:

list <str,:obj:str, str>

classmethod getSource(name)[source]

provides datasource from pool device

Parameters:

name (str) – pool device name

Returns:

source of pool device

Return type:

str

classmethod getTimers(pools, filters=None)[source]

provides tiemrs of given pools

Parameters:
Returns:

list of timer names

Return type:

list <str>

class nxsrecconfig.Utils.TangoUtils[source]

Bases: object

Tango Utilities

classmethod command(server, command, *var)[source]

executes command on server on python package

Parameters:
Returns:

command result

Return type:

any

classmethod getDeviceName(db, cname)[source]

finds device of give class

Parameters:
Returns:

device name if exists

Return type:

bool

classmethod getFullAttrName(source, fqdn=False)[source]

provides tango device full name with host and port

Parameters:
  • source (str) – string with device name and its attribute

  • fqdn (bool) – if true adds fqdn host name

Returns:

database host and port in url string

Return type:

str

classmethod getProxies(names)[source]

provides proxies of given device names

Parameters:

names (list <str>) – given device names

Returns:

list of device DeviceProxies

Return type:

list <tango.DeviceProxy>

classmethod getShapeTypeUnit(source)[source]

retrives shape type units for attribure

Parameters:

source (str) – string with device name and its attribute

Returns:

(shape, data_type, units)

Return type:

(list <int>, str, str)

classmethod openProxy(device, counter=1000)[source]

opens device proxy of the given device

Parameters:

device (str) – device name

Returns:

DeviceProxy of device

Return type:

tango.DeviceProxy

tTnp = {tango._tango.CmdArgType.DevBoolean: 'bool', tango._tango.CmdArgType.DevShort: 'int16', tango._tango.CmdArgType.DevLong: 'int32', tango._tango.CmdArgType.DevFloat: 'float32', tango._tango.CmdArgType.DevDouble: 'float64', tango._tango.CmdArgType.DevUShort: 'uint16', tango._tango.CmdArgType.DevULong: 'uint32', tango._tango.CmdArgType.DevString: 'string', tango._tango.CmdArgType.DevUChar: 'uint8', tango._tango.CmdArgType.DevLong64: 'int64', tango._tango.CmdArgType.DevULong64: 'uint64', tango._tango.CmdArgType.DevEncoded: 'encoded'}

(dict <tango.CmdArgType, str>) map of Tango:Numpy types

classmethod wait(proxy, counter=100, state='RUNNING')[source]

waits for device proxy not running

Parameters:

proxy (tango.DeviceProxy) – device proxy

Returns:

if proxy device ready

Return type:

str

class nxsrecconfig.Utils.Utils[source]

Bases: object

Miscellaneous Utilities

MNTGRP_RUNTIME_CHANNEL_KEYS = ['value_stream_ref']

(list <str>) channel keys of measurement group configurations set by Sardana with blissdata publishing, e.g. stream references of running scans

MNTGRP_RUNTIME_CTRL_KEYS = ['streamable']

(list <str>) controller keys of measurement group configurations set by Sardana with blissdata publishing

classmethod compareDict(dct, dct2)[source]

copares two dictionaries

Parameters:
  • dct (dict) – first dictinary

  • dct2 (dict) – second dictinary

Returns:

if dictionaries are the same

Return type:

bool

classmethod dataSourceNode(xml)[source]

provides the datasource node of a datasource XML definition

Parameters:

xml (str) – datasource XML definition

Returns:

datasource node or None

Return type:

lxml.etree.Element

classmethod dataSourceType(xml)[source]

provides the type of a datasource XML definition

Parameters:

xml (str) – datasource XML definition

Returns:

datasource type, e.g. TANGO, DB, PYEVAL or CLIENT

Return type:

str

classmethod getRecord(node)[source]

provides datasource record from xml dom node

Parameters:

node (lxml.etree.Element) – xml DOM node

Returns:

datasource record

Return type:

str

classmethod getText(node)[source]

collects text from text child nodes

Parameters:

node (xml.etree.ElementTree.Element) – parent node

classmethod pickleloads(bytestr)[source]

loads pickle byte string :param bytestr: byte string to convert :type bytesstr: bytes :returns: loaded bytestring :rtype: any

classmethod stringToDictJson(string, toBool=False)[source]

converts string to json dictionary

Parameters:
  • string (str) – string with list of item or json dictionary

  • toBool (bool) – if true convert dictionary values to bool

Returns:

json dictionary

Return type:

str

classmethod stringToListJson(string)[source]

converts string to json list

Parameters:

string (str) – with list of item or json list

Returns:

json list

Return type:

str

classmethod stripMntGrpRuntimeKeys(conf)[source]
removes keys of measurement group configurations which are

set by Sardana at runtime, i.e. stream references of scans and streamable controller flags of blissdata publishing

Parameters:

conf (str or dict) – measurement group configuration

Returns:

configuration without the runtime keys, of the type of the given configuration

Return type:

str or dict

classmethod toString(obj)[source]

converts list/dict/object of unicode/string to string object

Parameters:

obj (any) – given unicode/string object

Returns:

string object

Return type:

str

classmethod tostr(text)[source]

convert bytestr or unicode to python str :param text: text to convert :type text: bytes or unicode or str :returns: converted text :rtype: str

nxsrecconfig.WriterConfiguration module

NXSDataWriter configuration of a selector profile and scan

It creates the XML configuration of NXSDataWriter for a scan from the profile of NXSRecSelector, i.e. the selected components, datasources, user data and configuration variables, and from the scan channels. It is used by the Sardana NeXus recorder and can be used by other scan systems, e.g. BLISS.

class nxsrecconfig.WriterConfiguration.NumpyEncoder(*, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, default=None)[source]

Bases: JSONEncoder

JSON encoder of numpy values

Constructor for JSONEncoder, with sensible defaults.

If skipkeys is false, then it is a TypeError to attempt encoding of keys that are not str, int, float, bool or None. If skipkeys is True, such items are simply skipped.

If ensure_ascii is true, the output is guaranteed to be str objects with all incoming non-ASCII characters escaped. If ensure_ascii is false, the output can contain non-ASCII characters.

If check_circular is true, then lists, dicts, and custom encoded objects will be checked for circular references during encoding to prevent an infinite recursion (which would cause an RecursionError). Otherwise, no such check takes place.

If allow_nan is true, then NaN, Infinity, and -Infinity will be encoded as such. This behavior is not JSON specification compliant, but is consistent with most JavaScript based encoders and decoders. Otherwise, it will be a ValueError to encode such floats.

If sort_keys is true, then the output of dictionaries will be sorted by key; this is useful for regression tests to ensure that JSON serializations can be compared on a day-to-day basis.

If indent is a non-negative integer, then JSON array elements and object members will be pretty-printed with that indent level. An indent level of 0 will only insert newlines. None is the most compact representation.

If specified, separators should be an (item_separator, key_separator) tuple. The default is (’, ‘, ‘: ‘) if indent is None and (‘,’, ‘: ‘) otherwise. To get the most compact JSON representation, you should specify (‘,’, ‘:’) to eliminate whitespace.

If specified, default is a function that gets called for objects that can’t otherwise be serialized. It should return a JSON encodable version of the object or raise a TypeError.

default(obj)[source]

converts numpy values to python values

Parameters:

obj (any) – object to convert

Returns:

converted object

Return type:

any

class nxsrecconfig.WriterConfiguration.WriterConfiguration(selector, conf=None, variables=None, log=None, getalias=None, moveables=None, oddmntgrp=False, cacheprefix='__configuration_', dynamiccp='__dynamic_component__')[source]

Bases: object

NXSDataWriter configuration of a selector profile and scan

constructor

Parameters:
  • selector (tango.DeviceProxy or any) – NXSRecSelector device proxy or nxsrecconfig.Settings.Settings

  • conf (dict <str, any>) – profile configuration of the selector

  • variables (dict <str, any>) – configuration variables, extended by the created configuration, e.g. nexus_components

  • log (logging.Logger or any) – logger with debug, info and warning methods

  • getalias (callable) – provides an alias of a channel or None, tango aliases by default

  • moveables (callable) – provides moveable names of the scan system, used for cache components

  • oddmntgrp (bool) – measurement group not defined by the selector, i.e. profile variables are not used

  • cacheprefix (str) – prefix of cache components

  • dynamiccp (str) – initial dynamic component name

aliases

(list <str>) ordered channel aliases

availableComponents()[source]

provides available components

Returns:

available component names

Return type:

list <str>

availableComps

(list <str>) optional components

cacheprefix

(str) prefix of cache components

collectAliases(envRec)[source]

collects aliases of the scan channels

Parameters:

envRec (dict <str, any>) – scan environment with counters, ref_moveables, column_desc or datadesc

command(command, *args)[source]

executes a selector command

Parameters:
  • command (str) – command name

  • args (list <any>) – command arguments

Returns:

command result

Return type:

any

conf

(dict <str, any>) profile configuration

confVar(var, default, decode=False, pass_default=False)[source]

provides a variable of the profile configuration

Parameters:
  • var (str) – variable name

  • default (any) – default value

  • decode (bool) – True if the variable is a JSON string

  • pass_default (bool) – if True it returns the default value

Returns:

variable value

Return type:

any

create(envRec, userdata)[source]

creates the NXSDataWriter configuration

The created dynamic component has to be removed with removeDynamicComponent() when the scan ends.

Parameters:
  • envRec (dict <str, any>) – scan environment with datadesc, and ref_moveables, counters or column_desc

  • userdata (dict <str, any>) – user data, extended by sanitized missing keys

Returns:

XML configuration

Return type:

str

createDynamicComponent(envRec, dss, keys, udata, nexuscomponents)[source]

creates a dynamic component

Parameters:
  • envRec (dict <str, any>) – scan environment with datadesc

  • dss (list <str>) – datasource names

  • keys (list <str>) – INIT datasource names

  • udata (dict <str, any>) – user data

  • nexuscomponents (list <str>) – component names

Returns:

dynamic component name

Return type:

str

deviceAliases

(dict <str, str>) device aliases

dynamicCP

(str) dynamic component name

dynamicDataSources

(dict <str, None>) dynamic datasources

getalias

(callable) alias provider

log

(logging.Logger or any) logger

moveableDataSources

(list <str>) moveable datasources

moveables

(callable) moveable name provider

oddmntgrp

(bool) measurement group not defined by the selector

removeDynamicComponent()[source]

removes the dynamic component

searchDataSources(nexuscomponents, cfm, dyncp, userkeys)[source]

searches the datasources of the scan in the components

Parameters:
  • nexuscomponents (list <str>) – component names

  • cfm (bool) – components from measurement group flag

  • dyncp (bool) – dynamic components flag

  • userkeys (list <str>) – user data keys

Returns:

selected datasources, datasources not found, components required by datasources, missing user data keys and cache datasources

Return type:

tuple <list <str>, list <str>, dict <str, list <str>>, list <str>, list <str>>

selector

(tango.DeviceProxy or any) selector

serverVar(attr, default, decode=False, pass_default=False)[source]

provides a selector variable

Parameters:
  • attr (str) – variable name

  • default (any) – default value

  • decode (bool) – True if the variable is a JSON string

  • pass_default (bool) – if True it returns the default value

Returns:

variable value

Return type:

any

classmethod shortName(name)[source]

provides a device name without the tango host

Parameters:

name (str) – device name

Returns:

short device name

Return type:

str

tangoAlias(name)[source]

provides a tango alias of a device name

Parameters:

name (str) – device name

Returns:

alias or None

Return type:

str

variables

(dict <str, any>) configuration variables

Module contents

NeXus Sardana Recorder Settings - Tango Server

nxsrecconfig.main()[source]
nxsrecconfig.run(argv)[source]

runs the TANGO server

Parameters:

argv (list <str>) – command-line arguments