\(\renewcommand\AA{\unicode{x212B}}\)
EditInstrumentGeometry v1¶
Summary¶
Adds a new instrument or edits an existing one; currently works in an overwrite mode only.
Properties¶
Name |
Direction |
Type |
Default |
Description |
---|---|---|---|---|
Workspace |
InOut |
Mandatory |
Workspace to edit the detector information |
|
PrimaryFlightPath |
Input |
number |
Optional |
Primary flight path L1 of the powder diffractometer. |
SpectrumIDs |
Input |
int list |
Spectrum Numbers (note that it is not detector ID or workspace indices). The list must be either empty or have a size equal to input workspace’s histogram number. |
|
L2 |
Input |
dbl list |
Mandatory |
Secondary flight (L2) paths for each detector. Number of L2 given must be same as number of histogram. |
Polar |
Input |
dbl list |
Mandatory |
Polar angles (two thetas) for detectors. Number of 2theta given must be same as number of histogram. |
Azimuthal |
Input |
dbl list |
Azimuthal angles (out-of-plane) for detectors. Number of azimuthal angles given must be same as number of histogram. |
|
DetectorIDs |
Input |
int list |
User specified detector IDs of the spectra. Number of specified detector IDs must be either zero or number of histogram |
|
InstrumentName |
Input |
string |
Name of the newly built instrument. If left empty, the original instrument will be used. |
Description¶
This algorithm can:
#. Add an Instrument to a Workspace without any real instrument associated with, or #. Replace a Workspace’s Instrument with a new Instrument, or #. Edit all detectors’ parameters of the instrument associated with a Workspace (partial instrument editing is not supported).
Requirements on input properties¶
PrimaryFightPath (L1): If it is not given, L1 will be the distance between source and sample in the original instrument. Otherwise, L1 is read from input. The source position of the modified instrument is (0, 0, -L1);
SpectrumIDs: If not specified (empty list), then Spectrum Numbers will be set up to any array such that SpectrumNos[wsindex] is the spectrum Number of workspace index ‘wsindex’;
L2 and Polar cannot be empty list;
SpectrumIDs[i], L2[i], Polar[i], Azimuthal[i] and optional DetectorIDs[i] correspond to the detector of a same spectrum.
Angles are specified in degrees.
Limitations¶
There are some limitations of this algorithm.
The key to locate the detector is via spectrum Number;
For each spectrum, there is only one and only one new detector. Thus, if one spectrum is associated with a group of detectors previously, the replacement (new) detector is the one which is (diffraction) focused on after this algorithm is called.
Usage¶
Example - Adding a new instrument to a workspace
import numpy
ws = CreateWorkspace(
DataX=[0., 1.],
DataY=[1., 2., 3.],
NSpec=3)
EditInstrumentGeometry(
ws,
PrimaryFlightPath=5.,
SpectrumIDs=[1, 2, 3],
L2=[2.0, 2.3, 2.6],
Polar=[10.0, 15.0, 23.0],
Azimuthal=[0.0, 0.0, 0.0],
DetectorIDs=[100, 101, 102],
InstrumentName='Bizarrio')
spectrumInfo = ws.spectrumInfo()
for i in range(ws.getNumberHistograms()):
print('Histogram {} scattering angle: {:.3} degrees'.format(i + 1, numpy.rad2deg(spectrumInfo.twoTheta(i))))
Output:
Histogram 1 scattering angle: 10.0 degrees
Histogram 2 scattering angle: 15.0 degrees
Histogram 3 scattering angle: 23.0 degrees
Categories: AlgorithmIndex | Diffraction\DataHandling | DataHandling\Instrument
Source¶
C++ header: EditInstrumentGeometry.h
C++ source: EditInstrumentGeometry.cpp