Focus()

Focus a range of spectra with given parameters

FOCUS() spectra=Range or IntegerArray [file=String] [detpars=Workspace] [specpars=Workspace] Focus a set of TOF spectra correcting for detector efficiency.
[:D] Convert to D-spacing before summing
[:Q] Convert to momentum transfer before summing
[:T] Sum in time of flight
[:VERBOSE] print out TOF parameters used in conversions

example:

	# Focus a time of flight spectrum in D-spacing
	# get the TOF parameters from the raw data file
	>> w = focus( 3:10, "irs12838.raw" )
	# Focus default file, every third period
	>> assign 3045
	>> refl = focus( 3:90@3, _, mydet )

Note: Focussing is done in D-spacing by default.

Focus

This command provides for focussing groups of neutron time of flight spectra from detectors at different scattering angles. This command, although written specifically for focussing multiple banks of detectors consecutively can be used for single scanning detectors data as long as the data from consecutive runs has been stored as numbered spectra in a data format Open GENIE understands, for example an old GENIE-V2 intermediate file (see Supported File Formats). If the data has been stored in an Open GENIE intermediate file, the parameters can be stored in workspace format, see the example below.

If the detector efficiency parameters and/or T-O-F parameters are available from some other source, the Focus() command can be extended easily to read these parameters using the Alias() command as in the following example.

Example

	# First alias the focus command so we can still get at it
	alias "original_focus" "focus"
	# Now define a new FOCUS procedure which can
	# read the parameters from a convenient file.
	PROCEDURE FOCUS
	    PARAMETERS SPECTRA FILE=String
	    QUALIFIERS /D /Q /T
	    RESULT res
	    LOCAL Tofpars Detpars
	    # read these from a convenient intermediate files, could also use
	    # the Asciifile() procedures to read any ascii file format
	    Tofpars = get("PARS", "parms.in3")
	    Detpars = get("EFF", "detpars.in3")
	    IF Q; res = original_focus:q(spectra, file, detpars, tofpars); ENDIF
	    IF D; res = original_focus:d(spectra, file, detpars, tofpars); ENDIF
	    IF T; res = original_focus:t(spectra, file, detpars, tofpars); ENDIF
	ENDPROCEDURE

The new focus command can be used transparently in place of the original command.

Parameters:

/D, /Q, /T

Specify whether to focus in D-spacing, momentum transfer or by time.

Spectra (Range)

This parameter specifies the spectra to be focussed from the input file as a Range.

Open GENIE supports unique data types called Interval and Range, a Range or Interval can be used to specify a range of indices respectively to access multi-spectra data. For more information on specifying intervals, please see a description of the Interval syntax.

For the most general ability to specify a group of arbitrary spectra an Integer array of spectrum identifiers can be given as the the "Spectra" parameter.

File (String) [ default = default input file ]

The name of the input data file. This parameter will default to the default input file set by the Set/File/Input command if it is not specified.

Detpars (Workspace) [ default = no detector efficiency correction ]

Parameters for correcting for detector efficiency. These are giiven in a workspace with the following field names:

Field name Type Description
PRESSURE Real Gas pressure (atms)
GAS_SIGMA0 Real Gas cross section at lambda 0 (cm-2)
PATHLENGTH Real Gas path length (cm)
lWAVELENGTH Real Characteristic wavelength (cm)
WEIGHT Real Molecular weight of container atoms (g mol-1)
DENSITY Real Density of container (g cm-3)
THICKNESS Real Container wall thickness (cm)
WALL_SIGMA0 Real Wall cross section at LAM0 (cm-2)
TYPE String Detector description, eg "He3 gas"

Specpars (Workspace) [ default = values from raw file ]

Time of flight parameters. These are given in a workspace with the following field names:

Field name Type Description
TWOTHETA Realarray Two theta scattering angles per spectrum (degrees)
EMODE Integer mode 0=inelastic, 1=incident, 2=transmitted
EFIXED Real or Realarray Fixed energy value or values if EMODE=2
L1 Real Primary flight path (m)
L2 Realarray Secondary flight paths (m)

The arrays need to be of size "nspec" where "nspec" is the total number of spectra being focussed.

RESULT = (Restype)

The final focussed spectrum.