\(\renewcommand\AA{\unicode{x212B}}\)

OSIRISDiffractionReduction v1

../_images/OSIRISDiffractionReduction-v1_dlg.png

OSIRISDiffractionReduction dialog.

Summary

This Python algorithm performs the operations necessary for the reduction of diffraction data from the Osiris instrument at ISIS into dSpacing, by correcting for the monitor and linking the various d-ranges together.

Properties

Name Direction Type Default Description
Sample Input str list   The list of run numbers that are part of the sample run. There should be five of these in most cases. Enter them as comma separated values.
Vanadium Input str list   The list of run numbers that are part of the sample run. There should be five of these in most cases. Enter them as comma separated values.
Container Input str list   The list of run numbers that are part of the sample run. There should be five of these in most cases. Enter them as comma separated values.
ContainerScaleFactor Input number 1 Factor by which to scale the container
CalFile Input string Mandatory Filename of the .cal file to use in the [[AlignDetectors]] and [[DiffractionFocussing]] child algorithms.
SpectraMin Input number 3 Minimum Spectrum to Load from (Must be more than 3)
SpectraMax Input number 962 Maximum Spectrum to Load from file (Must be less than 962)
OutputWorkspace Output MatrixWorkspace Mandatory Name to give the output workspace. If no name is provided, one will be generated based on the run numbers.
LoadLogFiles Input boolean True Load log files when loading runs

Description

Performs a diffraction reduction for OSIRIS using normalisation to a set of vanadium sample runs.

The dRanges are numbered as per the OSIRIS manual. Otherwise the dRange is determined based on the table provided in the manual.

Usage

Example - Running OSIRISDiffractionReduction.

import os

def createDummyOSIRISWorkspace(name, func, xmin, xmax, bin_width):
  """Creates a workspace that looks something like an OSIRIS diffraction run"""
  #create workspace according to function
  ws = CreateSampleWorkspace("Histogram", Function="User Defined", UserDefinedFunction=func, XMin=xmin, XMax=xmax, Random=True, BinWidth=bin_width, NumBanks=11, OutputWorkspace=name)
  ws = CropWorkspace(ws, StartWorkspaceIndex=0, EndWorkspaceIndex=1009, OutputWorkspace=name)
  AddSampleLog(ws, 'gd_prtn_chrg', '30.01270866394043',  'Number')

  #load instrument parameters
  LoadInstrument(ws, RewriteSpectraMap=True, InstrumentName='OSIRIS')
  param_file = config['instrumentDefinition.directory'] + 'OSIRIS_diffraction_diffspec_Parameters.xml'
  LoadParameterFile(ws, Filename=param_file)
  return ws

#create two dummy workspaces with one peak
function = "name=Lorentzian, Amplitude=350000,PeakCentre=40000, FWHM=80"
ws1 = createDummyOSIRISWorkspace('ws1', function, 1.17e+04, 5.17e+04, 4.7)
ws2 = createDummyOSIRISWorkspace('ws2', function, 29400, 69400, 16.1)

#create two vanadium runs
function = "name=FlatBackground, A0=10"
van1 = createDummyOSIRISWorkspace('van1', function, 1.17e+04, 5.17e+04, 4.7)
van2 = createDummyOSIRISWorkspace('van2', function, 29400, 69400, 16.1)

samples = [ws1.name(),  ws2.name() ]
vanadium = [van1.name(), van2.name()]

#OSIRISDiffractionReduction currently only support loading from file.
for ws in (samples + vanadium):
  path = os.path.join(os.path.expanduser("~"), ws + ".nxs")
  SaveNexus(ws, path)

#run OSIRISDiffractionReduction
samples = [os.path.join(os.path.expanduser("~"), sample + ".nxs") for sample in samples]
vanadium = [os.path.join(os.path.expanduser("~"), van  + ".nxs") for van in vanadium]
ws = OSIRISDiffractionReduction(Sample=','.join(samples), Vanadium=','.join(vanadium), CalFile="osiris_041_RES10.cal")

print("Number of Spectra: {}, Number of bins: {}".format(ws.getNumberHistograms(), ws.blocksize()))

Output:

Number of Spectra: 1, Number of bins: 7581

Categories: AlgorithmIndex | Diffraction\Reduction