Beamline Instrument Software Support |
|
SPEC Macro documentation:
[ Macro Index |
BCU Home ]
|
MCA.MAC | ||||||
[ source code | installed at | configured at ] | ||||||
See other macros in category: Detection MCA | ||||||
Description:
| ||||||
Documentation:
These macros provide users with basic MCA commands, i.e. start, stop, init, read memory, etc..., as well as with more sophisticated features such as ROIs, channel calibration, peak search, data saving and recovering, etc... MCA control is inserted in SPEC internal code, making it possible to automatically operate the MCA, from standard SPEC counting and scanning commands, e.g. acquire, plot out, save spectrum for each point of a scan. A Graphical User Interface is also available. ATTENTION About the usage of the Graphical User Interface (GUI) : it is at the moment only capable of monitoring the data acquired, as there is no connection between SPEC and that GUI, appart from the spectrum data itself and its calibration parameters, both stored in shared memory. For instance, the ROIs defined from SPEC or from the GUI are not connected together. They are two seperate sets of ROI definitions. The GUI is not capable of sending control commands to the hardware. Be more particularly aware that the acquisition times are not known by the GUI, so if you save the spectrum from the GUI, they wont be included in the file. rather use SPEC for saving your data. The GUI is a display. SETUP Hardware supported : Some Particular settings: OVERVIEW EXAMPLE INTERNALS MCA macro user hook: Users can hook their own macro to those macros, using "cdef()". DEPENDENCIES
| ||||||
Macros:
Usage: mcasetup [adc] [tmode] [gsz] [g] [cal] [Xlbl] [Xun] [nclr] [sleep] [bgnd] [gui] [log] [dots] [lines] [ebars] [flag] [red] [synchr] Sets the MCA hardware and software up. You can either give all the parameters on the command line or use the menu that shows up when typing "mcasetup" alone.
NB : It is possible to have the last acquisition elapsed times values reported in counters by simply configuring the counters you need out of mcaLt, mcaRt and mcaDt mnemonics, respectively standing for Live, Real and Dead times. mcaoff Usage: mcaoff Disables the MCA. The MCA is no longer addressed during standard SPEC operation ("ct", scans ..), but still from "mcaacq". mcaon Usage: mcaon Enables back the MCA. mcainit Usage: mcainit Initialises the MCA macros and hardware. Can be called at startup to re-setup things without giving any parameter, nor calling any menu. The current or default parameters are then set. Default are mensionned together with mcasetup description. mcaacq Usage: mcaacq [preset_seconds] [roi | first] [last] Acquires data with the MCA only. The rest of counters configured in SPEC are not addressed by this command. If you need it, use standard ct command. (don't forgot, mcasetup set AUTO-RUN mode <ON>, or mcaon). mcaacqconsists in the following sequence: The MCA memory is read within the range specified, or if none, the active ROI . If the requested preset time is 0 or un-specified, the acquisition is started "for ever"; press "control-C" or "s" or "q" to stop it. Pressing "c" would clear the memory on the fly. If the GUI is not active, you can also change the plot update intervals (press "u"), change the plot x or y ranges (press "x" or "y"), integrate counts on region (press "i"), toggles plot attributes such as lines (press "l"), large dots ("d") and log y("g"). Meanwhile, the acquisition goes on. mcaclear Usage: mcaclear Clears the active MCA memory group. mcastart Usage: mcastart [preset_seconds] Presets and starts an acquisition. mcastop Usage: mcastop Stops acquisition if running. mcahalt Usage: mcahalt Send "stop acquisition" signal whatever is the status of the device. It might happen that the device server gives a meaningless error message, if the status is already "IDLE". mcaread Usage: mcaread [roi|first] [last] Reads the MCA memory within the range specified. mcatimes Usage: mcatimes Reports the MCA elapsed live , real and dead times. mcastat Usage: mcastat Prints out a detailed status of the SPEC MCA registers. mcaroi Usage: mcaroi [no|name] [<first> <last>] [name] ROIs definition.
mcanewfile Usage: mcanewfile [file_name] Sets a new file prefix and initialises the spectrum run number, which appears in the file name as e.g. PREFIX_001.mca. But when spectrum was taken during a scan, the file name changes for PREFIX_001_000.mca, where first number is the scan number (SCAN_N) and second one the point number in the scan. mcasave Usage: mcasave [roi|min] [max] [-silent] Saves acquired data to disk file. If a range is specified, the data are saved within that range, otherwise the whole spectrum is dumped to the file. The file is either the standard scanfile or a private MCA file, depending on "mcasetup" entries. If standard scanfile is used, each spectrum originated from out of a scan (ct or mcaacq) is nevertheless referenced to a "scan number". (SCAN_N is incremented). If a private file is used, it must have been set a prefix using "mcanewfile" command. Then each spectrum is saved to a different file. The file name extensions gives the information on its origin. see mcanewfile. The file syntax is standard and MCA mixed. MCA syntax is described below: Each MCA related line holds the character "@".
It consists of: mcaload Usage: mcaload <file> <scan_no> [scanpt_no] [0|1] Loads spectrum from a file. The loaded spectrum is stored into WS memory as if it would have just been acquired. If file is a standard scan file, spectra are referrenced to by their "scan" number, and eventually their "scan_point" number. Both numbers must be 0 when loading data from private MCA files. 4th argument to 1 means that the calibration parameters are to be loaded from the file as well. In that case any other current calibration is overwritten. To avoid it, "mcasave" it with the current spectrum, before "mcaload"ing. Reduced data channel numbering starts from the first channel value (prior to reduction) added integer part of half the "factor", every next point incremented by "factor" ..... mcapar Usage: mcapar Shows calibration fit parameters or inputs new parameters. mcaE Usage: mcaE Toggles between channel (uncalib) and calibrated mode. mcacal Usage: mcacal Computer aided energy calibration of the MCA. mcacalm Usage: mcacalm Manual calibration of the MCA. mcapeak Usage: mcapeak Peak search on the current spectrum. mcashow Usage: mcashow Shows peaks found. mcacplot Usage: mcacplot [first|roi] [last] A screen plot of the current MCA data in cplot format. Part of the plot parameters are taken from "mcasetup", rest from "cpsetup" settings. mcapplot Usage: mcapplot [first|roi] [last] A printer plot of the current MCA data in cplot format. That follows the same rules as "mcacplot" macro. mcaguion Usage: mcaguion Turns MCA Graphical Interface on. mcaguioff Usage: mcaguioff Turns MCA Graphical Interface off. mcasplot Usage: mcasplot [xmin] [xmax] [ymin] [ymax] Plots the current MCA data spectrum. Does nothing when using GUI.
| ||||||
Internal Macros: | ||||||
Usage: mcaunsetup Setup file service. mca_defaults Usage: mca_defaults [mask] Sets default values to some global variables. mca_max_channels Usage: mca_max_channels (size) Returns installed device full memory size. If the device is disconneted, the size specified as input is returned, so that simulation mode or loaded data analysis are possible. mca_device Usage: mca_device Checks wether a MCA is configured and reads in its device server name or its device type. If it appears that no device is configured, it makes that the mca macros detach themselves from the SPEC standard ones. mca_state Usage: mca_state () Checks MCA State. (acquiring, idle, disconnected or not configured) mca_setup Usage: mca_setup (adc,tm,sz,g,cal,lbl,un,nclr,slp,bgd,lg,dt,ln,eb,flag,red,syn) Reads in setup parameters and do the setup. see "mcasetup" for details mca_dosetup Usage: mca_dosetup () Does the actual setup, i.e. hardware setup, general operation setup and subsequent software setup. mca_hdwsetup Usage: mca_hdwsetup() hardware setup, i.e. Adc selection, Memory initialisation, and operation setup, i.e. time mode and soft preset. mca_wait Usage: mca_wait () loops printing a message till the acquisition is finished. mca_firstinit Usage: mca_firstinit() Does things that must or need only to be done once at startup. Loads roi from file, Reset|Declare shared memory ... mca_softsetup Usage: mca_softsetup() software setup, i.e. inits memory and assign newly set up parameters to the relevant globals. mca_deldef Usage: mca_deldef() Un-hooks MCA operation from the standard macros. mca_roideldef Usage: mca_roideldef () Un-hooks ROI operation from the standard macros. mca_cdef Usage: mca_cdef() Hooks MCA operation to the standard macros. mca_saveroihead Usage: mca_saveroihead Saves to DATAFILE MCA ROIS description. mca_roicdef Usage: mca_roicdef () Hooks ROI operation to the standard macros. mca_config Usage: mca_config "config" / "reconfig" service. Hooked to "config_mac". mca_setupmenu Usage: mca_setupmenu MCA menu. mca_menu Usage: mca_menu Display MCA General menu. (page 1) mca_calgrp Usage: mca_calgrp Prepares MCA memory group setting. mca_cpmenu Usage: mca_cpmenu Display MCA CPLOT menu. (page 2) mca_setupchk Usage: mca_setupchk Checks availability of some menu options. mca_io Usage: mca_io (command,argument,flag) Management of input/output to the MCA. flag 0: returns what mca_par() returns or argument if error occured (cheat a bit) flag 1: returns really what mca_par() returns. mca_waitcounts Usage: mca_waitcounts Plots and prints out times while waiting for the acquisition to complete. This is used by "mcaacq" macro. mca_key Usage: mca_key <key> Manages a menu which is callable using input keys. see "mcaacq". mca_preset Usage: mca_preset (seconds) Sets the preset time value for the next acquisition. mca_read Usage: mca_read [first_ch] [last_ch] Read the MCA memory within the channel range specified. Default reads the whole memory. mca_times Usage: mca_times () Reads in times elapsed. (Live, Real and Dead time). mca_readbuffer Usage: mca_readbuffer Reads in MCA spectrum and plots it. That macro is hooked to "user_getcounts". mca_getcounts Usage: mca_getcounts <ROI_counter_mnemonic> <channel_min> <channel_max> Integrates counts on ROIs and updates SPEC counters register. This is hooked to "user_getcounts", one hook per counter-assigned ROI. mca_integrate Usage: mca_integrate (channel_min,channel_max) Integrates counts on channels region. This is called by "mca_getcounts". Does a backgroung substraction if that option is turned on in "mcasetup". mcaloadroi Usage: mcaloadroi re-loads ROI definition from disk. mcasaveroi Usage: mcasaveroi saves ROI definition to disk. mca_roinum Usage: mca_roinum (roi_id) Returns ROI number, or -1 if not found. "roi_id" is a ROI name or a ROI number. mca_roidisp Usage: mca_roidisp () Prints out ROI definition table. mca_roisetname Usage: mca_roisetname (no,name) Assigns ROI number <no> with name <name>. mca_roisetrange Usage: mca_roisetrange (no,min,max) Assigns ROI number <no> with specified range. mca_roimenu Usage: mca_roimenu ROI edition menu. _mca_roiadd Usage: _mca_roiadd New ROI input. _mca_roiname Usage: _mca_roiname ROI name input. _mca_roirange Usage: _mca_roirange ROI range input. _mca_roidel Usage: _mca_roidel ROI deletion. _mca_roichange Usage: _mca_roichange ROI modification. mca_fileheader Usage: mca_fileheader(file) Opens next MCA private file, and writes header on it. mca_filename Usage: mca_filename (prefix, number, suffix) Returns MCA private file name. MCA_SL Usage: MCA_SL Returns true when the saveload package macros are loaded. mca_sl_test Usage: mca_sl_test [string] Checks if saveload macro package is loaded. mca_data_red Usage: mca_data_red() Applies data reduction on data in SPEC memory. The reduction consists of: mca_savescanhead Usage: mca_savescanhead (ch_min,ch_max) Save file header during scans. Hooked to "measure2". mca_savescandata Usage: mca_savescandata (ch_min,ch_max) Save MCA data during scans. Hooked to "user_scan_loop". mca_savectdata Usage: mca_savectdata (ch_min,ch_max) Save header and data to file after a "ct". Hooked to "user_handlecounts". mca_saveacqdata Usage: mca_saveacqdata (ch_min, ch_max, headline) Save header and data to file after a "mcaacq". Called from "mcaacq". mca_chtoE Usage: mca_chtoE <array1> <col1> <array2> <col2> Same as ps_chtoE from psearch.mac package. i.e., converts all the channels in array1[][col1] to energies and puts these values into destination array2[][col2]. The calibration function E=a+b ch + c ch^2 is used. mca_tops Usage: mca_tops Reads in parameters from shared memory (GUI). MCA_EA Usage: MCA_EA calibration parameter A.(Shared memory) MCA_EB Usage: MCA_EB calibration parameter B.(Shared memory) MCA_EC Usage: MCA_EC calibration parameter C.(Shared memory) mca_Ech Usage: mca_Ech <mode> <energy> <channel> Converts calibrated value into channels (mode 1) or reverse (mode 0) and returns the result. mca_calcE Usage: mca_calcE(x) Calculated the channel from the given Energy mca_calcch Usage: mca_calcch(en) Calculated the channel from the given Energy mca_fromps Usage: mca_fromps Writes out parameters to shared memory (GUI). MCA_PS Usage: MCA_PS Returns non 0 value if psearch macro package is loaded. mca_ps_test Usage: mca_ps_test [string] Check if psearch macro package is loaded. mca_cplot Usage: mca_cplot Decides between data in memory or in files for cplot. mca_mplot Usage: mca_mplot Arranges cplot parameters for MCA private needs and calls cplot program. Recover previous cpsetup settings when finished. mca_fplot Usage: mca_fplot not implemented yet. foreseen for c-plotting MCA data from a file. mca_guirun Usage: mca_guirun Checks wether the GUI is running, otherwise starts it. mca_guistart Usage: mca_guistart () Starts the Graphical Interface and returns its PID number. mca_plotit Usage: mca_plotit Just an indirection for mca_plot1 for the sake of the GUI. mca_plot1 Usage: mca_plot1 (group,xelem,yelem,xmin,xmax,ymin,ymax) MCA running plot. mca_resize_to_roi Usage: mca_resize_to_roi <roi> <channel_min> <channel_max> Resises specified range to the specified roi. (in channels) mca_resize_to_last_read Usage: mca_resize_to_last_read <channel_min> <channel_max> Resises specified range to the last read spectrum range. (in channels) mca_sharedarray_to_group Usage: mca_sharedarray_to_group Transfers data spectrum held in the shared memory into SPEC data group. mca_msgw Usage: mca_msgw (seconds) loops printing dots for the specified time (sec.). mca_getoffset Usage: mca_getoffset (name,column,xmin) Returns array row number of first "xmin" value occurence in the specified array column. mca_getnpts Usage: mca_getnpts (name,column,xmin,xmax) Returns number of points between first occurences of "xmin" and "xmax" in the specified array column. mca_const_utils_and_rdef Usage: mca_const_utils_and_rdef Macro which is run once at mca.mac file loading to prepare things up. mcatcp Usage: mcatcp mcadsstat Usage: mcadsstat mcacry Usage: mcacry mca_dump Usage: mca_dump mcasimon Usage: mcasimon mcasimoff Usage: mcasimoff mca_getroi Usage: mca_getroi <roi_number|roi_name> <mode> <first> <last> Converts ROI into <first> and <last> range limit. mca_roi_Ech Usage: mca_roi_Ech Converts channels into calibrated value all over the defined ROI. | ||||||
|