Difference between revisions of "Homer Utilities"
Toby Perring (talk | contribs) |
|||
(10 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
− | + | == gget == | |
+ | generic raw file access | ||
− | + | it is possible at the matlab comand line to extract any variable from the rawfile by making a call to a populated [[IXTraw_file]] object. | |
− | head() returns the header information for the raw file defined by the run_number, or the path to a defined raw file. | + | <pre> |
+ | >> rawfile=IXTraw_file('/path/to/my/file.raw') | ||
+ | >> value=gget(rawfile,'FIELD') | ||
+ | </pre> | ||
+ | |||
+ | == dae access == | ||
+ | |||
+ | It is possible to access the data in the DAE by populating an [[IXTraw_file]] with a special string argument. We prefix <tt>DAE:</tt> to the name of the instrument control computer. Once this has been successfully populated all data access and get functions can be called. | ||
+ | |||
+ | <pre> | ||
+ | >> rawf=IXTraw_file('DAE:ndxmerlin') | ||
+ | >> w1=getspectrum(rawf,1) | ||
+ | >> title=gget(rawf,'TITL') | ||
+ | </pre> | ||
+ | |||
+ | This process is not possible with all instruments and requires the newest ICP to be installed. Full homer processes are possible but take a very long time, it is best used to access single spectra. | ||
+ | |||
+ | == head == | ||
+ | |||
+ | head() returns the header information for the raw file defined by the run_number, or the path to a defined raw file. Multiple run numbers can be combined together with limited practical use. | ||
<pre> | <pre> | ||
Line 16: | Line 36: | ||
# a cell array of numerics <tt>{12345 45673 34436}</tt> | # a cell array of numerics <tt>{12345 45673 34436}</tt> | ||
− | * <tt>path_to_raw_file</tt> is defined as a string or a cell array of strings <tt>'C:\data\myfile.raw'</tt> | + | * <tt>path_to_raw_file</tt> is defined as a string or a cell array of strings of the form <tt>'C:\data\myfile.raw'</tt>, relative paths are also possible as well as using the [[Global IXTpath objects]] <tt>'inst_data:::myfile.raw'</tt> provided they have been set properly in the [[Instrument setup]] |
mhead() returns the header information for each raw file defined by an '''array''' of run numbers, or an '''array''' of paths to a raw file. | mhead() returns the header information for each raw file defined by an '''array''' of run numbers, or an '''array''' of paths to a raw file. | ||
Line 30: | Line 50: | ||
# a cell array of strings <tt>{'12345' '45673' '34436'}</tt> | # a cell array of strings <tt>{'12345' '45673' '34436'}</tt> | ||
# a cell array of numerics <tt>{12345 45673 34436}</tt> | # a cell array of numerics <tt>{12345 45673 34436}</tt> | ||
− | * <tt>paths_to_raw_files</tt> is defined as a cell or string array | + | * <tt>paths_to_raw_files</tt> is defined as a cell or string array of the form <tt>'C:\data\myfile.raw'</tt>, relative paths are also possible as well as using the [[Global IXTpath objects]] <tt>'inst_data:::myfile.raw'</tt> provided they have been set properly in the [[Instrument setup]] |
+ | |||
+ | == get_ei == | ||
+ | get_ei() returns the energy of given a monochromatic run number, a guide energy can optionally be provided to focus the search for a monitor peak. It also optionally returns a structure containing the peak position, area and normalised area of the two monitors used to determine the energy. Multiple run numbers may be combined. | ||
− | == | + | <pre> |
+ | >> [ei,props]=get_ei(run_number,ei_guess) | ||
+ | >> [ei,props]=get_ei(path_to_raw_file,ei_guess) | ||
+ | </pre> | ||
+ | |||
+ | * <tt>run_number</tt> can be defined in the following ways | ||
+ | # a numerical array of numbers <tt> [12345 45673 34436]</tt> or a single numeric | ||
+ | # an array of strings <tt>char('12345' '45673' '34436')</tt> or a single string | ||
+ | # a cell array of strings <tt>{'12345' '45673' '34436'}</tt> | ||
+ | # a cell array of numerics <tt>{12345 45673 34436}</tt> | ||
+ | * <tt>path_to_raw_file</tt> is defined as a string or a cell array of strings of the form <tt>'C:\data\myfile.raw'</tt>, relative paths are also possible as well as using the [[Global IXTpath objects]] <tt>'inst_data:::myfile.raw'</tt> provided they have been set properly in the [[Instrument setup]] | ||
+ | * ei_guess is a single numeric value containing the starting ei for get_ei to use in its calculation | ||
+ | |||
+ | mget_ei() | ||
+ | |||
+ | <pre> | ||
+ | >> [ei,props]=mget_ei(run_numbers,ei_guesses) | ||
+ | >> [ei,props]=mget_ei(path_to_raw_file,ei_guesses) | ||
+ | </pre> | ||
+ | |||
+ | * <tt>run_numbers</tt> can be defined in the following ways | ||
+ | # a numerical array of numbers <tt> [12345 45673 34436]</tt> | ||
+ | # an array of strings <tt>char('12345' '45673' '34436')</tt> | ||
+ | # a cell array of strings <tt>{'12345' '45673' '34436'}</tt> | ||
+ | # a cell array of numerics <tt>{12345 45673 34436}</tt> | ||
+ | * <tt>paths_to_raw_files</tt> is defined as a cell or string array of the form <tt>'C:\data\myfile.raw'</tt>, relative paths are also possible as well as using the [[Global IXTpath objects]] <tt>'inst_data:::myfile.raw'</tt> provided they have been set properly in the [[Instrument setup]] | ||
+ | *ei_guesses must be a numerical array equal to the number of run_numbers, containing the starting ei for mget_ei to use in the energy calculation for each run |
Latest revision as of 19:43, 2 February 2010
gget
generic raw file access
it is possible at the matlab comand line to extract any variable from the rawfile by making a call to a populated IXTraw_file object.
>> rawfile=IXTraw_file('/path/to/my/file.raw') >> value=gget(rawfile,'FIELD')
dae access
It is possible to access the data in the DAE by populating an IXTraw_file with a special string argument. We prefix DAE: to the name of the instrument control computer. Once this has been successfully populated all data access and get functions can be called.
>> rawf=IXTraw_file('DAE:ndxmerlin') >> w1=getspectrum(rawf,1) >> title=gget(rawf,'TITL')
This process is not possible with all instruments and requires the newest ICP to be installed. Full homer processes are possible but take a very long time, it is best used to access single spectra.
head
head() returns the header information for the raw file defined by the run_number, or the path to a defined raw file. Multiple run numbers can be combined together with limited practical use.
>> head(run_number) >> head(path_to_raw_file)
- run_number can be defined in the following ways
- a numerical array of numbers [12345 45673 34436] or a single numeric
- an array of strings char('12345' '45673' '34436') or a single string
- a cell array of strings {'12345' '45673' '34436'}
- a cell array of numerics {12345 45673 34436}
- path_to_raw_file is defined as a string or a cell array of strings of the form 'C:\data\myfile.raw', relative paths are also possible as well as using the Global IXTpath objects 'inst_data:::myfile.raw' provided they have been set properly in the Instrument setup
mhead() returns the header information for each raw file defined by an array of run numbers, or an array of paths to a raw file.
>> mhead(run_numbers) >> mhead(paths_to_raw_files)
- run_numbers can be defined in the following ways
- a numerical array of numbers [12345 45673 34436]
- an array of strings char('12345' '45673' '34436')
- a cell array of strings {'12345' '45673' '34436'}
- a cell array of numerics {12345 45673 34436}
- paths_to_raw_files is defined as a cell or string array of the form 'C:\data\myfile.raw', relative paths are also possible as well as using the Global IXTpath objects 'inst_data:::myfile.raw' provided they have been set properly in the Instrument setup
get_ei
get_ei() returns the energy of given a monochromatic run number, a guide energy can optionally be provided to focus the search for a monitor peak. It also optionally returns a structure containing the peak position, area and normalised area of the two monitors used to determine the energy. Multiple run numbers may be combined.
>> [ei,props]=get_ei(run_number,ei_guess) >> [ei,props]=get_ei(path_to_raw_file,ei_guess)
- run_number can be defined in the following ways
- a numerical array of numbers [12345 45673 34436] or a single numeric
- an array of strings char('12345' '45673' '34436') or a single string
- a cell array of strings {'12345' '45673' '34436'}
- a cell array of numerics {12345 45673 34436}
- path_to_raw_file is defined as a string or a cell array of strings of the form 'C:\data\myfile.raw', relative paths are also possible as well as using the Global IXTpath objects 'inst_data:::myfile.raw' provided they have been set properly in the Instrument setup
- ei_guess is a single numeric value containing the starting ei for get_ei to use in its calculation
mget_ei()
>> [ei,props]=mget_ei(run_numbers,ei_guesses) >> [ei,props]=mget_ei(path_to_raw_file,ei_guesses)
- run_numbers can be defined in the following ways
- a numerical array of numbers [12345 45673 34436]
- an array of strings char('12345' '45673' '34436')
- a cell array of strings {'12345' '45673' '34436'}
- a cell array of numerics {12345 45673 34436}
- paths_to_raw_files is defined as a cell or string array of the form 'C:\data\myfile.raw', relative paths are also possible as well as using the Global IXTpath objects 'inst_data:::myfile.raw' provided they have been set properly in the Instrument setup
- ei_guesses must be a numerical array equal to the number of run_numbers, containing the starting ei for mget_ei to use in the energy calculation for each run