System devices

These device classes do not represent actual hardware devices, but they use the same configuration and parameter API as devices and are therefore Device subclasses.

Experiment

The experiment device collects all configuration pertaining to the current experiment – i.e. proposal information, sample, current configuration of detectors and sample environment.

The experiment device is selected in setups using The sysconfig dictionary.

class nicos.experiment.Experiment

Bases: Device

A special singleton device to represent the experiment.

This class is normally subclassed for specific instruments to e.g. select the data paths according to instrument standards.

Several parameters configure special behavior:

  • datapath (usually set proposal-specific by the new method) is a list of paths where raw data files are stored. If there is more than one entry in the list, the data files are created in the first path and hardlinked in the others.
  • detlist and envlist are lists of names of the currently selected standard detector and sample environment devices, respectively. The Experiment object has detectors and sampleenv properties that return lists of the actual devices.
  • scripts is managed by the session and should contain a stack of code of user scripts currently executed.

The experiment singleton is available at runtime as nicos.session.experiment.

User methods

addUser(name, email=None, affiliation=None)

Called by AddUser.

finish(*args, **kwargs)

Called by FinishExperiment. Does nothing by default.

new(proposal, title=None, localcontact=None, **kwds)

Called by NewExperiment.

Attached devices

sample

The device object representing the sample. Type: Sample.

Parameters

datapath (a non-empty list of str, settable at runtime)

List of paths where data files should be stored. Default value: [''].

dataroot (?, mandatory in setup)

Root data path under which all proposal specific paths are created.

detlist (a list of str, settable at runtime)

List of default detector device names. Default value: [].

elog (bool)

True if the electronig logbook should be enabled. Default value: True.

envlist (a list of str, settable at runtime)

List of default environment device names to read at every scan point. Default value: [].

localcontact (str, settable at runtime)

Local contact for current experiment. Default value: ''.

propdb (str, not shown to user)

user@host:dbname credentials for proposal DB. Default value: ''.

proposal (str, settable at runtime)

Current proposal number or proposal string. Default value: ''.

proposaldir (str, settable at runtime)

Directory for proposal specific files. Default value: ''.

remark (str, settable at runtime)

Current remark about experiment configuration. Default value: ''.

remember (a list of str, settable at runtime)

List of messages to remember for next experiment start. Default value: [].

scriptdir (str, settable at runtime)

Standard script directory. Default value: ''.

scripts (a list of str, settable at runtime)

Currently executed scripts. Default value: [].

title (str, settable at runtime)

Experiment title. Default value: ''.

users (a list of str, settable at runtime)

User names and affiliations for the proposal. Default value: [].

Parameters inherited from the base classes: description, loglevel, lowlevel

class nicos.experiment.Sample

Bases: Device

A special device to represent a sample.

An instance of this class is used as the sample attached device of the Experiment object. It can be subclassed to add special sample properties, such as lattice and orientation calculations, or more parameters describing the sample.

Parameters

samplename (str, settable at runtime)

Sample name. Default value: ''.

Parameters inherited from the base classes: description, loglevel, lowlevel

Instrument

Each setup requires an instrument device, giving basic information and functionality of the specific instrument. It is selected in setups using The sysconfig dictionary.

class nicos.instrument.Instrument

Bases: Device

A special singleton device to represent the instrument.

This class can be subclassed for specific instruments to e.g. provide the notion of moving “the instrument” in HKL space, such as in TAS.

The instrument singleton is available at runtime as nicos.session.instrument.

Parameters

countloopdelay (float)

Loop delay in checking for counting finished. Default value: 0.025000000000000001.

instrument (str)

Instrument name. Default value: ''.

responsible (str)

Instrument responsible name and email. Default value: ''.

Parameters inherited from the base classes: description, loglevel, lowlevel

Data Sinks

These data sinks provide different ways of processing scan data. They can be configured in setups like normal devices and selected in The sysconfig dictionary.

class nicos.data.DataSink

Bases: Device

Base class for all data sinks.

A DataSink is a configurable object that receives scan data. All data handling is done by sinks; e.g. displaying it on the console or saving to a data file.

Parameters

scantypes (a list of str)

Scan types for which the sink is active. Default value: [].

Parameters inherited from the base classes: description, loglevel, lowlevel

class nicos.data.ConsoleSink

Bases: DataSink

A DataSink that prints scan data onto the console.

Parameters inherited from the base classes: description, loglevel, lowlevel, scantypes

class nicos.data.AsciiDatafileSink

Bases: DatafileSink

A data sink that writes to a plain ASCII data file.

The lastfilenumber and lastpoint parameters are managed automatically.

The current file counter is normally stored in a file called “counter” in the data directory. If the globalcounter parameter is nonempty, it gives the name of a global counter file instead, which is always used regardless of data path.

Parameters

commentchar (str, settable at runtime)

Comment character. Default value: '#'.

globalcounter (str)

File name for a global file counter instead of one per datapath. Default value: ''.

lastfilenumber (int)

The number of the last written data file. Default value: 0.

lastpoint (int)

The number of the last point in the data file. Default value: 0.

semicolon (bool)

Whether to add a semicolon between X and Y values. Default value: True.

Parameters inherited from the base classes: datapath, description, loglevel, lowlevel, scantypes

class nicos.data.GraceSink

Bases: DataSink

A DataSink that plots datasets in the Grace plotting program.

Needs the GracePlot module. Only active for console sessions.

Parameters

activecounter (None or str, settable at runtime)

Name of active counter to plot. Default value: None.

Parameters inherited from the base classes: description, loglevel, lowlevel, scantypes

class nicos.data.GnuplotSink

Bases: DataSink

A DataSink that plots datasets in the Gnuplot plotting program.

Needs the Gnuplot module. Only active for console sessions.

Parameters

activecounter (None or str, settable at runtime)

Name of active counter to plot. Default value: None.

Parameters inherited from the base classes: description, loglevel, lowlevel, scantypes

class nicos.data.DaemonSink

Bases: DataSink

A DataSink that sends datasets to connected GUI clients for live plotting. Only active for daemon sessions.

Parameters inherited from the base classes: description, loglevel, lowlevel, scantypes

Notifiers

These devices provide a way to notify user or instrument responsible. For example, in case of unhandled exceptions a notification is always sent if the script has run for more than a few seconds.

Notifiers can be configured in setups like normal devices and are selected in The sysconfig dictionary.

class nicos.notify.Notifier

Bases: Device

Base class for all notification systems.

User methods

send(subject, body, what=None, short=None, important=True)

Send a notification.

sendConditionally(runtime, subject, body, what=None, short=None, important=True)

Send a notification if the given runtime is large enough.

Parameters

minruntime (float, settable at runtime)

Minimum runtime of a command before a failure is sent over the notifier. Default value: 300. Unit: s.

Parameters inherited from the base classes: description, loglevel, lowlevel

class nicos.notify.Mailer

Bases: Notifier

E-Mail notification handling.

If a Mailer is configured as a notifier, the receiver addresses (not copies) can be set by SetMailReceivers.

Parameters

copies (a list of str, settable at runtime)

Mail copy addresses. Default value: [].

receivers (a list of str, settable at runtime)

Mail receiver addresses. Default value: [].

sender (str, mandatory in setup)

Mail sender address.

subject (str)

Subject prefix. Default value: 'NICOS'.

Parameters inherited from the base classes: description, loglevel, lowlevel, minruntime

class nicos.notify.SMSer

Bases: Notifier

SMS notifications via smslink client program.

If a SMSer is configured as a notifier, the receiver addresses (not copies) can be set by SetSMSReceivers.

Parameters

receivers (a list of str, settable at runtime)

SMS receiver phone numbers. Default value: [].

server (str, mandatory in setup)

Name of SMS server.

subject (str)

Body prefix. Default value: 'NICOS'.

Parameters inherited from the base classes: description, loglevel, lowlevel, minruntime

class nicos.notify.Jabberer

Bases: Notifier

Notifier to send Jabber notifications.

Needs the xmpp module.

Parameters

jid (str, mandatory in setup)

Jabber JID of the notifier.

password (str, mandatory in setup)

Password for the given JID.

receivers (a list of str, settable at runtime)

List of receiver JIDs. Default value: [].

Parameters inherited from the base classes: description, loglevel, lowlevel, minruntime

Table Of Contents

Previous topic

Device classes

Next topic

Abstract device classes