generic Package

generic Package

Generic device classes using hardware-specific attached devices.

axis Module

NICOS axis classes.

class nicos.generic.axis.Axis(name, **config)

Bases: nicos.abstract.Axis

Bases: Axis

Axis implemented in Python, with NICOS devices for motor and coders.

Attached devices

coder

Main axis encoder device. Type: Coder.

motor

Axis motor device. Type: Motor.

obs

Auxiliary encoders used to verify position, can be empty. Type: a list of Coder.

Parameters

jitter (a float in the range [0.000000, 10.000000], settable at runtime)

Amount of position jitter allowed. Default value: 0.0. Unit: same as device value.

speed (float, settable at runtime, volatile)

Motor speed. Default value: 0.0. Unit: main/s.

Parameters inherited from the base classes: abslimits, backlash, description, dragerror, fixed, fmtstr, loglevel, loopdelay, lowlevel, maxage, maxtries, offset, pollinterval, precision, target, unit, userlimits

cache Module

Cache reader/writer devices.

class nicos.generic.cache.CacheReader(name, **config)

Bases: nicos.core.device.Readable

Bases: Readable

A readable device that gets values exclusively via cache.

This is useful for devices that cannot be usefully integrated into NICOS, but that can be coerced to write their current value into the NICOS cache. NICOS will then rely on the cache to supply current values for the device; if there is no such value in the cache, a CommunicationError will be raised. The status is likewise read from the cache; if none is present, status.UNKNOWN is returned.

Devices must write into the cache under the keys nicos/devname/value and nicos/devname/status, where devname is the NICOS device name configured in the setup.

Parameters inherited from the base classes: description, fmtstr, loglevel, lowlevel, maxage, pollinterval, unit

class nicos.generic.cache.CacheWriter(name, **config)

Bases: nicos.core.device.HasLimits, nicos.core.device.Moveable

Bases: HasLimits, Moveable

A moveable device that writes values via the cache.

This is the equivalent to CacheReader for moveable devices. The device is expected to itself subscribe to cache updates relating to its subkeys, and deliver value updates via the cache as well.

This class will write setpoint changes into the cache under the key nicos/devname/setkey, where devname is the NICOS device name, and setkey is given by the device parameter.

Parameters

loopdelay (float, settable at runtime)

Sleep time when waiting. Default value: 1.0. Unit: s.

setkey (str)

Subkey to use to set the device value. Default value: 'setpoint'.

timeout (float, settable at runtime)

Timeout for checking stabilization. Default value: 900.0. Unit: s.

tolerance (float, settable at runtime)

Size of the stabilization window. Default value: 1.0. Unit: same as device value.

window (float, settable at runtime)

Time window for checking stabilization (zero for no stabilization check). Default value: 0.0. Unit: s.

Parameters inherited from the base classes: abslimits, description, fixed, fmtstr, loglevel, lowlevel, maxage, pollinterval, target, unit, userlimits

manual Module

“Manual” moveable devices, to keep track of manual instrument changes.

class nicos.generic.manual.ManualMove(name, **config)

Bases: nicos.core.device.HasLimits, nicos.core.device.Moveable

Bases: HasLimits, Moveable

A representation of a manually moveable continuous device.

This device does nothing but record the latest position you moved to. This is useful for instrument parameters that have to be changed manually, but you still want to record them in data files, status monitor etc.

Parameters

default (float)

Default value when freshly initialized. Default value: 0.0.

Parameters inherited from the base classes: abslimits, description, fixed, fmtstr, loglevel, lowlevel, maxage, pollinterval, target, unit, userlimits

class nicos.generic.manual.ManualSwitch(name, **config)

Bases: nicos.core.device.Moveable

Bases: Moveable

A representation of a manually changeable device.

This is akin to the ManualMove device, but for instrument parameters that take only discrete values.

If the states parameter is not empty, it represents a list of all allowed values of the device. If it is empty, all values are allowed.

Parameters

states (a list of any value, mandatory in setup)

List of allowed states.

Parameters inherited from the base classes: description, fixed, fmtstr, loglevel, lowlevel, maxage, pollinterval, target, unit

slit Module

NICOS slit device.

class nicos.generic.slit.CenterXSlitAxis(name, **config)

Bases: nicos.generic.slit.SlitAxis

Bases: SlitAxis

Attached devices

slit

Slit whose axis is controlled. Type: Slit.

Parameters inherited from the base classes: description, fixed, fmtstr, loglevel, lowlevel, maxage, pollinterval, target, unit

class nicos.generic.slit.CenterYSlitAxis(name, **config)

Bases: nicos.generic.slit.SlitAxis

Bases: SlitAxis

Attached devices

slit

Slit whose axis is controlled. Type: Slit.

Parameters inherited from the base classes: description, fixed, fmtstr, loglevel, lowlevel, maxage, pollinterval, target, unit

class nicos.generic.slit.HeightSlitAxis(name, **config)

Bases: nicos.generic.slit.SlitAxis

Bases: SlitAxis

Attached devices

slit

Slit whose axis is controlled. Type: Slit.

Parameters inherited from the base classes: description, fixed, fmtstr, loglevel, lowlevel, maxage, pollinterval, target, unit

class nicos.generic.slit.Slit(name, **config)

Bases: nicos.core.device.Moveable

Bases: Moveable

A rectangular slit consisting of four blades.

The slit can operate in four “opmodes”, controlled by the opmode parameter:

  • ‘4blades’ – all four blades are controlled separately. Values read from the slit are lists in the order [left, right, bottom, top]; for move() the same list of coordinates has to be supplied.
  • ‘centered’ – only width and height are controlled; the slit is centered at the zero value of the left-right and bottom-top coordinates. Values read and written are in the form [width, height].
  • ‘offcentered’ – the center and width/height are controlled. Values read and written are in the form [centerx, centery, width, height].

Normally, the right and left as well as the bottom and top devices need to share a common coordinate system, i.e. when right.read() == left.read() the slit is closed. A different convention can be selected when setting coordinates to "opposite": in this case, the blades meet at coordinate 0, and both move in positive direction when they open.

All instances have attributes controlling single dimensions that can be used as devices, for example in scans. These attributes are:

  • left, right, bottom, top – controlling the blades individually, independent of the opmode
  • centerx, centery, width, height – controlling “logical” coordinates of the slit, independent of the opmode

Example usage:

>>> move(slit.centerx, 5)      # move slit center
>>> scan(slit.width, 0, 1, 6)  # scan over slit width from 0 to 5 mm

Attached devices

bottom

Bottom blade. Type: HasPrecision.

left

Left blade. Type: HasPrecision.

right

Right blade. Type: HasPrecision.

top

Top blade. Type: HasPrecision.

Parameters

coordinates (one of 'equal', 'opposite')

Coordinate convention for left/right and top/bottom blades. Default value: 'equal'.

opmode (one of '4blades', 'centered', 'offcentered', settable at runtime)

Mode of operation for the slit. Default value: '4blades'.

Parameters inherited from the base classes: description, fixed, fmtstr, loglevel, lowlevel, maxage, pollinterval, target, unit

class nicos.generic.slit.SlitAxis(name, **config)

Bases: nicos.core.device.Moveable, nicos.core.device.AutoDevice

Bases: Moveable, AutoDevice

“Partial” devices for slit axes, useful for e.g. scanning over the device slit.centerx.

Attached devices

slit

Slit whose axis is controlled. Type: Slit.

Parameters inherited from the base classes: description, fixed, fmtstr, loglevel, lowlevel, maxage, pollinterval, target, unit

class nicos.generic.slit.WidthSlitAxis(name, **config)

Bases: nicos.generic.slit.SlitAxis

Bases: SlitAxis

Attached devices

slit

Slit whose axis is controlled. Type: Slit.

Parameters inherited from the base classes: description, fixed, fmtstr, loglevel, lowlevel, maxage, pollinterval, target, unit

switcher Module

NICOS “switcher” device.

class nicos.generic.switcher.ReadonlySwitcher(name, **config)

Bases: nicos.core.device.Readable

Bases: Readable

Same as the Switcher, but for read-only underlying devices.

Attached devices

readable

The continuous device which is read. Type: Readable.

Parameters

precision (float)

Precision for comparison. Default value: 0.

states (a list of str, mandatory in setup)

List of state names.

values (a list of any value, mandatory in setup)

List of values to move to.

Parameters inherited from the base classes: description, fmtstr, loglevel, lowlevel, maxage, pollinterval, unit

class nicos.generic.switcher.Switcher(name, **config)

Bases: nicos.core.device.Moveable

Bases: Moveable

The switcher is a device that maps switch states onto discrete values of a continuously moveable device.

This is useful if you have for example a motor that only every moves to certain discrete positions, e.g. a monochromator changer. Then you can control it using

move(changer_switch, 'up')
move(changer_switch, 'down')

instead of moving the axis to positions hard to understand:

move(changer, 14.55)
move(changer, 51.3)

and still have the underlying continuously moveable device available for debugging purposes.

Attached devices

moveable

The continuous device which is controlled. Type: Moveable.

Parameters

precision (float, mandatory in setup)

Precision for comparison.

states (a list of str, mandatory in setup)

List of state names.

values (a list of any value, mandatory in setup)

List of values to move to.

Parameters inherited from the base classes: description, fixed, fmtstr, loglevel, lowlevel, maxage, pollinterval, target, unit

system Module

System-related device classes for NICOS.

class nicos.generic.system.FreeSpace(name, **config)

Bases: nicos.core.device.Readable

Bases: Readable

This is a readable device that returns the free space on a filesystem.

It is useful to record this in the cache, for example to enable warnings about low free space before data files cannot be saved anymore.

The device status is OK until free space is below the value set by the minfree parameter.

Parameters

minfree (float, settable at runtime)

Minimum free space for “ok” status. Default value: 5. Unit: GiB.

path (None or str)

The path to the filesystem mount point (or None to check the experiment data directory. Default value: None.

Parameters inherited from the base classes: description, fmtstr, loglevel, lowlevel, maxage, pollinterval, unit

virtual Module

Virtual devices for testing.

class nicos.generic.virtual.VirtualCoder(name, **config)

Bases: nicos.abstract.Coder, nicos.core.device.HasOffset

Bases: Coder, HasOffset

A virtual coder that just returns the value of a motor, with offset.

Attached devices

motor

Motor to read out to get coder value. Type: Readable.

Parameters inherited from the base classes: description, fmtstr, loglevel, lowlevel, maxage, offset, pollinterval, precision, unit

class nicos.generic.virtual.VirtualCounter(name, **config)

Bases: nicos.taco.detector.FRMCounterChannel

Bases: FRMCounterChannel

A virtual counter channel for use together with nicos.taco.Detector.

Parameters

countrate (float)

The maximum countrate. Default value: 1000.

tacodevice (a valid taco device)

(not used). Default value: None.

Parameters inherited from the base classes: description, fmtstr, ismaster, loglevel, lowlevel, maxage, mode, pollinterval, preselection, tacodelay, tacotimeout, tacotries, type, unit

class nicos.generic.virtual.VirtualMotor(name, **config)

Bases: nicos.abstract.Motor, nicos.core.device.HasOffset

Bases: Motor, HasOffset

A virtual motor that can be set to move in finite time using a thread.

Parameters

curstatus (a tuple of (int, str), settable at runtime)

Current status. Default value: (100, 'idle').

curvalue (float, settable at runtime)

Current value. Default value: 0.0.

jitter (float)

Jitter of the read value. Default value: 0.

speed (float, settable at runtime)

Virtual speed of the device. Default value: 0.0.

Parameters inherited from the base classes: abslimits, description, fixed, fmtstr, loglevel, lowlevel, maxage, offset, pollinterval, precision, target, unit, userlimits

class nicos.generic.virtual.VirtualTimer(name, **config)

Bases: nicos.taco.detector.FRMTimerChannel

Bases: FRMTimerChannel

A virtual timer channel for use together with nicos.taco.Detector.

Parameters

tacodevice (a valid taco device)

(not used). Default value: None.

Parameters inherited from the base classes: description, fmtstr, ismaster, loglevel, lowlevel, maxage, mode, pollinterval, preselection, tacodelay, tacotimeout, tacotries, unit

Table Of Contents

Previous topic

elog Package

Next topic

gui Package