Version 1.1.0 (07/13/05): The Mp.Variable class methods write and send_variable no longer require single object arguments passed to them to be converted to a 1-element tuple by the calling script. In addition, if the methods read and receive_variable are about to return a 1-element tuple to the caller, they unpack the tuple and directly return the object inside to the caller. This means that a method call like d = d_spacing_variable.read() now returns a value like 3.13555 rather than the previous behavior of returning (3.13555,). MP now defines its own set of Python exceptions that are returned when MX returns an error code. There is a 1-to-1 mapping between MX errors and MP exceptions. For example: MXE_ILLEGAL_ARGUMENT --> Mp.Illegal_Argument_Error MXE_NOT_READY --> Mp.Not_Ready_Error Added new methods to the Mp.MCA class called get_soft_roi_integrals, get_energy_scale, set_energy_scale, get_energy_offset, set energy_offset, get_energy_axis. Except for the first one, all of these methods were added to support displaying MCA spectra with an X axis in units of energy rather than channel number. Added new methods to the Mp.Motor class called get_status and get_extended_status which directly call the underlying MX functions mx_motor_get_status() and mx_motor_get_extended_status(). Added support for scan pause request handlers. These handlers allow the user to pause a scan in progress and then optionally resume the scan. Version 1.0.2 (08/27/04): Added two new device classes called Mp.USB and Mp.USBDevice. While an Mp.USB object does have a directly corresponding MX_RECORD, an Mp.USBDevice object does not. You obtain an Mp.USBDevice object from an Mp.USB object by a method like the following, where libusb is the usb record: usb = record_list.get_object( 'libusb' ) usbdev = usb.find_device_by_order( 0x6c2, 0x46, 0, 1, 0, 0, 0 ) You can find the arguments to find_device_by_order in the module file 'libMp/Mp.py'. This first implementation of an MX USB interface contains support for both control transfers and bulk transfers, although only the bulk transfers are really tested. There is currently no support for interrupt and isochronous transfers, since the Linux libusb package itself does not contain support for them. A new application program 'mpshell' based on 'mpscript' has been added. It provides a Python command interpreter similar to the one you get with the interactive 'python' command. The difference is that once you get to the command line of 'mpshell', MX is already setup with a running MX database loaded from the $MXDIR/etc/motor.dat file. 'mpshell' predefines two objects called 'record_list' and 'argv', where 'record_list' is the MX record list object for the running database and 'argv' is a tuple containing the command line arguments from sys.argv, but with the leading arguments 'python' and 'mpscript' stripped off. One example of using 'mpshell' looks like: === start of example === nyx:~$ mpshell (MX Python Interactive Console) >>> print record_list >>> print argv [] >>> theta = record_list.get_record( 'theta' ) >>> theta.get_position() 9.175650000000001 >>> theta.move_absolute( 20 ) >>> theta.get_position() 10.575650000000001 >>> theta.get_position() 13.17065 >>> theta.get_position() 15.290650000000001 >>> theta.get_position() 17.690650000000002 >>> theta.get_position() 19.854200000000002 >>> theta.get_position() 20.0 >>> ^D nyx:~$ === end of example === 'mpshell' is certainly not a replacement for 'motor', but it does expose a variety of interfaces to MX that are not directly available in 'motor'. Version 1.0.1 (05/26/04): Added new methods for the Mp.AnalogInput class called get_dark_current and set_dark_current. See the MX changelog for more information. Added a new method for the Mp.Timer class called get_last_measurement_time. This method can be used for computing dark current corrections directly in Python code. Version 1.0.0 (04/26/04): Added two new device classes called Mp.SampleChanger and Mp.MODBUS. The Mp.SampleChanger class is intended for use with robotic sample changers such as are used at many new crystallography beamlines. The Mp.MODBUS class is an interface to the new MODBUS fieldbus protocol in MX. Added get_signal_state and set_signal_state methods to the Mp.RS232 class. These methods allow the program to read and change the state of individual RS-232 pins. The Mp.VME class methods for multiword data transfer have been modified to include a new argument for the address increment. If the address increment is 0, then each read or write is done using the same VME bus address. If the address increment is _not_ zero, then the VME bus address is incremented by that value between each VME read or write. The Mp.CCD class now has a new method called start_for_preset_time. The Mp.Variable class now permits the passing of strings as arguments as requested by Jim Fait. Version 0.66.1 (08/24/03): The MX architecture 'freebsd' has been renamed to 'bsd' to reflect the fact that it builds equally well on FreeBSD, NetBSD, and OpenBSD. Version 0.66.0 (08/15/03): Added two new device classes Mp.PulseGenerator and Mp.CCD. The Mp.PulseGenerator class is a Python interface to the already existing MX pulse generator support, while the Mp.CCD class is an interface to the new MX support for remote control of CCD detectors. Added several new methods to the Mp.Motor class, namely, set_acceleration_time, get_gain, set_gain, and send_control_command. The get_gain and set_gain methods allow Python scripts to read and modify motor servo loop parameters such as proportional gain, integral gain, derivative gain, and so forth. send_control_command is for operations like enabling a motor axis, resetting controller faults, and reenabling closed loop control when the controller has gone open loop. Added a new method shutdown_hardware to the Mp.RecordList class that was requested by Terry Griffin of Axian, Inc. This method invokes the libMx routine mx_shutdown_hardware() routine and is used to cleanly shutdown connections to data acquisition controllers when an MP script is preparing to exit. Version 0.65.0 (04/01/03): The MP makefiles have renamed the old ARCH and INSTALL_DIR variables to MX_ARCH and MX_INSTALL_DIR. A new Mp.SCA class has been added as an interface to the new SCA (single channel analyzer) drivers that have been added to the base MX package. A new method for Mp.RecordList objects called set_program_name has been added that allows MP client scripts to identify themselves to remote MX servers. Although this feature is optional, MP scripts are encouraged to make use of this feature, since it makes the MX server's list of clients more useful. The write() and send_variable() methods of the Mp.Variable class have been modified to verify that the supplied value argument is a Python tuple. The MP examples directory has been reorganized. The old 'mpscript' examples are now in an 'mpscript' subdirectory. New subdirectories include 'simple' and 'tkinter_ex'. The examples in the 'simple' directories show ways of invoking MP that are simpler, although somewhat less portable, than the method used by the 'mpscript' examples. 'tkinter_ex' contains a set of example classes used by Jim Fait of SER-CAT to build MP-based Tkinter GUIs for automatic tune feedback and other tasks. MP has added support for QNX and FreeBSD. All references to 'acceleration_parameters' in MP have been changed to 'raw_acceleration_parameters' to match the corresponding changes in MX. Version 0.62.0 (12/03/02): A new build target 'irix-gcc' has been added to support building MP under SGI Irix with GCC. See the changelogs for MX or MxTcl for the reasons. 'mpscript' has been modified to see if the environment variable MXDATABASE exists. If the variable MXDATABASE exists, then 'mpscript' loads its MX database from that file instead of the default file '/opt/mx/etc/motor.dat'. Steve Weigand of DND-CAT discovered some bugs in the creation of MP amplifier objects which prevented them from working correctly. These bugs have been fixed. Version 0.60.0 (08/13/02): New functions have been added for controlling where output messages are sent and for controlling where user input is received from. These functions are: Mp.info, Mp.set_info_output_function Mp.warning, Mp.set_warning_output_function Mp.debug, Mp.set_debug_output_function Mp.set_error_output_function Mp.info_dialog, Mp.set_info_dialog_output_function Mp.getch, Mp.kbhit Mp.user_requested_interrupt, Mp.set_user_interrupt_function These functions are primarily used to permit things like sending output to a GUI window, receiving user interrupts from a GUI button, and so forth. However, they are also useful in other circumstances like using MP under the Apache mod_python module. The old MpTk module was previously responsible for doing some of the tasks mentioned above. Since these functions have now been folded into the base Mp module, the MpTk module has been deleted. The MpScan module for loading and saving scans has now finally been completed and tested. A new 'get_previous_record' method has been added to MP records. In addition, 'get_multiple_records' now has an extra argument to specify the order in which the records should be returned. This is done to support returning a list of records in reverse order. 'mxgui' uses this to report its list of scans in reverse order in the scan selection dialog. New 'move_absolute_with_flags' and 'move_relative_with_flags' methods have been added to the motor class. This allows MP scripts to directly set the flags field in the underlying C functions. The 'is_at_home_switch' method for motors has been renamed to 'home_search_succeeded'. A new 'read_raw' method for scalers has been added. This is to allow clients to read a scaler without dark current subtraction being performed. The old 'read_dark_current_subtracted_value' method for scalers has been removed since the 'read' method itself now does this. Version 0.56.1 (04/04/02): MP has now been tested on MacOS X using the Fink version of Python 2.2. Fink (fink.sourceforge.net) is a project that has ported a large number of Unix applications to MacOS X including a rootless XFree86 server that can share the screen with Aqua. Fink manages them using a modified version of the Debian dpkg and apt-get package system. At this point, both Fink and native Aqua versions of Python should work with MP. The code that parses MX string variables was not correctly initializing the value of the max_string_token_length variable. This has been fixed. Version 0.56.0 (03/04/02): This is the initial release of the Python interface to MX called MP. MP provides an object oriented interface to the MX beamline control system. The currently implemented base object classes are: Mp.RecordList, Mp.Record The following higher level classes are derived from the base Mp.Record class: Mp.CAMAC, Mp.GPIB, Mp.Portio, Mp.RS232, Mp.VME Mp.Amplifier, Mp.AnalogInput, Mp.AnalogOutput, Mp.Autoscale, Mp.DigitalInput, Mp.DigitalOutput, Mp.Encoder, Mp.MCA, Mp.MCE, Mp.MCS, Mp.Motor, Mp.Relay, Mp.Scaler, Mp.Table, Mp.Timer Mp.Scan Mp.Variable Since _real_ documentation has not yet been written, you can examine the file 'libMp/Mp.py' to see what class methods and functions are currently available for the objects. All of the standard MX functionality is available for moving motors, reading counters, running scans, and so forth. The subdirectory 'examples' contains several examples of MP scripts written using the 'mpscript' utility. The mpscript utility is intended as a front end to the Mp module to make it easier to write simple scripts to control MX. Mpscript is invoked by a Unix shell or DOS prompt command of the form mpscript user_script argument1 argument2 argument3 ... Mpscript handles all of the MX and MP initialization and then invokes a 'main' procedure with the supplied arguments that is expected to be provided by the supplied 'user_script'. Here is a complete working example: -------------------------- cut here ----------------------- #! /usr/bin/env mpscript # # This script reports the position of the requested motor. # def main( record_list, argv ): if ( len(argv) != 1 ): print "" print "Usage: mp_get_position motorname" print "" sys.exit(0); motor = record_list.get_record( argv[0] ) position = motor.get_position() units = motor.get_field("units") print "Motor '%s' position = %g %s" % (argv[0], position, units) -------------------------- cut here ----------------------- Alternate examples may be found in the examples package found at http://www.imca.aps.anl.gov/mx/src/examples.tar.gz. The examples package shows examples in C, Tcl, and Python of performing a step scan either via directly commanded motor moves or via an MX scan record. The alternate examples example1.py and example2.py there demonstrate setting up the Mp module directly and do not go through the 'mpscript' package.