Table of Contents
This method assumes you are familiar with the concept of objects in Python. If not more details can be read here: A quick introduction to objects
To create a POLARIS object the following parameters are required:
Optionally a configuration file may be specified if one exists using the following parameter:
See Using configuration files on YAML configuration files for more details
from isis_powder import Polaris
calibration_dir = r"C:\path\to\calibration_dir"
output_dir = r"C:\path\to\output_dir"
polaris_example = Polaris(calibration_directory=calibration_dir,
output_directory=output_dir,
user_name="Mantid")
# Optionally we could provide a configuration file like so
# Notice how the file name ends with .yaml
config_file_path = r"C:\path\to\config_file.yaml
polaris_example = Polaris(config_file=config_file_path,
user_name="Mantid", ...)
The following methods can be executed on a POLARIS object:
For information on creating a POLARIS object see: Creating POLARIS Object
The create_vanadium method allows a user to process a vanadium run. Whilst processing the vanadium run the scripts can apply any corrections the user enables and will spline the resulting workspace(s) for later focusing.
On POLARIS the following parameters are required when executing create_vanadium:
If do_absorb_corrections is set to True the following parameter is required in addition to the above:
The focus method processes the user specified run(s). It aligns, focuses and optionally applies corrections if the user has requested them.
On POLARIS the following parameters are required when executing focus:
If do_absorb_corrections is set to True the following parameter is required in addition to the above:
The following parameters may also be optionally set:
The set_sample method allows a user to specify a SampleDetails object which contains the sample properties used when do_absorb_corrections is True whilst focusing.
For more details on the SampleDetails object and how to set it see: ISIS Powder Diffraction Scripts - SampleDetails Reference
The following parameter is required when calling set_sample
Warning
Total scattering support is not yet fully implemented. Any results obtaining from using the below routine in its current state should not be considered accurate or complete.
The create_total_scattering_pdf method allows a user to create a Pair Distribution Function (PDF) from focused POLARIS data, with a view performing further total scattering analysis.
With no merging criteria specified, merge_banks=False a PDF will be generated for each bank within the focused_workspace.
This function requires the run_number you wish to analyse. The focused file for this run number must either be loaded in Mantid with the naming format given by the focus method:
<run number>-Results-<TOF/D>-Grp
for example:
12345-Results-TOF-Grp
Or the focused file must be in the output directory of the POLARIS instrument.
The calibration mapping file holds the mapping between run numbers, current label, offset filename and the empty and vanadium numbers.
For more details on the calibration mapping file see: Cycle mapping files
The layout on POLARIS should look as follows for each block substituting the below values for appropriate values:
1 2 3 4 5 6 7 8 9 | 1-100:
label: "1_1"
offset_file_name: "offset_file.cal"
PDF:
vanadium_run_numbers: "10"
empty_run_numbers: "20"
Rietveld:
vanadium_run_numbers: "30"
empty_run_numbers: "40"
|
Lines 5 and 6 in this example set the vanadium and empty run numbers for chopper off mode. Lines 8 and 9 set the vanadium and empty for chopper on mode.
1-100:
label: "1_1"
offset_file_name: "offset_file.cal"
PDF:
vanadium_run_numbers: "10"
empty_run_numbers: "20"
Rietveld:
vanadium_run_numbers: "30"
empty_run_numbers: "40"
101-:
label: "1_2"
offset_file_name: "offset_file.cal"
PDF:
vanadium_run_numbers: "110"
empty_run_numbers: "120"
Rietveld:
vanadium_run_numbers: "130"
empty_run_numbers: "140"
The following parameters for POLARIS are intended for regular use when using the ISIS Powder scripts.
This parameter should be the full path to the calibration folder. Within the folder the following should be present:
The script will also save out vanadium splines into the relevant label folder which are subsequently loaded and used within the focus method.
Example Input:
polaris_example = Polaris(calibration_directory=r"C:\path\to\calibration_dir", ...)
This parameter gives the full path to the YAML file containing the calibration mapping. For more details on this file see: Calibration Mapping File
Note: This should be the full path to the file including extension
Example Input:
# Notice the filename always ends in .yaml
polaris_example = Polaris(calibration_mapping_file=r"C:\path\to\file\calibration_mapping.yaml", ...)
The current chopper mode to use in the create_vanadium and focus method. This determines which vanadium and empty run numbers to use whilst processing.
Accepted values are: PDF or Rietveld
Note: This parameter is not case sensitive
Example Input:
polaris_example.create_vanadium(mode="PDF", ...)
# Or
polaris_example.focus(mode="Rietveld", ...)
The full path to the YAML configuration file. This file is described in detail here: Using configuration files It is recommended to set this parameter at object creation instead of on a method as it will warn if any parameters are overridden in the scripting window.
Note: This should be the full path to the file including extension
Example Input:
# Notice the filename always ends in .yaml
polaris_example = Polaris(config_file=r"C:\path\to\file\configuration.yaml", ...)
Indicates whether to perform vanadium absorption corrections in create_vanadium mode. In focus mode sample absorption corrections require the sample be set first with the set_sample method.
Accepted values are: True or False
Note: If this is set to ‘True’ multiple_scattering must be set
Example Input:
polaris_example.create_vanadium(do_absorb_corrections=True, ...)
# Or (this assumes sample details have already been set)
polaris_example.focus(do_absorb_corrections=True, ...)
Indicates whether to divide the focused workspace within focus mode with a previously generated vanadium spline.
This requires a vanadium to have been previously created with the create_vanadium method
Accepted values are: True or False
Example Input:
polaris_example.focus(do_van_normalisation=True, ...)
Optional
Specifies a file extension to use when using the focus method.
This should be used to process partial runs. When processing full runs (i.e. completed runs) it should not be specified as Mantid will automatically determine the best extension to use.
Note: A leading dot (.) is not required but is preferred for readability
Example Input:
polaris_example.focus(file_ext=".s01", ...)
Indicates a run from the current cycle to use when calling create_vanadium. This does not have the be the first run of the cycle or the run number corresponding to the vanadium. However it must be in the correct cycle according to the Calibration Mapping File.
Example Input:
# In this example assume we mean a cycle with run numbers 100-200
polaris_example.create_vanadium(first_cycle_run_no=100, ...)
Indicates how to interpret the parameter run_number whilst calling the focus method. If the input_mode is set to Summed it will process to sum all runs specified. If set to Individual it will process all runs individually (i.e. One at a time)
Accepted values are: Summed and Individual
Note: This parameter is not case sensitive
Example Input:
polaris_example.focus(input_mode="Summed", ...)
Indicates whether to account for the effects of multiple scattering when calculating absorption corrections. If do_absorb_corrections is set to True this parameter must be set.
Accepted values are: True or False
Note: Calculating multiple scattering effects will add around 10-30 minutes to the script runtime depending on the speed of the computer you are using
Example Input:
polaris_example.create_vanadium(multiple_scattering=True, ...)
# Or
polaris_example.focus(multiple_scattering=False, ...)
Specifies the path to the output directory to save resulting files into. The script will automatically create a folder with the label determined from the calibration_mapping_file and within that create another folder for the current user_name.
Within this folder processed data will be saved out in several formats.
Example Input:
polaris_example = Polaris(output_directory=r"C:\path\to\output_dir", ...)
Specifies the run number(s) to process when calling the focus method.
This parameter accepts a single value or a range of values with the following syntax:
- : Indicates a range of runs inclusive (e.g. 1-10 would process 1, 2, 3....8, 9, 10)
, : Indicates a gap between runs (e.g. 1, 3, 5, 7 would process run numbers 1, 3, 5, 7)
These can be combined like so: 1-3, 5, 8-10 would process run numbers 1, 2, 3, 5, 8, 9, 10.
In addition the input_mode parameter determines what effect a range of inputs has on the data to be processed
Example Input:
# Process run number 1, 3, 5, 6, 7
polaris_example.focus(run_number="1, 3, 5-7", ...)
# Or just a single run
polaris_example.focus(run_number=100, ...)
Optional
This parameter specifies a/several sample empty run(s) to subtract from the run in the focus method. If multiple runs are specified it will sum these runs before subtracting the result.
This input uses the same syntax as run_number. Please visit the above page for more details.
Note: If this parameter is set to True sample_empty_scale must also be set. This is set to 1.0 by default.
Example Input:
# Our sample empty is a single number
polaris_example.focus(sample_empty=100, ...)
# Or a range of numbers
polaris_example.focus(sample_empty="100-110", ...)
Optional
This parameter specifies a suffix to append the names of output files during a focus.
Example Input:
polaris_example.focus(suffix="-corr", ...)
Specifies the name of the current user when creating a new POLARIS object. This is only used when saving data to sort data into respective user folders. See output_directory for more details.
Example Input:
polaris_example = Polaris(user_name="Mantid", ...)
Warning
These values are not intended to be changed and should reflect optimal defaults for the instrument. For more details please read: Instrument advanced properties
This section is mainly intended to act as reference of the current settings distributed with Mantid
All values changed in the advanced configuration file requires the user to restart Mantid for the new values to take effect. Please read Instrument advanced properties before proceeding to change values within the advanced configuration file.
Indicates a list of TOF values to crop the focused workspace which was created by focus on a bank by bank basis.
This parameter is a list of bank cropping values with one list entry per bank. The values must have a smaller TOF window than the vanadium_cropping_values
On POLARIS this is set to the following TOF windows:
focused_cropping_values = [
(700, 30000), # Bank 1
(1200, 24900), # Bank 2
(1100, 19950), # Bank 3
(1100, 19950), # Bank 4
(1100, 19950), # Bank 5
]
Determines the name of the grouping cal file which is located within top level of the calibration_directory.
The grouping file determines the detector ID to bank mapping to use whilst focusing the spectra into banks.
On POLARIS this is set to the following:
grouping_file_name: "Master_copy_of_grouping_file_with_essential_masks.cal"
Determines the name of the masking file containing the masks to remove Bragg peaks on Polaris. This file must be located within the top level of the calibration_directory.
On POLARIS this is set to the following:
vanadium_peaks_masking_file: "VanaPeaks.dat"
Required if sample_empty is set to True
Sets a factor to scale the sample empty run(s) to before subtracting. This value is multiplied after summing the sample empty runs and before subtracting the empty from the data set. For more details see: Scale.
Example Input:
# Scale sample empty to 90% of original
polaris_example.focus(sample_empty_scale=0.9, ...)
Determines the TOF window to crop all spectra down to before any processing in the create_vanadium and focus methods.
This helps remove negative counts where at very low TOF the empty counts can exceed the captured neutron counts of the run to process.
On POLARIS this is set to the following:
raw_data_cropping_values: (750, 20000)
Determines the spline coefficient to use after processing the vanadium in create_vanadium method. For more details see SplineBackground
Note that if this value is changed ‘create_vanadium’ will need to be called again.
On POLARIS this is set to the following:
spline_coefficient: 100
Determines the TOF windows to crop to on a bank by bank basis within the create_vanadium method. This is applied after focusing and before a spline is taken.
It is used to remove low counts at the start and end of the vanadium run to produce a spline which better matches the data.
This parameter is a list of bank cropping values with one list entry per bank. The values must have a larger TOF window than the focused_cropping_values and a smaller window than raw_data_cropping_values.
On POLARIS this is set to the following:
vanadium_cropping_values = [(800, 19995), # Bank 1
(800, 19995), # Bank 2
(800, 19995), # Bank 3
(800, 19995), # Bank 4
(800, 19995), # Bank 5
]
The chemical formula for the Vanadium rod.
On POLARIS this is set to the following:
chemical_formula = "V"
The height of the Vanadium rod.
On POLARIS this is set to the following:
cylinder_sample_height = 4.0
The radius of the Vanadium rod.
On POLARIS this is set to the following:
cylinder_sample_radius = 0.25
The position of the Vanadium rod in [x, y, z]
On POLARIS this is set to the following:
cylinder_position = [0.0, 0.0, 0.0]
Category: Techniques