Difference between revisions of "Homer and mgenie style functions"
(→homer) |
m (→homer) |
||
(9 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | == Preparing the [IXTdata_source] == | + | == 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: | 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]] | + | *rawfiles: [[add_rawfile]] [[add_multrawfile]] |
*monitor map files: [[add_monmap]] | *monitor map files: [[add_monmap]] | ||
*monitor mask files: [[add_monmask]] | *monitor mask files: [[add_monmask]] | ||
Line 22: | Line 22: | ||
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.) | 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. | + | *'''For any of these functions to run properly the matlab environment must be prepared by calling the [[instrument setup]] scripts.''' |
− | + | *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. | + | *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. | The standard construction for these population routines is as follows. | ||
Line 57: | Line 57: | ||
| 'period' || numeric || specifies period default:1, if = 0 then spectra can be defined from more than one period | | '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_map'|| 'string' or [[IXTmap]] || 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 | | '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 | + | | '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 |
|} | |} | ||
Line 73: | Line 73: | ||
>> runfile = mon(dso,run_no,'mon_map',monitor_map_file,'mon_mask',monitor_mask_file,'m_rebin',rebin_parameters) | >> runfile = mon(dso,run_no,'mon_map',monitor_map_file,'mon_mask',monitor_mask_file,'m_rebin',rebin_parameters) | ||
</pre> | </pre> | ||
− | |||
=== spec === | === spec === | ||
Line 87: | Line 86: | ||
| 'period' ||numeric ||specifies period default:1, if = 0 then spectra can be defined from more than one period | | '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_map' or ||'string' or [[IXTmap]] ||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 | | 'det_mask'||'string' ||specifies a mask file, supplied parameter is defines the location of the detector mask file | ||
Line 122: | Line 121: | ||
|'period' || numeric || specifies period default:1, if = 0 then spectra can be defined from more than one period | |'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_map' or ||'string' or [[IXTmap]] ||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 | |'mon_mask'|| 'string' ||specifies a monitor mask file, supplied parameter is defines the location of the monitor mask file | ||
Line 128: | Line 127: | ||
|'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 | |'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_map' or ||'string' or [[IXTmap]] ||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 | |'det_mask'|| 'string' || specifies a detector mask file, supplied parameter is defines the location of the detector mask file | ||
Line 173: | Line 172: | ||
|'fixei' || real || specifies a known incident energy, so that ei determination is not necessary | |'fixei' || real || specifies a known incident energy, so that ei determination is not necessary | ||
|- | |- | ||
− | |'mon_map'|| 'string' || specifies a monitor map file, supplied parameter is defines the location of the monitor map file | + | | 'mon_map' or ||'string' or [[IXTmap]] || 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 | |'mon_mask'|| 'string' || specifies a monitor mask file, supplied parameter is defines the location of the monitor mask file | ||
Line 181: | Line 180: | ||
|'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 | |'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_map' or ||'string' or [[IXTmap]] ||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 | |'det_mask'|| 'string' || specifies a detector mask file, supplied parameter is defines the location of the detector mask file | ||
Line 189: | Line 188: | ||
|'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' | |'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' | ||
|- | |- | ||
− | |'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'. limits are specified in the units of the data, therefore if your output units are 'w' then your integration limits are specified in meV. if no units are specified then the limits are in time (microseconds) |
|- | |- | ||
|'background'|| [xlo,xhi] || specifies a background subtraction, the supplied parameter is a numerical array defining the background integration range in time-of-flight | |'background'|| [xlo,xhi] || specifies a background subtraction, the supplied parameter is a numerical array defining the background integration range in time-of-flight | ||
Line 211: | Line 210: | ||
|'mass' || real || mass of sample | |'mass' || real || mass of sample | ||
|- | |- | ||
− | |'RMM' || | + | |'RMM' || real || relative molecular mass of sample |
|} | |} | ||
− | |||
− | |||
− | |||
− | |||
− |
Latest revision as of 14:12, 12 August 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 add_multrawfile
- 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
IXTmap and IXTmask files
Different instruments generally have their own map files associated with them, but it is also possible to create IXTmap and IXTmask from the matlab command line
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.)
- For any of these functions to run properly the matlab environment must be prepared by calling the instrument setup scripts.
- 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)
For any of these functions to run properly the matlab environment must be prepared by calling the instrument setup scripts.
- 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 automatically according to which setup file has been run. If this has not been run then the script will fail and tell you
- 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 | 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' or IXTmap | 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 | Parameter Type | Brief Description |
---|---|---|
'period' | numeric | specifies period default:1, if = 0 then spectra can be defined from more than one period |
'det_map' or | 'string' or IXTmap | 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 | Parameter Type | Brief Description |
---|---|---|
'period' | numeric | specifies period default:1, if = 0 then spectra can be defined from more than one period |
'mon_map' or | 'string' or IXTmap | 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' or | 'string' or IXTmap | 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 | Parameter Type | Brief Description |
---|---|---|
'period' | numeric | specifies period default:1, if = 0 then spectra can be defined from more than one period |
'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 |
'mon_map' or | 'string' or IXTmap | 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 |
'mon_units' | [units code] | specifies output units of monitor data |
'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' or | 'string' or IXTmap | 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 |
'det_units' | [units code] | specifies output units of detector data |
'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' |
'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'. limits are specified in the units of the data, therefore if your output units are 'w' then your integration limits are specified in meV. if no units are specified then the limits are in time (microseconds) |
'background' | [xlo,xhi] | specifies a background subtraction, the supplied parameter is a numerical array defining the background integration range in time-of-flight |
'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' | |
'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] |
'abs' | real | absolute units scaling factor |
'mass' | real | mass of sample |
'RMM' | real | relative molecular mass of sample |