Diffuse Scattering Spectrometer


These pages provide a comprehensive guide to the data analysis and reduction on D7 using LAMP.
LAMP (Large Array Manipulation Package) is an IDL based data reduction package written at the ILL and used on most of the ILL instruments as a tool for primary data inspection.

LAMP for D7 was written by:


Setting Up LAMP

After starting up LAMP you need to define the instrument and where to find the data files. Click on the “DATA Access” button in the top left-hand corner of the window and new buttons will appear. The second button from the left (next to the “Self ...” button) defines the instrument name. From the pull-down menu here, select “TOF” and then “D7”. The button to the right of this defines where to find the data files. From the pull-down menu, select “d7” (not “On-Line”). This reads the data directly from the DEC Alpha workstation and means that you can read data from a run which is still going.

You should also define your printer by clicking in the “Options” -> “Titles..” menu (just above the plot region). This will open a new window and at the bottom here, you will see a field for “Default Postscript DEVICE”. Here you enter "ep1_d7" for the Epson printer in the cabin, or "lc1_07ver" for the colour LaserJet outside the IN6 cabin,  and you can then return to the main window by clicking “Done”.

These pages are intended as an introduction to LAMP and specifically, D7 data analysis using LAMP. For a more complete description (but without the D7-specifics) see the LAMP manual, which can be obtained by selecting the “Help” ->“manual” menu in LAMP. 

I strongly recommend that you select the option “Extend to classical LAMP” in the “Lamp/layout” menu.  This gives all the functionality of LAMP in a more visible manner than the menus, and in these pages I assume that you have done this.

LAMP Workspaces

A workspace is a buffer for storing data. LAMP predefines 20 workspaces which are known as w1, w2, ..., w20. These workspaces can contain whole runs or series of runs – not just single spectra as in Genie. When you read data into a workspace, it automatically adapts to the dimensions of the data. In the simplest case you read data using the “Read” button. Workspaces can then be displayed by selecting them and pressing the “Plot W ” button. Workspaces can be manipulated using intuitive commands such as: 

w3 = w1+w2 or w5 = w4/3.7 or w6 = total(w5) etc.

Standard instrument procedures are provided either at the press of a button or via a function such as: 


in which data in w1 are intensity normalised using the counting time.

To read a run or a series of runs into a workspace, enter the run number(s) into the field to the right of the “Read” button and click the button, e.g. 3713 (reads run number 3713), 3713>3716 (reads run numbers 3713 up to 3716 and adds them together), 3713:3716 (reads run numbers 3713 up to 3716 and concatenates them).

LAMP Parameters associated with Workspaces

There are 7 different numerical arrays associated with each workspace read in by LAMP.  In addition there 6 text arrays which deal with captions.  These are

  1. x
  2. y
  3. z
  4. e
  5. n
  6. p
  7. pv
  8. captions: w_tit, x_tit, y_tit, z_tit, other_tit, par_txt

For each workspace, a series of parameters are defined. These are (for w3):

an array containing the x-axis values for the data points in w3. e.g. if w3 has dimensions (128,32), x3 should have dimensions (128)

the y-axis (only applicable if w3 has 2 dimensions or more). e.g. if w3 has dimensions (128,32), y3 should have dimensions (32)

the z-axis (only applicable if w3 has 3 dimensions or more)

the error bars (usually the standard deviation) associated with w3. Must have same dimensions as w3

the monitor/counting time. On D7, n3 always has dimensions (4,7) and contains the following:




 Total cts 






Z non-flip





 Z flip





X non-flip





 X flip





Y non-flip





Y flip

It is seen that index numbers start at 0 in this programming language (IDL). The first line, i.e.  n3(*,0) contains zeros for consistency with the format of other instruments.

has dimensions (50). Contains instrument parameters relevant to the data in w3, such as flipper currents, time-of-flight parameters, flipping ratios, etc. They can be seen and edited by pressing the “Data Params” button.

has dimensions (50,nruns). Contains the same information as p3 if only one run is stored in w3.  If the workspace consists of a concatenation of runs, the parameters for each run are stored  separately in pv3.

These are: x_tit(3), y_tit(3),w_tit(3) and other_tit(3) with the obvious meanings.

LAMP Workspace manipulation

Workspace manipulation can take place in one of three ways:

  1. The manipulation can be entered in the “MANIPULATIONS” field followed by return
  2. It can be entered in one of the function fields (the five fields to the right of the “User Macros?” button) followed by return or by clicking “Do”
  3. It can be written into a command file (.prox file) and executed by entering @filename.prox in the “MANIPULATIONS” or function fields.

Each time workspaces are manipulated, most of the parameters are passed on, with parameters of the first workspace after the “=” taking priority, e.g 

w1 = w2 + w3

automatically invokes: 

p1 = p2
x1 = x2

y1 = y2
x_tit(1) = x_tit(2)  &  y_tit(1) = y_tit(2)  &  w_tit(1) = w_tit(2)

which is what you would expect. However, it also invokes 

n1 = n2 
e1 = e2

which is often not at all what you expect.

There are two very important points here, which are often a source of error:

1) If you are adding together raw (un-normalised) data, you should always explicitly add the monitors, i.e. 

n1 = n2 + n3

in the above example

2) You should always explicitly perform the error bar calculation, i.e. 

e1 = sqrt(e2^2 + e3^2)

in the above example. Note that you do not need to do this when the manipulation is done by an existing IDL program, e.g. 

w1 = normalise​​​​​​​(w2)

automatically gets the error bars right.

D7 data Format

Many different modes of measurement are possible on D7; there are two types of data format:

Without time-of-flight analysis: Data is one- or two-dimensional: x-axis is detector angle, y-axis is spin measurement (known as “phase”).   e.g. for w1, if the measurement is without polarization analysis (No-PA) w1 has dimensions (64) since there are 64 detectors. For measurement with and without spin-flip (Z-PA) w1 has dimensions (64,2) and for measurement with full XYZ-PA w1 has dimensions (64,6) arranged as follows

w1(*,0) - Z non-flip 
w1(*,1) - Z flip 
w1(*,2) - X non-flip 
w1(*,3) - X flip 
w1(*,4) - Y non-flip 
w1(*,5) - Y flip

With time-of-flight analysis: Data is two-dimensional: x-axis is channel number, y-axis is scattering angle (which is repeated for PA measurements). E.g. for w1, if the measurement is No-PA w1 has dimensions (128,64) (i.e. 128 time channels, 64 detectors). For measurement with Z-PA, w1 has dimensions (128,128) and for measurements with XYZ-PA w1 has dimensions (128,384) arranged as follows:

w1(*,0:63)  - Z non-flip 
w1(*,64:127) - Z flip 
w1(*,128:191) - X non-flip 
w1(*,192:255) - X flip 
w1(*,256:319) - Y non-flip 
w1(*,320:383) - Y flip

Standard IDL Functions

1. To see the dimensions and contents of workspaces and parameters, the following two commands can be used:

help, w1

which tells you the type of variable w1 is and its dimensions, and 

print, w1

which prints out its elements. The results are displayed in the winterm window from which LAMP was launched.

2. Some useful functions are given in examples below. For the example we assume that w1 contains XYZ-PA time-of-flight data and therefore has dimensions (128,384):

w2 = w1(*, 0)

This takes all time channels of the first spectrum of w1, i.e. w2 will contain spectrum 1 of w1 (Z non-flip). Remember that index numbers in IDL start with 0, so if w1 has dimensions (128,384), the highest channel number (spectrum number) is 127 (383).

w3 = w2(70:80)

takes out the region from channels 70 to 80 (the elastic peak, for instance). w3 will have dimensions (11)

w2 = total(w1, 1)

integrates along the first dimension (i.e. channel number). If w1 has dimensions (128,384), w2 will have dimensions (384) and contain the integrated intensity as a function of scattering angle. Similarly,

w2 = total(w1,2)

will integrate along the second dimension (i.e. scattering angle). w2 will now have dimensions (128) and contain a summed time-of-flight spectrum for all the detectors and all phases. Combinations are also possible, such as

w2 = total(w1(*,0:63), 1)

which integrates the counts in each spectrum but only does it for spectra 0 to 63, i.e. the Z non-flip phase. w2 will have dimensions (64).

Reading Data

It is usually useful to create command files for reading and treating data. To do this, press the “User Macros?” button. The resulting window is a crude editor for creating macros and command files. The programming language is IDL. Enter the name of the command file you wish to create (must end with .prox) in the file name field, e.g. test.prox. The first line of your command file will usually consist of reading in run numbers. There are three read-in functions:  

w1 = rdrun(3276)

reads a single run (same as entering 3276 in the “Read” field)

w1 = rdsum(3276,3280)

reads and adds together all runs from 3276 to 3280 (same as entering 3276>3280 in the “Read” field)

w1 = rdand(3276,3280)

reads and concatenates all runs from 3276 to 3280 (same as entering 3276:3280 in the “Read” field)

Normalising Data

The next step is then usually to run the macro normalise, which does two things: it normalises to counting time or incident beam monitor (up to six different counting times or monitor counts for an XYZ-PA measurement). It also removes (if desired) every other spectrum, keeping the even detector numbers, since only these have polarizers in front. It is called by entering  

w2 =  normalise(w1)

A simple command file test.prox could then consist of two lines  

w1 = rdsum(3276,3280)  
w2 =  normalise(w1)

To save this file (and simultaneously check the syntax) press the “Compile new file” button and then “Exit”. You can now execute the command file by entering @test (the .prox extension is taken by default) and hitting return. Any error messages or run-time comments are displayed in the winterm window from which LAMP was launched. The workspaces can be examined with the “Plot W ”, “Scroll Spectra”, “GK_Fit” or “SuperPlot” buttons (see LAMP manual for descriptions).

A more sophisticated command file could be

w1 = rdsum(3276,3280) ; sample runs
w2 =  normalise(w1)
w3 =  rdrun(3281)      ; empty can run
w4 =  normalise(w3)
w5 = background(sample = w2, empty = w4)

here it is seen that the semicolon is the comment separator in IDL. The other important point is that the error calculation in the last line has been performed explicitly.  In this batch file we have used the macro to subtract the empty can run.  This macro will be explained more fully below.

A macro called exists that allows you to easily concatenate runs that have already been read in. Say you have measured in two different positions of the detector banks, but you measured position 1 before position 2 for the sample run, but position 2 first for the empty run, you would then need to do something like:

w1 = rdand(4910,4911) ; sample runs
w2 =  normalise(w1)
w3 = rdrun(4913)     ; empty can position 1
w4 = rdrun(4912)      ; empty can position 2
w5 = concatenate(w3,w4)
w6 = normalise(w5)
w7 = background(sample = w2, empty = w6)

After subtraction of the empty can signal, the macros used depend on the type of measurement. There are, however, two command files which are common to most types of measurement on D7. These are the quartz and vanadium correction command files. After describing the procedure for these two corrections a typical command file for data analysis of each type of measurement will be explained

Flipping Ratio (Quartz) Correction

Neither the incident beam polarizer or the analysers before the detectors are perfectly polarizing. A small amount of neutrons with the wrong spin state always manages to pass through. To correct for this, a run is performed with an amorphous silicate (quartz) sample. Quartz is a perfectly coherent scatterer and any signal picked up in the spin-flip channel must therefore arise from non-ideal polarization. This is described by the flipping ratio which is different for each detector. The following is an example of a command file quartz.prox (found in the D7/BASEDIR macros list) for extracting the flipping ratios: 

Quartz run, 1 position, XYZPA or ZPA - download this file

 ;Example of a batch file to produce a flipping ratio correction file
 ;uncomment the following lines to automatically set the year and cycle
 ;RDSET, inst = 'D7', base = 'C_year 2000', cycle = 002, /raw
 ;SETMANIP, /raw
 w1 = rdsum(44076,44078)           ; quartz runs
 w2 = normalise(w1, /monitor)      ; normalise quartz runs to monitor
 w3 = rdsum(44079,44080)           ; empty container
 w4 = normalise(w3,/monitor)       ; normalise background runs to monitor
 w5 = background(sample = w2, empty = w4, T = 0.9)
 ;perform background subtraction using w2 as sample, w4 as background,
 ;and a quartz transmission of 0.9
 w6 = quartz(w5)
 ;calculate flipping ratios and write to a file
 ;in this case, output file is called - "quartz_44078.dat"

The last line calls a macro quartz which takes the background-subtracted quartz data in w5, calculates the flipping ratios, puts the result into w6 and also writes the flipping ratios to a file quartz_44078.dat (using the last of the quartz run numbers for the file name). This file is then used later in the analysis to make the flipping ratio correction.

Vanadium normalisation and correction

ach detector sees a different amount of solid angle and has a different efficiency. Each analyser has a different transmission. To make this correction, a run is usually made with a vanadium sample. Vanadium is a purely incoherent scatterer and incoherent scattering is by definition isotropic. The scattering intensity seen in each detector is a measurement of detector efficiency, solid angle and analyser transmission. The following is an example of a command file vanadium.prox for extracting the vanadium integrals: 

Vanadium run, 1 position, NOPO, ZPA or XYZPA - download the file


;Example of a batch file to create detector efficiency correction files from 
;vanadium data

;uncomment the following lines to automatically set the year and cycle

;RDSET, inst = 'D7', base = 'C_year 1999', cycle = 993 

w1 = rdsum(38287,38290)                ; vanadium run
 w2 = normalise(w1,/monitor)
 w3 = rdsum(38291,38294)                ; empty run
 w4 = normalise(w3,/monitor)
 w5 = rdsum(38330)                ; cadmium run 
 w6 = normalise(w5,/monitor)

w7 = background(sample = w2, empty = w4, cadmium = w6, MS_file = 'vanadium.mscatt')
;perform background subtraction and correct for multiple scattering
;using "vanadium.mscatt". See MSCATT web page for further details

w8 = corr_xyz(w7, filenum = 38306) 
;correct vanadium data using flipping ratios in quartz_38306.dat'

w9 = vanadium(w8) 
;compute vanadium integrals and save to file vanadium_38290.dat 
;ie number of vanadium file is last in sum sequence

Vanadium.prox adds the non-spin-flip and spin-flip scattering together and puts the total intensities into w9. It also writes them to a file vanadium_38290.dat (using the last of the vanadium run numbers for the file name). This file is then used later in the analysis for correction.

Another new macro has been introduced here, namely:

Makes flipping ratio and multiple scattering corrections. It takes two arguments. The first is the run number of the quartz file where to find the flipping ratios. If it is set to zero, no flipping ratio correction is performed.

In addition we are using to make a multiple scattering correction to the vanadium data, using a correction file produced by the D7 MSCATT program.   Remember that the multiple scattering correction file also corrects for sample attenuation, and therefore the transmission of the sample is omitted from the argument list.  See the D7 MSCATT Book for details of producing the multiple scattering correction file.

Example Command File I: XYZPA

No TOF, XYZ-PA, one position of detector banks - download this file

 ;Example of batch file to reduce an XYZPA measurement
 ;uncomment the following lines to automatically set the year and cycle
 ;RDSET, inst = 'D7', base = 'C_year 1999', cycle = 993, /raw
 ;SETMANIP, /raw
 w1 = rdsum(38321,38323)                ; sample
 w1 = normalise(w1,/monitor)
 w2 = rdsum(38295,38297)                ; empty can
 w2 = normalise(w2,/monitor)
 w3 = rdsum(38327,38329)                ; Cd 
 w3 = normalise(w3,/monitor)
 m  = 0.773                             ; muR measured
 w4 = background(sample = w1, empty = w2, cadmium = w3, muR = m)
 ;perform background subtraction with w2 as empty and w3 as Cd
 w6 = zero_detectors(w4, [38,40])       ;remove shadowed detectors
 w7 = corr_xyz(w6, filenum = 38306)     ;correct FR with quartz file 'quartz_38306.dat'
 w8 = components(w7)
 ;separate nuclear, magnetic and spin-incoherent components
 w9 = norm_van(w8, filenum = 38290, S_mass = 15.053, Fwt = 55.338, V_mass = 5.80)
 ;correct detector efficiency with vanadium file 'vanadium_38290.dat'
 ;and include absolute normalisation to vanadium
 w10 = theta_scan(w9, /all)            ;common x-axis (+/- angles)
 w11 = phi2q(w10)                      ;convert 2theta to Q
 w12 = w11(*,0)                        ; total
 w_tit(12) = 'total ' + STRTRIM(w_tit(11),2)
 w13 = w11(*,1)                        ; spin-incoherent
 w_tit(13) = 'spin-incoherent ' + STRTRIM(w_tit(11),2)
 w14 = w11(*,2)                        ; coherent + isotope incoherent
 w_tit(14) = 'coherent + isotope incoherent ' + STRTRIM(w_tit(11),2)
 w15 = w11(*,3)                        ; magnetic
 w_tit(15) =  'magnetic ' + STRTRIM(w_tit(11),2)
 w16 = w11(*,4)                        ; NSF magnetic
 w_tit(16) = 'non-spin-flip magnetic ' + STRTRIM(w_tit(11),2)
 w17 = w11(*,5)                        ; SF magnetic
 w_tit(17) = 'spin-flip magnetic ' + STRTRIM(w_tit(11),2)

Here, five new macros are introduced:

Zeroes bad detectors. It also sets the error bars to -1, which is used later on as a criterion for discarding them entirely.

Extracts the various components (incoherent, coherent, magnetic) from the data and puts them all into one workspace. In this example, w7 has dimensions (32,6) (32 detectors * 6 flip phases). w8, the output workspace has the same dimensions (32 detectors * 6 scattering components), arranged as follows:

w8(*,0) total scattering (sum of all components) 
w8(*,1) spin-incoherent component 
w8(*,2) coherent + isotope-incoherent component 
w8(*,3) average of non-spin-flip and spin-flip paramagnetic components 
w8(*,4) non-spin-flip paramagnetic component 
w8(*,5) spin-flip paramagnetic component

Corrects for apparent detector efficiency and also provides an absolute normalisation (if desired).  It normalises to a previously created (using vanadium file. The first argument after the input workspace specifies the vanadium file number. The following three arguments are optional. If they are not given, the data are normalised to an arbitrary intensity scale. Otherwise, they must be specified as follows: S_mass:  sample mass (in g), Fwt: mass (in amu) of one formula unit of the sample, V_mass: mass (in g) of vanadium sample. The data are then normalised to an absolute scale in units of barns / steradian / formula unit.

Rearranges the data in ascending order of the magnitude of the scattering angle. The name derives from the fact that it is particularly useful for data measured at different positions of the detector banks (a 2-theta scan). There is an optional argument after the input workspace of either /neg, /pos or /all which determines whether - /neg: only negative scattering angles are kept, /pos: only positive scattering angles, or /all: all scattering angles are kept.  The default option is /all.   It also discards detectors with zero counts and negative error bars (from zero_detectors).

Transforms the x-scale from scattering angle in degrees to wavevector transfer Q (Å-1).

Example Command File II : 2theta scan

No TOF, Z-PA, several positions of detector banks (2theta scan) - download this file

 ; Example of batch file to reduce a ZPA 2theta scan
 ;uncomment the following lines to automatically set the year and cycle
 ;RDSET, inst='D7', base='C_year 2000', cycle=002, /raw
 ;SETMANIP, /raw
 w1 = rdand(43489,43500)          ; sample
 w2 = normalise(w1,/monitor)
 w3 = rdand(43301,43312)          ; empty
 w4 = normalise(w3,/monitor)
 t  = 0.5                          ;transmission
 w5 = background(sample = w2, empty = w4, MS_file = 'alba1.mscatt')
 ;perform background subtraction using w4 as empty
 ;Multiple scattering correction using alba1.mscatt
 w6 = corr_xyz(w5, filenum = 43264)  ;Flipping ratio correction using quartz_43264.dat
 w7 = components(w6)
 ;separation of total, coherent and spin-incoherent components
 w8 = theta_scan(w7,/all)         ;sort out angles
 w9 = phi2q(w8)                   ;convert 2theta to Q
 w10 = norm_inc(w9, inc_xs = 97.3, Debye = 0.07)
 ;correct detector efficiency and perform absolute normalisation using 
 ;known spin-incoherent cross-section of 97.3barns, and Debye-Waller
 ;parameter exp(-0.07*Q^2)
 w11 = w10(*,0)   ;total
 w_tit(11) = 'total ' + STRTRIM(w_tit(10),2)
 w12 = w10(*,1)   ; spin-incoherent
 w_tit(12) = 'spin-incoherent ' + STRTRIM(w_tit(10),2)
 w13 = w10(*,2)   ; coherent + isotope incoherent
 w_tit(13) = 'coherent + isotope incoherent ' + STRTRIM(w_tit(10),2)
 output, w12, file = 'XtalC3.dat'
 output, w13, file = 'XtalI3.dat'   ;output final datafiles

The main difference compared to the previous example is that the detector angles are different for each run. The run numbers are therefore not simply added together, but concatenated (using rdand instead of rdsum) . The workspace dimensions for a single run would be (64,2) (since these are Z-PA no-TOF runs). However, w1 contains more than one run and is therefore 3-dimensional; it has dimensions (64,2,12) –this is a bit difficult to visualise, as it requires a four-dimensional screen. This is taken care of in theta_scan, where the points are rearranged in order of ascending scattering angle. The 3-dimensional input file (of dimensions (32,2,12)) is rearranged to a 2-dimensional output file of dimensions (32*12,2).

Normalises the data to the spin-incoherent scattering of the sample, known as the internal calibration method. There are two possible arguments after the input workspace in norm_inc. The first (required), inc_xs, is the spin-incoherent scattering cross-section of one formula unit of the sample (in barns). The data are then normalised to an absolute scale in units of barns / steradian / formula unit.  The second (optional), debye, is the Debye-Waller constant W, used to calculate the Debye-Waller factor, exp(-2WQ2).  If given then the spin-incoherent cross-section is divided by the Debye-Waller factor before normalisation.  In fact, since the measured spin-incoherent scattering is modified by the Debye-Waller factor, then a bare division of the data by the measured spin-incoherent counts automatically corrects for the Debye-Waller factor.  The argument, debye, should only be used if you want to avoid this correction (i.e. to compare with a vanadium correction, for example).

Example Command File III : Single crystal

No TOF, XYZ-PA, sample rotation scan -single crystal data - download this file

 ;Example of batch file to reduce an XYZPA single crystal omega-scan
 ;uncomment the following lines to automatically set the year and cycle
 ;RDSET, inst='D7', base='C_year 2000', cycle=002, /raw
 ;SETMANIP, /raw
 w1 = rdand(44081,44259)              ; sample omega scan
 w2 = normalise(w1, /monitor)
 w3 = zero_detectors(w2, [34,36,38,40,42])    ;remove shadowed detectors
 w4 = corr_xyz(w3, filenum = 44078)
 ;correct data for flipping ratio using 'quartz_44078.dat'
 w5 = norm_van(w4, filenum = 43807)
 ;correct data for detector efficiency using 'vanadium_43807.dat'
 w6 =  components(w5)
 ;separate nuclear, spin-incoherent and magnetic components
 w7 = omega_scan(w6,/all)
 ;rearrange concatenated scan runs into detector angle vs. spin-phase vs. omega
 w8 = w7(*,*,1)                          ; spin-incoherent
 w_tit(8) = 'Spin-incoherent ' + STRTRIM(w_tit(7),2)
 w9 = w7(*,*,2)                          ; nuclear short-range order
 w_tit(9) = 'Nuclear ' + STRTRIM(w_tit(7),2)
 w10 = w7(*,*,3)                         ; magnetic short-range order
 w_tit(10) = 'Magnetic ' + STRTRIM(w_tit(7),2)
 w11 = qxqy(w8, omega = 34.)
 w12 = qxqy(w9, omega = 34.)
 w13 = qxqy(w10, omega = 34.)
 ;interpolate each phase to a constant Qx-Qy grid, Omega0=34 degrees
 w14 = fold(w11)
 w15 = fold(w12)
 w16 = fold(w13)
 ;fold the interpolated Q-grid into the first quadrant
 w17 = qrebin(w8, omega = 34.)
 w18 = qrebin(w9, omega = 34.)
 w19 = qrebin(w10, omega = 34.)
 ;performs same function as, but using a proper rebin procedure
 ;giving sensible errors.  Omega0=34 degrees

A single-crystal omega-scan maps out an entire plane in Q-space. The following macros are specific to this type of measurement:

Serves a similar function as theta_scan. In this example w6 has dimensions (32,6,179) while w7, the output file of omega_scan has dimensions (27,179,6), i.e. five zeroed detectors have been removed and the data have been rearranged with omega-rotation as the y-axis. Takes the same arguments as theta_scan, i.e. /neg, /pos and /all.

Interpolates the data onto a rectangular grid in the plane in Q-space defined by the scattering vectors of the detectors. The output workspace is 2-dimensional with intensity as a function of Qx and Qy. The second argument, omega, is the offset of the direction of the crystal Qx axis with respect to the incident beam.

Takes the output data of QxQy and folds it onto a single quadrant in the Qx–Qy plane to improve statistics. and are useful mainly for visualising the data in a 3-dimensional or contour plot. Unfortunately, since is an interpolation routine, the error bars are not treated correctly. In order to see cuts through the measured plane in a particular Q-direction with real error bars, the macro Qrebin should be used. This rebins the data onto a rectangular grid and, optionally, folds it onto a single quadrant.   It takes the same argument, omega, as QxQy – i.e. the offset of the crystal Qx axis with respect to the incident beam.

Example Command File IV : Time-of-flight

Time-of-flight, Z-PA - download this file

 ;Example of batch file to reduce a ZPA time-of-flight measurement
 ;uncomment the following lines to automatically set the year and cycle
 ;RDSET, inst='D7', base='C_year 2000', cycle=002, /raw
 ;SETMANIP, /raw
 w1 = rdsum(43135,43142)            ;sample runs
 w2 = normalise(w1, /monitor)       ;normalised to monitor 1
 w3 = rdsum(43050,43053)            ;background runs
 w4 = normalise(w3, /monitor)
 w5 = background(sample = w2, empty = w4, MS_file = 'hlippo.mscatt')
 ;background subtraction of sample (w2) using w4 as empty
 ;MSCATT multiple scattering correction using 'hlippo.mscatt'
 w6 = zero_detectors(w5, [62])      ;remove faulty detector
 w18 = rdsum(43039,43049)           ;time-of-flight vanadium runs
 w19 = normalise(w18, /monitor)
 T = 0.75                           ;transmission of vanadium
 w20 = background(sample = w19, empty = w4, T = T)
 ;background subtraction of vanadium (w20) using w4 as empty, no Cd run
 ;and a transmission of T
 w20 = zero_detectors(w20, [62])    ;remove faulty detector from vanadium run
 w7 = vnorm(w6, w20, min = 80, max = 110)         
 ;perform vanadium normalisation over time-channels 80-110
 w8 = corr_xyz(w7, filenum = 43032) ;Flipping ratio correction using 'quartz_43032.dat'
 w9 = corr_tof(w8, /det_eff, /frameoverlap, /ana_eff)
 ;corrects data for
 ;1)Energy dependent detector efficiency
 ;2)Frame Overlap
 ;3)Energy dependent supermirror analyser transmission
 w10 = components(w9)              ;separate nuclear and spin-incoherent components
 w11 = t2e(w10)                    ;convert x-axis to Energy transfer
 w12 = reform(w11, 128, 32, 3)
 e12 = reform(e11, 128, 32, 3)
 ;split array into 3 dimensions: energy vs. 2theta vs. spin-phase
 y12 = y11(0:31)                   ;set y dimension (2nd dimension) to detector 2theta angle
 w13 = w12(*,*,0) 
 w_tit(13) = 'Total ' + STRTRIM(w_tit(12),2)
 w14 = w12(*,*,1) 
 w_tit(14) = 'Spin-Incoherent ' + STRTRIM(w_tit(12),2)
 w15 = w12(*,*,2) 
 w_tit(15)='Coherent ' + STRTRIM(w_tit(12),2)
 w13 = reb(w13, dE = 0.05)
 w14 = reb(w14, dE = 0.05)
 w15 = reb​​​​​​​(w15, dE = 0.05)
 ;rebin to constant energy transfer bins of 0.05meV (where necessary)
 w16 = sqw_rebin(w13, dQ = 0.1, emin = -20, /all)
 w17 = sqw_rebin​​​​​​​(w14, dQ = 0.1, emin = -20, /all)
 w18 = sqw_rebin​​​​​​​(w15, dQ = 0.1, emin = -20, /all)
 ;rebin data to Q-w grid with dQ=0.1 and min energy transfer of -20meV
 output_allqs, w16, file = 'd_PPO16_290K_si'
 output_allqs​​​​​​​, w17, file = 'd_PPO16_290K_coh'
 ;output datafiles of each Qstrip (with dQ=0.1 set by sqw_rebin)
 ;files are named e.g. 'd_PPO16_290K_si.q110' for Qstrip at Q=1.1

This macro looks quite a lot more complicated than the others, and contains several TOF specific macros (found in the TOF section of the macros list).   These are;

This macros takes as input, the workspaces containing the sample and the vanadium time-of-flight runs and the normalises the data to the vanadium integrals between the time channel limits given by the min and max argument.  One may optionally include arguments to enable an absolute normalisation of the data using

Can be called with up to three additional arguments.  These switches specify three possible corrections to the data. These are  a) /det_eff - correction for the energy-dependence of the detector efficiency, b) /ana_eff - correction for the energy-dependence of the analyser transmission and c) /frameoverlap - t-4 tail subtracted to correct for frame overlap.

Converts from scattering cross-section as a function of time-of-flight to the scattering function S(Q,) as a function of energy transfer.

An intrinsic IDL function which rearranges the data in an array.

Rebins the output of t2e to constant energy bin width, given by the second argument, dE (energy unit is meV). By default, it rebins only where the intrinsic point spacing is less than the rebin width.

This macro rebins the data onto a regular Q-E grid - and includes proper propagation of error-bars, unlike its brother -   However, it can take quite a long time to run - so be patient.  One may specify in the argument list, the q-binning, dQ, and the minimum energy-transfer, emin.

This macro outputs x-y-error files of Intensity vs. energy transfer for each q-bin defined in - NB it only works with regularly binned data outputted from sqw_rebin.  For outputs at constant angle on unbinned data, use instead.

D7 LAMP macros in detail

The D7 data analysis macros are divided into four sections - 

  1. The BASE macros (found in the D7/BASEDIR section of the macros list), 
  2. The GENERAL macros (not restricted to D7 data), 
  3. The TOF macros (including - kept in the TOF section of the macros list)

Another category of "special" D7 macros visible from the LAMP macros window, are not used by the user under normal circumstances and will not be described here.

I. BASE Macros



w3 = add_xyz(w2[, /zpo][, /xyz][, /nopo])

(optional keywords shown in square brackets)

Adds the X, Y and Z measurements together. Must be performed on raw data, i.e. before calling

 /zpo: (default) 
        three non-flip measurements are added together to give one three flip measurements are also added together. 
                w_in(nspectra,6,nruns) -> w_out(nspectra,2,nruns)

        after separately adding together the non-flip and flip measurements, the sums are then copied into the X and Y phases. 
                w_in(nspectra,6,nruns) -> w_out(nspectra,6,nruns)

         add all flip phases together to obtain a single measurement. Then copy sum into the Z1, X and Y phases. 
                w_in(nspectra,6,nruns) -> w_out(nspectra,6,nruns)

DIMENSIONS: (see above)



w3 = background(sample = w1, empty = w2[, cadmium = w3][, T = <T>][, muR = <muR>][,MS_file = '<filename>'])

(optional keywords/arguments shown in square brackets)

Performs background subtraction of normalised data.

         sample : workspace containing sample runs (required) 
         empty : workspace containing empty runs (required) 
         cadmium : workspace containing of cadmium runs (optional) 
         T : sample transmission (default: T=1) 
         muR : muR parameter required for Hewat-type angular transmission correction
         MS_file: name of multiple scattering correction file output by MSCATT (see the D7 MSCATT guide for details).

 N.B. Specify either T for a normal background subtraction or muR for an angular dependent background subtraction - NOT BOTH
         If using a MSCATT file, then don't include a transmission factor.

         TOF:         w_in=w_out(nchannels,nspectra*nphases) - only deals with 1 run 
        NOTOF:    w_in=w_out(nspectra,nphases,nruns) - unless nruns=1



w3 = binq(w1, dQ = <dQ>)

Interpolates data along the x-axis to regular steps with point spacing dQ. Only runs on 1d data.

         dQ :desired constant Q-bin width

         w_in(nspectra) -> w_out(nQ)



w3 = components(w2[, /Schaerpf])

(optional keywords shown in square brackets)

Separates data taken with Z or XYZ polarization analysis into the constituent components:

     0: total 
     1: incoherent 
     2: coherent + isotope-incoherent 
     3: paramagnetic (average of spin-flip and non-spin-flip paramagnetic) 
     4: non-spin-flip paramagnetic 
     5: spin-flip paramagnetic

         /Schaerpf:  use original Schaerpf expressions for component separation

         No-TOF: w_in(32,nphases,nruns) -> w_out(32,ncomponents,nruns) 
         TOF: w_in(128,nspectra*nphases) -> w_out(128,nspectra*ncomponents)



w3 = concatenate(w1, w2)

Concatenates two workspaces. Must be performed on raw data, i.e. before calling

         any - but first n-1 out of n dimensions must be equal in w1 and w2 
         e.g. w1(nspectra,nphases,nrun1) 
         w2(nspectra,nphases,nrun2) -> w3(nspectra,nphases,nrun1+nrun2)



w2 = corr_xyz(w1, filenum = <filenum>[, temp = <temp>])

(optional arguments shown in square brackets)

Corrects for flipping ratios and optionally for multiple scattering

         filenum : numor(s) of flipping ratio file(s) to use:  e.g. filenum=27134 to use the file "quartz_27134.dat" 
                      filenum=[27134,27135,27136] to use multiple files 
         temp : specified temperature in case of temperature dependent flipping ratio files as created by 
                    e.g. filenum=27134, temp=100 - reads file "quartz_27134_100.dat"

         TOF -> w_in=w_out(nchannels,nspectra*nphases) 
         NOTOF -> w_in=w_out(nspectra,nphases,nruns)



w10 = fold(w9)

Folds the four quadrants of the Qx-Qy plane, output from, into one.

         w_in(nQ.nQ) -> w_out(nQ/2,nQ/2)



w1 = input_quartz(numor = <numor>[, temp = <temp>])

(optional arguments shown in square brackets)

Read a quartz flipping ratio file 'quartz_<numor>_<temp>.dat' and loads it into the desired workspace

         numor : numor corresponding to quartz file of interest 
         temp : temperature parameter of corrected quartz file (see



w1 = input_vanadium(<numor>[, nspectra = <nspectra>][, /number][, /angle])

(optional arguments/keywords shown in square brackets)

Reads the vanadium file 'vanadium_<numor>.dat', and puts it into a 1-D workspace. Also reads in multiple numors (e.g numor=[47324,47336]) and puts them into a 2-d workspace.

         numor :numor(s) corresponding to vanadium file(s) to be read in 
         nspectra :number of spectra to read in from file

         /number :x-axis is spectrum number (default) 
         /angle :x-axis is scattering angle



w6 = isotropic_ms(w5, roh = <roh>, muR = <muR>, abs = <abs>, nuc = <nuc>, inc = <inc>[, mag = <mag>])

(optional arguments shown in square brackets)

Takes background subtracted D7 data of 1, 2 or 6 phases and corrects for multiple scattering using the isotropic approximation of Wells and Cywinski, and the secondary scattering coefficients of Blech and Averbach. At present, deals only with cylindrical samples. Correction of TOF data not yet implemented.

 P. Wells and R. Cywinski, Aust. J. Phys. 34 (1981) 193 
 T. M. Harders, T. J. Hicks and P. Wells, J. Appl. Cryst. 18 (1985) 131 
 J. Mayers and R. Cywinski, Nucl. Inst. Meth. Phys. Res. A241 (1985) 519 
 I. A. Blech and B. L. Averbach, Phys. Rev. 137 (1965) A1113

         roh : R/h - radius of cylinder over height 
         muR : Nsigmat*R calculated from transmission measurements 
         abs: Absorption Cross-section (at experimental wavelength) in barns 
         nuc: Nuclear Cross-section in barns 
         inc: Spin-Incoherent cross-section in barns 
         mag: Magnetic cross-section in barns (optional)

         w_in = w_out(nspectra,nphases,nruns) - unless nruns=1



w2 = norm_inc(w1, inc_xs = <inc_xs>[, debye = <debye>])

(optional arguments shown in square brackets)

Normalise intensities to the incoherent scattering of the sample.  Must be called after and and

         inc_xs :incoherent cross-section of the sample (required) 
         debye :Debye-Waller factor (optional)

        x-axis must be in Q -> w_in=w_out(nQ)



w2 = norm_van(w1, filenum = <numor(s)>[, S_mass = <S_mass>, fwt = <fwt>, V_mass = <V_mass>])

(optional arguments shown in square brackets)

Correct for "apparent" detector efficiencies using vanadium data. If desired, normalise intensity to an absolute scale.

         filenum :number of vanadium integral file - "vanadium_<filenum>.dat" created by 
                Is possible also to input multiple vanadium file numbers for use with theta_scan data, 
                e.g. filenum=[13487,13491] - use 5 vanadium files numbered, 13487,13488,13489,13490,13491 
                i.e. sequential order 
                filenum=[13487,13490,13499] - use the three specified files,  i.e. non-sequential order

         S_mass :sample mass (g) -optional 
         V_mass :V mass (g) -optional 
         Fwt :formula weight (amu) per f.u. -optional

         w_in=w_out(nspectra,nphases,nruns) unless nruns=1



w5 = omega_scan(w4[, /all_angles][, /pos_angles][, /neg_angles])

(optional keywords shown in square brackets)

Input: 2-D or 3-D workspace containing a non-tof omega-scan read in with rdand, normalised with and optionally separated into components with  Rearranges to a 1-D or 2-D workspace with detector angle theta as x-axis and omega angle as y-axis.

         /neg_angles : only use data with negative angles 
         /pos_angles : only use data with positive angles 
         /all_angles : use all banks (default)

         input format: w(32_or_64,nphases,nruns) - unless nphases or nruns is 1 
         output: w(nspectra,nruns,nphases) - unless nphases is 1



w10 = phi2q(w9)

Transforms scattering angle on x-axis to Q, assuming elastic scattering.




w10 = qrebin(w9[, omegashift = <omegashift>][, /fold])

(optional arguments shown in square brackets)

Takes output workspace of containing omega-scan, converts to Q-space and rebins to a constant Qx-Qy grid, giving sensible error bars! Deals with only one spin phase at a time.

         omegashift : offset in degrees of omega=0 position

         /fold:  optionally fold data on to + + quadrant

         w_in(nspectra,nruns) ->w_out(nQ,nQ) (folded),  w_out(2*nQ,2*nQ) (unfolded)



w5 = quartz(w4[, /nosave][, FR_depol = <FR_depol>, temp = <temp>])

(optional arguments/keywords shown in square brackets)

Takes 2-D or 3-D workspace containing a normalised non-tof z-PA or xyz-PA background-subtracted quartz run (or runs). Puts the flipping ratios into w_out and also into the file 'quartz_"numor".dat'. Will also correct for depolarization due to the sample (assuming cylindrical geometry) if desired.

         FR_depol :if depolarization is present in the sample -  FR_depol is flipping ratio (in M2) 
                in the presence of depolarization 
         temp :if depolarization is present in the sample - temp is the temperature (used to name the output file 
                "quartz_<numor>_<temp>.dat") to identify the depolarisation correction at that temperature

         /nosave :don't save flipping ratios to file

         w_in(nspectra, nphases) -> w_out(nspectra)



w6 = QxQy(w5[, omegashift = <omegashift>])

(optional arguments/keywords shown in square brackets)

Takes output workspace of containing omega-scan, converts to Q-space and interpolates to a constant Qx-Qy grid (rough and ready version of Deals with only one spin phase at a time.

         omegashift : angle (in degrees) of omega=0 position

         w_in(nspectra,nruns) -> w_out(nQx,nQy)



w2 = remove_zeros(w1)

Removes points with y=0 and e=-1 from a 1-d workspace.

        1d workspace only



w5 = slab(w5, angle = <angle>, muR = <muR>, Tmin = <Tmin>)

For D7 data only - (useful for slab geometry single crystal omega scans).  Corrects for sample attenuation of the scattered neutrons assuming  infinite slab geometry.

         angle :angle in degrees of sample normal rel. to incident beam at omega=0.  Counterclockwise is +ve 
         muR :muR is Nsigmat where sample transmission=EXP(-Nsigmat)  N*sigma=0.037 mm^-1 for vanadium 
         Tmin :Minimum transmission of sample (defined by real thickness and length)

 w_in(32,nphases,nruns) -> w_out(32,nphases,nruns)



w10 = theta_scan(w9[, /all_angles][, /pos_angles][, /neg_angles][, detector = <det>][, /coder])

(optional keywords/arguments shown in square brackets)

Puts all detector angles onto a common x-axis. Removes zeroed data points.

         detector :optional argument specifying an individual detector to use

         /neg_angles :only use data with negative angles 
         /pos_angles :only use data with positive angles 
         /all_angles :use all detector banks (default) 
         /coder :only used if an individual detector is specified 
             If set: 
                     use coder angle as x-axis, 
                     use calculated detector angle as x-axis

        input format: w(nspectra,nphases,nruns) - unless nphases or nruns is 1 
        output: w(nruns*nspectra,nphases) - unless nphases is 1



w10 = unfold(w9)

Reproduces one quadrant of the Qx-Qy plane (from or into all four quadrants.

         w_in(nQ,nQ) -> w_out(2*nQ,2*nQ)



w5 = vanadium(w4[, /nosave])

(optional keyword shown in square brackets)

Takes 2-D or 3-D workspace containing one or more normalised non-tof z-PA or xyz-PA background-subtracted vanadium runs. For quartz and multiple scattering corrections, data should be run through corr_xyz first. adds the flip and non-flip intensities and puts the sums into w_out and also into the file 'vanadium_<numor>.dat'

         /nosave :Don't save in file format

     input format: w_in(32,nphases,nruns) 
     output format: w_out(32,nruns) (saved in <nrun> individual files)



w2 = zero_detectors(w1, bad1[, bad2][, bad3][, bad4][, bad5][, /angle])

(optional keywords/arguments shown in square brackets)

Zeroes non-contributing spectra or angular regions - (I=0, dI=-1) Data should already have every other detector removed (i.e. must have been put through

         bad1, bad2, ... :Can either be 
                 a) detector number arrays 
                 b) ranges in scattering angle 
                (at least one array - bad1 - is required)

         /angle :specifies that angular ranges are used





w3 = average(w1, w2)

Takes the weighted average of two workspaces, w1 and w2.



w3 = bin(w1, ibin)

Bins the points in the x-axis of a 1-d workspace, w1 by an integer multiple, ibin.



w3 = divide(w1, w2)

Divides workspace w1 by workspace w2.   Ensures proper error propagation on division.



w3 = fit_poly(w2, degree = <npoly>)

Fits a polynomial of degree npoly in the x-dimension to one- or  two-dimensional data

         degree :degree of polynomial to fit the data with

         1-d or 2d data



w1 = input(file = '<in_file>')

Reads a file previously saved by (with titles), or any XYE formatted file.

         file :name of file to input 
                 NB - don't forget to include single quotes



output, w1, file = 'myfile.dat' <,/params>

Takes a workspace w1 and writes it to the file, "myfile.dat". 1-d workspaces are saved in a standard (x,y,e) 3-column format. Larger workspaces are saved differently.

          file: name of file to output

          params:  specifies whether to output the run parameters with the data



output_gsas, w1, file = 'outfile'

Takes a 1-d workspace an writes it to a GSAS format data file.  Since GSAS requires constant angular steps, should be run on the data first.



w2 = remove(w1, min = <xmin>, max = <xmax>)

Removes points from 1-d data within x-region specified by xmin, xmax.

         min : min of x-region 
         max : max of x-region

         1-d data only



w2 = smoothx(w1, nsmooth)

Smoothes data using a moving filter in the x-dimension of one- or two-dimensional data.  Smoothes over -nsmooth to +nsmooth



w2 = smoothy(w1, nsmooth)

Smoothes data using a moving filter in the y-dimension of  two-dimensional data.  Smoothes over -nsmooth to +nsmooth



w3 = splice(w1, w2, min = <min>, max = <max>)

Splices together two data sets together. Takes w_in1 outside the  xmin->xmax region and w_in2 inside.

         min :min of w_in2 region 
         max :max of w_in2 region

         must be 2 1-d arrays input

III. TOF Macros



w6 = corr_tof(w5[, /det_eff][, /frameoverlap][, /ana_eff])

(optional keywords shown in square brackets)

         /det_eff : corrects for energy-variation of detector efficiency 
         /frameoverlap: subtracts a t^-4 tail from the beginning of the time frame 
         /ana_eff : correct for energy dependence of analyser transmission




w3 = elastic(w2[, min = <min>, max = <max>][, /save])

(optional arguments and keywords shown in square brackets)

Finds the elastic peak position in each spectrum by fitting a Gaussian and a flat background. Looks for peak in region xmin<x<xmax

ARGUMENTS: <br />          min: minimum x-value for peak search 
         max: maximum x-value for peak search

         /save : Write out results to file 'elastic.dat'

         w_in(nchannels,nspectra) OR w_in(nchannels)



w10 = estrip(w9, E = <Evalue>, dE = <dE>, dQ = <dQ>[, /all_angles][, /pos_angles][, /neg_angles])

(Optional keywords shown in square brackets)

Rebins output data from and to regular-grid S(Q,w) data using the old KHA IN6 rebin algorithm. Selects a single E-value. Input workspace must be in energy transfer versus scattering angle, i.e. only one component or spin phase.

         E: E-value at centre of extracted strip 
         dE : Width of E-strip 
         dQ : Q bin width

         /neg_angles : use only negative angles 
         /pos_angles : use only positive angles 
         /all_angles : use all angles (default)

         w_in(nE,nphi) -> w_out(nE,nQ)



w2 = normalise(w1[, /raw][, /monitor][, /time][, detector = <det>][, /all][, /madangles][, zeroshift = <zeroshift>])

(optional keywords/arguments shown in square brackets)

Normalises raw data to monitor or counting time. Extracts every other spectrum if desired(=> nspectra=32) and normalises intensity

         detector : detector number to normalise to 
         zeroshift : angle in degrees of 2theta=0     (depends on wavelength and setup)

         /raw : no normlisation (error bars calculated) 
         /monitor : normalise data to 1000 monitor1 counts (DEFAULT) 
         /time : normalise data to counting time 
         /all : supresses the removal of the odd numbered detectors 
         /madangles : supresses the recalculation of the detector angles using the current YIG calibration

         non-TOF data: w_out(nspectra,nphases,nruns) -unless nphases is 1 
         TOF data: w_out(nchannels,nspectra*nphases,nruns)



output_allangles, w17, file = 'outfile'

Takes a 2-D workspace from and writes it to a series of files, one for each detector. x-axis must be energy transfer and y-axis detector number. 

Output files have names: 
<file>.det2 for detector #2, 
<file>.det4 for detector #4,  

         file : name of output file stem

         w_in(nspectra,dE) output from [and]



output_allqs, w17, file = 'outfile'

Takes a 2-d workspace from and writes it to a series of files, one for each Q. x-axis must be Q and y-axis energy transfer.

Output files have names:    
<outfile>.q010  for  Q=0.10 Å-1
<outfile>.q010  for  Q=0.10 Å-1 

         file : name of output file stem

         w_in(dQ,dE) output from



w10 = qstrip(w9, Q = <Qvalue>, dQ = <dQ>[, /all_angles][, /pos_angles][, /neg_angles])

(optional keywords shown in square brackets)

Rebins output data from and to regular-grid S(Q,w) data using the old KHA IN6 rebin algorithm. Selects a single Q-value. Input workspace must be in energy transfer versus scattering angle, i.e. only one component or spin phase.

         Qvalue: Q-value at centre of extracted strip 
         dQ : Width of Q-strip

         /neg_angles : use only negative angles 
         /pos_angles : use only positive angles 
         /all_angles : use all angles (default)

         w_in(nE,nphi) -> w_out(nE)



w10 = reb(w8, dE = <dE>[, /force])

(optional keywords shown in square brackets)

Rebins output workspace from to constant energy bin width.

         dE : required energy bin width

         /force : rebin over entire energy range otherwise: rebin only where dE is > point spacing (default)

         w_in=(nE,nspectra) -> w_out(dE, nspectra)



w7 = slab_tof(w6, angle = <angle>, inc = <inc>, abs = <abs>, thick = <thick>, N = <N>)

Takes a 2-D tof workspace and corrects for sample attenuation of the scattered neutrons assuming infinite slab geometry.

         angle : the angle in degrees of sample normal relative to incident beam 
         inc: incoherent cross-section of sample (barns) 
         abs: absorption cross-section for thermal neutrons (lambda=1.8Å) (barns) 
         thick : thickness of sample (mm) 
         N : number density of sample (*10^22 per cm^3)

         w_in(nchannels,nspectra) -> w_out(nchannels,nspectra)



w10 = sqw_interp(w9, dQ = <dQ>, dE = <dE>, Emin = <emin>[, /all_angles][, /pos_angles][, /neg_angles])

(optional keywords shown in square brackets)

Converts output data from to regular-grid interpolated S(Q,w) data. Input workspace must be in energy transfer versus scattering angle.

         dQ : Q bin width 
         dE : energy bin width 
         Emin : minimum energy (neutron energy gain is defined as negative)

         /neg_angles : use only negative angles 
         /pos_angles : use only positive angles 
         /all_angles : use all angles (default)

 w_in(nE,nphi) -> w_out(nQs,nEs)



w10 = sqw_rebin(w9, dQ = <dQ>, Emin = <emin>[, /all_angles][, /pos_angles][, /neg_angles])

(optional keywords shown in square brackets)

Rebins output data from and to regular-grid S(Q,w) data using the old KHA IN6 rebin algorithm. Proper rebinning routine with error analysis (unlike

         dQ : Q bin width 
         Emin0: Minimum energy value (meV) - neutron energy gain is negative

         /neg_angles : use only negative angles 
         /pos_angles : use only positive angles 
         /all_angles : use all angles (default)

         w_in(nE,nphi) -> w_out(nQs,nEs)



w10 = t2e(w9[, /ken])

Converts tof data in w_in to energy transfer in w_out. Includes the factor of ki/kf.

         /ken : use Ken's expression for dEdt in (not recommended)

         w_in(nchannels,nspectra) -> w_out(nE,spectra)



w8 = vnorm(w7, w20, min = <min>, max = <max>[, tv = <tv>, Ns = <Ns>, ts = <ts>])

(optional arguments shown in square brackets)

Normalises data in w7 vanadium data in w20 integrated between given limits.  Absolute normalisation is possible if desired - although it this assumes flat-plate geometry.

         min : lower time channel limit of integration over vanadium elastic peak 
         max : upper time channel limit 
         tv : thickness of vanadium sample 
         Ns : number density of sample 
         ts : effective sample thickness

         w_in=w_out(nchannels, nspectra)