changes
highlights of modifications for spec release 6.01
Notes For Beta Release
Thanks for taking a look at the spec 6.01 beta release. In additional to the usual assortment of bug fixes and new hardware support, this spec release contains some noteworthy new features. Please explore them and report back to CSS any comments, questions, concerns or suggestions.
First on the list of new features is the new interactive plotting utility called splot. splot not only does real-time plots of scan data, but also can read and display scans from spec data files. In addition, splot has controls to send commands to spec to position motors and initiate scans. Note, though, spec must be run in server mode (use the -S flag when starting) in order to send commands to position motors or do scans from splot.
Another added feature is a new built-in spec_menu() function which provides interactive menu configuration capabilities. The standard setplot, plotselect and setshow macros have been replaced with versions that use spec_menu(). A new mstartup macro replaces much of the configuration provided by the old startup macro. Additional menu-ized configuration macros will be forthcoming.
A new set of continuous scan macros, cscan, c2scan, etc., performs rapid scans where the counters are read continuously, while the motors move steadily from the scan starting to ending positions.
The splot program is written in Python and requires the PyQt4 and PyQwt5 packages. A script called install_splot_needs is included in the spec distribution, which will attempt to install the required packages and their dependencies. One can also install the needed packages using whatever tools the particular Linux distribution includes. To use the supplied script, go to the spec distribution directory and type:
sudo ./install_splot_needs [-y]
The -y flag is optional. If included, the package installation programs will assume a yes in response to queries to confirm additional package installation. The above Python packages do have dependencies, so the package maintenance programs (yum or apt-get, depending on Linux distribution) will likely download a dozen or so additional packages.
Be sure to either start fresh, as in spec -f, or run the newmac macro to read in the updated macros. Run setplot to choose whether to use the new splot utility, the traditional X11 plotting utility, neither or both.
Please read through the update notes below for a full list of updates. We at CSS look forward to your feedback. Thanks!
May 2, 2014 - RELEASE 6.01.12 Beta
Include install_splot_needs Script In Distribution
The install_splot_needs script is now included in the distribution.
Updated setplot Macro
A number of splot-related options, such as symbol size and whether to display a grid have been added to the setplot macro.
Fixes For splot_cntl() Function
The splot_cntl() function has been updated to require semicolons to separate multiple commands in order to be able to parse the options associated with the "plot" command.
Faster splot Start Up
The server connection to the splot program is now faster on start up.
Updated Newport XPS Support
The Newport XPS motor controller code will now show warning messages if a move stops because of a following error or any of the other events that cause the controller to put the axis in a disabled state. Also, the commands to set the motor speed and acceleration are now done more efficiently.
April 14, 2014 - RELEASE 6.01.11 Beta
Fixes For cmesh Macro
The string assigned to the HEADING symbol for the cmesh macro is now correct.
Fixes and Performance Improvements For the splot Utility
This release contains fixes and improvements for the splot utility.
April 6, 2014 - RELEASE 6.01.10 Beta
Fix For Drifting Pseudomotors
An old problem associated with the internal rounding of motor positions calculated for pseudomotors from real motors or for real motors from pseudomotors, such as with a kappa head on a fourc, fivec or psic diffractometer, has been addressed. The rounding could lead to position drift during repetitive movements in certain configurations. The get_commanded macro, introduced in the first 6.01 Beta release to work around the problem, has been eliminated, as it is no longer needed.
Fix For newfile Macro When Opening Existing File
An unnecessary warning message about the last scan number in existing data files with more than nine scans has been fixed. This bug was introduced with the reorganization of the newfile macros in the initial 6.01 Beta release.
"SignedInteger" Recognized As an ESRF Data Format Data Type
Some programs that use the ESRF data format (EDF) use "SignedInteger" rather than the "SignedLong" to characterize the 32-bit integer data type. The fmt_esrf.c file included in the spec distribution that implements the EDF format for the fmt_read() and fmt_write() functions now recognizes "SignedInteger" as a data type.
Fix For tango_put()
An old programming error in the implementation of the tango_put() function that has only recently manifested on 64-bit Linux builds has been fixed. Before the fix, a tango_put() call of a scalar attribute could pass an incorrect value.
Support For National Instruments X Series Counter/Timers
The National Instruments 6300 X series PCIe and PXIe 6300 boards are now supported as counter/timers. The digital I/O capabilities of the boards can also be used. The analog-to-digital and digital-to-analog capabilities are not currently supported. See the ni63xx help file for details.
Updates For C400
The support for the FMB-Oxford C400 counter/timer has been updated. See the new c400 help file.
Fixes and Performance Improvements For the splot Utility
This release again contains various fixes and improvements for the splot utility.
March 24, 2014 - RELEASE 6.01.10 Beta
Fix For Counter Mnemonic Check In Configuration Editor
A old bug in the configuration editor, where a check for illegal use of spaces in the counter mnemonics was applied to strings in row 2 of the scaler screen and not the mnemonics in column 2, has been fixed.
March 12, 2014 - RELEASE 6.01.09 Beta
Fix For array_copy()
A bug, where an "Out of temporary cells" message would appear after a bit less than 20 calls of the new array_copy() function (but only when the first argument was a subarray), has been fixed.
Fixes and Performance Improvements For the splot Utility
This release contains various fixes and improvements for the splot utility.
March 5, 2014 - RELEASE 6.01.08 Beta
Fixes For Server/Client Issues
Several old issues with spec server/client mode have been addressed. A bug where a client may not find a previously open server specified by host and port number when the client is already attached to multiple servers has been fixed. A deadlock hang in server mode that could occur if a keyboard ^C came while socket connections were being opened from both the main thread and the server read thread has been eliminated.
Updates For Continuous Scan Macros
Several improvements have been made to the screen display and plotting during for continuous scan cscan and cmesh macros.
Updates For splot Utility
Various fixes and improvements for the splot utility are included.
February 26, 2014 - RELEASE 6.01.07 Beta
Continuous Scan Macros Now Include a cmesh Macro
The continuous-scan macros have been updated to include a cmesh scan. The cmesh scan does a series of single motor on-the-fly scans while an additional motor is stepped through a specified range. The scan direction is reversed after each on-the-fly scan to minimize overhead time.
In addition, the cscan count time has been decreased from 3600 seconds to 999 seconds to accommodate counter/timers with lower maximum count times.
Fix For resize_scan_data()
A syntax error in the updated definition for the resize_scan_data() macro (associated with the standard plotting macros) has been fixed. The error would only have been seen for scans with more than 4096 points.
Fix For pl_MIN, pl_MAX, pl_SUM and pl_SUMSQ Definitions
The definitions for pl_MIN, pl_MAX, pl_SUM and pl_SUMSQ have been belatedly updated to match the changes in the rest of the plotting macros.
The fmt_read() and fmt_write() Functions Now Work With Subarrays
The fmt_read() and fmt_write() commands, used to read and write binary data in standard and user-created formats, will now work using subarray syntax. Previously, the commands could only work with full data arrays.
Preliminary Support For C400 Counter/Timer
This spec release contains very preliminary support for the C400 counter/timer made by Pyramid Technical Consultants and sold by FMB-Oxford. The spec support is over the serial interface only.
Preliminary Support For Trinamic TMCL Motor Controllers
This spec release contains very preliminary support for the TMCL line of motor controllers from Trinamic. Both serial and CAN interfaces are supported.
February 22, 2014 - RELEASE 6.01.06 Beta
Fix For Rare Crash In Server Mode
When running server mode, there is now a mutual-exclusion lock around the code that spec uses to maintain the list of socket connections. Previously, data corruption and a crash could sometimes occur if clients were making and breaking connections to a spec server that was also making socket connections from the main command loop. This flaw has been present since the introduction of spec's server mode.
Reversion Of Fix For the @ Indirection Operator
A fix to address an issue with the @ indirection operator and two-dimensional associative array elements introduced with the first 6.01 release has been removed, as it caused more problems than it fixed.
February 14, 2014 - RELEASE 6.01.05 Beta
Hardware Support For the New Focus 8742 Motor Controller
This release includes initial support for the New Focus (Newport) model 8742 Picmotor Controller/Driver. The current support is limited to the Ethernet interface. The USB interface and RS-458 network support will be added when needed.
Epoch Now Saved To Data File With Added Precision
The default _loop macro, called at each point of the standard scans, will now save the epoch value for each scan point to millisecond resolution. Previously, the value was saved as an integer. The value is the difference between the current time and value of the EPOCH variable. The value for EPOCH is set to the current time when a new data file is created and is saved in the data file header.
Duplicate Port Numbers In sock_par("show") Eliminated
The strings printed with sock_par("show") and returned by sock_par("info") no longer list the same port number twice after the host.
January 27, 2014 - RELEASE 6.01.04 Beta
Fix For Smaract Motor Controller
This release has a fix to accommodate the Smaract MCS motor firmware update which had broken spec's presence test for the controller.
January 25, 2014 - RELEASE 6.01.03 Beta
Update For counters Macro
Counter names, in addition to counter numbers and mnemonics, are now included in the list of counters displayed with the counters and show_counters() macros.
January 23, 2014 - RELEASE 6.01.02 Beta
Name-Space Issues with Moving and Counting Macros Addressed
The local variable names used within the _mmov macro (used by mv, umv, mvr, umvr, mvd and umvd) now all start with an underscore to lessen the chance of a name conflict with local definitions in user_getangles, user_premove, user_postmove, etc.
In addition, get_angles in the wm and _update() macros has been replaced with a new macro function called get_angles_func(). The new macro function serves as a wrapper to get_angles, insulating local variables that appear in user_getangles from symbols used in the calling macros. A get_counts_func() provides a similar wrapper to get_counts and is used in the updating counting macro uct.
Move Macros Now Allow Variables For Motor Mnemonics
The _mmov internal macro used by the standard motor-move macros (mv, umv, mvr, umvr, mvd and umvd) will now work if the motor number or mnemonic argument is a variable. For example:
for (i = 0; i < 5; i++) mv i 10
will move motors 0 through 4. Similarly:
{ par="phi"; umv par 4; par=th; umv par 1 }
will work. In the first case, the symbol par is assigned a string version of the motor mnemonic. In the second case, par is assigned the number value of the mnemonic.
splot Updated
The version of the splot utility in this spec release includes fixes and performance enhancements.
Fix For Display of Disabled Counters In uct
The uct macro has been fixed to properly format the display when disabled counters are included.
December 18, 2013 - RELEASE 6.01 Beta
New splot Utility
A new stand-alone plotting utility called splot is introduced with this spec release. The splot program is intended to replace the standard x11filt window and provide additional functions. The splot program uses shared-memory data arrays and/or spec server/client protocols to communicate with the spec process.
The splot code is written in Python and the source is included in the spec distribution. The current version of splot requires the PyQwt package.
Note, the x11filt plotting is still available and can be used simultaneously with splot. Use the setplot macro to configure plotting.
New splot_cntl() Built-In Function
To support the tight integration of the new splot utility with spec, a new splot_cntl() function is provided to send and receive splot messages. See the splot_cntl help file for details.
array_plot() Will Now Plot One-Dimensional Arrays
The array_plot() function has been updated to plot one-dimensional data arrays, such as might be read from an MCA device. For such plots, the x-axis is set to the point number.
Updated and Improved Plotting Macros
The standard plotting macros have been updated and revised to fix some old problems and to accommodate the new splot utility, which is an alternative to the standard spec x11filt plots.
The SCAN_D data array now defaults to a shared-memory object to accommodate the splot program. In addition, SCAN_D now includes data for all the configured counters at each data point along with HKL values for motor scans that include geometry motors.
New scan_info_update() and scan_meta_update() macros have been worked into the standard macros to fill the shared memory info and meta region with details of the spec configuration and scan status for the benefit of splot.
Many of the internal macros have been reworked. If a site's local macros use internal macros from the macros/plotarray.mac file, those local macros should be checked and possibly revised to maintain compatibility.
New mstartup Macro
A new mstartup macro (for menu startup) uses the new spec_menu() function and replaces much of the functionality of the standard startup macro.
New Continuous Scan Macros
New cscan, c2scan, c3scan and c4scan standard macros for on-the-fly scans are included with this spec release. With these scans, while the motors move from the start to end positions, the counters and motor positions are read continuously. The scan arguments include the start and finish positions for each motor and the total time for the scan. The speed of each motor will be set to approximate that scan time. An additional optional argument specifies a sleep interval between each counter reading. See the comments in the cscan.mac source file for details.
Unlimited Number Of Output Files
Previous releases of spec limited the number of open files (using the open(), on() or fprintf() functions) to 25. With this spec release, there is no built-in limit. The number of files that can be opened is only constrained by the system limits.
Note, it is not a good idea to run up against the system limit. A number of commands in spec will cease to work if no more file descriptors are available from the system. Make sure that macros that open files have provision to close the files when they are no longer needed. Note also, the spec_par() "auto_file_close" option can be set to have spec automatically close files that haven't been accessed in the specified time. See the spec_par help file for details.
New Built-In OUTFILES Associative Array
spec will now maintain an associative array named OUTFILES that will hold information about all the currently open output files. OUTFILES is a two-dimensional array. The first index is the name by which the file was opened using open(), on() or fprintf(). For the second index "name", the value is the same as the first index. For the second index is "path", the value is the full path name. For example:
1048.FOURC> for (i in OUTFILES[]["name"]) 1049.more> printf("%10s %s\n", OUTFILES[i]["name"], OUTFILES[i]["path"]) dlog /private/tmp/dlog data1 /private/tmp/data1 tty /dev/tty /dev/null /dev/null
or
1053.FOURC> p OUTFILES[DATAFILE]["path"] /private/tmp/data1
Note, the special built-in name "pipe" is not included in OUTFILES. The special built-in name "/dev/null" includes the full path in both "name" and "path" to work with the standard macros that always refer to that special file by the full path name.
Support For 64-Bit Integer Data Arrays
New keywords long64 and ulong64 are available to create 64-bit signed and unsigned integer data arrays, respectively. The 64-bit arrays can be used in all contexts that accept array data types. Note, though, spec will only work with 52 bits of precision in some contexts, since the internal code uses double-precision floating point format for many operations associated with spec user-level symbols. (Double floats use 52 bits for the significand and the remaining 12 bits for sign and exponent). The spec_shm.h and spec_server.h files included in the spec distribution have been updated to include definitions for 64-bit data-array data types.
New Variable Argument Feature For Macro Functions
New local variables now exist within macro functions. The variables are named argc, arg0 and possibly arg1, arg2, etc., and represent parameters used in the invocation of the macro function that were not declared in the definition of the macro function. The variable argc is a count of the additional parameters. The variable arg0 is a string with the name of the macro function. The additional variables arg1, arg2, etc., contain the values of the additional arguments and will have the same data type -- number, string, associative array or data array -- as the parameter in the call to the macro function.
Note, argc and the arg# parameters only apply to arguments after the declared arguments. For example, consider this macro function:
def test(par1, par2) '{ ... }
When called as
test(1, 2, 3, 4)
the value of argc will be 2, arg1 will be 3 and arg2 will be 4.
If a parameter or local variable of the same name is used in the definition of the macro function, that instance will override these automatically created argc/arg# variables.
New Filename Completion For do and qdo Macro Commands
Although do and qdo are defined as standard user-level macros, filename completion code has been added to automatically include directory paths contained in the global variable DO_DIR. Macro support for path lists in DO_DIR was added to the standard macros in spec release 6.00.05. Filename completion is available when spec is linked with the libedit or readline libraries.
New input() Option To Read Arrow Keys and Forward Delete
The cbreak mode for input() now has an option to return special codes when arrow keys or the forward-delete key are pressed. Type h input at the spec prompt or see the funcs help file for details.
New IS_SERVER Built-In Variable
A new built-in variable named IS_SERVER will be nonzero if spec is running in server mode (invoked with the -S option). When in server mode, IS_SERVER will be set to the port number on which the spec server is listening.
New HOSTNAME Built-In Variable
A new built-in variable named HOSTNAME will be set to the hostname of the computer running spec.
New Flexibility For Identifying spec Server
The configuration of spec server motors and counters and the built-in functions for communicating with a spec server all require an argument of the form host:port or host:spec to identify the host and the port on which the server is listening. With this new release, if the host part of the string is missing, spec will use "localhost". In addition, it is now allowed to mix references to the same server by port number and by spec process name. See the server help file for details.
Improvements For remote_stat()
spec will now include a check for pending connections to spec servers during a call of remote_stat(), making it possible for a loop that tests the return value of remote_stat() to determine when a server connection comes up.
Also, remote_stat() will no longer return "lost" for a previously open connection after a new call of remote_par(..., "connect") for the same host is made.
Length Of Allowed Input Line Increased
The maximum length of input records has been increased from 512 to 4096 bytes.
Fix For Detection of Invalid Octal Values In Strings
An old issue where strings starting with the characters "08" or "09" would evaluate to zero in certain contexts, in particular in conditional statements, has been fixed. The problem was that the C code improperly identified the strings as octal constants due to the leading zero, but a scan for an octal number would return a zero value since 8 and 9 are not valid octal digits.
Fix For date() Glitch
A bug in the date() implementation where two successive values for the time of day displayed using the format date("%s.%.6") could result in anomalous values such as:
1382650482.99999905 1382650482.00001097,
where the second invocation shows an earlier time than the first, has been fixed. Note, a more straightforward way to obtain the same information is using the time() function, which never had such an issue.
Fix For decode() Of Two-Dimensional Associative Arrays
The built-in decode() function will now properly decode two-dimensional associative arrays. See the encode help file for details on encode() and decode().
Fix For x11filt Retained-Pixmap Mode Text Garbling
The x11filt plotting utility can use either backing store or a retained-pixmap to maintain content that is drawn when the plot window itself is not visible. Backing store is a server feature. The retained pixmap is implemented within the x11filt code. The default mode for x11filt is to use backing store, but on some platforms the default X server configuration has backing store disabled. In that case, x11filt uses the retained pixmap. An old (twenty-one year) bug associated with writing labels to the x11filt retained-pixmap buffer that resulted in garbled labels when a window becomes visible that had been updated while hidden has been fixed.
New CP_FILTER_CMD Option For cplot_plot Macro
The standard cplot_plot macro now recognizes a CP_FILTER_CMD global variable. If it exists, the cplot_plot macro will evaluate its string value to create a dynamic CP_FILTER command. For example, the following will produce pdf files using the C-PLOT pdf filter containing the current scan number as part of the pdf filename:
CP_FILTER_CMD = 'sprintf("pdf scan_%04d.pdf", SCAN_N)'
See the macro source file macros/cplot.mac in the spec distribution for implementation details.
New COUNT_FMT_MAXCH Option For Updated Counting
The number of counters displayed while doing an updated count with the uct macro can be limited to the number of counters in the new global variable COUNT_FMT_MAXCH. If the value is zero, all the counters will be displayed. The setshow macro will prompt for a value.
newfile Macro Updated and Reorganized
The standard newfile macro has been split into pieces. A new newfile_head() macro function creates the file header. A new newfile_f() macro function handles most of the task of creating the new data file. The chk_file shell utility test on whether an existing file begins with the standard header has been replaced with calls of built-in spec functions that perform the same test. The newfile macro itself handles parsing arguments and calls newfile_f(). The newfile_f() macro is also called from the new mstartup menu startup macro. See the macro source file macros/file.mac in the spec distribution for implementation details.
Fix For Drifting Positions In Motor Scans In Some Pseudo Motor Configurations
A new get_commanded macro, which is defined as read_motors(0x10) (that puts each motor's last commanded position into the A[] array) has been added to _ascan and mesh macros before motor positions are calculated for each new scan point. This addition to the macros addresses a problem with real motor drift while scanning related pseudo motors in certain configurations.
New Serial Baud Rate and Other Fixes
spec now recognizes a baud rate or 600000 for serial devices. In addition, some issues with the code to set certain non-standard baud rates (7200, 14400 and 28800) on Linux have been addressed.
Updated Behavior For Several Motor Controllers
An update to the motor control error handling will now abort the move if there is an error during the "prestart_one" and "prestart_all" phase of sending the commands. Only a handful of motor controllers are affected by this change, namely the Oriel 18092, Advanced Control System MCU, Missouri Research Reactor motors, MicroMo MVP-2001, New Focus Picomotor 875x, Newport XPS, SPring-8 Equipment Manager motors, along with the macro hardware motor support. In practice, one is not likely to see any difference in behavior with the real motor controllers. However, the updated behavior may be useful with the macro hardware motor support.
TANGO Support For 64-Bit Integer Data Types
spec now supports the DEVVAR_LONG64ARRAY and DEVVAR_ULONG64ARRAY as input and output types for tango_io(), as input types for tango_get() and as output types for tango_put().
Support For SmarAct SCU Motor Controllers
spec now supports the SmarAct SCU model motor controller in addition to the MCS model already supported. See the smaract help file for details.
Updates For the Newport XPS Motor Controllers
Previously, spec would automatically send the home-search command to a Newport XPS motor group if the XPS reported that motors in the group were in the not-referenced state. When an XPS motor is in the not-referenced state, nothing can be done with the motor until the home-search command has been sent. This spec release changes the default behavior so that the home-search command is not sent automatically. Instead, a message is printed during hardware configuration or when a move is attempted telling the user that the home command must be run.
The previous default behavior of automatic home-search can be restored on a controller-wide basis by adding the non-standard optional controller parameter "auto_home" to the hardware configuration file. A value of 1 for the parameter will allow spec to send the home-search command during hardware configuration. A value of 2 will allow spec to send the home-search command any time it is needed.
Improved Abort Handling for ACS MCB-4B Motor Controller
A problem with the ACS MCB-4B motor controller, where communication errors occurred after sending a motor-stop command associated with a ^C user abort, has been addressed. spec now gives the controller motors time to decelerate before sending a command after sending the stop command, as the controller firmware appears to require such a delay.