Close This Window

Please download official ILL logos here


For using on the web or on a screenFor printing in high resolutionWhite version, for dark backgrounds

Download PNG

Download AI

Download white PNG

Download JPG


Download white AI


The Computing for Science (CS) group supports ILL scientists, students and visitors in a number of activities including data analysis, instrument simulation and sample simulation.

Back to ILL Homepage
English French Deutsch 

All Software

INX - Program for time-of-flight data reduction



INX has been devised to perform treatment of Time-of-flight instrument data (IN4,IN5 & IN6). Basically this program calculates S(Q,w) from the raw data. It includes interface input of treatment parameters and outputs treated files in standard format. Part I of this manual describes the input parameters and running S(Q,w). More detailed information about the methods used in the program, the approximations that have been made, the actual calculations performed etc. will be found in Part II

To top

PART I: How to use the program?

I-1 General considerations

Raw data reading:
Data can be read-in from ILL data bases or from individual files in a local directory.

Structure of the program:
INX has been written to allow simple treatments of TOF data. A modular structure in the program allows different steps of the treatment to be performed by independent routines. Thus, the program can be easily modified for special individual purposes. One should be aware however, that the order of operations is usually important: For example group detectors and then normalize is not equivalent to normalize first and then group. In the same way, a background which is flat when dealing with time channels will display a 1/E3/2 dependence when converted into energy.

The treated data are output under the standard "CROSSX" format. This file can be plotted using the program PLOTOF, or reduced to cover a smaller energy range (reduce button). The program also produces a log file (INX.LOG) containing the parameters used in the treatment.

I-2 Instrument, Cycle and Run numbers definitions

Instrument and Cycle number:
The program assumes that same instrument name and cycle number will be used for all the series of runs to be treated. The cycle numbers can be defined as follows:

    • /usr/illdata/data/inst for current cycle
    • /usr/illdata/data-1/inst for previous cycle
    • /usr/illdata/cyclenumber/inst for older cycle eg:992 for second cycle of year 1992

For data files in the local directory

    • ./filename

Run number definition
Two series of numors should be given: one related to the sample and the other related to vanadium. The run numbers can be separated by spaces ( ), commas(,) or pluses (+). Minus signs (-) are interpreted as meaning from first numor to last numor. For example:
...means that runs 2145 to 2150 plus run 2154 will be added together. Transmission for vanadium and sample runs should also be given. In a first step, the program will read in the rumors, add them together and subtract background and cadmium runs with associated weights (X=S-tB-( 1 -t)C). Sample and Vanadium are treated in the same way during this first stage.

To top

I-3 data correction and manipulations

    • Grouping
      The counts located in different channels or different spectra may be grouped together.

      • Energy/Channels grouping
        The energy channels can be grouped together in different ways:
        - One can make standard energy "binning" i.e. group channels n by n.
        - One can also group counts into energy channels with constant width. Note that in this case, the program will produce spectra whose energies will extend from Emin to EmaX calculated from TOFs. If Emax is so large that covering the whole range would require more than NmaX=5l2 channels, EmaX is set to Emin+Nmax dE.
                • Angles
                  Spectra corresponding to different angles can be grouped together. The grouping should be defined in a standard ASCII file whose name is to be given (e.g angle.inx). Each line of this file should contain the number of the spectra to be added together. For example the file containing these 2 lines ...
                  9 27+29 31
                  34 38+40 40+42 42
                  ...will produce a two spectra output: spectra 9 to 27 and 29 to 31 will be added to form the first spectrum and spectra 34 to 38 plus spectrum 40 and spectrum 42 will make the second spectra.
                  N.B: avoid including in the grouping special spectra like monitors (usually 1 2 &3) ,hardware sums.(5,6,7 &8 on IN5), or empty spectra; these spectra are normally removed in the treatment and the program will not be able to find them.

    • Flat background removal
      This option allows an additional flat background to be removed from each spectrum for sample. The background level is determined by moving a window of N=10 channels across each spectrum. The minimum value found is then subtracted.

    • Elastic peak position determination ("Convert to energy")
      The elastic peak position can be obtained from sample runs ("S") or vanadium runs ("V"). It will be used as the reference for zero energy transfer in the TOF to Energy conversion. Normally one uses the sample spectra themselves to determine this position. In some cases however, the elastic peak in the sample is poorly defined (or even absent) so that using vanadium may be a better choice. Note that when choosing the V option one has to make sure that both sample and vanadium runs have been taken in the same conditions. (especially as regards the elastic peak position).
      You can also answer no ("none") to this question. Then the program will not make any conversion and will just keep files with time channel numbers as abscissae. Note that many corrections are then forbidden since they normally depend on energy.(ex:Detector efficiency,"Slab corrections"... ). Channel and angle groupings are still possible and normalization to vanadium will be performed. Note that this is a way- of obtaining semi-raw data files that can be examined with standard programs. (Note that since the abscissae will be in ascending order, answer Y to the backscattering question of plotting programs (ex:PLOTOF)).

    • Correction of the vanadium intensities
      Vanadium is normally used as a standard to calibrate the relative efficiencies of all detectors. One has to assume that it is a pure isotropic scatterer,which is reasonable provided the Debye-Waller correction is made to the runs.

    • Debye Walter correction
      Due to Debye-Waller factor, the scattering is slightly weaker at large Q's. The program asks for the actual temperature (in K) of the vanadium. 0 will yield no correction.

    • Detector efficiency corrections
      The detector efficiencies vary with the neutron energies and this variation depends on the kind of detectors. A correction for this dependence has been included in the program. Answer Y or N. Be aware that only crude approximations have been included in the program.

    • "Slab" corrections
      The geometrical shape of the vanadium sample also affects the angular distribution of the scattering. One can correct for this effect for slab ("S") or cylindrical ("C") vanadium samples. For slabs, the angle of the plane of the slab with respect to the beam has to be given (in degrees) as well as the slab thickness (in mm). For cylindrical samples, the inner and outer radii have to be specified (in mm). NB:radii, not diameters! You can also enter ("No corr") in which case no correction will be made.

    • Self-attenuation ("Slab") corrections for sample.
      Correction for the effect of the geometrical shape of the sample have been included. Corrections for slabs ("S"), hollow ("H") and full ("F") cylinders are available. If no correction is demanded type ("No corr"). Then you have to enter the parameters for the calculations: For a slab, these are angle (in degrees), thickness (in mm),then the total cross-sections of the sample (scattering & absorption) then the density and the atomic mass.
      For cylinders, angle & thickness are replaced by inner and outer radii (for H), or radius (for F). All cross-sections should be given in barns and they may correspond to any atomic unit (e.g. molecule,unit cell etc...) provided the atomic mass given corresponds. Absorption cross sections must be given for 2200m/s neutrons (1.8A These values are those directly obtainable from the tables. The density should be given in g/cm3. Note that it should be the actual value for the sample, which can be considerably smaller than the calculated one in case of powders. The atomic mass is the mass of one mole of the unit whose crosssections have been given before. It should be given in g (more exactly in g per mole).

    • Display of the parameters ("Check parameters")
      This will produce a menu output of final parameters for sample and vanadium runs., after summation. It allows changes to be made to the final parameters. this can be useful if some parameters have not been properly set up on the instrument and do not correspond to actual values. Normally the program checks for consistency of parameters of runs to be added,subtracted etc... and proposes to change them if they do not match; it may happen however that some parameters are "coherently" wrong so that changes may be necessary on the final values. Answer Y or N.
      (In Web-INX on the BARNS server, this functionality is not available and the DATA_CORRECTOR utility should be used to modify parameters in the data files.)

    • Output file
      The default name for the output file is obtained from the first sample numor (nnnn) and instrument name (INp). Example: R2145IN5.DAT for run 2145-... taken on IN5.

To top

PART II Some more about treatment computations

II-1 Introduction

What physical quantity does the program actually calculate?

The number of neutrons detected within a time channel of width Delta.t, by a detector covering a solid

angle Delta.Omega,during a period T with a sample illuminated by a beam of Phi0 incident neutrons per
second (energy Eo), can be expressed as:


In these formulae, SAF(E) is the energy dependent self attenuation factor (see 5), eff(E) is the efficiency of the detector .For vanadium, the same expression holds but integrating over all energy transfers and assuming the scattering function reduces to the standard Debye-Waller factor one gets:

Finally, one gets after normalisation and correction for the energy dependent factors, an ouput which is:

The unit is (meV-l). The corresponding statistical error is also output (each line in one spectrum is E, y(E), Yerr,(E) ).


To top

II-2 Background subtraction

The presence in the beam of scatterers other than the sample itself produces additional signal in the detector. Since these scatterers are generally at distances from the detector different than the sample itself, the scattering (although mainly elastic) finally turns out to ptoduce background located in every time-of-flight channel. The subtraction of this background is usually performed using two additional measurements, one with no sample in the instrument and another one with cadmium in place of the sample. (see figure 1.1) This allows a determination of the additional scattering produced by the neutron beam before and after the sample.
If we call X the true scattering of the sample then:

S=A+X+tP "Sample" run
E=A+P "Empty can " run
C=A "Cadmium" run
=> X= S - tE -(1-t)C

...where t is the transmission of the sample. It should be noted that when detailed background subtraction is to be made, the "Empty can" runs to be entered should rather be viewed as "Empty instrument" runs since the contribution of the container itself can be measured separately and removed after appropriate corrections. In the absence of any cadmium run, one has to make assumptions about the relative parts scattered before and after the sample, which amounts to choosing the adequate value for the transmission.

For example if
- P=0 -> X=S-E i.e tact=1
- A=P -> X=S-(1+t)/2 E i.e tact=(1+t)/2
- A=0 -> X=S-t E i.e tact=t

Note that this type of correction is rather crude and it doesn't take into account the detailed repartition of the scatterers along the neutron path (which is rather ill-defined in most cases due to the presence of a variety of elements along the beam path). Constant electronic background is not removed unless if t=1.For all these reasons, the possibility of supplementary background removal has been included in the treatment sequence. The background level is determined by moving a N-channel window across each spectrum (N=10); the minimum value obtained is then removed from this spectrum. Note that this background subtraction is performed after summation of sample runs, background runs, Cd runs... but before subtraction. This is to avoid problems arising when "negative" counts appear from overcorrection: it may happen that one gets a final negative elastic peak (at small angles especially) whose level will be taken as the background level due to the procedure employed. The program will then subtract a large negative background (i.e. add a large background in some spectra) and this will usually spoil the whole group of angles.


To top

II-3 Vanadium corrections

Vanadium runs are normally used as standards for calibrating the relative efficiencies of detectors with respect to each others (at the incident energy). The treatment of the vanadium is the following:
-First, standard background can be subtracted, just as for any sample run.
Since vanadium scattering is (almost) purely elastic, eventual residual background is also subtracted. A sloped background is removed, whose level is determined from off-peak intensities on both side of the elastic line (-3N to -2N and 2N to 3N where N is twice the theoretical resolution width (calculated from the run parameters (chopper speed)). Two corrections can be applied to vanadium intensities:
-A correction for Debye-Waller attenuation. We have assumed that the DW factor is proportional to T:

...which yields numerically:
exp(-W(k))=exp(-alpha.k2) where alpha=.0067T/3OO
-A correction for self-attenuation is also applied.



To top

II-4 Conversion from Time~of.flight to energy

The neutron counts per unit energy (here meV) are obtained from the neutron counts per time channel using:

nepp is the actual position of the elastic peak channel, Eelast is obtained from the wavelength and telast is calculated using the mean sample-to-detector distance. Note that this approximation of taking a mean elastic time (and neglecting the difference of distances between detectors) does not affect too much the determination of the actual energy changes of each time channels, except for very large energy transfers. Indeed:

and fluctuations of telast contribute only to second order in delta.Ej calculation if << telast:

It may happen that tj becomes negative. In this case, the neutron counts (that originate from the previous incident pulse) are transferred to the other end of the spectra (i.e. tj is replaced by tj+T where T is the period). Actually, all channels corresponding to energies larger than 9999. meV are transferred.


To top

II-5 Detector & channels grouping

To improve the statistics or reduce the size of the TOF data, a grouping over angles or over energy channels can be performed. The way of grouping the angles is defined in a standard ASCII file; each line of this file contains the numbers of the detectors to be grouped together

For example

15 25+27 29

...means that counts in detector n°15 to 25 and 27 to 29 will be added into a single spectrum.
In general, due to the different distances between each detector and the sample, the energy of each channel is different from one spectrum to another. Thus, before addition, an interpolation to the energy values corresponding to the first spectrum of the group is performed. Note that each time channel corresponds to a certain energy window. The channel grouping corresponds to an addition of the neutron counts in a larger window, i.e. to an average of neutron counts per energy weighted by the energy widths: We have also added the possibility of obtaining energy channels with constant widths dEw. Since the energy values are no longer related to the inital time channels (Ei=Emin+ i Delta.Ew) longer interpolation procedure is employed in this case.

To top

II-6 Self~absorption & self-shielding corrections

Due to absorption and scattering losses, the energy and wavevector distribution of the scattering is affected by the geometry of the sample. The presence of a container around the sample also alters the signal coming from the sample itself . This additional signal cannot be simply removed using an empty container measurement since this signal is itself altered by the presence of the sample. The correction procedure should thus take into account these interdependent effects and correct each measurement accordingly. Taking the example of a cylindrical sample enclosed in two concentrical cylindrical containers (e.g. the container and a furnace shielding) ,one will have to perform (n=3) measurement for the correction,namely:

R1: Sample+Containerl+Container2
R2: Container1+Container2
R3: Container2
The true sample scattering S is related to these runs through the equations:

R1= s x SAF:(SIS+C1+C2) + C1 x SAF(C1/S+C1+C2) + C2 x SAF(C2/S+Cl+C2)
R2= C1 xSAF(C1/C1+C2) +C2 x SAF(C2/C1+C2)
R3= C2 xSAF(C2/C2)

One can see that the correction procedure involves n=3 runs and evaluation of n(n+l)t2=6 coefficients. To find the true scattering functions , the above equations have to be solved for every angle and every final neutron energy. On IN5 for example, this requires the evaluation of 128x512(x6) Self Attenuation Factors (SAF). Each SAF is expressed as an integral, and, with the notations of the previous example:

a is the scattering angle (20) and E is the final energy and: where the index j stands for the sequence of components in the system
(e.g Sample, Container 1, container 2 )
Except in the case of simple slabs, the integral has to be calculated numerically and the correction turns out to be extremely time consuming. The calculation time can be reduced however by evaluating the integrals only for a few energies. (The SAFs are in general smooth functions of the energy ). The program only uses Emin, Eelast and Emax.
In the standard treatment programs, the self-absorption corrections can be made for "monotype" systems only. This choice has been made since for standard experiments (using e.g. Aluminium containers) most of the background originates in scattering parts located far away from the sample itself. Composite systems necessitate access to several runs simultaneously and calculation of several SAFs per run. For example, a complete background subtraction for a sample enclosed in a container requires in principle 4 distinct measurements: Sample & Container + Empty instrument & Cadmium runs. For such two components system, n(n+1)/2=3 SAF calculations would be required . Sample in presence of Sample & Container, Container in presence of Sample & Container and Container in presence of Container only. Nevertheless, the SAF calculation routines (SAFSLAB & SAFCYL) can be used for any sequence of up to 1O components. An array containing the parameters used for the SAF calculations has to be given. So, if one wishes to perform detailed corrections, it is recommended to first treat the container & sample data with no SAF corrections to simply remove instrumental background, then use a separate program that would simply solve the coreresponding equations, the SAF factors being calculated using standard SAFCYL & SAFSLAB routines. The parameters to be forwarded to the routines are, for each component of the sequence, the scattering and absorption cross sections as Sigmaa (for 2200m/s neutrons), the density and atomic mass of the compound (used to determine the number of scatterers per unit volume). In the slab geometry, the angle of the plane of the slab with respect to the beam and the thickness of the slab have to be given; in the cylindrical geometry inner and outer radii are requested. In case of a system made of several atomic species, the sigmas and the atomic mass may correspond to one molecule or one unit cell...


To top

II-7 Detector efficiencies

Due to the energy dependence of absorption cross-sections and macroscopic scattering cross-sections, the detector efficiencies vary with energy and one has to correct for this dependence. This correction changes with the different types of detectors that are present on the different instruments and even on a single instrument.

To top

7.1 Theory

Let's consider a standard cylindrical detector filled with 3 He and assume the neutrons are incident on a direction perpendicular to the detector axis (Fig.6. 1). The probability for a neutron to be absorbed (i.e to be detected) is given by:

where mu is the linear absorption coefficient (mu=Sigmaa.N, where N is the number of nuclei per unit volume). Setting z=mu.D2mu.e and changing variables, the efficiency can be expressed as a definite integral function of z only:

This integral can be expressed as:


where L1(z) is a "modified Struve function" and I1(z) is a modified Bessel function.
To approximate the function, it is interesting to make a power expansion for z close to 0. This expansion can be obtained from the expansions of Ll (z) and 11 (z) or simpler by differentiating the exponential under the integral.(6.2). The coefficients of the expansion an are given by:

where the Wn are the standard Wallis integrals:
The expression of Wn is given by:
which yield, for the first terms of the expansion:
eff(z)=Pi/4 z -1/3 z2 +Pi/32 z3+...

Such an expression of course is only valid for small z. For large z, eff(z) tends to 1, as can be seen from the integral expression. The function eff(z) increases monotonically from 0 to 1 A graphical representation of eff(z) is given Fig.6.2. On the practical side now, we need an approximation of eff(z) which is fast to compute. So far the function f which has been used for this purpose is:

..whose expansion in 0 is identical for the terms of orders 0 & 1 and close for the next ones:
eff(z)= Pi/4 z .333 z2 + .098 z3 +...
and f(z)= Pi/4 z - .308 z2 + .0807 z3+...

For large z, both functions tend to 1.
This standard approximation has been drawn fig.6.2. as well and one can see that the maximum relative discrepancy betweeen the two curves is of the order of 5%. An improved approximation could be obtained using where coefficients a & b are determined so as to minimize the discrepancy.(with a=1/2(Pi/4)2-1/3 and b=.2 it reduces to less than 2%).
Typically, the value of z for a standard detector (p=3 bars, D=2.54cm at Lambda=1.8Ang) is 1.1. An other effect which has to be taken into account in the energy dependence of the detector efficiency is the absorption in any material located between the sample and the 3 He. The most obvious contribution comes from the detector walls themselves. For detectors on IN4,5 & 6, the walls are made of stainless steel. For Lambda >4A they are standard absorbers but for Lambda <4A, Bragg scattering occurs in the walls and the effective absorption is no longer simply related to A. In absence of any detailed calibration of the detector only crude approximation can be made. we shall quote below the formulae that have been used in the program but one should remember that they are obviously incorrect, especially when dealing with energies close to the cutoff (4A for steel, 4.5A for aluminium).

To top

7.2 Computations

The formula actually used in the programs as a function of energy can be found in the listing of DETEFF.FOR.
They correspond to:

-for IN4 detectors [z=1.42 at l.8A]
Eff =.951 exp(-0.0887/sqrt(E))(1-exp(-5.597)/sqrt(E))

-for IN5 detectors
type 1 (p=8 bars d=.9cm) [z=1.03 at 1.8A]


type 2 (IN6 type) [z=.83 at 1.8A]

Eff = exp(-0.0565/sqrt(E))(1-exp(-3.284/sqrt(E))

-for IN6 detectors [z=.83 at 1.8A]
For lambda>4A
Eff = exp(-0.0565/sqrt(E))(l-exp(-3.284/sqrt(E))

For lambda<4A

Eff = .94(1-exp(-3.284/sqrt(E))

To top