changes

Highlights for spec release 6.13

March 21, 2025 - RELEASE 6.13.04

IMPROVEMENTS

New Linux udev Rules For PCI Memory Access

To better accommodate sites where root access is only available with an IT department visit, spec now supports udev rules on Linux platforms that allow unprivileged access to memory adresses associated with the most commonly used PCI/PCIe data acquisition cards. Root access is required to install the spec udev rules file, but once installed, spec can be updated by users without root access, as long as they have write permission in the directory where spec's executable and auxiliary files are stored. See the notes on privileged I/O access in the updated spec install help file for additional details.

Currently supported PCI/PCIe modules for memory access via udev rules include the Struck SIS1100 and SIS1100E (driverless), the SBS (Bit3) 616/617/618 (driverless), the Oregon Micro Systems PCIx, the Trinamic CANnes, the National Instruments PCI-GPIB (driverless - in various form factors), the National Instruments 6601, 6602 and 6608 counter/timers (both PCI and PXI), and the many National Instruments X series data acquisition models that spec supports (the 63xx models -- see the ni63xx help file for a list). Contact CSS to discuss the possibility of support for other devices.

If PCI/PCIe memory access fails using the method that relies on the udev rules, spec will fall back to the previous method using special privileges to open /dev/mem.

Code Signing For Patched Executables on MacOS

On MacOS installations, the spec install procedure now performs ad-hoc code signing of executables that are patched during installation to set the default spec auxiliary file directory. Affected executables are chelp, show_state, tidy_spec and wiz_passwd. Without the code signing, the programs exit immediately with a message "Killed: 9". Ad-hoc signing means the code is signed with no identity. The system may require authorization to run the programs (with luck, just once), but at least the programs can be run.

libedit Updated

The libedit code included with the spec distribution has been updated to release 20250104-3.1, obtained from thrysoee.dk/editline. As before, patches contained in the file spec_libedit.patch have been applied to those sources. See the libedit help file.

Added caxis Geometry

Files for the caxis (chi-axis) geometry, as used at the Advanced Photon Source 12ID-D beamline, are part of this spec release. Newly included files are geo_caxis.c, macros/caxis.src and config/cf.caxis. There are also additions to u_hook.c and geometries.

FIXES

Fix For Linked Geometry Settings Files

An issue in spec release 6.13.01 related to the new feature to allow up to 1000 motors has been fixed. The problem was that if updating from an earlier spec release when using linked geometries, some motor positions, offsets and limits could be lost. Linked geometries are a feature where config and settings files are hard linked among multiple spec instances, and motors and counters can be configured as common to all geometries or specific to a particular geometry.

Fix For Nested Macro Hardware MCA and Image Array Reads

A memory-corruption issue where a "read" call of a macro hardware MCA or image device that calls another macro hardware MCA or image device with a "read" argument has been fixed. The corrupted memory would lead to a crash.

MACROS

New Option For Per Point Sleep Times For Scans

The standard _array_scan scan-engine macro now includes an option to have a different sleep time between each scan point's move and subsequent count period. If the bit in _stype named scanType_ArraySleep is set, _array_scan will sleep for the time specified in the array SCAN_SLEEP[]. SCAN_SLEEP[] is indexed by point number. Both _stype and scanType_ArraySleep are now standard global variables. However, the SCAN_SLEEP[] array needs to be created and assigned values for the feature to be enabled.

Fix For Fly Scan Macros In Reverse Direction

A bug in the flyscan macros which would lead to missing values for the last point of a scan when the endpoint position was less that the starting point has been fixed.

HARDWARE

Tweak For USB-CTR Preset Counter Roll Over

The programming for the Digilent (formerly Measurement Computing) USB-CTR has been slightly tweaked to avoid an issue where a stray electrical pulse on the input could cause the preset timer channel to rollover to zero at the end of counting. The previous programming has been fine for most installations for the last ten years, but one site has had an issue that this fix addresses.

PYTHON

Fix For splot Interaction With newfile

A fix is included for an issue where the Python splot would not refresh the plot window for a new scan if newfile was between scan macros calls on the same command line.

Fix For splot "raise" Issue

A problem where the "raise" splot_cntl() option was not working on certain Linux platforms (e.g. Ubuntu and Debian) has been fixed.

January 31, 2025 - RELEASE 6.13.03

IMPROVEMENTS

New SPEC_COMMAND Built-in Variable

A new built-in variable named SPEC_COMMAND is set to the command line by which spec was invoked.

FIXES

Fix For Recently Introduced edconf Crash

Recent changes to increase the allowed number of motors triggered an old coding error that could result in an edconf crash when editing the motor screen, depending on motor controller choices, number of motors and platform. That issue is now fixed.

Fix For Creation Of Unnamed Macro

Previously, each call of cdef("", "") would create a new entry in the table of macros with no name and no definition. With this spec release, that no longer happens. In addition, spec will not restore such macros when reading state files created by previous releases that contain such entries.

HARDWARE

Fix For Old EPICS Motor Record Limits Issue

Internally, spec considers negative limits and positive limits in terms of a motor's dial position. With the standard EPICS motor record, spec looks for limit events on the LLS and HLS PVs (low and high limit switch process variables). However, those PVs are in user units. If the sign-of-user*dial parameter (the DIR PV) is negative, spec will misinterpret the limit sense. A change in spec release 6.03.10 to improve limit switch behavior took into account the direction of movement along with the limit switch indication. Prior to that change, the misinterpretation of the EPICS hard limit events was not an issue. In any case, this spec release now takes into account the sign-of-user*dial value in deciding whether a low or high limit has been hit when using the standard EPICS motor record.

MACROS

Fix For acq Macros

A typo in the chk_acq_using macro (part of the recently developed MCA- and image-device acquisition macros) that produced a spurious error message when disabling an image device has been fixed.

December 22, 2024 - RELEASE 6.13.02

IMPROVEMENTS

Updates To the edconf Configuration Editor

There are several improvements to the edconf hardware configuration editor, normally invoked via the config macro:

A new READ_ONLY protection level is available, similar to a wizard protection level, but not requiring a wizard password.

The READ_ONLY and wizard protection levels now prevent changing, adding or deleting non-standard optional motor parameters (the ones reached by typing p).

A bug where the ability to change the steps per deg/mm and the sign of user versus dial parameters was not restored when switching to wizard level 1 from wizard level 2 or 3 is fixed.

A bug where deleting a number valued non-standard optional parameter's value resulted in a large floating point number appearing in the screen cell has been fixed.

A couple of other display glitches are fixed.

Read-Only Motors Recognized

spec now understands read-only motor configuration from the config file. A read-only motor cannot be moved, nor can its parameters be changed.

Read-Only Parameters Recognized

spec now prevents changing parameters that are configured as read only in the config file, either via the READ ONLY level or via wizard levels 1, 2 and 3. See the new wizard help file.

Avoid Immediate Quit On Startup From Error In Macro Motor Macro

Previously, an error in a macro function that implements a macro-hardware motor could cause spec to quit on startup before the main prompt has been issued. With this spec release, that should no longer occur.

HARDWARE

Rename "modules" To "nmodules" For Mythen

The mca_par() command to return the number of modules, implemented for the Dectris Mythen MCA in the previous spec release, has been renamed "nmodules" from "modules". The "modules" mca_par() is intended to indicate the number of distinct MCA spectra that can be obtained from the MCA unit and is used in the recently added MCA- and image-acquisition macros. A Mythen with multiple modules is usually used such that it will return one spectrum that includes data from all the modules. See the acq help file.

Abort Motion Command Modified For Galil Controllers

The abort command sent to Galil motor controllers when the user types a ^C has been changed from a bare "ST" to an "ST" with an axis argument for each motor in motion. The bare "ST" would also halt any on-board programs executing in the background, which was problematic in at least one installation.

MACROS

Fix For MCA X Window Plots

A issue associated with the update to the plotting macros to automatically make X window plots of MCA data is fixed. The problem was that the first MCA plot was drawn in the same window as the scan plots if the option to plot different counters in different windows was not selected.

December 1, 2024 - RELEASE 6.13.01

IMPROVEMENTS

Up To 100 Controllers In config File

The "Motor and Counter Device" configuration screen of the spec edconf hardware configuration editor now allows up to 100 controller entries for both motors and scalers. The previous limit was 64.

Up To 1000 Motors In config File

spec and the edconf hardware configuration editor now allow up to 1000 motors, an increase from the previous limit of 300 for an instance of spec and 320 in edconf (allowing for linked configurations). The settings file format now accommodates an unlimited number of motors. Note, this update is not entirely backward compatible. Releases prior to spec 6.13.01 will not see the additional motors. Releases prior to spec 6.10.01 will crash if there are more than 320 motors in the configuration file. Due to an unfortunate bug, edconf prior to that included in this spec release will crash if there are more than 320 motors in the configuration. That is, one can't use an old version of edconf to modify a configuration created with more then 320 motors.

State Files Now Created With (Umaskable) Group-Write Permission

Since its origin, spec created the associated state files (used for restoring the internal state between invocations) with access permissions 0644 (rw-r--r--), that is, readable by all but writable only by the owner. At least one site would prefer the files be group writable, so that the same state files could be used by different users invoking spec with the same -U fake_user flag. With this spec release, state files are now created with permissions 0664 (rw-rw-r--). The creat() system call that does the file creation will mask the permissions using the file creation mode mask as set by umask in the shell or inherited from the shell's parent process. For example, the shell command umask 022 will cause files to have the permissions as before, 0644. Such a command could be put into the default shell start-up file (/etc/bash.bashrc, /etc/csh.cshrc, etc.) to restore the previous permission-setting behavior.

Rate Limit For settings File Updates

The settings file, which holds each motor's current dial position, user offset and dial limits, gets updated when any of those values change. Such an update involves reading the settings file into an internal data structure, updating the values that have changed, then writing out the data structure. Position updates are done at the end of a move, whether completed or aborted, or after a sync or chg_dials() modifies the position. Offsets and limit updates are done when the associated commands change those values. Normally, the updates are not unreasonably frequent. However, it is possible to generate a large number of updates, say, by setting new limits for many motors via a loop. Whatever the source of the calls to update the file, this release of spec now limits the updates to twice a second.

spec_menu() Updates

The "default" key now works correctly to set default values for items associated with new siblings created in families where the number of siblings is editable.

Including a "value" or "svalue" key with an "@" key can now be used to force a number or string type for the value. Previously, the type was determined by whether the initial value was a number or a string. It is now possible to force a string value, even if the initial value is a number, for example.

The "check_macro" key of spec_menu() that sets a macro function to be called when a user enters a value now works as intended for ordinary string and number entries.

HARDWARE

Support For USB-CTR As Secondary Unit For Fly Scans

spec now supports additional USB-CTR modules in multichannel scaler (MCS) mode for use with the flyscan macros to allow additional detector channels to be used in the fly scan. Although multiple secondary units are supported in the code, the current fly scan macros work with only one secondary unit. The primary USB-CTR is described in the hardware configuration editor as "USB-CTR Multi-Channel Scaler (main)", while secondary units are "USB-CTR Multi-Channel Scaler (2ndary)". With multiple USB-CTR modules, it is important to enter the serial number in the ADDR field of the configuration editor. Otherwise, the assignment of units numbers to configuration entries depends on the order in which the operating system enumerates the USB devices. See the usbctr help file.

New DIO "pulse" and "pulsed" Options For USB-CTR

A new mca_par()/counter_par() "pulse" option will generate a pulse from low to high to low on the specified digital I/O (DIO) pin. The pulse can be from 1 100,000 usec in duration. A new "pulsed" option indicates that whenever the specified DIO pin is set, either with "set_bit" or "set_bits", it will be pulsed. The pulse duration can also be configured. See the usbctr help file for details.

Dectris Mythen Now Supports mca_par("modules")

Support for the Dectris Mythen and Mythen2 MCA models now return the number of modules available with the spec function mca_par("modules"). (Note, renamed "nmodules" is spec release 6.13.02.)

MACROS

Improvements to Fly Scan Macros

The spec fly scan macros now support a second USB-CTR module in order to allow additional counters to be involved in the fly scan data acquisition. Note, any prescale and/or normalization channels must be on the primary module.

Configuration of gate mode and a DIO gate-mode bit are now separate options, to accommodate use of an arbitrary gate signal.

A new option to use a DIO pin as input to one of the 74151 channels to allow gating of all counters in MCS mode is available.

There is new flysetup option to enable a USB-CTR DIO bit to use as trigger for the MCS, particularly important if using two USB-CTR modules together. If both a trigger bit and a non-zero gate mode are selected, both bits are set with a single call of mca_spar(). The trigger bit can be configured to pulse when set using the new mca_par() "pulsed" option.

If the normalize flysetup option is selected, the normalization is done after saving to the data file, but before screen plotting. Thus, the data saved is the data as read from the MCS.

The syntax of the fly_normalize() macro is changed. By default, the macro normalizes all the fly scan data in the SCAN_D[] array to channel number FLY_normalize_chan on the main USB-CTR module. Previously, an argument to the macro could specify an alternate channel. Now, a nonzero argument instructs the macro to undo the normalization. The macro also sets the plot title (T_L) to include the word "normalized" to indicate that data displayed was normalized. In addition, the macro looks at T_L on entry to avoid performing the normalize or unnormalize operation on data that has already had the operation performed.

New macros, fly_norm and fly_unnorm, call the fly_normalized() macro function with appropriate arguments.

When rereading the fly scan macro source file, existing user hook macro definitions will no longer be removed for user_flyscan_pre_run, user_flyscan_trigger, user_flyscan_post_run and user_flyscan_post_sweep.

New user hook macros, user_flysetup and user_flysetup_fini, are available to add configuration options to the flysetup menu. See an example at the end of the flyscan.mac macro source file.

See the flyscan help file for more details.

Fix For "normalize_to_time" With cscan Macros

The "normalize_to_time" counter configuration option added in spec release 6.10.07 did not work well for counters in a continuous scan. The cscan macros now turns off "normalize_to_time" for the duration of the scan and normalizes such counters to time as they are read. The "normalize_to_time" setting is restored when the scan finishes or is aborted.

Number Of X11 Plot Windows Increased

The plotting macros now allow up to nine x11filt plot windows, up from the previous limit of five.

New acqsetup Option To Create X11 Plots After Reading MCA Devices

It is now possible to configure the MCA acquisition macros to automatically plot the acquired MCA spectra in an x11filt window each time each spectrum is read. If selected, these x11filt plots will be drawn, even if X11 plots are disabled via setplot. Thus, one could have X11 plots for MCA data and Python splot plotting of scaler counters from scan data.

Note, one can also use the Python splot utility to plot MCA spectra. The Python splot automatically updates any windows that are configured to plot a spec shared data array, such as those associated with MCA acquisitions. To configure such a window, chose SPEC->Display Variable in the splot menu, and select the shared data array in the pop-up window. As usual, the newly created splot tab can be detached by dragging.