changes

Highlights for spec release 6.09

February 19, 2021 - RELEASE 6.09.13

FIXES

Issues With splot To spec Server Communication Fixed

Problems with the recently refactored version of the Python spec client library included in spec release 6.09.10 resulted in issues with the connection from the splot utility to a spec server. Commands from splot, such as initiating a move or scan from the splot server panel, didn't work properly, and splot didn't exit quickly when spec sent a quit message. Those problems have been fixed with updates to the library (install location is SPECD/pyspec/client) and splot.

Fix For Closing Server Connections

On some platforms under certain conditions, a spec client could start racing when a connected server exited. That problem should now be fixed.

February 4, 2021 - RELEASE 6.09.12

MACROS

Fix For fscan/fdscan Bug

The file scan (fscan) macro in spec release 6.09.01 included updates to implement a delta-position scan (fdscan), but there were a couple of bugs that prevented the file scans from working at all. That issue is now fixed. fscan and fdscan are scans that take motor positions and optional count times from a file.

January 27, 2021 - RELEASE 6.09.11

FIXES

Fix For getline() Bug

A bug associated with the updated capabilities for the getline() function introduced with spec release 6.09.05 has been fixed. The bug was that the value for the current line number of the input file was not reset when the file was closed or a different file was accessed without explicitly using the "open" argument. Thus, the wrong line number would be read from the new file, or an end-of-file could be returned if the new file had only one line. Specifying the line number explicitly or using the "open" argument with a new file did not have an issue.

Fix For lsdef and prdef Globbing

The expanded globbing introduced in spec release 6.07.01 that added support for the [...] metacharacter pattern for several built-in commands did not work with the lsdef and prdef command as intended. It works now.

December 14, 2020 - RELEASE 6.09.10

IMPROVEMENTS

New "type" array_op() Option

The "type" argument to the array_op() function now returns a string that represents the data type of the array. For example, array_op("type", SCAN_D) returns the string "double". See the arrays help file for details.

Assignment Now Allowed With global and local Declarations

The declarations global and local now allow initialization in the statement. For example,

local tmp[] = [ 1, 2, 3 ]
global VAR = 1.234
global arr[] = [ "one":1, "two":2, "three":3 ]

Note, only one variable per statement can be declared and initialized using this syntax. (Associative array initialization was introduced in spec release 6.06.01.)

Updates For splot

This release includes bug fixes and stability improvements for the Python splot utility.

MACROS

Fix For _assign_mA Macro

An unfortunate bug introduced in spec release 6.09.07 that broke the _assign_mA macro that is used with the spec HKL geometry configurations is fixed. That macro fills the global mA[] associative array with motor numbers putting the diffractometer motors first in the list. The _assign_mA macro is called by way of the geometry-dependent _assign macro called within the standard config macro. The bug did not affect geometry-less configurations or configurations where the geometry motors were the first motors in the config file.

Updates For flyscan Macros

The fly scan macros include several fixes and additions. A new user_flyscan_trigger hook is called immediately after starting the MCS. The MCS data is now read before the call to fly_chk_beam so that the data so obtained can be used in any beam-check considerations. For unidirectional mesh fly scans, the fly motor backlash is restored for each move back to the starting position. An oversight where the absolute value of the motor_par() "step_size" parameter was not used has been fixed. See the flyscan help file.

FIXES

Fix For prompt_mac Deletion On ^C

An issue introduced in spec release 6.06.01, where prompt_mac was deleted on ^C, is now fixed. See the macros help file for a description of prompt_mac.

Fix For array_copy() Shared Memory Notification

A bug where the array_copy() function did not update the shared memory utime counter when copying to a shared array has been fixed. Utilities that check for updated values, such as spec's splot, use that counter to tell when array contents have been updated. See the spec_shm.h and sps.c files included in the spec distribution.

November 2, 2020 - RELEASE 6.09.09

IMPROVEMENTS

New "reopen" ser_par() Option

It is now possible to close and reopen an ordinary serial device configured for generic user-level access without having to run reconfig. The command ser_par(addr, "reopen") will close and attempt to reopen the serial device configured at addr. Such a capability is not normally needed, but may be useful for certain poorly behaved interfaces. The serial device parameters previously set, such as baud rate, parity, "raw" versus "cooked", etc., will be restored. This option only acts on UNIX serial devices and returns zero if successful and -1 if not. Does nothing and returns zero for SOCKET, EPICS and TACO serial interfaces. See the serial help file.

Updates For splot

The Python splot utility now includes support for live-time display of 2D images. In addition, fly scan plotting issues have been fixed along with fixes for other minor issues.

HARDWARE

Improvements For USBCTR MCS Mode

A few tweaks to the timeout and packet size used with the Measurement Computing USBCTR in the MCS mode used by spec's fly scan macros have resulted in more robust operation. See the usbctr help file.

MACROS

Update For USB-CTR flyscan Macros

The "trigger" support in the flyscan macros when using the Measurement Computing USB-CTR has been straightened out. What was previously referred to as "DIO bit for trigger" is now more properly referred to as "DIO bit to use for gating", in that the DIO bit (if selected) is set at the start of the pass and cleared at the end of the pass and can be used to gate an external device. In addition, a new option "external trigger to start pass" can be selected from the fly_setup macro to use the trigger input on the USB-CTR to start the pass. Choices are "off", "low", "high", "falling" and "rising" referring to the kind of signal presented to the input. See the flyscan help file.

Fixes To _tail and scan_meta_update() For Fly Scans

The standard macros _tail and scan_meta_update() include updates that accommodate fly scan plotting using the splot utility.

FIXES

Fix For Crash With "disable" Option To motor_par() and counter_par()

An old bug that became problematical in spec release 6.09.05 where it could result in a crash when using the "disable" option to counter_par() or motor_par() with certain hardware configurations has been fixed.

October 15, 2020 - RELEASE 6.09.08

IMPROVEMENTS

New "move_timeout" Parameter

A new optional "move_timeout" parameter is available to have spec abort moves or home sequences that do not complete within a specified timeout interval. Such a feature might be useful during unattended operation of an instrument when, for example, a motor with encoder becomes physically blocked and unable to complete a requested move while the controller continues to generate steps.

The parameter can be set four ways. Each method given takes precedence over the prior method. First, a global spec_par("move_timeout") value can be set that will apply to all motors. Second, a "move_timeout" nonstandard optional controller parameter can be set in the config file that will apply to all motors associated with the controller. Third, a "move_timeout" nonstandard optional motor parameter can be set for individual motors in the config file. Finally, motor_par(mne, "move_timeout") can be used during a spec session to set the value for a single motor. Values set with motor_par() will be lost on start up and reconfig. A value set with spec_par() will be saved in the state file.

Units for "move_timeout" are seconds. Fractional values are allowed. If a move or home sequence doesn't complete in the time given, all current moves will be aborted and spec will reset, just as if a hard limit had been hit.

HARDWARE FIXES

Fix For Possible Crash With TMCL Motors

The source of occasional segmentation faults on configuration when using Trinamic TMCL motors has been found and fixed. The issue appeared with spec release 6.09.01 which included support for additional TMCL models.

October 6, 2020 - RELEASE 6.09.07

MACROS

ascan and dscan Can Now Take Multiple Motor Arguments

The standard ascan and dscan macros will now accept an unlimited number of "motor start end" arguments before the number of intervals and count-time arguments. The macros a2scan through a5scan and d2scan through d5scan still exist and do require the number of motors to match the digit in the macro name.

HARDWARE

Updates For eiger_server

The support for the Dectris Eiger detectors through spec's eiger_server hardware server facility includes fixes and improvements. See the eiger help file for current capabilities.

FIXES

Updates For splot

This release includes bug fixes and stability improvements for the Python splot utility.

July 30, 2020 - RELEASE 6.09.06

MACROS

New Option To Show Motors On Screen During HKL Scans

It is now possible to show geometry motors on the screen during reciprocal space scans. The mstartup and startup macros will prompt for which motors to include.

Improved Screen Formatting For Scans

The standard scans now do a more consistent job of filling the available screen row with counters beyond the always shown main detector and monitor channels. The width per counter column is adjusted from 8 to 11 characters based on the available space. In addition, if the window size is changed mid scan, the number of columns displayed and their width is dynamically recalculated. Also the column headers will be redisplayed. These changes are part of the standard _head and _loop macros. If local spec administrators have replaced one or both of these macros (not recommended), the local versions need to be reconciled with the standard versions.

FIXES

Fix For cleanup_once In Server Mode

A long standing bug, where cleanup_once would not run if there was an error in a command sent from a client to a spec server, has been fixed.

Fix For CANbus Bit Rate In config File

An issue where the hardware configuration editor might not read the CANbus bit rate correctly from the config file has been fixed.

Stability Improvements For Python Tools

The Python code for the splot and eiger_server utilities includes fixes and improvements.

July 20, 2020 - RELEASE 6.09.05

IMPROVEMENTS

New Multi-line getline() Options

The built-in getline() function now supports options to read a specific line in the input file and also to read a range of lines at once. The beginning of the range can either be the current position or a specified line number. The end of the range can be specified as a line number, the first line that matches a regular expression or all lines to the end of the file. See getline in the funcs help file.

savstate Will Now Execute Within Statement Blocks

Previously, the savstate built-in command would only set an internal flag to indicate the action was requested. The actual saving of the state didn't occur until spec returned to the main prompt. spec will now write out the state file at the point at which the command occurs.

Updated Behavior For quit Command

Previously the quit command to exit spec (same as ^D typed at the main prompt) was only allowed at the beginning of a line either typed on the keyboard or read from a command file. The command could not be included in a macro. With this release, quit is now an ordinary command that can be included in macros, flow control statement, etc. A new "legacy_quit" spec_par() option is available to restore the old behavior. See the spec_par help file.

New mainloop_mac For Controlling Access To spec Commands

If there is a macro called mainloop_mac, that macro will be run instead of spec prompting for input. The intention of this macro is to provide site administrators a tool to limit what commands are available to users. The macro should prompt the user for input and act on that input. Unless the macro includes an option to undefine itself, the macro will run forever. The macro is undefined automatically when spec exits, either by quit or ^\ (quit signal). See the macros help file for more information.

Error Message Now Printed If Concatenation Used In Function Arguments

The concatenation operator comes into effect when expressions are combined separated only by space characters. The resulting expression is the concatenation of the string values of the constituent expressions. Concatenation is only allowed on the right side of an assignment operator, in the arguments to the print and eprint commands and in the value assigned to a variable in a constant statement. Previously, concatenated expressions in arguments to functions used as terms where concatenation is allowed were not flagged as errors.

New SPEC_PID Built-In Global Variable

A new immutable global variable SPEC_PID contains the process ID of the spec process.

July 13, 2020 - RELEASE 6.09.04

FIXES

Fix For Setting Powder-Mode Parameters In config File

A long standing issue where the powder-mode parameters "powder_base", "powder_slew" and "powder_acceleration" could not be set as nonstandard optional parameters in the config file has been fixed. The parameters could be set during a spec session with motor_par(). The values for "powder_base" and "powder_slew" still default to the base rate and "powder_acceleration" to the acceleration value from the config file.

Fix For TMCL Parameter Restore Feature

The code that restores TMCL motor parameters on detection of a power cycle has been tuned to ensure that there will be no movement of the motor when the actual position and the target position registers are restored.

Fix For New Signal Handling

An issue with the revised signal handling introduced in spec release 6.09.01, where the hardware abort code and cleanup macros might not be execute on a ^C interrupt during a sleep(), has been fixed.

June 25, 2020 - RELEASE 6.09.03

HARDWARE

Eiger2 Now Supported

The eiger_server code used with spec's server hardware facility now supports the Dectris Eiger2 model that uses version 1.8.0 of the SIMPLON API. See the eiger and server_hdw help files for details.

FIXES

Fix For sixc Gamma Position

A bug introduced in spec release 6.08.06 in the sixc geometry code that affected configurations with no geometry pseudomotors has been fixed. The issue was that the position for the Gamma motor after a calcA was not restored after a read_motors().

Fix For TMCL Support

A bug introduced in spec release 6.09.01 that could lead to a crash when using a TMCL motor that didn't have the "home_slew_rate" parameter set has been fixed.

June 19, 2020 - RELEASE 6.09.02

IMPROVEMENTS

New rpi_io() Function To Access GPIO Pins On Raspberry PI

This spec release includes a new rpi_io() function for the Raspberry PI platform to allow access to the general purpose I/O (GPIO) pins. See the rpi help file for details. Note, spec has been available for the Raspberry PI running Raspian Linux since spec release 6.03.01 from February 2015.

Stability Improvements For Python Tools

The Python code for the eiger_server and splot utilities include some fixes and improvements.

MACROS

New user_pregetcounts Hook

The standard get_counts macro, which is the lowest level counter reading macro, now includes a user hook macro user_pregetcounts, which is called before the built-in getcounts command. The existing user hook user_getcounts is called immediately after getcounts. Both user_getcounts and user_pregetcounts are defined as null macros by default.

HARDWARE

Update For Standard EPICS Scaler Record Support

spec now uses a ca_put_callback() to set the CNT process variable to begin counting. With this method, the standard scaler record will send an event for CNT after counting is finished and after final value events have been sent for all associated scaler channels. Previously, spec relied on regular callback events when the value of CNT changed to zero to signal the end of counting. It seems that method doesn't guarantee that all scaler channel final value events arrive before the CNT event.

May 13, 2020 - RELEASE 6.09.01

IMPROVEMENTS

More Robust Signal Handling

The signal handling code associated with a keyboard ^C has been reorganized to correct a potential source of crashes. As spec evolved, the actions taken on a ^C interrupt became more complex. In particular, with the addition of macro hardware and spec server functionality, interrupt handling code sometimes included calls of the C library memory allocation functions. Those function are not re-entrant. If a ^C came while spec was in those functions, a call to the same functions from the signal handling code could cause spec to crash. Although the bug has been present for a long time, it was very rarely seen. CSS has no user reports associated with this bug, but the issue was seen with in house testing.

In this release of spec, the interrupt handling does nothing more than set a flag. That flag is examined at key check points in the code, and if set the appropriate actions are taken (stopping motors, resetting to the main prompt, etc.). There should be no point where a ^C fails to break out of a loop, but it is possible some loop was missed. Please report any anomalies to CSS.

Reorganized File Hierarchy To Support Python Utilities

The spec auxiliary file directory (normally /usr/local/lib/spec.d) now contains a subdirectory called pyspec which currently includes utility packages used by the Python splot utility, the eiger_server hardware server program, and the specfile utility.

Support For Python 3

The Python-based spec utilities (splot, eiger_serve*, specfile) now work with Python 3. The programs will use Python 3 if available, otherwise Python 2 will be used.

Python Library and Examples For Connecting To a spec Server

The Python modules used by the splot utility to connect to a spec server are now located in the new pyspec subdirectory of the spec auxiliary file directory. The source files and examples are included in the spec distribution directory under pyspec/python/client. The examples create graphical widgets that can interact with a spec server.

MACROS

New Delta File Scan Macros

A new fdscan macro works similarly to the fscan macro. Both take motor positions (and possibly count times) from a file. With fscan the file positions are absolute motor positions. For fdscan, the positions in the file are taken as offsets from the motor positions at the start of the scan.

Fix For Screen Display Of Integer Counts

A change in spec release 6.08.05 to no longer round significant figures of integer counter readings for the screen display of updated counting and count values during scans had the unintended consequence of limiting values to 32-bit signed integers. That problem has been fixed by changing the format from "%d" to "%.0f".

FIXES

Problems With cbreak-mode input() Fixed

When the input() function is called with a numerical argument less than zero, the tty state is set to cbreak mode, input echo is turned off and the state remains in that mode until a call of input() with a positive numerical argument or if spec returns to the main prompt. A bug introduced with spec release 6.06.04 that implemented use of the command-line editing library for the input(), yesno(), getval() and getsval() could lead to issues with the tty state if one of those functions was called while the tty state was in cbreak mode. For example, consider the following:

for (;;) {
     key = input(-1)
     if (key == "x")
             val = getval("Enter", val)
     sleep(.1)
}

If getval() call is made, the tty state would not be properly restored to the expected cbreak mode for the next input() call. That issue has been fixed.

In addition, a problem where ^C (interrupt signal) and ^\ (quit signal) were disabled while cbreak mode was active has been fixed.

HARDWARE

Support For Thorlabs LTS150/LTS300 APT Motor Controllers

spec now supports the LTS150 and LTS300 models of Thorlabs APT controller over USB. Support for additional models will be added as needed. See the thorlabs help file for details.

Support For Trinamic TMCL-6210 Motor Controllers

The initial spec support for Trinamic TMCL motor controllers was tested with models TMCM-1140 and TMCM-3110. This release adds support for model TMCM-6210. Support for other models will be added as needed or requested. See the tmcl help file.

Support For Dectris Eiger Detectors

spec now includes Python-based support for the Dectris Eiger detectors using the server hardware facility. See the eiger and server_hdw help files for details.