Difference between revisions of "Homer and mgenie style functions"

From LIBISIS
Jump to navigation Jump to search
Line 228: Line 228:
 
|'det_units'  || [units code]    || specifies output units of detector data
 
|'det_units'  || [units code]    || specifies output units of detector data
 
|-
 
|-
|'d_int'|| [xlo,xhi] || specifies limits for integration of the dataset between two limits, if 'det_units' has been supplied then integration will take place after units conversion, 'd_int' *cannot* be supplied with 'd_rebin'
+
|'d_int'|| [xlo,xhi] || specifies limits for integration of the dataset between two limits, if 'det_units' has been supplied then integration will take place after units conversion, 'd_int' '''cannot''' be supplied with 'd_rebin'
 
|-
 
|-
 
|'scale'  || real || specifies units of normalisation ie per 1e6 counts or per 1000uAhrs [default 1]
 
|'scale'  || real || specifies units of normalisation ie per 1e6 counts or per 1000uAhrs [default 1]

Revision as of 16:57, 24 January 2008

Preparing the [IXTdata_source]

All the population routines descirbed here use the IXTdata_source object. The IXTdata_source object is used to define source files for the population of an IXTrunfile object. Different source files can be added to the IXTdata_source object with their own special commands:

  • rawfiles: [add_rawfile]
  • monitor map files: [add_monmap]
  • monitor mask files: [add_monmask]
  • detector map files: [add_detmap]
  • detector mask files: [add_detmask]

It is necessary to define the type of instrument you are using in the IXTdata_source object, of course only one instrument can be defined for population to work as you would expect. This affects how the IXTrunfile is populated, and the current options are as follows

  • chopper instruments: [add_chopinst]
  • diffraction instruments: [add_diffinst]


Alternative [IXTmap], [IXTmask] population

The commands above are for specifying files, it is also possible to populate [IXTmap] and [IXTmask] objects in the matlab environment from the command line.

[IXTmask]

>> mask_array = [1,3,5,6,7,8,9]
>> mask = IXTmask(mask_array)

or

>> mask = IXTmask([1,3,5,6,7,8,9])
  • this is a special [IXTmask] constructor
  • mask is an [IXTmask] object
  • mask_array is an array of spectra to be masked
  • a mask object can be created by DIAG which is one of the [Diagnostic tools for homer]

[IXTmap]

>> spectrum_arrays = {[1,3,5,6],[7,8,9,10],[11,12,13,14]}
>> workspace_numbers = [1,22,333]
>> map=IXTmap(spectrum_arrays)

or

>> map=IXTmap([1,22,333],{[1,3,5,6],[7,8,9,10],[11,12,13,14]})
  • this is a special [IXTmap] constructor
  • spectrum_arrays is a cell array containing numerical lists of spectra to be grouped together into workspaces
  • the array workspace_numbers is optional, and if not provided workspace numbers will be given values 1->N where N = size(spectrum_arrays,2)


Populating [IXTrunfile]

There are three standard ways to populate an [IXTrunfile] object, all require an [IXTdata_source] object which has had the type of instrument defined in it ie. chopper or diffraction instrument. As well as simply loading data from a raw file the data can generally be optionally masked/mapped/rebinned using an argument to the population function as a keyword with an associated parameter (eg. a map/mask file, rebin parameters etc.)

If a map/mask/raw file is provided as a command line argument, then it will override any specification already defined in the [IXTdata_source] object.

If no map files are defined, either on the command line or in the [IXTdata_source] object then a 1:1 mapping with _all_ spectra will be created by default. If no mask files are defined then all spectra will be included in the workspaces.

The standard construction for these population routines is as follows.

>> RF=pop_fun(DSO,  run_no, 'keyword_1', parameter_1,..., 'keyword_N',parameter_N)
  • RF is an [IXTrunfile] object
  • DSO is an [IXTdata_source] object which contains an instrument type definition
  • pop_fun can be either _mon,spec,pop_full,homer_
  • raw file specification does not use a keyword, it is built up from the standard instrument abbreviation (eg. HRP, MAR, SRF etc.) and the run number
  • keywords are _always_ character strings and each keyword must be followed by a parameter
  • values can take any appropriate type
  • map files have a designated [Map File Format]
  • mask files have a designated [Mask File Format]


mon

This function populates an [IXTrunfile] object with the raw time-of-flight data for the monitors in the runfile.mon_data [IXTdata] object only. It will optionally accept the keywords in the following table:

Keyword arguments for mon function
Keyword Parameter Type Brief Description
'period' numeric specifies period default:1, if = 0 then spectra can be defined from more than one period
'mon_map' 'string' specifies a map file, supplied parameter is defines the location of the monitor map file
'mon_mask' 'string' specifies a mask file, supplied parameter is defines the location of the monitor mask file
'm_rebin' [xlo,dx,xhi] or [x_1,dx_1,x_2,dx_2,...,x_n,dx_n,x_n+1] rebin parameters are defined according to the numerical array inputs of [rebin_x],[rebin] for single datasets

An example sequence of commands is shown below.

>> run_no= '12345' % run number
>> monitor_mask_file = 'X:\MASKFILES\MON.MASK'
>> monitor_map_file = 'X:\MAPFILES\MON.MAP'
>> rebin_parameters = [1000,100,20000]
>> runfile = mon(dso,run_no,'mon_map',monitor_map_file,'mon_mask',monitor_mask_file,'m_rebin',rebin_parameters)


spec

This function populates an [IXTrunfile] object with the raw time-of-flight data for the detectors in the runfile.det_data [IXTdata] object only. It will optionally accept the keywords in the following table:

Keyword arguments for spec function
Keyword Parameter Type Brief Description
'period' numeric specifies period default:1, if = 0 then spectra can be defined from more than one period
'det_map' 'string' specifies a map file, supplied parameter is defines the location of the detector map file
'det_mask' 'string' specifies a mask file, supplied parameter is defines the location of the detector mask file
'd_rebin' [xlo,dx,xhi] or [x_1,dx_1,x_2,dx_2,...,x_n,dx_n,x_n+1] specifies rebinning of data, rebin parameters are defined according to the *numerical* array inputs of [rebin_x],[rebin] for single datasets
'd_int' [xlo,xhi] specifies limits for integration of the dataset between two limits, 'd_int' *cannot* be supplied with 'd_rebin'
'background' [xlo,xhi] specifies a background subtraction, the supplied parameter is a numerical array defining the background integration range in time-of-flight

An example sequence of commands is shown below.

>> run_no= '54321' % run number
>> detector_mask_file = 'X:\MASKFILES\DET.MASK'
>> detector_map_file = 'X:\MAPFILES\DET.MAP'
>> rebin_parameters = [1000,100,20000]
>> bgrd =[12000,18000]
>> runfile = spec(dso,run_no,'det_map',detector_map_file,'det_mask',detector_mask_file,'d_rebin',rebin_parameters)

pop_full

This function populates an [IXTrunfile] object with the raw time-of-flight data for the detectors in the runfile.det_data [IXTdata] object only. It will optionally accept the keywords in the following table:

Keyword arguments for pop_full function
Keyword Parameter Type Brief Description
'period' numeric specifies period default:1, if = 0 then spectra can be defined from more than one period
'mon_map' 'string' specifies a monitor map file, supplied parameter is defines the location of the monitor map file
'mon_mask' 'string' specifies a monitor mask file, supplied parameter is defines the location of the monitor mask file
'm_rebin' [xlo,dx,xhi] or [x_1,dx_1,x_2,dx_2,...,x_n,dx_n,x_n+1] specifies rebinning of monitor data, rebin parameters are defined according to the *numerical* array inputs of [rebin_x],[rebin] for single datasets
'det_map' 'string' specifies a detector map file, supplied parameter is defines the location of the detector map file
'det_mask' 'string' specifies a detector mask file, supplied parameter is defines the location of the detector mask file
'd_rebin' [xlo,dx,xhi] or [x_1,dx_1,x_2,dx_2,...,x_n,dx_n,x_n+1] specifies rebinning of detector data, rebin parameters are defined according to the *numerical* array inputs of [rebin_x],[rebin] for single datasets
'd_int' [xlo,xhi] specifies limits for integration of the dataset between two limits, 'd_int' *cannot* be supplied with 'd_rebin'
'background' [xlo,xhi] specifies a background subtraction, the supplied parameter is a numerical array defining the background integration range in time-of-flight

An example sequence of commands is shown below.

>> run_no= '54321' % run number
>> monitor_mask_file = 'X:\MASKFILES\MON.MASK'
>> monitor_map_file = 'X:\MAPFILES\MON.MAP'
>> mon_rebin_parameters = [1000,100,20000]
>> detector_mask_file = 'X:\MASKFILES\DET.MASK'
>> detector_map_file = 'X:\MAPFILES\DET.MAP'
>> det_rebin_parameters = [1000,100,20000]
>> bgrd = [12000,18000]
>> runfile = pop_full(dso,run_no,'mon_map',monitor_map_file,'mon_mask',monitor_mask_file,'m_rebin',mon_rebin_parameters, ...
                                      'det_map',detector_map_file,'det_mask',detector_mask_file,'d_rebin',det_rebin_parameters)


homer

The homer command is a special version of the populate command in which extra normalisation keywords can be supplied with a fixed set of associated parameters.

Keyword arguments for homer function
Keyword Parameter Type Brief Description
'period' numeric specifies period default:1, if = 0 then spectra can be defined from more than one period
'mon_map' 'string' specifies a monitor map file, supplied parameter is defines the location of the monitor map file
'mon_mask' 'string' specifies a monitor mask file, supplied parameter is defines the location of the monitor mask file
'm_rebin' [xlo,dx,xhi] or [x_1,dx_1,x_2,dx_2,...,x_n,dx_n,x_n+1] specifies rebinning of monitor data, rebin parameters are defined according to the *numerical* array inputs of [rebin_x],[rebin] for single datasets
'det_map' 'string' specifies a detector map file, supplied parameter is defines the location of the detector map file
'det_mask' 'string' specifies a detector mask file, supplied parameter is defines the location of the detector mask file
'd_rebin' [xlo,dx,xhi] or [x_1,dx_1,x_2,dx_2,...,x_n,dx_n,x_n+1] specifies rebinning of detector data, rebin parameters are defined according to the numerical array inputs of [rebin_x],[rebin] for single datasets. 'd_rebin' cannot be supplied with 'd_int'
'background' [xlo,xhi] specifies a background subtraction, the supplied parameter is a numerical array defining the background integration range in time-of-flight
'ei' real defines estimate of incident energy (meV)
'white' specifies treatment as a white beam
'fixei' real specifies a known incident energy, so that ei determination is not necessary
'normalisation' integer value specifies workspace number of monitor used in normalisation [default 1]
'uahr' specifies normalisation by microamp hours, 'range' keyword cannot be specified if this parameter is defined
'range' [xlo,xhi] specifies range of integration for normalisation, using monitor workspace defined by 'normalisation' and declared in the units defined in 'mon_units'
'peak' specifies to use the area determined by peak search in the monitor defined by 'normalisation' close to the value of either 'ei' or 'fixei', only valid if 'ei' numeric, not if 'white'
'mon_units' [units code] specifies output units of monitor data
'det_units' [units code] specifies output units of detector data
'd_int' [xlo,xhi] specifies limits for integration of the dataset between two limits, if 'det_units' has been supplied then integration will take place after units conversion, 'd_int' cannot be supplied with 'd_rebin'
'scale' real specifies units of normalisation ie per 1e6 counts or per 1000uAhrs [default 1]
'solid' [IXTrunfile] Specifies a solid angle correction, the supplied parameter *must* be a white beam [IXTrunfile] object which has been integrated for every spectrum (i suppose one could also just provide a run number....)
'corr' logical Specifies detector efficiency correction and kf/ki correction will be applied [default false]


see also: [Creating Datasets], [Arrays of Datasets], [Mathematical Functions and Operators], [Other Matlab Utilities], [Input and Output Functions], [Dataset Manipulation and Conversion Functions]