changes

Highlights for spec release 6.13

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 can 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").

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.