Difference between revisions of "Overriding and setting default values for homer processes"

From LIBISIS
Jump to navigation Jump to search
 
(13 intermediate revisions by the same user not shown)
Line 14: Line 14:
 
each instrument has a named directory where there are instrument specific scripts used to define default values and files which are used to set up and populate the [[IXTrunfile]] object.
 
each instrument has a named directory where there are instrument specific scripts used to define default values and files which are used to set up and populate the [[IXTrunfile]] object.
  
== Overriding instrument specific population ==
+
== Setting homer defaults ==
 +
 
 +
For each instrument there can be particular default values specified for each step in the homering process. When homering using a script there are set default values for the [[Scripting_Homer_Functions#white_beam|white beam]] process (None of the following is relevant to the GUI system). For example the MARI white beam defaults are specified in the script:
 +
 
 +
<tt>MARI/setup_mari_white_beam.m</tt>
 +
<pre>
 +
function setup_mari_white_beam
 +
 
 +
ixf_global_var('homer_white_beam','remove');
 +
 
 +
% particular to white beam operation
 +
ixf_global_var('homer_white_beam','set','ei','white');
 +
ixf_global_var('homer_white_beam','set','d_int',[20,40]);
 +
 
 +
% more general settings
 +
ixf_global_var('homer_white_beam','set','peak_scale',1000000);
 +
ixf_global_var('homer_white_beam','set','uamp_scale',1000);
 +
ixf_global_var('homer_white_beam','set','mon_scale',1000);
 +
ixf_global_var('homer_white_beam','set','det_units','$e');
 +
 
 +
% default normalisation is with monitor 1
 +
ixf_global_var('homer_white_beam','set','normalisation',int32(1));
 +
ixf_global_var('homer_white_beam','set','range',[1000,2000]);
 +
</pre>
 +
 
 +
all the values are stored in persistent matlab memory using the function <tt>ixf_global_var</tt>, the specific values which have been set all refer to keywords which are specific to the  [[Scripting_Homer_Functions#white_beam|white beam]] process. To therefore set the default white beam integration limits to be 20 to 100 meV and for the monitor normalisation integration range to be 1000 to 5000 microseconds
 +
<pre>
 +
ixf_global_var('homer_white_beam','set','d_int',[20,100]);
 +
ixf_global_var('homer_white_beam','set','range',[1000,5000]);
 +
</pre>
 +
 
 +
It is also possible to change the normalisation process entirely, if we want instead to set normalisation by microamp hours we remove the 'range' and change the normalisation to be:
 +
<pre>
 +
ixf_global_var('homer_white_beam','set','normalisation','uamp');
 +
</pre>
  
In the case where there is incorrect information in the rawfile which has been generated we can populate detector and spectra information from a nexus file. [[Overriding_and_setting_default_values_for_homer_processes#Creating populated nexus files|Creating populated nexus files]]
+
== Overriding homer defaults ==
  
 +
To override homer defaults when using the [[Scripting_Homer_Functions]] it is quite simple. The keywords are simply specified with their value eg.
 +
<pre>
 +
>> rf=white_beam(dso,run_number,'range',[1000,5000],'d_int',[20,100])
 +
</pre>
 +
 +
== Overriding instrument specific population ==
 +
=== using defined nexus files ===
 +
In the case where there is incorrect information in the rawfile which has been generated we can populate detector and spectra information from a nexus file. The [[Overriding_and_setting_default_values_for_homer_processes#Creating populated nexus files|creation of these files]] is defined below
  
 
For example the specific MERLIN population information is contained in the file  
 
For example the specific MERLIN population information is contained in the file  
  
<tt>setup_merlin_data_source.m</tt>
+
<tt>MERLIN/setup_merlin_data_source.m</tt>
  
This file defines the nexus files which are required for population of the [[IXTrunfile]] object which in turn the .spe file is produced from.  
+
This script defines the nexus files which are required for population of the [[IXTrunfile]] object which in turn the .spe file is produced from.  
  
To define files used to populate the [[IXTdetector]] and [[IXTspectra]] objects from the we can add the following two lines to this file:
+
To define files used to populate the [[IXTdetector]] and [[IXTspectra]] objects we can add the following two lines to this file:
 
<pre>
 
<pre>
 
DSO=add_item(DSO,'inst_nxs:::merlin_detector.nxs','detector');
 
DSO=add_item(DSO,'inst_nxs:::merlin_detector.nxs','detector');
Line 31: Line 73:
 
</pre>
 
</pre>
  
These files are not distributed with libisis package as they can change. the '<tt>inst_nxs:::/tt>' path is a standard definition which is specified in the <tt>inst_defs.m</tt> file or in the [[Instrument setup]]
+
These files are not distributed with the libisis package as they can change. The '<tt>inst_nxs:::</tt>' path is a standard definition which is specified in the <tt>[[Homer_Gui_setup|inst_defs.m]]</tt> file or in the [[Instrument setup]]
 +
 
 +
=== using a reference file built from a detector.dat information ===
 +
 
 +
it is possible to generate detector information from the files specified to create detector.dat files, these contain extra information about the [[IXTgeometry]], [[IXTshape]], [[IXTtranslation] and [[IXTorientation]] of the detectors.
 +
 
 +
It is first necessary to [[Building a reference detector file|build a reference detector file]]. Once you have done this it is again necessary to edit a script.
 +
 
 +
For example for the MAPS instrument we need to edit the following script file:
 +
 
 +
<tt>MAPS/setup_maps_data_source.m</tt>
 +
 
 +
we add the line:
 +
 
 +
<pre>
 +
DSO=add_item(DSO,'inst_nxs:::detref.nxs','detector','full_reference_detector');
 +
</pre>
  
 
== Creating populated nexus files ==
 
== Creating populated nexus files ==
populate an IXTrunfile from a rawfile containing the correct values and enough detectors to include all those used by the mapping you have chosen - ie if you have an [[IXTrunfile]] which has been populated by the 'mon' command then it will not contain enough detector information.
+
Populate an [[IXTrunfile]] from a raw file containing the correct values and enough detectors to include all those used by the mapping you have chosen - ie if you have an [[IXTrunfile]] which has been populated by the 'mon' command then it will not contain enough detector information.
 
then you make the matlab command
 
then you make the matlab command
 
<pre>
 
<pre>
Line 40: Line 98:
 
>> write_nxs(your_runfile.inst.spectra,'myspectrafile.nxs')
 
>> write_nxs(your_runfile.inst.spectra,'myspectrafile.nxs')
 
</pre>
 
</pre>
these files can then be used in the lines above to populate the [[IXTrunfile]] object provided thety are placed in the inst_nxs::: path
+
these files can then be used in the lines above to populate the [[IXTrunfile]] object provided they are placed in the <tt>inst_nxs:::</tt> path

Latest revision as of 11:07, 4 July 2008

Where are the defaults specified

the homer distribution files are contained in

on a windows distribution: /your_libisis_directory/matlab/

on a linux rpm installation: /usr/local/libisis/applications/matlab/

in the svn repository: /libisis/applications/matlab/

each instrument has a named directory where there are instrument specific scripts used to define default values and files which are used to set up and populate the IXTrunfile object.

Setting homer defaults

For each instrument there can be particular default values specified for each step in the homering process. When homering using a script there are set default values for the white beam process (None of the following is relevant to the GUI system). For example the MARI white beam defaults are specified in the script:

MARI/setup_mari_white_beam.m

function setup_mari_white_beam

ixf_global_var('homer_white_beam','remove');

% particular to white beam operation
ixf_global_var('homer_white_beam','set','ei','white');
ixf_global_var('homer_white_beam','set','d_int',[20,40]);

% more general settings 
ixf_global_var('homer_white_beam','set','peak_scale',1000000);
ixf_global_var('homer_white_beam','set','uamp_scale',1000);
ixf_global_var('homer_white_beam','set','mon_scale',1000);
ixf_global_var('homer_white_beam','set','det_units','$e');

% default normalisation is with monitor 1
ixf_global_var('homer_white_beam','set','normalisation',int32(1));
ixf_global_var('homer_white_beam','set','range',[1000,2000]);

all the values are stored in persistent matlab memory using the function ixf_global_var, the specific values which have been set all refer to keywords which are specific to the white beam process. To therefore set the default white beam integration limits to be 20 to 100 meV and for the monitor normalisation integration range to be 1000 to 5000 microseconds

ixf_global_var('homer_white_beam','set','d_int',[20,100]);
ixf_global_var('homer_white_beam','set','range',[1000,5000]);

It is also possible to change the normalisation process entirely, if we want instead to set normalisation by microamp hours we remove the 'range' and change the normalisation to be:

ixf_global_var('homer_white_beam','set','normalisation','uamp');

Overriding homer defaults

To override homer defaults when using the Scripting_Homer_Functions it is quite simple. The keywords are simply specified with their value eg.

>> rf=white_beam(dso,run_number,'range',[1000,5000],'d_int',[20,100])

Overriding instrument specific population

using defined nexus files

In the case where there is incorrect information in the rawfile which has been generated we can populate detector and spectra information from a nexus file. The creation of these files is defined below

For example the specific MERLIN population information is contained in the file

MERLIN/setup_merlin_data_source.m

This script defines the nexus files which are required for population of the IXTrunfile object which in turn the .spe file is produced from.

To define files used to populate the IXTdetector and IXTspectra objects we can add the following two lines to this file:

DSO=add_item(DSO,'inst_nxs:::merlin_detector.nxs','detector');
DSO=add_item(DSO,'inst_nxs:::merlin_spectra.nxs','spectra');

These files are not distributed with the libisis package as they can change. The 'inst_nxs:::' path is a standard definition which is specified in the inst_defs.m file or in the Instrument setup

using a reference file built from a detector.dat information

it is possible to generate detector information from the files specified to create detector.dat files, these contain extra information about the IXTgeometry, IXTshape, [[IXTtranslation] and IXTorientation of the detectors.

It is first necessary to build a reference detector file. Once you have done this it is again necessary to edit a script.

For example for the MAPS instrument we need to edit the following script file:

MAPS/setup_maps_data_source.m

we add the line:

DSO=add_item(DSO,'inst_nxs:::detref.nxs','detector','full_reference_detector');

Creating populated nexus files

Populate an IXTrunfile from a raw file containing the correct values and enough detectors to include all those used by the mapping you have chosen - ie if you have an IXTrunfile which has been populated by the 'mon' command then it will not contain enough detector information. then you make the matlab command

>> write_nxs(your_runfile.inst.detector,'mydetectorfile.nxs')
>> write_nxs(your_runfile.inst.spectra,'myspectrafile.nxs')

these files can then be used in the lines above to populate the IXTrunfile object provided they are placed in the inst_nxs::: path