esrf

Beamline Instrument Software Support
SPEC Macro documentation: [ Macro Index | BCU Home ]

SAVELOAD.MAC
See other macros in category: All
Description:
    Standard and general SPEC data saving/loading facility.
Documentation:
    DESCRIPTION
    These macros functions provide programmers with the basic data saving possibilities. The standard scan format is kept and added something special for MCA data, including spectrum re-loading. Each macro function deals with a particular set of information or data.

    DEPENDENCIES
      - The file has saveload.mac to be read in
    


Macros:
    savestdheader
    Usage: savestdheader (file,flag,lastindex)
    Writes to file something close to the standard scan header, using the same syntax, e.g.:
    	#S 3  ct 0.2
    	#D Mon Nov 20 15:37:58 1995
    	#T 0.2  (Seconds)
    	#G1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
    	#Q 
    	#P0 10 112.64444 -27 
    
    The <flag> has the following meaning:
    • 0x01 : save #T/#M info ( COUNT_TIME )
    • 0x02 : save #P Motor positions
    • 0x04 : do not save #G, #U, and #M geo parameters
    The <lastindex> incremented by one is written in place of scan number and returned by the function. The command and the date are held respectively by the variables HEADING and DATE.
     Example :
     SCAN_N=savestdheader(DATAFILE,3,SCAN_N) 
    	would increments scan number and writes down to standard scan file 
    	the information as described above.
    


    savecntheader
    Usage: savecntheader (file)
    Writes to <file> the number and list of counters configured, as it is done when scanning, e.g:
    	#N 6
    	#L  Seconds  MM/CC  MCAA  MCA  Counter 4  Counter 5
    


    savemcaheader
    Usage: savemcaheader (file,fmt,npts,fch,lch,red,pst,elt,ert)
    Writes to <file> some information relevant for a MCA,i.e.:
     fmt: 	data_dump() format, e.g. "%16C"
     npts:	number of points dumped down
     fch: 	first channel saved
     lch: 	last channel saved
     red: 	data reduction coefficient
     pst:	preset time
     elt:	elapsed live time
     ert: 	elapsed real time
    
     The saved data looks like the following:
    
    	#@MCA %16C		as for dump format
    	#@CHANN 10 1250 1260 1	as for no of chans, fst, lst, reduc coeff 
    	#@CTIME 1 0.49 1	as for preset time, elapsed live time, -real-
    


    savemcacalib
    Usage: savemcacalib (file,a,b,c)
    Writes to <file> the MCA calibration fit parameters such as CALIBRATION = a + b*CHANNEL + c*CHANNEL^2 . What is saved data looks like the following:
    	#@CALIB  0 1 0 as for a b c calibration parameters (see above)
     


    savemcaroi
    Usage: savemcaroi (file,fch,lch,name)
    Writes to <file> the current MCA ROIs definition. Looks like this:
    	#@ROI  MCAA  1250  1300		as for roi name, fst and lst channels
    


    savecounters
    Usage: savecounters (file)
    Writes to <file> the contents of S[] array on 1 data line.
    e.g. :
    	0.199 62 62 0 0 0 
    


    savemcadata
    Usage: savemcadata (file,data,size,fmt)
    Writes to <file> the MCA spectrum held by <data> array, using the format <fmt> coherant to data_dump() function. That function needs to know the size, or number of points to be dumped. The output migth look like the following: (format 16C, for cplot)
    	@A 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\
    	 0 0 32 30 0 0 0 0 0 0 0 0 0 0 0 0\
    	 0 
    


    loadmcadata
    Usage: loadmcadata <file> <array_name> <column> <scan_no> <scan_pt_no> <mode> <out1> <out2> <out3> <out4>
    Reads from <file> and loads into mca <array_name>[][<column>] the MCA spectrum referrenced by its scan number and eventually its scan point number. <mode = 1> means that the calibration parameters are read from the file together with the data and reported in <out4> string (like "a b c", for E = a + b*ch + c*ch^2). <out1> and <out2> returns the absolute first and last channels and <out3> the reduction coefficient.

Internal Macros:
    savefileheader
    Usage: savefileheader(file,flag)


    savemot
    Usage: savemot


    savecnt
    Usage: savecnt


    savecounters
    Usage: savecounters(file)


Filename: saveload.mac
Author: SAVELOAD.MAC - Marie-Claire LAGIER - 96/1/8
Changed to use macro functions and arrays on 96/03
 
%TOC%
Last mod.: 06/05/2014 14:44 by beteva