From Mantid to Scipp#
Data types#
Workspaces#
Mantid workspaces are converted into Scipp data groups. Those data groups contain a number of entries converted from properties of the workspace and one entry called 'data'
which holds the histogram or event data. The type of the latter depends on the type of workspace according to the following table.
Mantid |
Scipp |
---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Notes#
In many cases it may be desirable to use
Dataset
instead ofDataArray
. You can easily create aDataset
directly from aDataArray
.Scipp takes basic geometric information from Mantid’s instrument in the form of positions. Detector grouping by spectrum is respected. Upon conversion, Scipp will perform spherical coordinate averaging for the group based on the beam direction, this preserves the average scattering angle between a group of detectors and the spectra representing the group. This may yield slightly different detector and spectrum positions between what is natively stored in Mantid’s instrument and Scipp.
Run and Sample are copied over to scipp from any MatrixWorkspace derived Workspaces.
Scipp (or rather conversion to scipp) is currently still incomplete and does not carry over all information from a workspace.
Other#
Mantid |
Scipp |
---|---|
|
|
Concepts#
Mantid’s MatrixWorkspace
(the common base class of Workspace2D
and EventWorkspace
) uses the terms “X”, “Y”, and “E” to refer to one of its axes, the data values, and the uncertainties.
Mantid stores standard-deviations in “E”, whereas scipp stores variances.
Typically Mantid’s “X” is the coordinate axis for the time-of-flight dimension, or the dimension derived from it.
Mantid’s “Y” is not the axis for the second dimension, but the data.
Mantid’s “X”, “Y”, and “E” are 1-D arrays of 1-D arrays, whereas scipp stores 2-D (or higher) arrays, if applicable.
We have the following “equivalence”:
Mantid |
Scipp |
comment |
---|---|---|
|
|
|
|
|
square former, or |
|
|
dimension label may vary |
|
|
dimension label may vary |
|
|
dimension label may vary |
Here i
is the index along the second axis (axis index 1
). Mantid’s readX
, readY
, and readE
always return 1-D arrays, whereas the values
and variances
properties in scipp return a multi-dimensional array. That is, there is no actual equivalence.
Algorithms#
Notes#
In Mantid a Python variable referencing a workspace is under the hood a global variable. Unless specified otherwise the variable name is the name of the workspace in the AnalysisDataService. For marginally more clarity, the examples in the following therefore use the string-based syntax for specifying output workspaces. In scipp there is no such limitation and everything behaves just like normal variables in Python.
Unless stated otherwise, the following code examples assume datasets or data arrays have
'tof'
for what Mantid calls “X” and'spectrum'
why Mantid calls “Y” or “spectrum axis”.There is no strict 1:1 equivalence between Mantid workspaces and functionality in scipp. The examples below give the most common examples, but in many cases exceptions apply and detailed behavior may differ. If in doubt, consult the Mantid algorithm documentation and the scipp documentation.
[1]:
import mantid.simpleapi as mantid
import scipp as sc
import scippneutron as scn
FrameworkManager-[Notice] Welcome to Mantid 6.10.0
FrameworkManager-[Notice] Please cite: http://dx.doi.org/10.1016/j.nima.2014.07.029 and this release: http://dx.doi.org/10.5286/Software/Mantid6.10
CheckMantidVersion-[Notice] A new version of Mantid(6.11.0) is available for download from https://download.mantidproject.org
DownloadInstrument-[Notice] All instrument definitions up to date
Test Data#
[2]:
input_bin_edges = mantid.CreateSampleWorkspace()
input_point_data = mantid.ConvertToPointData(input_bin_edges)
a_mantid = mantid.ExtractSpectra(
input_point_data, StartWorkspaceIndex=0, EndWorkspaceIndex=10
)
b_mantid = mantid.ExtractSpectra(
input_point_data, StartWorkspaceIndex=10, EndWorkspaceIndex=20
)
a_scipp = scn.from_mantid(a_mantid)
b_scipp = scn.from_mantid(b_mantid)
CreateSampleWorkspace-[Notice] CreateSampleWorkspace started
CreateSampleWorkspace-[Notice] CreateSampleWorkspace successful, Duration 0.00 seconds
ConvertToPointData-[Notice] ConvertToPointData started
ConvertToPointData-[Notice] ConvertToPointData successful, Duration 0.00 seconds
ExtractSpectra-[Notice] ExtractSpectra started
ExtractSpectra-[Notice] ExtractSpectra successful, Duration 0.00 seconds
ExtractSpectra-[Notice] ExtractSpectra started
ExtractSpectra-[Notice] ExtractSpectra successful, Duration 0.00 seconds
Generic algorithms#
CloneWorkspace#
[3]:
cloned = mantid.CloneWorkspace(InputWorkspace=input_point_data, OutputWorkspace='copy')
cloned
CloneWorkspace-[Notice] CloneWorkspace started
CloneWorkspace-[Notice] CloneWorkspace successful, Duration 0.00 seconds
[3]:
Workspace2D
Title: Test Workspace
Histograms: 200
Bins: 100
Data points
X axis: Time-of-flight / microsecond
Y axis: Counts
Distribution: False
Instrument: basic_rect (1990-Jan-01 to 1990-Jan-01)
Run start: 2010-Jan-01 00:00:00
Run end: 2010-Jan-01 01:00:00
Equivalent in scipp:
[4]:
copy = a_scipp.copy()
copy
[4]:
- datascippDataArray(spectrum: 11, tof: 100)float64counts0.3, 0.3, ..., 0.3, 0.3
- samplescippVariable()PyObject<mantid.api._api.Sample object at 0x7f1eec139150>
- instrument_namestr()basic_rect
- run_titlescippVariable()string𝟙Test Workspace
- start_timescippVariable()string𝟙2010-01-01T00:00:00
- end_timescippVariable()string𝟙2010-01-01T01:00:00
- run_startscippVariable()string𝟙2010-01-01T00:00:00
- run_endscippVariable()string𝟙2010-01-01T01:00:00
DeleteWorkspace#
[5]:
mantid.DeleteWorkspace(Workspace=cloned)
DeleteWorkspace-[Notice] DeleteWorkspace started
DeleteWorkspace-[Notice] DeleteWorkspace successful, Duration 0.00 seconds
Equivalent in scipp:
[6]:
del copy
ExtractSingleSpectrum#
[7]:
spec = mantid.ExtractSingleSpectrum(
InputWorkspace=input_point_data, OutputWorkspace='spec', WorkspaceIndex=7
)
ExtractSingleSpectrum-[Notice] ExtractSingleSpectrum started
ExtractSingleSpectrum-[Notice] ExtractSingleSpectrum successful, Duration 0.00 seconds
Equivalent in scipp:
[8]:
spec = a_scipp['spectrum', 7]
If an actual copy is required use:
[9]:
spec = a_scipp['spectrum', 7].copy()
ExtractSpectra / CropWorkspace#
[10]:
mantid.ExtractSpectra(
InputWorkspace=input_point_data,
OutputWorkspace='spectra',
StartWorkspaceIndex=1,
EndWorkspaceIndex=4,
)
ExtractSpectra-[Notice] ExtractSpectra started
ExtractSpectra-[Notice] ExtractSpectra successful, Duration 0.00 seconds
[10]:
Workspace2D
Title: Test Workspace
Histograms: 4
Bins: 100
Data points
X axis: Time-of-flight / microsecond
Y axis: Counts
Distribution: False
Instrument: basic_rect (1990-Jan-01 to 1990-Jan-01)
Run start: 2010-Jan-01 00:00:00
Run end: 2010-Jan-01 01:00:00
Equivalent in scipp:
[11]:
a_scipp['spectrum', 1:5]
[11]:
- datascippDataArray(spectrum: 4, tof: 100)float64counts0.3, 0.3, ..., 0.3, 0.3
- samplescippVariable()PyObject<mantid.api._api.Sample object at 0x7f1e7e9e2a40>
- instrument_namestr()basic_rect
- run_titlescippVariable()string𝟙Test Workspace
- start_timescippVariable()string𝟙2010-01-01T00:00:00
- end_timescippVariable()string𝟙2010-01-01T01:00:00
- run_startscippVariable()string𝟙2010-01-01T00:00:00
- run_endscippVariable()string𝟙2010-01-01T01:00:00
If an actual copy is required use:
[12]:
spectra = a_scipp['spectrum', 1:5].copy()
Transpose#
[13]:
mantid.Transpose(InputWorkspace=input_point_data, OutputWorkspace='data')
Transpose-[Notice] Transpose started
Transpose-[Notice] Transpose successful, Duration 0.00 seconds
[13]:
Workspace2D
Title: Test Workspace
Histograms: 100
Bins: 200
Data points
X axis: Spectrum /
Y axis: Counts
Distribution: False
Instrument: basic_rect (1990-Jan-01 to 1990-Jan-01)
Run start: 2010-Jan-01 00:00:00
Run end: 2010-Jan-01 01:00:00
Equivalent in scipp: Transposing is implicit and automatic based on dimension labels and not required for any of the common operations, including plotting.
AppendSpectra#
[14]:
mantid.AppendSpectra(
InputWorkspace1=a_mantid, InputWorkspace2=b_mantid, OutputWorkspace='combined'
)
AppendSpectra-[Notice] AppendSpectra started
AppendSpectra-[Notice] AppendSpectra successful, Duration 0.00 seconds
[14]:
Workspace2D
Title: Test Workspace
Histograms: 22
Bins: 100
Data points
X axis: Time-of-flight / microsecond
Y axis: Counts
Distribution: False
Instrument: basic_rect (1990-Jan-01 to 1990-Jan-01)
Run start: 2010-Jan-01 00:00:00
Run end: 2010-Jan-01 01:00:00
Equivalent in scipp:
[15]:
data = sc.concat([a_scipp['data'], b_scipp['data']], 'spectrum')
data
[15]:
- spectrum: 22
- tof: 100
- position(spectrum)vector3m[0. 0. 5.], [0. 0.008 5. ], ..., [0.008 0.072 5. ], [0.016 0. 5. ]
Values:
array([[0. , 0. , 5. ], [0. , 0.008, 5. ], [0. , 0.016, 5. ], [0. , 0.024, 5. ], [0. , 0.032, 5. ], [0. , 0.04 , 5. ], [0. , 0.048, 5. ], [0. , 0.056, 5. ], [0. , 0.064, 5. ], [0. , 0.072, 5. ], [0.008, 0. , 5. ], [0.008, 0. , 5. ], [0.008, 0.008, 5. ], [0.008, 0.016, 5. ], [0.008, 0.024, 5. ], [0.008, 0.032, 5. ], [0.008, 0.04 , 5. ], [0.008, 0.048, 5. ], [0.008, 0.056, 5. ], [0.008, 0.064, 5. ], [0.008, 0.072, 5. ], [0.016, 0. , 5. ]]) - sample_position()vector3m[0. 0. 0.]
Values:
array([0., 0., 0.]) - source_position()vector3m[ 0. 0. -10.]
Values:
array([ 0., 0., -10.]) - spectrum(spectrum)int321, 2, ..., 20, 21
Values:
array([ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21], dtype=int32) - tof(tof)float64µs100.0, 300.0, ..., 1.970e+04, 1.990e+04
Values:
array([ 100., 300., 500., 700., 900., 1100., 1300., 1500., 1700., 1900., 2100., 2300., 2500., 2700., 2900., 3100., 3300., 3500., 3700., 3900., 4100., 4300., 4500., 4700., 4900., 5100., 5300., 5500., 5700., 5900., 6100., 6300., 6500., 6700., 6900., 7100., 7300., 7500., 7700., 7900., 8100., 8300., 8500., 8700., 8900., 9100., 9300., 9500., 9700., 9900., 10100., 10300., 10500., 10700., 10900., 11100., 11300., 11500., 11700., 11900., 12100., 12300., 12500., 12700., 12900., 13100., 13300., 13500., 13700., 13900., 14100., 14300., 14500., 14700., 14900., 15100., 15300., 15500., 15700., 15900., 16100., 16300., 16500., 16700., 16900., 17100., 17300., 17500., 17700., 17900., 18100., 18300., 18500., 18700., 18900., 19100., 19300., 19500., 19700., 19900.])
- (spectrum, tof)float64counts0.3, 0.3, ..., 0.3, 0.3σ = 0.548, 0.548, ..., 0.548, 0.548
Values:
array([[0.3, 0.3, 0.3, ..., 0.3, 0.3, 0.3], [0.3, 0.3, 0.3, ..., 0.3, 0.3, 0.3], [0.3, 0.3, 0.3, ..., 0.3, 0.3, 0.3], ..., [0.3, 0.3, 0.3, ..., 0.3, 0.3, 0.3], [0.3, 0.3, 0.3, ..., 0.3, 0.3, 0.3], [0.3, 0.3, 0.3, ..., 0.3, 0.3, 0.3]])
Variances (σ²):
array([[0.3, 0.3, 0.3, ..., 0.3, 0.3, 0.3], [0.3, 0.3, 0.3, ..., 0.3, 0.3, 0.3], [0.3, 0.3, 0.3, ..., 0.3, 0.3, 0.3], ..., [0.3, 0.3, 0.3, ..., 0.3, 0.3, 0.3], [0.3, 0.3, 0.3, ..., 0.3, 0.3, 0.3], [0.3, 0.3, 0.3, ..., 0.3, 0.3, 0.3]])
ConjoinXRuns#
[16]:
mantid.ConjoinXRuns(InputWorkspaces=['a_mantid', 'b_mantid'], OutputWorkspace='data')
ConjoinXRuns-[Notice] ConjoinXRuns started
ConjoinXRuns-[Notice] ConjoinXRuns successful, Duration 0.00 seconds
[16]:
Workspace2D
Title: Test Workspace
Histograms: 11
Bins: 200
Data points
X axis: Time-of-flight / microsecond
Y axis: Counts
Distribution: False
Instrument: basic_rect (1990-Jan-01 to 1990-Jan-01)
Run start: 2010-Jan-01 00:00:00
Run end: 2010-Jan-01 01:00:00
Equivalent in scipp:
[17]:
sc.concat([a_scipp['data'], b_scipp['data']], 'tof')
[17]:
- spectrum: 11
- tof: 200
- position(tof, spectrum)vector3m[0. 0. 5.], [0. 0.008 5. ], ..., [0.008 0.072 5. ], [0.016 0. 5. ]
Values:
array([[[0. , 0. , 5. ], [0. , 0.008, 5. ], [0. , 0.016, 5. ], ..., [0. , 0.064, 5. ], [0. , 0.072, 5. ], [0.008, 0. , 5. ]], [[0. , 0. , 5. ], [0. , 0.008, 5. ], [0. , 0.016, 5. ], ..., [0. , 0.064, 5. ], [0. , 0.072, 5. ], [0.008, 0. , 5. ]], [[0. , 0. , 5. ], [0. , 0.008, 5. ], [0. , 0.016, 5. ], ..., [0. , 0.064, 5. ], [0. , 0.072, 5. ], [0.008, 0. , 5. ]], ..., [[0.008, 0. , 5. ], [0.008, 0.008, 5. ], [0.008, 0.016, 5. ], ..., [0.008, 0.064, 5. ], [0.008, 0.072, 5. ], [0.016, 0. , 5. ]], [[0.008, 0. , 5. ], [0.008, 0.008, 5. ], [0.008, 0.016, 5. ], ..., [0.008, 0.064, 5. ], [0.008, 0.072, 5. ], [0.016, 0. , 5. ]], [[0.008, 0. , 5. ], [0.008, 0.008, 5. ], [0.008, 0.016, 5. ], ..., [0.008, 0.064, 5. ], [0.008, 0.072, 5. ], [0.016, 0. , 5. ]]]) - sample_position()vector3m[0. 0. 0.]
Values:
array([0., 0., 0.]) - source_position()vector3m[ 0. 0. -10.]
Values:
array([ 0., 0., -10.]) - spectrum(tof, spectrum)int321, 2, ..., 20, 21
Values:
array([[ 1, 2, 3, ..., 9, 10, 11], [ 1, 2, 3, ..., 9, 10, 11], [ 1, 2, 3, ..., 9, 10, 11], ..., [11, 12, 13, ..., 19, 20, 21], [11, 12, 13, ..., 19, 20, 21], [11, 12, 13, ..., 19, 20, 21]], dtype=int32) - tof(tof)float64µs100.0, 300.0, ..., 1.970e+04, 1.990e+04
Values:
array([ 100., 300., 500., 700., 900., 1100., 1300., 1500., 1700., 1900., 2100., 2300., 2500., 2700., 2900., 3100., 3300., 3500., 3700., 3900., 4100., 4300., 4500., 4700., 4900., 5100., 5300., 5500., 5700., 5900., 6100., 6300., 6500., 6700., 6900., 7100., 7300., 7500., 7700., 7900., 8100., 8300., 8500., 8700., 8900., 9100., 9300., 9500., 9700., 9900., 10100., 10300., 10500., 10700., 10900., 11100., 11300., 11500., 11700., 11900., 12100., 12300., 12500., 12700., 12900., 13100., 13300., 13500., 13700., 13900., 14100., 14300., 14500., 14700., 14900., 15100., 15300., 15500., 15700., 15900., 16100., 16300., 16500., 16700., 16900., 17100., 17300., 17500., 17700., 17900., 18100., 18300., 18500., 18700., 18900., 19100., 19300., 19500., 19700., 19900., 100., 300., 500., 700., 900., 1100., 1300., 1500., 1700., 1900., 2100., 2300., 2500., 2700., 2900., 3100., 3300., 3500., 3700., 3900., 4100., 4300., 4500., 4700., 4900., 5100., 5300., 5500., 5700., 5900., 6100., 6300., 6500., 6700., 6900., 7100., 7300., 7500., 7700., 7900., 8100., 8300., 8500., 8700., 8900., 9100., 9300., 9500., 9700., 9900., 10100., 10300., 10500., 10700., 10900., 11100., 11300., 11500., 11700., 11900., 12100., 12300., 12500., 12700., 12900., 13100., 13300., 13500., 13700., 13900., 14100., 14300., 14500., 14700., 14900., 15100., 15300., 15500., 15700., 15900., 16100., 16300., 16500., 16700., 16900., 17100., 17300., 17500., 17700., 17900., 18100., 18300., 18500., 18700., 18900., 19100., 19300., 19500., 19700., 19900.])
- (spectrum, tof)float64counts0.3, 0.3, ..., 0.3, 0.3σ = 0.548, 0.548, ..., 0.548, 0.548
Values:
array([[0.3, 0.3, 0.3, ..., 0.3, 0.3, 0.3], [0.3, 0.3, 0.3, ..., 0.3, 0.3, 0.3], [0.3, 0.3, 0.3, ..., 0.3, 0.3, 0.3], ..., [0.3, 0.3, 0.3, ..., 0.3, 0.3, 0.3], [0.3, 0.3, 0.3, ..., 0.3, 0.3, 0.3], [0.3, 0.3, 0.3, ..., 0.3, 0.3, 0.3]])
Variances (σ²):
array([[0.3, 0.3, 0.3, ..., 0.3, 0.3, 0.3], [0.3, 0.3, 0.3, ..., 0.3, 0.3, 0.3], [0.3, 0.3, 0.3, ..., 0.3, 0.3, 0.3], ..., [0.3, 0.3, 0.3, ..., 0.3, 0.3, 0.3], [0.3, 0.3, 0.3, ..., 0.3, 0.3, 0.3], [0.3, 0.3, 0.3, ..., 0.3, 0.3, 0.3]])
ConjoinSpectra#
[18]:
mantid.ConjoinSpectra(
InputWorkspaces='a_mantid, b_mantid', OutputWorkspace='out', WorkspaceIndex=7
)
ConjoinSpectra-[Notice] ConjoinSpectra started
ExtractSingleSpectrum-[Notice] ExtractSingleSpectrum started (child)
ExtractSingleSpectrum-[Notice] ExtractSingleSpectrum successful, Duration 0.00 seconds
RenameWorkspace-[Notice] RenameWorkspace started (child)
RenameWorkspace-[Notice] RenameWorkspace successful, Duration 0.00 seconds
ExtractSingleSpectrum-[Notice] ExtractSingleSpectrum started (child)
ExtractSingleSpectrum-[Notice] ExtractSingleSpectrum successful, Duration 0.00 seconds
ConjoinWorkspaces-[Notice] ConjoinWorkspaces started (child)
ConjoinWorkspaces-[Notice] ConjoinWorkspaces successful, Duration 0.00 seconds
ConjoinSpectra-[Notice] ConjoinSpectra successful, Duration 0.00 seconds
[18]:
Workspace2D
Title: Test Workspace
Histograms: 2
Bins: 100
Data points
X axis: Time-of-flight / microsecond
Y axis: Counts
Distribution: False
Instrument: basic_rect (1990-Jan-01 to 1990-Jan-01)
Run start: 2010-Jan-01 00:00:00
Run end: 2010-Jan-01 01:00:00
Equivalent in scipp:
[19]:
sc.concat([a_scipp['data'], b_scipp['data']], 'spectra')['spectrum', 7]
[19]:
- spectra: 2
- tof: 100
- position(spectra)vector3m[0. 0.056 5. ], [0.008 0.056 5. ]
Values:
array([[0. , 0.056, 5. ], [0.008, 0.056, 5. ]]) - sample_position()vector3m[0. 0. 0.]
Values:
array([0., 0., 0.]) - source_position()vector3m[ 0. 0. -10.]
Values:
array([ 0., 0., -10.]) - spectrum(spectra)int328, 18
Values:
array([ 8, 18], dtype=int32) - tof(tof)float64µs100.0, 300.0, ..., 1.970e+04, 1.990e+04
Values:
array([ 100., 300., 500., 700., 900., 1100., 1300., 1500., 1700., 1900., 2100., 2300., 2500., 2700., 2900., 3100., 3300., 3500., 3700., 3900., 4100., 4300., 4500., 4700., 4900., 5100., 5300., 5500., 5700., 5900., 6100., 6300., 6500., 6700., 6900., 7100., 7300., 7500., 7700., 7900., 8100., 8300., 8500., 8700., 8900., 9100., 9300., 9500., 9700., 9900., 10100., 10300., 10500., 10700., 10900., 11100., 11300., 11500., 11700., 11900., 12100., 12300., 12500., 12700., 12900., 13100., 13300., 13500., 13700., 13900., 14100., 14300., 14500., 14700., 14900., 15100., 15300., 15500., 15700., 15900., 16100., 16300., 16500., 16700., 16900., 17100., 17300., 17500., 17700., 17900., 18100., 18300., 18500., 18700., 18900., 19100., 19300., 19500., 19700., 19900.])
- (spectra, tof)float64counts0.3, 0.3, ..., 0.3, 0.3σ = 0.548, 0.548, ..., 0.548, 0.548
Values:
array([[ 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 10.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3], [ 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 10.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3]])
Variances (σ²):
array([[ 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 10.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3], [ 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 10.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3]])
Or more efficiently
[20]:
sc.concat([a_scipp['data']['spectrum', 7], b_scipp['data']['spectrum', 7]], 'spectrum')
[20]:
- spectrum: 2
- tof: 100
- position(spectrum)vector3m[0. 0.056 5. ], [0.008 0.056 5. ]
Values:
array([[0. , 0.056, 5. ], [0.008, 0.056, 5. ]]) - sample_position()vector3m[0. 0. 0.]
Values:
array([0., 0., 0.]) - source_position()vector3m[ 0. 0. -10.]
Values:
array([ 0., 0., -10.]) - spectrum(spectrum)int328, 18
Values:
array([ 8, 18], dtype=int32) - tof(tof)float64µs100.0, 300.0, ..., 1.970e+04, 1.990e+04
Values:
array([ 100., 300., 500., 700., 900., 1100., 1300., 1500., 1700., 1900., 2100., 2300., 2500., 2700., 2900., 3100., 3300., 3500., 3700., 3900., 4100., 4300., 4500., 4700., 4900., 5100., 5300., 5500., 5700., 5900., 6100., 6300., 6500., 6700., 6900., 7100., 7300., 7500., 7700., 7900., 8100., 8300., 8500., 8700., 8900., 9100., 9300., 9500., 9700., 9900., 10100., 10300., 10500., 10700., 10900., 11100., 11300., 11500., 11700., 11900., 12100., 12300., 12500., 12700., 12900., 13100., 13300., 13500., 13700., 13900., 14100., 14300., 14500., 14700., 14900., 15100., 15300., 15500., 15700., 15900., 16100., 16300., 16500., 16700., 16900., 17100., 17300., 17500., 17700., 17900., 18100., 18300., 18500., 18700., 18900., 19100., 19300., 19500., 19700., 19900.])
- (spectrum, tof)float64counts0.3, 0.3, ..., 0.3, 0.3σ = 0.548, 0.548, ..., 0.548, 0.548
Values:
array([[ 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 10.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3], [ 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 10.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3]])
Variances (σ²):
array([[ 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 10.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3], [ 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 10.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3]])
GroupWorkspaces#
[21]:
mantid.GroupWorkspaces(InputWorkspaces='a_mantid, b_mantid', OutputWorkspace='data')
GroupWorkspaces-[Notice] GroupWorkspaces started
[21]:
WorkspaceGroup
-- a_mantid
-- b_mantid
GroupWorkspaces-[Notice] GroupWorkspaces successful, Duration 0.00 seconds
Equivalent in scipp:
[22]:
sc.Dataset(data={'data1': a_scipp['data'], 'data2': a_scipp['data'].copy()})
[22]:
- spectrum: 11
- tof: 100
- position(spectrum)vector3m[0. 0. 5.], [0. 0.008 5. ], ..., [0. 0.072 5. ], [0.008 0. 5. ]
Values:
array([[0. , 0. , 5. ], [0. , 0.008, 5. ], [0. , 0.016, 5. ], [0. , 0.024, 5. ], [0. , 0.032, 5. ], [0. , 0.04 , 5. ], [0. , 0.048, 5. ], [0. , 0.056, 5. ], [0. , 0.064, 5. ], [0. , 0.072, 5. ], [0.008, 0. , 5. ]]) - sample_position()vector3m[0. 0. 0.]
Values:
array([0., 0., 0.]) - source_position()vector3m[ 0. 0. -10.]
Values:
array([ 0., 0., -10.]) - spectrum(spectrum)int321, 2, ..., 10, 11
Values:
array([ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11], dtype=int32) - tof(tof)float64µs100.0, 300.0, ..., 1.970e+04, 1.990e+04
Values:
array([ 100., 300., 500., 700., 900., 1100., 1300., 1500., 1700., 1900., 2100., 2300., 2500., 2700., 2900., 3100., 3300., 3500., 3700., 3900., 4100., 4300., 4500., 4700., 4900., 5100., 5300., 5500., 5700., 5900., 6100., 6300., 6500., 6700., 6900., 7100., 7300., 7500., 7700., 7900., 8100., 8300., 8500., 8700., 8900., 9100., 9300., 9500., 9700., 9900., 10100., 10300., 10500., 10700., 10900., 11100., 11300., 11500., 11700., 11900., 12100., 12300., 12500., 12700., 12900., 13100., 13300., 13500., 13700., 13900., 14100., 14300., 14500., 14700., 14900., 15100., 15300., 15500., 15700., 15900., 16100., 16300., 16500., 16700., 16900., 17100., 17300., 17500., 17700., 17900., 18100., 18300., 18500., 18700., 18900., 19100., 19300., 19500., 19700., 19900.])
- data1(spectrum, tof)float64counts0.3, 0.3, ..., 0.3, 0.3σ = 0.548, 0.548, ..., 0.548, 0.548
Values:
array([[0.3, 0.3, 0.3, ..., 0.3, 0.3, 0.3], [0.3, 0.3, 0.3, ..., 0.3, 0.3, 0.3], [0.3, 0.3, 0.3, ..., 0.3, 0.3, 0.3], ..., [0.3, 0.3, 0.3, ..., 0.3, 0.3, 0.3], [0.3, 0.3, 0.3, ..., 0.3, 0.3, 0.3], [0.3, 0.3, 0.3, ..., 0.3, 0.3, 0.3]])
Variances (σ²):
array([[0.3, 0.3, 0.3, ..., 0.3, 0.3, 0.3], [0.3, 0.3, 0.3, ..., 0.3, 0.3, 0.3], [0.3, 0.3, 0.3, ..., 0.3, 0.3, 0.3], ..., [0.3, 0.3, 0.3, ..., 0.3, 0.3, 0.3], [0.3, 0.3, 0.3, ..., 0.3, 0.3, 0.3], [0.3, 0.3, 0.3, ..., 0.3, 0.3, 0.3]]) - data2(spectrum, tof)float64counts0.3, 0.3, ..., 0.3, 0.3σ = 0.548, 0.548, ..., 0.548, 0.548
Values:
array([[0.3, 0.3, 0.3, ..., 0.3, 0.3, 0.3], [0.3, 0.3, 0.3, ..., 0.3, 0.3, 0.3], [0.3, 0.3, 0.3, ..., 0.3, 0.3, 0.3], ..., [0.3, 0.3, 0.3, ..., 0.3, 0.3, 0.3], [0.3, 0.3, 0.3, ..., 0.3, 0.3, 0.3], [0.3, 0.3, 0.3, ..., 0.3, 0.3, 0.3]])
Variances (σ²):
array([[0.3, 0.3, 0.3, ..., 0.3, 0.3, 0.3], [0.3, 0.3, 0.3, ..., 0.3, 0.3, 0.3], [0.3, 0.3, 0.3, ..., 0.3, 0.3, 0.3], ..., [0.3, 0.3, 0.3, ..., 0.3, 0.3, 0.3], [0.3, 0.3, 0.3, ..., 0.3, 0.3, 0.3], [0.3, 0.3, 0.3, ..., 0.3, 0.3, 0.3]])
This requires aligned dimensions (matching coordinates) in all input arrays. It is a more powerful concept than that provided by WorkspaceGroups, but restricted. Slicing for example can be applied to the whole dataset and items are handled accordingly. For a loose collection of objects, more similar to the WorkspaceGroup concept, use scipp.DataGroup
or a Python dict
or list
for grouping unaligned data.
[23]:
sc.DataGroup({'data1': a_scipp, 'data2': a_scipp.copy()})
[23]:
- scippDataGroup(spectrum: 11, tof: 100)
- datascippDataArray(spectrum: 11, tof: 100)float64counts0.3, 0.3, ..., 0.3, 0.3
- samplescippVariable()PyObject<mantid.api._api.Sample object at 0x7f1e7e9e2a40>
- instrument_namestr()basic_rect
- run_titlescippVariable()string𝟙Test Workspace
- start_timescippVariable()string𝟙2010-01-01T00:00:00
- end_timescippVariable()string𝟙2010-01-01T01:00:00
- run_startscippVariable()string𝟙2010-01-01T00:00:00
- run_endscippVariable()string𝟙2010-01-01T01:00:00
- scippDataGroup(spectrum: 11, tof: 100)
- datascippDataArray(spectrum: 11, tof: 100)float64counts0.3, 0.3, ..., 0.3, 0.3
- samplescippVariable()PyObject<mantid.api._api.Sample object at 0x7f1e7e87d930>
- instrument_namestr()basic_rect
- run_titlescippVariable()string𝟙Test Workspace
- start_timescippVariable()string𝟙2010-01-01T00:00:00
- end_timescippVariable()string𝟙2010-01-01T01:00:00
- run_startscippVariable()string𝟙2010-01-01T00:00:00
- run_endscippVariable()string𝟙2010-01-01T01:00:00
Rebin Workspace2D
into Workspace2D
#
[24]:
mantid.Rebin(
InputWorkspace=input_point_data, OutputWorkspace='histo', Params='0,100,20000'
)
Rebin-[Notice] Rebin started
Rebin-[Notice] Rebin successful, Duration 0.00 seconds
[24]:
Workspace2D
Title: Test Workspace
Histograms: 200
Bins: 200
Data points
X axis: Time-of-flight / microsecond
Y axis: Counts
Distribution: False
Instrument: basic_rect (1990-Jan-01 to 1990-Jan-01)
Run start: 2010-Jan-01 00:00:00
Run end: 2010-Jan-01 01:00:00
Equivalent in scipp:
[25]:
edges = sc.arange(dim='tof', unit='us', start=0.0, stop=20000.0, step=100.0)
data = scn.from_mantid(input_bin_edges)['data']
sc.rebin(data, tof=edges)
[25]:
- spectrum: 200
- tof: 199
- position(spectrum)vector3m[0. 0. 5.], [0. 0.008 5. ], ..., [ 0.072 0.064 10. ], [ 0.072 0.072 10. ]
Values:
array([[0.0e+00, 0.0e+00, 5.0e+00], [0.0e+00, 8.0e-03, 5.0e+00], [0.0e+00, 1.6e-02, 5.0e+00], [0.0e+00, 2.4e-02, 5.0e+00], [0.0e+00, 3.2e-02, 5.0e+00], [0.0e+00, 4.0e-02, 5.0e+00], [0.0e+00, 4.8e-02, 5.0e+00], [0.0e+00, 5.6e-02, 5.0e+00], [0.0e+00, 6.4e-02, 5.0e+00], [0.0e+00, 7.2e-02, 5.0e+00], [8.0e-03, 0.0e+00, 5.0e+00], [8.0e-03, 8.0e-03, 5.0e+00], [8.0e-03, 1.6e-02, 5.0e+00], [8.0e-03, 2.4e-02, 5.0e+00], [8.0e-03, 3.2e-02, 5.0e+00], [8.0e-03, 4.0e-02, 5.0e+00], [8.0e-03, 4.8e-02, 5.0e+00], [8.0e-03, 5.6e-02, 5.0e+00], [8.0e-03, 6.4e-02, 5.0e+00], [8.0e-03, 7.2e-02, 5.0e+00], [1.6e-02, 0.0e+00, 5.0e+00], [1.6e-02, 8.0e-03, 5.0e+00], [1.6e-02, 1.6e-02, 5.0e+00], [1.6e-02, 2.4e-02, 5.0e+00], [1.6e-02, 3.2e-02, 5.0e+00], [1.6e-02, 4.0e-02, 5.0e+00], [1.6e-02, 4.8e-02, 5.0e+00], [1.6e-02, 5.6e-02, 5.0e+00], [1.6e-02, 6.4e-02, 5.0e+00], [1.6e-02, 7.2e-02, 5.0e+00], [2.4e-02, 0.0e+00, 5.0e+00], [2.4e-02, 8.0e-03, 5.0e+00], [2.4e-02, 1.6e-02, 5.0e+00], [2.4e-02, 2.4e-02, 5.0e+00], [2.4e-02, 3.2e-02, 5.0e+00], [2.4e-02, 4.0e-02, 5.0e+00], [2.4e-02, 4.8e-02, 5.0e+00], [2.4e-02, 5.6e-02, 5.0e+00], [2.4e-02, 6.4e-02, 5.0e+00], [2.4e-02, 7.2e-02, 5.0e+00], [3.2e-02, 0.0e+00, 5.0e+00], [3.2e-02, 8.0e-03, 5.0e+00], [3.2e-02, 1.6e-02, 5.0e+00], [3.2e-02, 2.4e-02, 5.0e+00], [3.2e-02, 3.2e-02, 5.0e+00], [3.2e-02, 4.0e-02, 5.0e+00], [3.2e-02, 4.8e-02, 5.0e+00], [3.2e-02, 5.6e-02, 5.0e+00], [3.2e-02, 6.4e-02, 5.0e+00], [3.2e-02, 7.2e-02, 5.0e+00], [4.0e-02, 0.0e+00, 5.0e+00], [4.0e-02, 8.0e-03, 5.0e+00], [4.0e-02, 1.6e-02, 5.0e+00], [4.0e-02, 2.4e-02, 5.0e+00], [4.0e-02, 3.2e-02, 5.0e+00], [4.0e-02, 4.0e-02, 5.0e+00], [4.0e-02, 4.8e-02, 5.0e+00], [4.0e-02, 5.6e-02, 5.0e+00], [4.0e-02, 6.4e-02, 5.0e+00], [4.0e-02, 7.2e-02, 5.0e+00], [4.8e-02, 0.0e+00, 5.0e+00], [4.8e-02, 8.0e-03, 5.0e+00], [4.8e-02, 1.6e-02, 5.0e+00], [4.8e-02, 2.4e-02, 5.0e+00], [4.8e-02, 3.2e-02, 5.0e+00], [4.8e-02, 4.0e-02, 5.0e+00], [4.8e-02, 4.8e-02, 5.0e+00], [4.8e-02, 5.6e-02, 5.0e+00], [4.8e-02, 6.4e-02, 5.0e+00], [4.8e-02, 7.2e-02, 5.0e+00], [5.6e-02, 0.0e+00, 5.0e+00], [5.6e-02, 8.0e-03, 5.0e+00], [5.6e-02, 1.6e-02, 5.0e+00], [5.6e-02, 2.4e-02, 5.0e+00], [5.6e-02, 3.2e-02, 5.0e+00], [5.6e-02, 4.0e-02, 5.0e+00], [5.6e-02, 4.8e-02, 5.0e+00], [5.6e-02, 5.6e-02, 5.0e+00], [5.6e-02, 6.4e-02, 5.0e+00], [5.6e-02, 7.2e-02, 5.0e+00], [6.4e-02, 0.0e+00, 5.0e+00], [6.4e-02, 8.0e-03, 5.0e+00], [6.4e-02, 1.6e-02, 5.0e+00], [6.4e-02, 2.4e-02, 5.0e+00], [6.4e-02, 3.2e-02, 5.0e+00], [6.4e-02, 4.0e-02, 5.0e+00], [6.4e-02, 4.8e-02, 5.0e+00], [6.4e-02, 5.6e-02, 5.0e+00], [6.4e-02, 6.4e-02, 5.0e+00], [6.4e-02, 7.2e-02, 5.0e+00], [7.2e-02, 0.0e+00, 5.0e+00], [7.2e-02, 8.0e-03, 5.0e+00], [7.2e-02, 1.6e-02, 5.0e+00], [7.2e-02, 2.4e-02, 5.0e+00], [7.2e-02, 3.2e-02, 5.0e+00], [7.2e-02, 4.0e-02, 5.0e+00], [7.2e-02, 4.8e-02, 5.0e+00], [7.2e-02, 5.6e-02, 5.0e+00], [7.2e-02, 6.4e-02, 5.0e+00], [7.2e-02, 7.2e-02, 5.0e+00], [0.0e+00, 0.0e+00, 1.0e+01], [0.0e+00, 8.0e-03, 1.0e+01], [0.0e+00, 1.6e-02, 1.0e+01], [0.0e+00, 2.4e-02, 1.0e+01], [0.0e+00, 3.2e-02, 1.0e+01], [0.0e+00, 4.0e-02, 1.0e+01], [0.0e+00, 4.8e-02, 1.0e+01], [0.0e+00, 5.6e-02, 1.0e+01], [0.0e+00, 6.4e-02, 1.0e+01], [0.0e+00, 7.2e-02, 1.0e+01], [8.0e-03, 0.0e+00, 1.0e+01], [8.0e-03, 8.0e-03, 1.0e+01], [8.0e-03, 1.6e-02, 1.0e+01], [8.0e-03, 2.4e-02, 1.0e+01], [8.0e-03, 3.2e-02, 1.0e+01], [8.0e-03, 4.0e-02, 1.0e+01], [8.0e-03, 4.8e-02, 1.0e+01], [8.0e-03, 5.6e-02, 1.0e+01], [8.0e-03, 6.4e-02, 1.0e+01], [8.0e-03, 7.2e-02, 1.0e+01], [1.6e-02, 0.0e+00, 1.0e+01], [1.6e-02, 8.0e-03, 1.0e+01], [1.6e-02, 1.6e-02, 1.0e+01], [1.6e-02, 2.4e-02, 1.0e+01], [1.6e-02, 3.2e-02, 1.0e+01], [1.6e-02, 4.0e-02, 1.0e+01], [1.6e-02, 4.8e-02, 1.0e+01], [1.6e-02, 5.6e-02, 1.0e+01], [1.6e-02, 6.4e-02, 1.0e+01], [1.6e-02, 7.2e-02, 1.0e+01], [2.4e-02, 0.0e+00, 1.0e+01], [2.4e-02, 8.0e-03, 1.0e+01], [2.4e-02, 1.6e-02, 1.0e+01], [2.4e-02, 2.4e-02, 1.0e+01], [2.4e-02, 3.2e-02, 1.0e+01], [2.4e-02, 4.0e-02, 1.0e+01], [2.4e-02, 4.8e-02, 1.0e+01], [2.4e-02, 5.6e-02, 1.0e+01], [2.4e-02, 6.4e-02, 1.0e+01], [2.4e-02, 7.2e-02, 1.0e+01], [3.2e-02, 0.0e+00, 1.0e+01], [3.2e-02, 8.0e-03, 1.0e+01], [3.2e-02, 1.6e-02, 1.0e+01], [3.2e-02, 2.4e-02, 1.0e+01], [3.2e-02, 3.2e-02, 1.0e+01], [3.2e-02, 4.0e-02, 1.0e+01], [3.2e-02, 4.8e-02, 1.0e+01], [3.2e-02, 5.6e-02, 1.0e+01], [3.2e-02, 6.4e-02, 1.0e+01], [3.2e-02, 7.2e-02, 1.0e+01], [4.0e-02, 0.0e+00, 1.0e+01], [4.0e-02, 8.0e-03, 1.0e+01], [4.0e-02, 1.6e-02, 1.0e+01], [4.0e-02, 2.4e-02, 1.0e+01], [4.0e-02, 3.2e-02, 1.0e+01], [4.0e-02, 4.0e-02, 1.0e+01], [4.0e-02, 4.8e-02, 1.0e+01], [4.0e-02, 5.6e-02, 1.0e+01], [4.0e-02, 6.4e-02, 1.0e+01], [4.0e-02, 7.2e-02, 1.0e+01], [4.8e-02, 0.0e+00, 1.0e+01], [4.8e-02, 8.0e-03, 1.0e+01], [4.8e-02, 1.6e-02, 1.0e+01], [4.8e-02, 2.4e-02, 1.0e+01], [4.8e-02, 3.2e-02, 1.0e+01], [4.8e-02, 4.0e-02, 1.0e+01], [4.8e-02, 4.8e-02, 1.0e+01], [4.8e-02, 5.6e-02, 1.0e+01], [4.8e-02, 6.4e-02, 1.0e+01], [4.8e-02, 7.2e-02, 1.0e+01], [5.6e-02, 0.0e+00, 1.0e+01], [5.6e-02, 8.0e-03, 1.0e+01], [5.6e-02, 1.6e-02, 1.0e+01], [5.6e-02, 2.4e-02, 1.0e+01], [5.6e-02, 3.2e-02, 1.0e+01], [5.6e-02, 4.0e-02, 1.0e+01], [5.6e-02, 4.8e-02, 1.0e+01], [5.6e-02, 5.6e-02, 1.0e+01], [5.6e-02, 6.4e-02, 1.0e+01], [5.6e-02, 7.2e-02, 1.0e+01], [6.4e-02, 0.0e+00, 1.0e+01], [6.4e-02, 8.0e-03, 1.0e+01], [6.4e-02, 1.6e-02, 1.0e+01], [6.4e-02, 2.4e-02, 1.0e+01], [6.4e-02, 3.2e-02, 1.0e+01], [6.4e-02, 4.0e-02, 1.0e+01], [6.4e-02, 4.8e-02, 1.0e+01], [6.4e-02, 5.6e-02, 1.0e+01], [6.4e-02, 6.4e-02, 1.0e+01], [6.4e-02, 7.2e-02, 1.0e+01], [7.2e-02, 0.0e+00, 1.0e+01], [7.2e-02, 8.0e-03, 1.0e+01], [7.2e-02, 1.6e-02, 1.0e+01], [7.2e-02, 2.4e-02, 1.0e+01], [7.2e-02, 3.2e-02, 1.0e+01], [7.2e-02, 4.0e-02, 1.0e+01], [7.2e-02, 4.8e-02, 1.0e+01], [7.2e-02, 5.6e-02, 1.0e+01], [7.2e-02, 6.4e-02, 1.0e+01], [7.2e-02, 7.2e-02, 1.0e+01]]) - sample_position()vector3m[0. 0. 0.]
Values:
array([0., 0., 0.]) - source_position()vector3m[ 0. 0. -10.]
Values:
array([ 0., 0., -10.]) - spectrum(spectrum)int321, 2, ..., 199, 200
Values:
array([ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200], dtype=int32) - tof(tof [bin-edge])float64µs0.0, 100.0, ..., 1.980e+04, 1.990e+04
Values:
array([ 0., 100., 200., 300., 400., 500., 600., 700., 800., 900., 1000., 1100., 1200., 1300., 1400., 1500., 1600., 1700., 1800., 1900., 2000., 2100., 2200., 2300., 2400., 2500., 2600., 2700., 2800., 2900., 3000., 3100., 3200., 3300., 3400., 3500., 3600., 3700., 3800., 3900., 4000., 4100., 4200., 4300., 4400., 4500., 4600., 4700., 4800., 4900., 5000., 5100., 5200., 5300., 5400., 5500., 5600., 5700., 5800., 5900., 6000., 6100., 6200., 6300., 6400., 6500., 6600., 6700., 6800., 6900., 7000., 7100., 7200., 7300., 7400., 7500., 7600., 7700., 7800., 7900., 8000., 8100., 8200., 8300., 8400., 8500., 8600., 8700., 8800., 8900., 9000., 9100., 9200., 9300., 9400., 9500., 9600., 9700., 9800., 9900., 10000., 10100., 10200., 10300., 10400., 10500., 10600., 10700., 10800., 10900., 11000., 11100., 11200., 11300., 11400., 11500., 11600., 11700., 11800., 11900., 12000., 12100., 12200., 12300., 12400., 12500., 12600., 12700., 12800., 12900., 13000., 13100., 13200., 13300., 13400., 13500., 13600., 13700., 13800., 13900., 14000., 14100., 14200., 14300., 14400., 14500., 14600., 14700., 14800., 14900., 15000., 15100., 15200., 15300., 15400., 15500., 15600., 15700., 15800., 15900., 16000., 16100., 16200., 16300., 16400., 16500., 16600., 16700., 16800., 16900., 17000., 17100., 17200., 17300., 17400., 17500., 17600., 17700., 17800., 17900., 18000., 18100., 18200., 18300., 18400., 18500., 18600., 18700., 18800., 18900., 19000., 19100., 19200., 19300., 19400., 19500., 19600., 19700., 19800., 19900.])
- (spectrum, tof)float64counts0.15, 0.15, ..., 0.15, 0.15σ = 0.387, 0.387, ..., 0.387, 0.387
Values:
array([[0.15, 0.15, 0.15, ..., 0.15, 0.15, 0.15], [0.15, 0.15, 0.15, ..., 0.15, 0.15, 0.15], [0.15, 0.15, 0.15, ..., 0.15, 0.15, 0.15], ..., [0.15, 0.15, 0.15, ..., 0.15, 0.15, 0.15], [0.15, 0.15, 0.15, ..., 0.15, 0.15, 0.15], [0.15, 0.15, 0.15, ..., 0.15, 0.15, 0.15]])
Variances (σ²):
array([[0.15, 0.15, 0.15, ..., 0.15, 0.15, 0.15], [0.15, 0.15, 0.15, ..., 0.15, 0.15, 0.15], [0.15, 0.15, 0.15, ..., 0.15, 0.15, 0.15], ..., [0.15, 0.15, 0.15, ..., 0.15, 0.15, 0.15], [0.15, 0.15, 0.15, ..., 0.15, 0.15, 0.15], [0.15, 0.15, 0.15, ..., 0.15, 0.15, 0.15]])
Rebin EventWorkspace
preserving events#
[26]:
event_workspace = mantid.CreateSampleWorkspace(WorkspaceType='Event')
mantid.Rebin(
InputWorkspace=event_workspace,
OutputWorkspace='rebinned_events',
Params='0,100,20000',
PreserveEvents=True,
)
CreateSampleWorkspace-[Notice] CreateSampleWorkspace started
CreateSampleWorkspace-[Notice] CreateSampleWorkspace successful, Duration 0.01 seconds
Rebin-[Notice] Rebin started
[26]:
EventWorkspace
Title: Test Workspace
Histograms: 200
Bins: 200
Histogram
X axis: Time-of-flight / microsecond
Y axis: Counts
Distribution: False
Instrument: basic_rect (1990-Jan-01 to 1990-Jan-01)
Run start: 2010-Jan-01 00:00:00
Run end: 2010-Jan-01 01:00:00
Events: 190000
Rebin-[Notice] Rebin successful, Duration 0.00 seconds
Equivalent in scipp:
[27]:
events = scn.from_mantid(event_workspace)['data']
tof_edges = sc.arange(dim='tof', unit='us', start=0.0, stop=20000.0, step=100.0)
events.bin(tof=tof_edges)
[27]:
- spectrum: 200
- tof: 199
- position(spectrum)vector3m[0. 0. 5.], [0. 0.008 5. ], ..., [ 0.072 0.064 10. ], [ 0.072 0.072 10. ]
Values:
array([[0.0e+00, 0.0e+00, 5.0e+00], [0.0e+00, 8.0e-03, 5.0e+00], [0.0e+00, 1.6e-02, 5.0e+00], [0.0e+00, 2.4e-02, 5.0e+00], [0.0e+00, 3.2e-02, 5.0e+00], [0.0e+00, 4.0e-02, 5.0e+00], [0.0e+00, 4.8e-02, 5.0e+00], [0.0e+00, 5.6e-02, 5.0e+00], [0.0e+00, 6.4e-02, 5.0e+00], [0.0e+00, 7.2e-02, 5.0e+00], [8.0e-03, 0.0e+00, 5.0e+00], [8.0e-03, 8.0e-03, 5.0e+00], [8.0e-03, 1.6e-02, 5.0e+00], [8.0e-03, 2.4e-02, 5.0e+00], [8.0e-03, 3.2e-02, 5.0e+00], [8.0e-03, 4.0e-02, 5.0e+00], [8.0e-03, 4.8e-02, 5.0e+00], [8.0e-03, 5.6e-02, 5.0e+00], [8.0e-03, 6.4e-02, 5.0e+00], [8.0e-03, 7.2e-02, 5.0e+00], [1.6e-02, 0.0e+00, 5.0e+00], [1.6e-02, 8.0e-03, 5.0e+00], [1.6e-02, 1.6e-02, 5.0e+00], [1.6e-02, 2.4e-02, 5.0e+00], [1.6e-02, 3.2e-02, 5.0e+00], [1.6e-02, 4.0e-02, 5.0e+00], [1.6e-02, 4.8e-02, 5.0e+00], [1.6e-02, 5.6e-02, 5.0e+00], [1.6e-02, 6.4e-02, 5.0e+00], [1.6e-02, 7.2e-02, 5.0e+00], [2.4e-02, 0.0e+00, 5.0e+00], [2.4e-02, 8.0e-03, 5.0e+00], [2.4e-02, 1.6e-02, 5.0e+00], [2.4e-02, 2.4e-02, 5.0e+00], [2.4e-02, 3.2e-02, 5.0e+00], [2.4e-02, 4.0e-02, 5.0e+00], [2.4e-02, 4.8e-02, 5.0e+00], [2.4e-02, 5.6e-02, 5.0e+00], [2.4e-02, 6.4e-02, 5.0e+00], [2.4e-02, 7.2e-02, 5.0e+00], [3.2e-02, 0.0e+00, 5.0e+00], [3.2e-02, 8.0e-03, 5.0e+00], [3.2e-02, 1.6e-02, 5.0e+00], [3.2e-02, 2.4e-02, 5.0e+00], [3.2e-02, 3.2e-02, 5.0e+00], [3.2e-02, 4.0e-02, 5.0e+00], [3.2e-02, 4.8e-02, 5.0e+00], [3.2e-02, 5.6e-02, 5.0e+00], [3.2e-02, 6.4e-02, 5.0e+00], [3.2e-02, 7.2e-02, 5.0e+00], [4.0e-02, 0.0e+00, 5.0e+00], [4.0e-02, 8.0e-03, 5.0e+00], [4.0e-02, 1.6e-02, 5.0e+00], [4.0e-02, 2.4e-02, 5.0e+00], [4.0e-02, 3.2e-02, 5.0e+00], [4.0e-02, 4.0e-02, 5.0e+00], [4.0e-02, 4.8e-02, 5.0e+00], [4.0e-02, 5.6e-02, 5.0e+00], [4.0e-02, 6.4e-02, 5.0e+00], [4.0e-02, 7.2e-02, 5.0e+00], [4.8e-02, 0.0e+00, 5.0e+00], [4.8e-02, 8.0e-03, 5.0e+00], [4.8e-02, 1.6e-02, 5.0e+00], [4.8e-02, 2.4e-02, 5.0e+00], [4.8e-02, 3.2e-02, 5.0e+00], [4.8e-02, 4.0e-02, 5.0e+00], [4.8e-02, 4.8e-02, 5.0e+00], [4.8e-02, 5.6e-02, 5.0e+00], [4.8e-02, 6.4e-02, 5.0e+00], [4.8e-02, 7.2e-02, 5.0e+00], [5.6e-02, 0.0e+00, 5.0e+00], [5.6e-02, 8.0e-03, 5.0e+00], [5.6e-02, 1.6e-02, 5.0e+00], [5.6e-02, 2.4e-02, 5.0e+00], [5.6e-02, 3.2e-02, 5.0e+00], [5.6e-02, 4.0e-02, 5.0e+00], [5.6e-02, 4.8e-02, 5.0e+00], [5.6e-02, 5.6e-02, 5.0e+00], [5.6e-02, 6.4e-02, 5.0e+00], [5.6e-02, 7.2e-02, 5.0e+00], [6.4e-02, 0.0e+00, 5.0e+00], [6.4e-02, 8.0e-03, 5.0e+00], [6.4e-02, 1.6e-02, 5.0e+00], [6.4e-02, 2.4e-02, 5.0e+00], [6.4e-02, 3.2e-02, 5.0e+00], [6.4e-02, 4.0e-02, 5.0e+00], [6.4e-02, 4.8e-02, 5.0e+00], [6.4e-02, 5.6e-02, 5.0e+00], [6.4e-02, 6.4e-02, 5.0e+00], [6.4e-02, 7.2e-02, 5.0e+00], [7.2e-02, 0.0e+00, 5.0e+00], [7.2e-02, 8.0e-03, 5.0e+00], [7.2e-02, 1.6e-02, 5.0e+00], [7.2e-02, 2.4e-02, 5.0e+00], [7.2e-02, 3.2e-02, 5.0e+00], [7.2e-02, 4.0e-02, 5.0e+00], [7.2e-02, 4.8e-02, 5.0e+00], [7.2e-02, 5.6e-02, 5.0e+00], [7.2e-02, 6.4e-02, 5.0e+00], [7.2e-02, 7.2e-02, 5.0e+00], [0.0e+00, 0.0e+00, 1.0e+01], [0.0e+00, 8.0e-03, 1.0e+01], [0.0e+00, 1.6e-02, 1.0e+01], [0.0e+00, 2.4e-02, 1.0e+01], [0.0e+00, 3.2e-02, 1.0e+01], [0.0e+00, 4.0e-02, 1.0e+01], [0.0e+00, 4.8e-02, 1.0e+01], [0.0e+00, 5.6e-02, 1.0e+01], [0.0e+00, 6.4e-02, 1.0e+01], [0.0e+00, 7.2e-02, 1.0e+01], [8.0e-03, 0.0e+00, 1.0e+01], [8.0e-03, 8.0e-03, 1.0e+01], [8.0e-03, 1.6e-02, 1.0e+01], [8.0e-03, 2.4e-02, 1.0e+01], [8.0e-03, 3.2e-02, 1.0e+01], [8.0e-03, 4.0e-02, 1.0e+01], [8.0e-03, 4.8e-02, 1.0e+01], [8.0e-03, 5.6e-02, 1.0e+01], [8.0e-03, 6.4e-02, 1.0e+01], [8.0e-03, 7.2e-02, 1.0e+01], [1.6e-02, 0.0e+00, 1.0e+01], [1.6e-02, 8.0e-03, 1.0e+01], [1.6e-02, 1.6e-02, 1.0e+01], [1.6e-02, 2.4e-02, 1.0e+01], [1.6e-02, 3.2e-02, 1.0e+01], [1.6e-02, 4.0e-02, 1.0e+01], [1.6e-02, 4.8e-02, 1.0e+01], [1.6e-02, 5.6e-02, 1.0e+01], [1.6e-02, 6.4e-02, 1.0e+01], [1.6e-02, 7.2e-02, 1.0e+01], [2.4e-02, 0.0e+00, 1.0e+01], [2.4e-02, 8.0e-03, 1.0e+01], [2.4e-02, 1.6e-02, 1.0e+01], [2.4e-02, 2.4e-02, 1.0e+01], [2.4e-02, 3.2e-02, 1.0e+01], [2.4e-02, 4.0e-02, 1.0e+01], [2.4e-02, 4.8e-02, 1.0e+01], [2.4e-02, 5.6e-02, 1.0e+01], [2.4e-02, 6.4e-02, 1.0e+01], [2.4e-02, 7.2e-02, 1.0e+01], [3.2e-02, 0.0e+00, 1.0e+01], [3.2e-02, 8.0e-03, 1.0e+01], [3.2e-02, 1.6e-02, 1.0e+01], [3.2e-02, 2.4e-02, 1.0e+01], [3.2e-02, 3.2e-02, 1.0e+01], [3.2e-02, 4.0e-02, 1.0e+01], [3.2e-02, 4.8e-02, 1.0e+01], [3.2e-02, 5.6e-02, 1.0e+01], [3.2e-02, 6.4e-02, 1.0e+01], [3.2e-02, 7.2e-02, 1.0e+01], [4.0e-02, 0.0e+00, 1.0e+01], [4.0e-02, 8.0e-03, 1.0e+01], [4.0e-02, 1.6e-02, 1.0e+01], [4.0e-02, 2.4e-02, 1.0e+01], [4.0e-02, 3.2e-02, 1.0e+01], [4.0e-02, 4.0e-02, 1.0e+01], [4.0e-02, 4.8e-02, 1.0e+01], [4.0e-02, 5.6e-02, 1.0e+01], [4.0e-02, 6.4e-02, 1.0e+01], [4.0e-02, 7.2e-02, 1.0e+01], [4.8e-02, 0.0e+00, 1.0e+01], [4.8e-02, 8.0e-03, 1.0e+01], [4.8e-02, 1.6e-02, 1.0e+01], [4.8e-02, 2.4e-02, 1.0e+01], [4.8e-02, 3.2e-02, 1.0e+01], [4.8e-02, 4.0e-02, 1.0e+01], [4.8e-02, 4.8e-02, 1.0e+01], [4.8e-02, 5.6e-02, 1.0e+01], [4.8e-02, 6.4e-02, 1.0e+01], [4.8e-02, 7.2e-02, 1.0e+01], [5.6e-02, 0.0e+00, 1.0e+01], [5.6e-02, 8.0e-03, 1.0e+01], [5.6e-02, 1.6e-02, 1.0e+01], [5.6e-02, 2.4e-02, 1.0e+01], [5.6e-02, 3.2e-02, 1.0e+01], [5.6e-02, 4.0e-02, 1.0e+01], [5.6e-02, 4.8e-02, 1.0e+01], [5.6e-02, 5.6e-02, 1.0e+01], [5.6e-02, 6.4e-02, 1.0e+01], [5.6e-02, 7.2e-02, 1.0e+01], [6.4e-02, 0.0e+00, 1.0e+01], [6.4e-02, 8.0e-03, 1.0e+01], [6.4e-02, 1.6e-02, 1.0e+01], [6.4e-02, 2.4e-02, 1.0e+01], [6.4e-02, 3.2e-02, 1.0e+01], [6.4e-02, 4.0e-02, 1.0e+01], [6.4e-02, 4.8e-02, 1.0e+01], [6.4e-02, 5.6e-02, 1.0e+01], [6.4e-02, 6.4e-02, 1.0e+01], [6.4e-02, 7.2e-02, 1.0e+01], [7.2e-02, 0.0e+00, 1.0e+01], [7.2e-02, 8.0e-03, 1.0e+01], [7.2e-02, 1.6e-02, 1.0e+01], [7.2e-02, 2.4e-02, 1.0e+01], [7.2e-02, 3.2e-02, 1.0e+01], [7.2e-02, 4.0e-02, 1.0e+01], [7.2e-02, 4.8e-02, 1.0e+01], [7.2e-02, 5.6e-02, 1.0e+01], [7.2e-02, 6.4e-02, 1.0e+01], [7.2e-02, 7.2e-02, 1.0e+01]]) - sample_position()vector3m[0. 0. 0.]
Values:
array([0., 0., 0.]) - source_position()vector3m[ 0. 0. -10.]
Values:
array([ 0., 0., -10.]) - spectrum(spectrum)int321, 2, ..., 199, 200
Values:
array([ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200], dtype=int32) - tof(tof [bin-edge])float64µs0.0, 100.0, ..., 1.980e+04, 1.990e+04
Values:
array([ 0., 100., 200., 300., 400., 500., 600., 700., 800., 900., 1000., 1100., 1200., 1300., 1400., 1500., 1600., 1700., 1800., 1900., 2000., 2100., 2200., 2300., 2400., 2500., 2600., 2700., 2800., 2900., 3000., 3100., 3200., 3300., 3400., 3500., 3600., 3700., 3800., 3900., 4000., 4100., 4200., 4300., 4400., 4500., 4600., 4700., 4800., 4900., 5000., 5100., 5200., 5300., 5400., 5500., 5600., 5700., 5800., 5900., 6000., 6100., 6200., 6300., 6400., 6500., 6600., 6700., 6800., 6900., 7000., 7100., 7200., 7300., 7400., 7500., 7600., 7700., 7800., 7900., 8000., 8100., 8200., 8300., 8400., 8500., 8600., 8700., 8800., 8900., 9000., 9100., 9200., 9300., 9400., 9500., 9600., 9700., 9800., 9900., 10000., 10100., 10200., 10300., 10400., 10500., 10600., 10700., 10800., 10900., 11000., 11100., 11200., 11300., 11400., 11500., 11600., 11700., 11800., 11900., 12000., 12100., 12200., 12300., 12400., 12500., 12600., 12700., 12800., 12900., 13000., 13100., 13200., 13300., 13400., 13500., 13600., 13700., 13800., 13900., 14000., 14100., 14200., 14300., 14400., 14500., 14600., 14700., 14800., 14900., 15000., 15100., 15200., 15300., 15400., 15500., 15600., 15700., 15800., 15900., 16000., 16100., 16200., 16300., 16400., 16500., 16600., 16700., 16800., 16900., 17000., 17100., 17200., 17300., 17400., 17500., 17600., 17700., 17800., 17900., 18000., 18100., 18200., 18300., 18400., 18500., 18600., 18700., 18800., 18900., 19000., 19100., 19200., 19300., 19400., 19500., 19600., 19700., 19800., 19900.])
- (spectrum, tof)DataArrayViewbinned data [len=4, len=3, ..., len=4, len=3]
dim='event', content=DataArray( dims=(event: 189287), data=float32[counts], coords={'tof':float64[µs], 'pulse_time':datetime64[ns]})
Or providing a bin size:
[28]:
events = scn.from_mantid(event_workspace)['data']
events.bin(tof=100.0 * sc.Unit('us'))
[28]:
- spectrum: 200
- tof: 200
- position(spectrum)vector3m[0. 0. 5.], [0. 0.008 5. ], ..., [ 0.072 0.064 10. ], [ 0.072 0.072 10. ]
Values:
array([[0.0e+00, 0.0e+00, 5.0e+00], [0.0e+00, 8.0e-03, 5.0e+00], [0.0e+00, 1.6e-02, 5.0e+00], [0.0e+00, 2.4e-02, 5.0e+00], [0.0e+00, 3.2e-02, 5.0e+00], [0.0e+00, 4.0e-02, 5.0e+00], [0.0e+00, 4.8e-02, 5.0e+00], [0.0e+00, 5.6e-02, 5.0e+00], [0.0e+00, 6.4e-02, 5.0e+00], [0.0e+00, 7.2e-02, 5.0e+00], [8.0e-03, 0.0e+00, 5.0e+00], [8.0e-03, 8.0e-03, 5.0e+00], [8.0e-03, 1.6e-02, 5.0e+00], [8.0e-03, 2.4e-02, 5.0e+00], [8.0e-03, 3.2e-02, 5.0e+00], [8.0e-03, 4.0e-02, 5.0e+00], [8.0e-03, 4.8e-02, 5.0e+00], [8.0e-03, 5.6e-02, 5.0e+00], [8.0e-03, 6.4e-02, 5.0e+00], [8.0e-03, 7.2e-02, 5.0e+00], [1.6e-02, 0.0e+00, 5.0e+00], [1.6e-02, 8.0e-03, 5.0e+00], [1.6e-02, 1.6e-02, 5.0e+00], [1.6e-02, 2.4e-02, 5.0e+00], [1.6e-02, 3.2e-02, 5.0e+00], [1.6e-02, 4.0e-02, 5.0e+00], [1.6e-02, 4.8e-02, 5.0e+00], [1.6e-02, 5.6e-02, 5.0e+00], [1.6e-02, 6.4e-02, 5.0e+00], [1.6e-02, 7.2e-02, 5.0e+00], [2.4e-02, 0.0e+00, 5.0e+00], [2.4e-02, 8.0e-03, 5.0e+00], [2.4e-02, 1.6e-02, 5.0e+00], [2.4e-02, 2.4e-02, 5.0e+00], [2.4e-02, 3.2e-02, 5.0e+00], [2.4e-02, 4.0e-02, 5.0e+00], [2.4e-02, 4.8e-02, 5.0e+00], [2.4e-02, 5.6e-02, 5.0e+00], [2.4e-02, 6.4e-02, 5.0e+00], [2.4e-02, 7.2e-02, 5.0e+00], [3.2e-02, 0.0e+00, 5.0e+00], [3.2e-02, 8.0e-03, 5.0e+00], [3.2e-02, 1.6e-02, 5.0e+00], [3.2e-02, 2.4e-02, 5.0e+00], [3.2e-02, 3.2e-02, 5.0e+00], [3.2e-02, 4.0e-02, 5.0e+00], [3.2e-02, 4.8e-02, 5.0e+00], [3.2e-02, 5.6e-02, 5.0e+00], [3.2e-02, 6.4e-02, 5.0e+00], [3.2e-02, 7.2e-02, 5.0e+00], [4.0e-02, 0.0e+00, 5.0e+00], [4.0e-02, 8.0e-03, 5.0e+00], [4.0e-02, 1.6e-02, 5.0e+00], [4.0e-02, 2.4e-02, 5.0e+00], [4.0e-02, 3.2e-02, 5.0e+00], [4.0e-02, 4.0e-02, 5.0e+00], [4.0e-02, 4.8e-02, 5.0e+00], [4.0e-02, 5.6e-02, 5.0e+00], [4.0e-02, 6.4e-02, 5.0e+00], [4.0e-02, 7.2e-02, 5.0e+00], [4.8e-02, 0.0e+00, 5.0e+00], [4.8e-02, 8.0e-03, 5.0e+00], [4.8e-02, 1.6e-02, 5.0e+00], [4.8e-02, 2.4e-02, 5.0e+00], [4.8e-02, 3.2e-02, 5.0e+00], [4.8e-02, 4.0e-02, 5.0e+00], [4.8e-02, 4.8e-02, 5.0e+00], [4.8e-02, 5.6e-02, 5.0e+00], [4.8e-02, 6.4e-02, 5.0e+00], [4.8e-02, 7.2e-02, 5.0e+00], [5.6e-02, 0.0e+00, 5.0e+00], [5.6e-02, 8.0e-03, 5.0e+00], [5.6e-02, 1.6e-02, 5.0e+00], [5.6e-02, 2.4e-02, 5.0e+00], [5.6e-02, 3.2e-02, 5.0e+00], [5.6e-02, 4.0e-02, 5.0e+00], [5.6e-02, 4.8e-02, 5.0e+00], [5.6e-02, 5.6e-02, 5.0e+00], [5.6e-02, 6.4e-02, 5.0e+00], [5.6e-02, 7.2e-02, 5.0e+00], [6.4e-02, 0.0e+00, 5.0e+00], [6.4e-02, 8.0e-03, 5.0e+00], [6.4e-02, 1.6e-02, 5.0e+00], [6.4e-02, 2.4e-02, 5.0e+00], [6.4e-02, 3.2e-02, 5.0e+00], [6.4e-02, 4.0e-02, 5.0e+00], [6.4e-02, 4.8e-02, 5.0e+00], [6.4e-02, 5.6e-02, 5.0e+00], [6.4e-02, 6.4e-02, 5.0e+00], [6.4e-02, 7.2e-02, 5.0e+00], [7.2e-02, 0.0e+00, 5.0e+00], [7.2e-02, 8.0e-03, 5.0e+00], [7.2e-02, 1.6e-02, 5.0e+00], [7.2e-02, 2.4e-02, 5.0e+00], [7.2e-02, 3.2e-02, 5.0e+00], [7.2e-02, 4.0e-02, 5.0e+00], [7.2e-02, 4.8e-02, 5.0e+00], [7.2e-02, 5.6e-02, 5.0e+00], [7.2e-02, 6.4e-02, 5.0e+00], [7.2e-02, 7.2e-02, 5.0e+00], [0.0e+00, 0.0e+00, 1.0e+01], [0.0e+00, 8.0e-03, 1.0e+01], [0.0e+00, 1.6e-02, 1.0e+01], [0.0e+00, 2.4e-02, 1.0e+01], [0.0e+00, 3.2e-02, 1.0e+01], [0.0e+00, 4.0e-02, 1.0e+01], [0.0e+00, 4.8e-02, 1.0e+01], [0.0e+00, 5.6e-02, 1.0e+01], [0.0e+00, 6.4e-02, 1.0e+01], [0.0e+00, 7.2e-02, 1.0e+01], [8.0e-03, 0.0e+00, 1.0e+01], [8.0e-03, 8.0e-03, 1.0e+01], [8.0e-03, 1.6e-02, 1.0e+01], [8.0e-03, 2.4e-02, 1.0e+01], [8.0e-03, 3.2e-02, 1.0e+01], [8.0e-03, 4.0e-02, 1.0e+01], [8.0e-03, 4.8e-02, 1.0e+01], [8.0e-03, 5.6e-02, 1.0e+01], [8.0e-03, 6.4e-02, 1.0e+01], [8.0e-03, 7.2e-02, 1.0e+01], [1.6e-02, 0.0e+00, 1.0e+01], [1.6e-02, 8.0e-03, 1.0e+01], [1.6e-02, 1.6e-02, 1.0e+01], [1.6e-02, 2.4e-02, 1.0e+01], [1.6e-02, 3.2e-02, 1.0e+01], [1.6e-02, 4.0e-02, 1.0e+01], [1.6e-02, 4.8e-02, 1.0e+01], [1.6e-02, 5.6e-02, 1.0e+01], [1.6e-02, 6.4e-02, 1.0e+01], [1.6e-02, 7.2e-02, 1.0e+01], [2.4e-02, 0.0e+00, 1.0e+01], [2.4e-02, 8.0e-03, 1.0e+01], [2.4e-02, 1.6e-02, 1.0e+01], [2.4e-02, 2.4e-02, 1.0e+01], [2.4e-02, 3.2e-02, 1.0e+01], [2.4e-02, 4.0e-02, 1.0e+01], [2.4e-02, 4.8e-02, 1.0e+01], [2.4e-02, 5.6e-02, 1.0e+01], [2.4e-02, 6.4e-02, 1.0e+01], [2.4e-02, 7.2e-02, 1.0e+01], [3.2e-02, 0.0e+00, 1.0e+01], [3.2e-02, 8.0e-03, 1.0e+01], [3.2e-02, 1.6e-02, 1.0e+01], [3.2e-02, 2.4e-02, 1.0e+01], [3.2e-02, 3.2e-02, 1.0e+01], [3.2e-02, 4.0e-02, 1.0e+01], [3.2e-02, 4.8e-02, 1.0e+01], [3.2e-02, 5.6e-02, 1.0e+01], [3.2e-02, 6.4e-02, 1.0e+01], [3.2e-02, 7.2e-02, 1.0e+01], [4.0e-02, 0.0e+00, 1.0e+01], [4.0e-02, 8.0e-03, 1.0e+01], [4.0e-02, 1.6e-02, 1.0e+01], [4.0e-02, 2.4e-02, 1.0e+01], [4.0e-02, 3.2e-02, 1.0e+01], [4.0e-02, 4.0e-02, 1.0e+01], [4.0e-02, 4.8e-02, 1.0e+01], [4.0e-02, 5.6e-02, 1.0e+01], [4.0e-02, 6.4e-02, 1.0e+01], [4.0e-02, 7.2e-02, 1.0e+01], [4.8e-02, 0.0e+00, 1.0e+01], [4.8e-02, 8.0e-03, 1.0e+01], [4.8e-02, 1.6e-02, 1.0e+01], [4.8e-02, 2.4e-02, 1.0e+01], [4.8e-02, 3.2e-02, 1.0e+01], [4.8e-02, 4.0e-02, 1.0e+01], [4.8e-02, 4.8e-02, 1.0e+01], [4.8e-02, 5.6e-02, 1.0e+01], [4.8e-02, 6.4e-02, 1.0e+01], [4.8e-02, 7.2e-02, 1.0e+01], [5.6e-02, 0.0e+00, 1.0e+01], [5.6e-02, 8.0e-03, 1.0e+01], [5.6e-02, 1.6e-02, 1.0e+01], [5.6e-02, 2.4e-02, 1.0e+01], [5.6e-02, 3.2e-02, 1.0e+01], [5.6e-02, 4.0e-02, 1.0e+01], [5.6e-02, 4.8e-02, 1.0e+01], [5.6e-02, 5.6e-02, 1.0e+01], [5.6e-02, 6.4e-02, 1.0e+01], [5.6e-02, 7.2e-02, 1.0e+01], [6.4e-02, 0.0e+00, 1.0e+01], [6.4e-02, 8.0e-03, 1.0e+01], [6.4e-02, 1.6e-02, 1.0e+01], [6.4e-02, 2.4e-02, 1.0e+01], [6.4e-02, 3.2e-02, 1.0e+01], [6.4e-02, 4.0e-02, 1.0e+01], [6.4e-02, 4.8e-02, 1.0e+01], [6.4e-02, 5.6e-02, 1.0e+01], [6.4e-02, 6.4e-02, 1.0e+01], [6.4e-02, 7.2e-02, 1.0e+01], [7.2e-02, 0.0e+00, 1.0e+01], [7.2e-02, 8.0e-03, 1.0e+01], [7.2e-02, 1.6e-02, 1.0e+01], [7.2e-02, 2.4e-02, 1.0e+01], [7.2e-02, 3.2e-02, 1.0e+01], [7.2e-02, 4.0e-02, 1.0e+01], [7.2e-02, 4.8e-02, 1.0e+01], [7.2e-02, 5.6e-02, 1.0e+01], [7.2e-02, 6.4e-02, 1.0e+01], [7.2e-02, 7.2e-02, 1.0e+01]]) - sample_position()vector3m[0. 0. 0.]
Values:
array([0., 0., 0.]) - source_position()vector3m[ 0. 0. -10.]
Values:
array([ 0., 0., -10.]) - spectrum(spectrum)int321, 2, ..., 199, 200
Values:
array([ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200], dtype=int32) - tof(tof [bin-edge])float64µs0.0, 100.0, ..., 1.990e+04, 2.000e+04
Values:
array([ 0., 100., 200., 300., 400., 500., 600., 700., 800., 900., 1000., 1100., 1200., 1300., 1400., 1500., 1600., 1700., 1800., 1900., 2000., 2100., 2200., 2300., 2400., 2500., 2600., 2700., 2800., 2900., 3000., 3100., 3200., 3300., 3400., 3500., 3600., 3700., 3800., 3900., 4000., 4100., 4200., 4300., 4400., 4500., 4600., 4700., 4800., 4900., 5000., 5100., 5200., 5300., 5400., 5500., 5600., 5700., 5800., 5900., 6000., 6100., 6200., 6300., 6400., 6500., 6600., 6700., 6800., 6900., 7000., 7100., 7200., 7300., 7400., 7500., 7600., 7700., 7800., 7900., 8000., 8100., 8200., 8300., 8400., 8500., 8600., 8700., 8800., 8900., 9000., 9100., 9200., 9300., 9400., 9500., 9600., 9700., 9800., 9900., 10000., 10100., 10200., 10300., 10400., 10500., 10600., 10700., 10800., 10900., 11000., 11100., 11200., 11300., 11400., 11500., 11600., 11700., 11800., 11900., 12000., 12100., 12200., 12300., 12400., 12500., 12600., 12700., 12800., 12900., 13000., 13100., 13200., 13300., 13400., 13500., 13600., 13700., 13800., 13900., 14000., 14100., 14200., 14300., 14400., 14500., 14600., 14700., 14800., 14900., 15000., 15100., 15200., 15300., 15400., 15500., 15600., 15700., 15800., 15900., 16000., 16100., 16200., 16300., 16400., 16500., 16600., 16700., 16800., 16900., 17000., 17100., 17200., 17300., 17400., 17500., 17600., 17700., 17800., 17900., 18000., 18100., 18200., 18300., 18400., 18500., 18600., 18700., 18800., 18900., 19000., 19100., 19200., 19300., 19400., 19500., 19600., 19700., 19800., 19900., 20000.])
- (spectrum, tof)DataArrayViewbinned data [len=4, len=3, ..., len=3, len=4]
dim='event', content=DataArray( dims=(event: 190000), data=float32[counts], coords={'tof':float64[µs], 'pulse_time':datetime64[ns]})
Or providing a bin count
[29]:
events = scn.from_mantid(event_workspace)['data']
events.bin(tof=201)
[29]:
- spectrum: 200
- tof: 201
- position(spectrum)vector3m[0. 0. 5.], [0. 0.008 5. ], ..., [ 0.072 0.064 10. ], [ 0.072 0.072 10. ]
Values:
array([[0.0e+00, 0.0e+00, 5.0e+00], [0.0e+00, 8.0e-03, 5.0e+00], [0.0e+00, 1.6e-02, 5.0e+00], [0.0e+00, 2.4e-02, 5.0e+00], [0.0e+00, 3.2e-02, 5.0e+00], [0.0e+00, 4.0e-02, 5.0e+00], [0.0e+00, 4.8e-02, 5.0e+00], [0.0e+00, 5.6e-02, 5.0e+00], [0.0e+00, 6.4e-02, 5.0e+00], [0.0e+00, 7.2e-02, 5.0e+00], [8.0e-03, 0.0e+00, 5.0e+00], [8.0e-03, 8.0e-03, 5.0e+00], [8.0e-03, 1.6e-02, 5.0e+00], [8.0e-03, 2.4e-02, 5.0e+00], [8.0e-03, 3.2e-02, 5.0e+00], [8.0e-03, 4.0e-02, 5.0e+00], [8.0e-03, 4.8e-02, 5.0e+00], [8.0e-03, 5.6e-02, 5.0e+00], [8.0e-03, 6.4e-02, 5.0e+00], [8.0e-03, 7.2e-02, 5.0e+00], [1.6e-02, 0.0e+00, 5.0e+00], [1.6e-02, 8.0e-03, 5.0e+00], [1.6e-02, 1.6e-02, 5.0e+00], [1.6e-02, 2.4e-02, 5.0e+00], [1.6e-02, 3.2e-02, 5.0e+00], [1.6e-02, 4.0e-02, 5.0e+00], [1.6e-02, 4.8e-02, 5.0e+00], [1.6e-02, 5.6e-02, 5.0e+00], [1.6e-02, 6.4e-02, 5.0e+00], [1.6e-02, 7.2e-02, 5.0e+00], [2.4e-02, 0.0e+00, 5.0e+00], [2.4e-02, 8.0e-03, 5.0e+00], [2.4e-02, 1.6e-02, 5.0e+00], [2.4e-02, 2.4e-02, 5.0e+00], [2.4e-02, 3.2e-02, 5.0e+00], [2.4e-02, 4.0e-02, 5.0e+00], [2.4e-02, 4.8e-02, 5.0e+00], [2.4e-02, 5.6e-02, 5.0e+00], [2.4e-02, 6.4e-02, 5.0e+00], [2.4e-02, 7.2e-02, 5.0e+00], [3.2e-02, 0.0e+00, 5.0e+00], [3.2e-02, 8.0e-03, 5.0e+00], [3.2e-02, 1.6e-02, 5.0e+00], [3.2e-02, 2.4e-02, 5.0e+00], [3.2e-02, 3.2e-02, 5.0e+00], [3.2e-02, 4.0e-02, 5.0e+00], [3.2e-02, 4.8e-02, 5.0e+00], [3.2e-02, 5.6e-02, 5.0e+00], [3.2e-02, 6.4e-02, 5.0e+00], [3.2e-02, 7.2e-02, 5.0e+00], [4.0e-02, 0.0e+00, 5.0e+00], [4.0e-02, 8.0e-03, 5.0e+00], [4.0e-02, 1.6e-02, 5.0e+00], [4.0e-02, 2.4e-02, 5.0e+00], [4.0e-02, 3.2e-02, 5.0e+00], [4.0e-02, 4.0e-02, 5.0e+00], [4.0e-02, 4.8e-02, 5.0e+00], [4.0e-02, 5.6e-02, 5.0e+00], [4.0e-02, 6.4e-02, 5.0e+00], [4.0e-02, 7.2e-02, 5.0e+00], [4.8e-02, 0.0e+00, 5.0e+00], [4.8e-02, 8.0e-03, 5.0e+00], [4.8e-02, 1.6e-02, 5.0e+00], [4.8e-02, 2.4e-02, 5.0e+00], [4.8e-02, 3.2e-02, 5.0e+00], [4.8e-02, 4.0e-02, 5.0e+00], [4.8e-02, 4.8e-02, 5.0e+00], [4.8e-02, 5.6e-02, 5.0e+00], [4.8e-02, 6.4e-02, 5.0e+00], [4.8e-02, 7.2e-02, 5.0e+00], [5.6e-02, 0.0e+00, 5.0e+00], [5.6e-02, 8.0e-03, 5.0e+00], [5.6e-02, 1.6e-02, 5.0e+00], [5.6e-02, 2.4e-02, 5.0e+00], [5.6e-02, 3.2e-02, 5.0e+00], [5.6e-02, 4.0e-02, 5.0e+00], [5.6e-02, 4.8e-02, 5.0e+00], [5.6e-02, 5.6e-02, 5.0e+00], [5.6e-02, 6.4e-02, 5.0e+00], [5.6e-02, 7.2e-02, 5.0e+00], [6.4e-02, 0.0e+00, 5.0e+00], [6.4e-02, 8.0e-03, 5.0e+00], [6.4e-02, 1.6e-02, 5.0e+00], [6.4e-02, 2.4e-02, 5.0e+00], [6.4e-02, 3.2e-02, 5.0e+00], [6.4e-02, 4.0e-02, 5.0e+00], [6.4e-02, 4.8e-02, 5.0e+00], [6.4e-02, 5.6e-02, 5.0e+00], [6.4e-02, 6.4e-02, 5.0e+00], [6.4e-02, 7.2e-02, 5.0e+00], [7.2e-02, 0.0e+00, 5.0e+00], [7.2e-02, 8.0e-03, 5.0e+00], [7.2e-02, 1.6e-02, 5.0e+00], [7.2e-02, 2.4e-02, 5.0e+00], [7.2e-02, 3.2e-02, 5.0e+00], [7.2e-02, 4.0e-02, 5.0e+00], [7.2e-02, 4.8e-02, 5.0e+00], [7.2e-02, 5.6e-02, 5.0e+00], [7.2e-02, 6.4e-02, 5.0e+00], [7.2e-02, 7.2e-02, 5.0e+00], [0.0e+00, 0.0e+00, 1.0e+01], [0.0e+00, 8.0e-03, 1.0e+01], [0.0e+00, 1.6e-02, 1.0e+01], [0.0e+00, 2.4e-02, 1.0e+01], [0.0e+00, 3.2e-02, 1.0e+01], [0.0e+00, 4.0e-02, 1.0e+01], [0.0e+00, 4.8e-02, 1.0e+01], [0.0e+00, 5.6e-02, 1.0e+01], [0.0e+00, 6.4e-02, 1.0e+01], [0.0e+00, 7.2e-02, 1.0e+01], [8.0e-03, 0.0e+00, 1.0e+01], [8.0e-03, 8.0e-03, 1.0e+01], [8.0e-03, 1.6e-02, 1.0e+01], [8.0e-03, 2.4e-02, 1.0e+01], [8.0e-03, 3.2e-02, 1.0e+01], [8.0e-03, 4.0e-02, 1.0e+01], [8.0e-03, 4.8e-02, 1.0e+01], [8.0e-03, 5.6e-02, 1.0e+01], [8.0e-03, 6.4e-02, 1.0e+01], [8.0e-03, 7.2e-02, 1.0e+01], [1.6e-02, 0.0e+00, 1.0e+01], [1.6e-02, 8.0e-03, 1.0e+01], [1.6e-02, 1.6e-02, 1.0e+01], [1.6e-02, 2.4e-02, 1.0e+01], [1.6e-02, 3.2e-02, 1.0e+01], [1.6e-02, 4.0e-02, 1.0e+01], [1.6e-02, 4.8e-02, 1.0e+01], [1.6e-02, 5.6e-02, 1.0e+01], [1.6e-02, 6.4e-02, 1.0e+01], [1.6e-02, 7.2e-02, 1.0e+01], [2.4e-02, 0.0e+00, 1.0e+01], [2.4e-02, 8.0e-03, 1.0e+01], [2.4e-02, 1.6e-02, 1.0e+01], [2.4e-02, 2.4e-02, 1.0e+01], [2.4e-02, 3.2e-02, 1.0e+01], [2.4e-02, 4.0e-02, 1.0e+01], [2.4e-02, 4.8e-02, 1.0e+01], [2.4e-02, 5.6e-02, 1.0e+01], [2.4e-02, 6.4e-02, 1.0e+01], [2.4e-02, 7.2e-02, 1.0e+01], [3.2e-02, 0.0e+00, 1.0e+01], [3.2e-02, 8.0e-03, 1.0e+01], [3.2e-02, 1.6e-02, 1.0e+01], [3.2e-02, 2.4e-02, 1.0e+01], [3.2e-02, 3.2e-02, 1.0e+01], [3.2e-02, 4.0e-02, 1.0e+01], [3.2e-02, 4.8e-02, 1.0e+01], [3.2e-02, 5.6e-02, 1.0e+01], [3.2e-02, 6.4e-02, 1.0e+01], [3.2e-02, 7.2e-02, 1.0e+01], [4.0e-02, 0.0e+00, 1.0e+01], [4.0e-02, 8.0e-03, 1.0e+01], [4.0e-02, 1.6e-02, 1.0e+01], [4.0e-02, 2.4e-02, 1.0e+01], [4.0e-02, 3.2e-02, 1.0e+01], [4.0e-02, 4.0e-02, 1.0e+01], [4.0e-02, 4.8e-02, 1.0e+01], [4.0e-02, 5.6e-02, 1.0e+01], [4.0e-02, 6.4e-02, 1.0e+01], [4.0e-02, 7.2e-02, 1.0e+01], [4.8e-02, 0.0e+00, 1.0e+01], [4.8e-02, 8.0e-03, 1.0e+01], [4.8e-02, 1.6e-02, 1.0e+01], [4.8e-02, 2.4e-02, 1.0e+01], [4.8e-02, 3.2e-02, 1.0e+01], [4.8e-02, 4.0e-02, 1.0e+01], [4.8e-02, 4.8e-02, 1.0e+01], [4.8e-02, 5.6e-02, 1.0e+01], [4.8e-02, 6.4e-02, 1.0e+01], [4.8e-02, 7.2e-02, 1.0e+01], [5.6e-02, 0.0e+00, 1.0e+01], [5.6e-02, 8.0e-03, 1.0e+01], [5.6e-02, 1.6e-02, 1.0e+01], [5.6e-02, 2.4e-02, 1.0e+01], [5.6e-02, 3.2e-02, 1.0e+01], [5.6e-02, 4.0e-02, 1.0e+01], [5.6e-02, 4.8e-02, 1.0e+01], [5.6e-02, 5.6e-02, 1.0e+01], [5.6e-02, 6.4e-02, 1.0e+01], [5.6e-02, 7.2e-02, 1.0e+01], [6.4e-02, 0.0e+00, 1.0e+01], [6.4e-02, 8.0e-03, 1.0e+01], [6.4e-02, 1.6e-02, 1.0e+01], [6.4e-02, 2.4e-02, 1.0e+01], [6.4e-02, 3.2e-02, 1.0e+01], [6.4e-02, 4.0e-02, 1.0e+01], [6.4e-02, 4.8e-02, 1.0e+01], [6.4e-02, 5.6e-02, 1.0e+01], [6.4e-02, 6.4e-02, 1.0e+01], [6.4e-02, 7.2e-02, 1.0e+01], [7.2e-02, 0.0e+00, 1.0e+01], [7.2e-02, 8.0e-03, 1.0e+01], [7.2e-02, 1.6e-02, 1.0e+01], [7.2e-02, 2.4e-02, 1.0e+01], [7.2e-02, 3.2e-02, 1.0e+01], [7.2e-02, 4.0e-02, 1.0e+01], [7.2e-02, 4.8e-02, 1.0e+01], [7.2e-02, 5.6e-02, 1.0e+01], [7.2e-02, 6.4e-02, 1.0e+01], [7.2e-02, 7.2e-02, 1.0e+01]]) - sample_position()vector3m[0. 0. 0.]
Values:
array([0., 0., 0.]) - source_position()vector3m[ 0. 0. -10.]
Values:
array([ 0., 0., -10.]) - spectrum(spectrum)int321, 2, ..., 199, 200
Values:
array([ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200], dtype=int32) - tof(tof [bin-edge])float64µs0.0, 99.502, ..., 1.990e+04, 2.000e+04
Values:
array([ 0. , 99.50248756, 199.00497512, 298.50746269, 398.00995025, 497.51243781, 597.01492537, 696.51741294, 796.0199005 , 895.52238806, 995.02487562, 1094.52736318, 1194.02985075, 1293.53233831, 1393.03482587, 1492.53731343, 1592.039801 , 1691.54228856, 1791.04477612, 1890.54726368, 1990.04975124, 2089.55223881, 2189.05472637, 2288.55721393, 2388.05970149, 2487.56218905, 2587.06467662, 2686.56716418, 2786.06965174, 2885.5721393 , 2985.07462687, 3084.57711443, 3184.07960199, 3283.58208955, 3383.08457711, 3482.58706468, 3582.08955224, 3681.5920398 , 3781.09452736, 3880.59701493, 3980.09950249, 4079.60199005, 4179.10447761, 4278.60696517, 4378.10945274, 4477.6119403 , 4577.11442786, 4676.61691542, 4776.11940299, 4875.62189055, 4975.12437811, 5074.62686567, 5174.12935323, 5273.6318408 , 5373.13432836, 5472.63681592, 5572.13930348, 5671.64179104, 5771.14427861, 5870.64676617, 5970.14925373, 6069.65174129, 6169.15422886, 6268.65671642, 6368.15920398, 6467.66169154, 6567.1641791 , 6666.66666667, 6766.16915423, 6865.67164179, 6965.17412935, 7064.67661692, 7164.17910448, 7263.68159204, 7363.1840796 , 7462.68656716, 7562.18905473, 7661.69154229, 7761.19402985, 7860.69651741, 7960.19900498, 8059.70149254, 8159.2039801 , 8258.70646766, 8358.20895522, 8457.71144279, 8557.21393035, 8656.71641791, 8756.21890547, 8855.72139303, 8955.2238806 , 9054.72636816, 9154.22885572, 9253.73134328, 9353.23383085, 9452.73631841, 9552.23880597, 9651.74129353, 9751.24378109, 9850.74626866, 9950.24875622, 10049.75124378, 10149.25373134, 10248.75621891, 10348.25870647, 10447.76119403, 10547.26368159, 10646.76616915, 10746.26865672, 10845.77114428, 10945.27363184, 11044.7761194 , 11144.27860697, 11243.78109453, 11343.28358209, 11442.78606965, 11542.28855721, 11641.79104478, 11741.29353234, 11840.7960199 , 11940.29850746, 12039.80099502, 12139.30348259, 12238.80597015, 12338.30845771, 12437.81094527, 12537.31343284, 12636.8159204 , 12736.31840796, 12835.82089552, 12935.32338308, 13034.82587065, 13134.32835821, 13233.83084577, 13333.33333333, 13432.8358209 , 13532.33830846, 13631.84079602, 13731.34328358, 13830.84577114, 13930.34825871, 14029.85074627, 14129.35323383, 14228.85572139, 14328.35820896, 14427.86069652, 14527.36318408, 14626.86567164, 14726.3681592 , 14825.87064677, 14925.37313433, 15024.87562189, 15124.37810945, 15223.88059701, 15323.38308458, 15422.88557214, 15522.3880597 , 15621.89054726, 15721.39303483, 15820.89552239, 15920.39800995, 16019.90049751, 16119.40298507, 16218.90547264, 16318.4079602 , 16417.91044776, 16517.41293532, 16616.91542289, 16716.41791045, 16815.92039801, 16915.42288557, 17014.92537313, 17114.4278607 , 17213.93034826, 17313.43283582, 17412.93532338, 17512.43781095, 17611.94029851, 17711.44278607, 17810.94527363, 17910.44776119, 18009.95024876, 18109.45273632, 18208.95522388, 18308.45771144, 18407.960199 , 18507.46268657, 18606.96517413, 18706.46766169, 18805.97014925, 18905.47263682, 19004.97512438, 19104.47761194, 19203.9800995 , 19303.48258706, 19402.98507463, 19502.48756219, 19601.99004975, 19701.49253731, 19800.99502488, 19900.49751244, 20000. ])
- (spectrum, tof)DataArrayViewbinned data [len=4, len=3, ..., len=3, len=4]
dim='event', content=DataArray( dims=(event: 190000), data=float32[counts], coords={'tof':float64[µs], 'pulse_time':datetime64[ns]})
Rebin EventWorkspace
into Workspace2D
#
[30]:
mantid.Rebin(
InputWorkspace=event_workspace,
OutputWorkspace='histo',
Params=[0, 100, 20000],
PreserveEvents=False,
)
Rebin-[Notice] Rebin started
Rebin-[Notice] Rebin successful, Duration 0.00 seconds
[30]:
Workspace2D
Title: Test Workspace
Histograms: 200
Bins: 200
Histogram
X axis: Time-of-flight / microsecond
Y axis: Counts
Distribution: False
Instrument: basic_rect (1990-Jan-01 to 1990-Jan-01)
Run start: 2010-Jan-01 00:00:00
Run end: 2010-Jan-01 01:00:00
Equivalent in scipp:
[31]:
tof_edges = sc.arange(dim='tof', unit='us', start=0.0, stop=20000.0, step=100.0)
events.hist(tof=tof_edges)
[31]:
- spectrum: 200
- tof: 199
- position(spectrum)vector3m[0. 0. 5.], [0. 0.008 5. ], ..., [ 0.072 0.064 10. ], [ 0.072 0.072 10. ]
Values:
array([[0.0e+00, 0.0e+00, 5.0e+00], [0.0e+00, 8.0e-03, 5.0e+00], [0.0e+00, 1.6e-02, 5.0e+00], [0.0e+00, 2.4e-02, 5.0e+00], [0.0e+00, 3.2e-02, 5.0e+00], [0.0e+00, 4.0e-02, 5.0e+00], [0.0e+00, 4.8e-02, 5.0e+00], [0.0e+00, 5.6e-02, 5.0e+00], [0.0e+00, 6.4e-02, 5.0e+00], [0.0e+00, 7.2e-02, 5.0e+00], [8.0e-03, 0.0e+00, 5.0e+00], [8.0e-03, 8.0e-03, 5.0e+00], [8.0e-03, 1.6e-02, 5.0e+00], [8.0e-03, 2.4e-02, 5.0e+00], [8.0e-03, 3.2e-02, 5.0e+00], [8.0e-03, 4.0e-02, 5.0e+00], [8.0e-03, 4.8e-02, 5.0e+00], [8.0e-03, 5.6e-02, 5.0e+00], [8.0e-03, 6.4e-02, 5.0e+00], [8.0e-03, 7.2e-02, 5.0e+00], [1.6e-02, 0.0e+00, 5.0e+00], [1.6e-02, 8.0e-03, 5.0e+00], [1.6e-02, 1.6e-02, 5.0e+00], [1.6e-02, 2.4e-02, 5.0e+00], [1.6e-02, 3.2e-02, 5.0e+00], [1.6e-02, 4.0e-02, 5.0e+00], [1.6e-02, 4.8e-02, 5.0e+00], [1.6e-02, 5.6e-02, 5.0e+00], [1.6e-02, 6.4e-02, 5.0e+00], [1.6e-02, 7.2e-02, 5.0e+00], [2.4e-02, 0.0e+00, 5.0e+00], [2.4e-02, 8.0e-03, 5.0e+00], [2.4e-02, 1.6e-02, 5.0e+00], [2.4e-02, 2.4e-02, 5.0e+00], [2.4e-02, 3.2e-02, 5.0e+00], [2.4e-02, 4.0e-02, 5.0e+00], [2.4e-02, 4.8e-02, 5.0e+00], [2.4e-02, 5.6e-02, 5.0e+00], [2.4e-02, 6.4e-02, 5.0e+00], [2.4e-02, 7.2e-02, 5.0e+00], [3.2e-02, 0.0e+00, 5.0e+00], [3.2e-02, 8.0e-03, 5.0e+00], [3.2e-02, 1.6e-02, 5.0e+00], [3.2e-02, 2.4e-02, 5.0e+00], [3.2e-02, 3.2e-02, 5.0e+00], [3.2e-02, 4.0e-02, 5.0e+00], [3.2e-02, 4.8e-02, 5.0e+00], [3.2e-02, 5.6e-02, 5.0e+00], [3.2e-02, 6.4e-02, 5.0e+00], [3.2e-02, 7.2e-02, 5.0e+00], [4.0e-02, 0.0e+00, 5.0e+00], [4.0e-02, 8.0e-03, 5.0e+00], [4.0e-02, 1.6e-02, 5.0e+00], [4.0e-02, 2.4e-02, 5.0e+00], [4.0e-02, 3.2e-02, 5.0e+00], [4.0e-02, 4.0e-02, 5.0e+00], [4.0e-02, 4.8e-02, 5.0e+00], [4.0e-02, 5.6e-02, 5.0e+00], [4.0e-02, 6.4e-02, 5.0e+00], [4.0e-02, 7.2e-02, 5.0e+00], [4.8e-02, 0.0e+00, 5.0e+00], [4.8e-02, 8.0e-03, 5.0e+00], [4.8e-02, 1.6e-02, 5.0e+00], [4.8e-02, 2.4e-02, 5.0e+00], [4.8e-02, 3.2e-02, 5.0e+00], [4.8e-02, 4.0e-02, 5.0e+00], [4.8e-02, 4.8e-02, 5.0e+00], [4.8e-02, 5.6e-02, 5.0e+00], [4.8e-02, 6.4e-02, 5.0e+00], [4.8e-02, 7.2e-02, 5.0e+00], [5.6e-02, 0.0e+00, 5.0e+00], [5.6e-02, 8.0e-03, 5.0e+00], [5.6e-02, 1.6e-02, 5.0e+00], [5.6e-02, 2.4e-02, 5.0e+00], [5.6e-02, 3.2e-02, 5.0e+00], [5.6e-02, 4.0e-02, 5.0e+00], [5.6e-02, 4.8e-02, 5.0e+00], [5.6e-02, 5.6e-02, 5.0e+00], [5.6e-02, 6.4e-02, 5.0e+00], [5.6e-02, 7.2e-02, 5.0e+00], [6.4e-02, 0.0e+00, 5.0e+00], [6.4e-02, 8.0e-03, 5.0e+00], [6.4e-02, 1.6e-02, 5.0e+00], [6.4e-02, 2.4e-02, 5.0e+00], [6.4e-02, 3.2e-02, 5.0e+00], [6.4e-02, 4.0e-02, 5.0e+00], [6.4e-02, 4.8e-02, 5.0e+00], [6.4e-02, 5.6e-02, 5.0e+00], [6.4e-02, 6.4e-02, 5.0e+00], [6.4e-02, 7.2e-02, 5.0e+00], [7.2e-02, 0.0e+00, 5.0e+00], [7.2e-02, 8.0e-03, 5.0e+00], [7.2e-02, 1.6e-02, 5.0e+00], [7.2e-02, 2.4e-02, 5.0e+00], [7.2e-02, 3.2e-02, 5.0e+00], [7.2e-02, 4.0e-02, 5.0e+00], [7.2e-02, 4.8e-02, 5.0e+00], [7.2e-02, 5.6e-02, 5.0e+00], [7.2e-02, 6.4e-02, 5.0e+00], [7.2e-02, 7.2e-02, 5.0e+00], [0.0e+00, 0.0e+00, 1.0e+01], [0.0e+00, 8.0e-03, 1.0e+01], [0.0e+00, 1.6e-02, 1.0e+01], [0.0e+00, 2.4e-02, 1.0e+01], [0.0e+00, 3.2e-02, 1.0e+01], [0.0e+00, 4.0e-02, 1.0e+01], [0.0e+00, 4.8e-02, 1.0e+01], [0.0e+00, 5.6e-02, 1.0e+01], [0.0e+00, 6.4e-02, 1.0e+01], [0.0e+00, 7.2e-02, 1.0e+01], [8.0e-03, 0.0e+00, 1.0e+01], [8.0e-03, 8.0e-03, 1.0e+01], [8.0e-03, 1.6e-02, 1.0e+01], [8.0e-03, 2.4e-02, 1.0e+01], [8.0e-03, 3.2e-02, 1.0e+01], [8.0e-03, 4.0e-02, 1.0e+01], [8.0e-03, 4.8e-02, 1.0e+01], [8.0e-03, 5.6e-02, 1.0e+01], [8.0e-03, 6.4e-02, 1.0e+01], [8.0e-03, 7.2e-02, 1.0e+01], [1.6e-02, 0.0e+00, 1.0e+01], [1.6e-02, 8.0e-03, 1.0e+01], [1.6e-02, 1.6e-02, 1.0e+01], [1.6e-02, 2.4e-02, 1.0e+01], [1.6e-02, 3.2e-02, 1.0e+01], [1.6e-02, 4.0e-02, 1.0e+01], [1.6e-02, 4.8e-02, 1.0e+01], [1.6e-02, 5.6e-02, 1.0e+01], [1.6e-02, 6.4e-02, 1.0e+01], [1.6e-02, 7.2e-02, 1.0e+01], [2.4e-02, 0.0e+00, 1.0e+01], [2.4e-02, 8.0e-03, 1.0e+01], [2.4e-02, 1.6e-02, 1.0e+01], [2.4e-02, 2.4e-02, 1.0e+01], [2.4e-02, 3.2e-02, 1.0e+01], [2.4e-02, 4.0e-02, 1.0e+01], [2.4e-02, 4.8e-02, 1.0e+01], [2.4e-02, 5.6e-02, 1.0e+01], [2.4e-02, 6.4e-02, 1.0e+01], [2.4e-02, 7.2e-02, 1.0e+01], [3.2e-02, 0.0e+00, 1.0e+01], [3.2e-02, 8.0e-03, 1.0e+01], [3.2e-02, 1.6e-02, 1.0e+01], [3.2e-02, 2.4e-02, 1.0e+01], [3.2e-02, 3.2e-02, 1.0e+01], [3.2e-02, 4.0e-02, 1.0e+01], [3.2e-02, 4.8e-02, 1.0e+01], [3.2e-02, 5.6e-02, 1.0e+01], [3.2e-02, 6.4e-02, 1.0e+01], [3.2e-02, 7.2e-02, 1.0e+01], [4.0e-02, 0.0e+00, 1.0e+01], [4.0e-02, 8.0e-03, 1.0e+01], [4.0e-02, 1.6e-02, 1.0e+01], [4.0e-02, 2.4e-02, 1.0e+01], [4.0e-02, 3.2e-02, 1.0e+01], [4.0e-02, 4.0e-02, 1.0e+01], [4.0e-02, 4.8e-02, 1.0e+01], [4.0e-02, 5.6e-02, 1.0e+01], [4.0e-02, 6.4e-02, 1.0e+01], [4.0e-02, 7.2e-02, 1.0e+01], [4.8e-02, 0.0e+00, 1.0e+01], [4.8e-02, 8.0e-03, 1.0e+01], [4.8e-02, 1.6e-02, 1.0e+01], [4.8e-02, 2.4e-02, 1.0e+01], [4.8e-02, 3.2e-02, 1.0e+01], [4.8e-02, 4.0e-02, 1.0e+01], [4.8e-02, 4.8e-02, 1.0e+01], [4.8e-02, 5.6e-02, 1.0e+01], [4.8e-02, 6.4e-02, 1.0e+01], [4.8e-02, 7.2e-02, 1.0e+01], [5.6e-02, 0.0e+00, 1.0e+01], [5.6e-02, 8.0e-03, 1.0e+01], [5.6e-02, 1.6e-02, 1.0e+01], [5.6e-02, 2.4e-02, 1.0e+01], [5.6e-02, 3.2e-02, 1.0e+01], [5.6e-02, 4.0e-02, 1.0e+01], [5.6e-02, 4.8e-02, 1.0e+01], [5.6e-02, 5.6e-02, 1.0e+01], [5.6e-02, 6.4e-02, 1.0e+01], [5.6e-02, 7.2e-02, 1.0e+01], [6.4e-02, 0.0e+00, 1.0e+01], [6.4e-02, 8.0e-03, 1.0e+01], [6.4e-02, 1.6e-02, 1.0e+01], [6.4e-02, 2.4e-02, 1.0e+01], [6.4e-02, 3.2e-02, 1.0e+01], [6.4e-02, 4.0e-02, 1.0e+01], [6.4e-02, 4.8e-02, 1.0e+01], [6.4e-02, 5.6e-02, 1.0e+01], [6.4e-02, 6.4e-02, 1.0e+01], [6.4e-02, 7.2e-02, 1.0e+01], [7.2e-02, 0.0e+00, 1.0e+01], [7.2e-02, 8.0e-03, 1.0e+01], [7.2e-02, 1.6e-02, 1.0e+01], [7.2e-02, 2.4e-02, 1.0e+01], [7.2e-02, 3.2e-02, 1.0e+01], [7.2e-02, 4.0e-02, 1.0e+01], [7.2e-02, 4.8e-02, 1.0e+01], [7.2e-02, 5.6e-02, 1.0e+01], [7.2e-02, 6.4e-02, 1.0e+01], [7.2e-02, 7.2e-02, 1.0e+01]]) - sample_position()vector3m[0. 0. 0.]
Values:
array([0., 0., 0.]) - source_position()vector3m[ 0. 0. -10.]
Values:
array([ 0., 0., -10.]) - spectrum(spectrum)int321, 2, ..., 199, 200
Values:
array([ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200], dtype=int32) - tof(tof [bin-edge])float64µs0.0, 100.0, ..., 1.980e+04, 1.990e+04
Values:
array([ 0., 100., 200., 300., 400., 500., 600., 700., 800., 900., 1000., 1100., 1200., 1300., 1400., 1500., 1600., 1700., 1800., 1900., 2000., 2100., 2200., 2300., 2400., 2500., 2600., 2700., 2800., 2900., 3000., 3100., 3200., 3300., 3400., 3500., 3600., 3700., 3800., 3900., 4000., 4100., 4200., 4300., 4400., 4500., 4600., 4700., 4800., 4900., 5000., 5100., 5200., 5300., 5400., 5500., 5600., 5700., 5800., 5900., 6000., 6100., 6200., 6300., 6400., 6500., 6600., 6700., 6800., 6900., 7000., 7100., 7200., 7300., 7400., 7500., 7600., 7700., 7800., 7900., 8000., 8100., 8200., 8300., 8400., 8500., 8600., 8700., 8800., 8900., 9000., 9100., 9200., 9300., 9400., 9500., 9600., 9700., 9800., 9900., 10000., 10100., 10200., 10300., 10400., 10500., 10600., 10700., 10800., 10900., 11000., 11100., 11200., 11300., 11400., 11500., 11600., 11700., 11800., 11900., 12000., 12100., 12200., 12300., 12400., 12500., 12600., 12700., 12800., 12900., 13000., 13100., 13200., 13300., 13400., 13500., 13600., 13700., 13800., 13900., 14000., 14100., 14200., 14300., 14400., 14500., 14600., 14700., 14800., 14900., 15000., 15100., 15200., 15300., 15400., 15500., 15600., 15700., 15800., 15900., 16000., 16100., 16200., 16300., 16400., 16500., 16600., 16700., 16800., 16900., 17000., 17100., 17200., 17300., 17400., 17500., 17600., 17700., 17800., 17900., 18000., 18100., 18200., 18300., 18400., 18500., 18600., 18700., 18800., 18900., 19000., 19100., 19200., 19300., 19400., 19500., 19600., 19700., 19800., 19900.])
- (spectrum, tof)float32counts4.0, 3.0, ..., 4.0, 3.0σ = 2.0, 1.7320508, ..., 2.0, 1.7320508
Values:
array([[4., 3., 0., ..., 3., 4., 5.], [4., 3., 2., ..., 1., 6., 2.], [4., 3., 2., ..., 3., 4., 4.], ..., [4., 3., 2., ..., 3., 4., 5.], [3., 4., 2., ..., 3., 4., 4.], [3., 4., 4., ..., 3., 4., 3.]], dtype=float32)
Variances (σ²):
array([[4., 3., 0., ..., 3., 4., 5.], [4., 3., 2., ..., 1., 6., 2.], [4., 3., 2., ..., 3., 4., 4.], ..., [4., 3., 2., ..., 3., 4., 5.], [3., 4., 2., ..., 3., 4., 4.], [3., 4., 4., ..., 3., 4., 3.]], dtype=float32)
Rebin with logarithmic bins#
[32]:
mantid.Rebin(
InputWorkspace=event_workspace, OutputWorkspace='histo', Params='2,-0.035,10'
)
Rebin-[Notice] Rebin started
Rebin-[Notice] Rebin successful, Duration 0.00 seconds
[32]:
EventWorkspace
Title: Test Workspace
Histograms: 200
Bins: 47
Histogram
X axis: Time-of-flight / microsecond
Y axis: Counts
Distribution: False
Instrument: basic_rect (1990-Jan-01 to 1990-Jan-01)
Run start: 2010-Jan-01 00:00:00
Run end: 2010-Jan-01 01:00:00
Events: 190000
Equivalent in scipp:
[33]:
edges = sc.geomspace(dim='tof', unit='us', start=2, stop=10, num=100)
events.bin(tof=edges)
[33]:
- spectrum: 200
- tof: 99
- position(spectrum)vector3m[0. 0. 5.], [0. 0.008 5. ], ..., [ 0.072 0.064 10. ], [ 0.072 0.072 10. ]
Values:
array([[0.0e+00, 0.0e+00, 5.0e+00], [0.0e+00, 8.0e-03, 5.0e+00], [0.0e+00, 1.6e-02, 5.0e+00], [0.0e+00, 2.4e-02, 5.0e+00], [0.0e+00, 3.2e-02, 5.0e+00], [0.0e+00, 4.0e-02, 5.0e+00], [0.0e+00, 4.8e-02, 5.0e+00], [0.0e+00, 5.6e-02, 5.0e+00], [0.0e+00, 6.4e-02, 5.0e+00], [0.0e+00, 7.2e-02, 5.0e+00], [8.0e-03, 0.0e+00, 5.0e+00], [8.0e-03, 8.0e-03, 5.0e+00], [8.0e-03, 1.6e-02, 5.0e+00], [8.0e-03, 2.4e-02, 5.0e+00], [8.0e-03, 3.2e-02, 5.0e+00], [8.0e-03, 4.0e-02, 5.0e+00], [8.0e-03, 4.8e-02, 5.0e+00], [8.0e-03, 5.6e-02, 5.0e+00], [8.0e-03, 6.4e-02, 5.0e+00], [8.0e-03, 7.2e-02, 5.0e+00], [1.6e-02, 0.0e+00, 5.0e+00], [1.6e-02, 8.0e-03, 5.0e+00], [1.6e-02, 1.6e-02, 5.0e+00], [1.6e-02, 2.4e-02, 5.0e+00], [1.6e-02, 3.2e-02, 5.0e+00], [1.6e-02, 4.0e-02, 5.0e+00], [1.6e-02, 4.8e-02, 5.0e+00], [1.6e-02, 5.6e-02, 5.0e+00], [1.6e-02, 6.4e-02, 5.0e+00], [1.6e-02, 7.2e-02, 5.0e+00], [2.4e-02, 0.0e+00, 5.0e+00], [2.4e-02, 8.0e-03, 5.0e+00], [2.4e-02, 1.6e-02, 5.0e+00], [2.4e-02, 2.4e-02, 5.0e+00], [2.4e-02, 3.2e-02, 5.0e+00], [2.4e-02, 4.0e-02, 5.0e+00], [2.4e-02, 4.8e-02, 5.0e+00], [2.4e-02, 5.6e-02, 5.0e+00], [2.4e-02, 6.4e-02, 5.0e+00], [2.4e-02, 7.2e-02, 5.0e+00], [3.2e-02, 0.0e+00, 5.0e+00], [3.2e-02, 8.0e-03, 5.0e+00], [3.2e-02, 1.6e-02, 5.0e+00], [3.2e-02, 2.4e-02, 5.0e+00], [3.2e-02, 3.2e-02, 5.0e+00], [3.2e-02, 4.0e-02, 5.0e+00], [3.2e-02, 4.8e-02, 5.0e+00], [3.2e-02, 5.6e-02, 5.0e+00], [3.2e-02, 6.4e-02, 5.0e+00], [3.2e-02, 7.2e-02, 5.0e+00], [4.0e-02, 0.0e+00, 5.0e+00], [4.0e-02, 8.0e-03, 5.0e+00], [4.0e-02, 1.6e-02, 5.0e+00], [4.0e-02, 2.4e-02, 5.0e+00], [4.0e-02, 3.2e-02, 5.0e+00], [4.0e-02, 4.0e-02, 5.0e+00], [4.0e-02, 4.8e-02, 5.0e+00], [4.0e-02, 5.6e-02, 5.0e+00], [4.0e-02, 6.4e-02, 5.0e+00], [4.0e-02, 7.2e-02, 5.0e+00], [4.8e-02, 0.0e+00, 5.0e+00], [4.8e-02, 8.0e-03, 5.0e+00], [4.8e-02, 1.6e-02, 5.0e+00], [4.8e-02, 2.4e-02, 5.0e+00], [4.8e-02, 3.2e-02, 5.0e+00], [4.8e-02, 4.0e-02, 5.0e+00], [4.8e-02, 4.8e-02, 5.0e+00], [4.8e-02, 5.6e-02, 5.0e+00], [4.8e-02, 6.4e-02, 5.0e+00], [4.8e-02, 7.2e-02, 5.0e+00], [5.6e-02, 0.0e+00, 5.0e+00], [5.6e-02, 8.0e-03, 5.0e+00], [5.6e-02, 1.6e-02, 5.0e+00], [5.6e-02, 2.4e-02, 5.0e+00], [5.6e-02, 3.2e-02, 5.0e+00], [5.6e-02, 4.0e-02, 5.0e+00], [5.6e-02, 4.8e-02, 5.0e+00], [5.6e-02, 5.6e-02, 5.0e+00], [5.6e-02, 6.4e-02, 5.0e+00], [5.6e-02, 7.2e-02, 5.0e+00], [6.4e-02, 0.0e+00, 5.0e+00], [6.4e-02, 8.0e-03, 5.0e+00], [6.4e-02, 1.6e-02, 5.0e+00], [6.4e-02, 2.4e-02, 5.0e+00], [6.4e-02, 3.2e-02, 5.0e+00], [6.4e-02, 4.0e-02, 5.0e+00], [6.4e-02, 4.8e-02, 5.0e+00], [6.4e-02, 5.6e-02, 5.0e+00], [6.4e-02, 6.4e-02, 5.0e+00], [6.4e-02, 7.2e-02, 5.0e+00], [7.2e-02, 0.0e+00, 5.0e+00], [7.2e-02, 8.0e-03, 5.0e+00], [7.2e-02, 1.6e-02, 5.0e+00], [7.2e-02, 2.4e-02, 5.0e+00], [7.2e-02, 3.2e-02, 5.0e+00], [7.2e-02, 4.0e-02, 5.0e+00], [7.2e-02, 4.8e-02, 5.0e+00], [7.2e-02, 5.6e-02, 5.0e+00], [7.2e-02, 6.4e-02, 5.0e+00], [7.2e-02, 7.2e-02, 5.0e+00], [0.0e+00, 0.0e+00, 1.0e+01], [0.0e+00, 8.0e-03, 1.0e+01], [0.0e+00, 1.6e-02, 1.0e+01], [0.0e+00, 2.4e-02, 1.0e+01], [0.0e+00, 3.2e-02, 1.0e+01], [0.0e+00, 4.0e-02, 1.0e+01], [0.0e+00, 4.8e-02, 1.0e+01], [0.0e+00, 5.6e-02, 1.0e+01], [0.0e+00, 6.4e-02, 1.0e+01], [0.0e+00, 7.2e-02, 1.0e+01], [8.0e-03, 0.0e+00, 1.0e+01], [8.0e-03, 8.0e-03, 1.0e+01], [8.0e-03, 1.6e-02, 1.0e+01], [8.0e-03, 2.4e-02, 1.0e+01], [8.0e-03, 3.2e-02, 1.0e+01], [8.0e-03, 4.0e-02, 1.0e+01], [8.0e-03, 4.8e-02, 1.0e+01], [8.0e-03, 5.6e-02, 1.0e+01], [8.0e-03, 6.4e-02, 1.0e+01], [8.0e-03, 7.2e-02, 1.0e+01], [1.6e-02, 0.0e+00, 1.0e+01], [1.6e-02, 8.0e-03, 1.0e+01], [1.6e-02, 1.6e-02, 1.0e+01], [1.6e-02, 2.4e-02, 1.0e+01], [1.6e-02, 3.2e-02, 1.0e+01], [1.6e-02, 4.0e-02, 1.0e+01], [1.6e-02, 4.8e-02, 1.0e+01], [1.6e-02, 5.6e-02, 1.0e+01], [1.6e-02, 6.4e-02, 1.0e+01], [1.6e-02, 7.2e-02, 1.0e+01], [2.4e-02, 0.0e+00, 1.0e+01], [2.4e-02, 8.0e-03, 1.0e+01], [2.4e-02, 1.6e-02, 1.0e+01], [2.4e-02, 2.4e-02, 1.0e+01], [2.4e-02, 3.2e-02, 1.0e+01], [2.4e-02, 4.0e-02, 1.0e+01], [2.4e-02, 4.8e-02, 1.0e+01], [2.4e-02, 5.6e-02, 1.0e+01], [2.4e-02, 6.4e-02, 1.0e+01], [2.4e-02, 7.2e-02, 1.0e+01], [3.2e-02, 0.0e+00, 1.0e+01], [3.2e-02, 8.0e-03, 1.0e+01], [3.2e-02, 1.6e-02, 1.0e+01], [3.2e-02, 2.4e-02, 1.0e+01], [3.2e-02, 3.2e-02, 1.0e+01], [3.2e-02, 4.0e-02, 1.0e+01], [3.2e-02, 4.8e-02, 1.0e+01], [3.2e-02, 5.6e-02, 1.0e+01], [3.2e-02, 6.4e-02, 1.0e+01], [3.2e-02, 7.2e-02, 1.0e+01], [4.0e-02, 0.0e+00, 1.0e+01], [4.0e-02, 8.0e-03, 1.0e+01], [4.0e-02, 1.6e-02, 1.0e+01], [4.0e-02, 2.4e-02, 1.0e+01], [4.0e-02, 3.2e-02, 1.0e+01], [4.0e-02, 4.0e-02, 1.0e+01], [4.0e-02, 4.8e-02, 1.0e+01], [4.0e-02, 5.6e-02, 1.0e+01], [4.0e-02, 6.4e-02, 1.0e+01], [4.0e-02, 7.2e-02, 1.0e+01], [4.8e-02, 0.0e+00, 1.0e+01], [4.8e-02, 8.0e-03, 1.0e+01], [4.8e-02, 1.6e-02, 1.0e+01], [4.8e-02, 2.4e-02, 1.0e+01], [4.8e-02, 3.2e-02, 1.0e+01], [4.8e-02, 4.0e-02, 1.0e+01], [4.8e-02, 4.8e-02, 1.0e+01], [4.8e-02, 5.6e-02, 1.0e+01], [4.8e-02, 6.4e-02, 1.0e+01], [4.8e-02, 7.2e-02, 1.0e+01], [5.6e-02, 0.0e+00, 1.0e+01], [5.6e-02, 8.0e-03, 1.0e+01], [5.6e-02, 1.6e-02, 1.0e+01], [5.6e-02, 2.4e-02, 1.0e+01], [5.6e-02, 3.2e-02, 1.0e+01], [5.6e-02, 4.0e-02, 1.0e+01], [5.6e-02, 4.8e-02, 1.0e+01], [5.6e-02, 5.6e-02, 1.0e+01], [5.6e-02, 6.4e-02, 1.0e+01], [5.6e-02, 7.2e-02, 1.0e+01], [6.4e-02, 0.0e+00, 1.0e+01], [6.4e-02, 8.0e-03, 1.0e+01], [6.4e-02, 1.6e-02, 1.0e+01], [6.4e-02, 2.4e-02, 1.0e+01], [6.4e-02, 3.2e-02, 1.0e+01], [6.4e-02, 4.0e-02, 1.0e+01], [6.4e-02, 4.8e-02, 1.0e+01], [6.4e-02, 5.6e-02, 1.0e+01], [6.4e-02, 6.4e-02, 1.0e+01], [6.4e-02, 7.2e-02, 1.0e+01], [7.2e-02, 0.0e+00, 1.0e+01], [7.2e-02, 8.0e-03, 1.0e+01], [7.2e-02, 1.6e-02, 1.0e+01], [7.2e-02, 2.4e-02, 1.0e+01], [7.2e-02, 3.2e-02, 1.0e+01], [7.2e-02, 4.0e-02, 1.0e+01], [7.2e-02, 4.8e-02, 1.0e+01], [7.2e-02, 5.6e-02, 1.0e+01], [7.2e-02, 6.4e-02, 1.0e+01], [7.2e-02, 7.2e-02, 1.0e+01]]) - sample_position()vector3m[0. 0. 0.]
Values:
array([0., 0., 0.]) - source_position()vector3m[ 0. 0. -10.]
Values:
array([ 0., 0., -10.]) - spectrum(spectrum)int321, 2, ..., 199, 200
Values:
array([ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200], dtype=int32) - tof(tof [bin-edge])float64µs2.0, 2.033, ..., 9.839, 10.0
Values:
array([ 2. , 2.03277962, 2.0660965 , 2.09995943, 2.13437737, 2.16935942, 2.20491481, 2.24105295, 2.27778338, 2.31511582, 2.35306014, 2.39162635, 2.43082465, 2.47066541, 2.51115915, 2.55231658, 2.59414857, 2.63666618, 2.67988064, 2.72380338, 2.768446 , 2.81382031, 2.8599383 , 2.90681215, 2.95445425, 3.0028772 , 3.05209379, 3.10211704, 3.15296015, 3.20463657, 3.25715996, 3.3105442 , 3.3648034 , 3.41995189, 3.47600426, 3.53297532, 3.59088012, 3.64973397, 3.70955242, 3.77035129, 3.83214663, 3.8949548 , 3.95879237, 4.02367623, 4.08962353, 4.15665169, 4.22477843, 4.29402175, 4.36439996, 4.43593166, 4.50863574, 4.58253143, 4.65763826, 4.73397607, 4.81156505, 4.8904257 , 4.97057885, 5.0520457 , 5.13484778, 5.21900697, 5.30454551, 5.39148602, 5.47985146, 5.56966519, 5.66095096, 5.75373288, 5.84803548, 5.94388368, 6.04130281, 6.14031863, 6.2409573 , 6.34324541, 6.44721001, 6.55287857, 6.66027901, 6.76943973, 6.88038958, 6.99315787, 7.10777441, 7.22426949, 7.34267391, 7.46301895, 7.58533643, 7.70965867, 7.83601852, 7.96444939, 8.09498522, 8.2276605 , 8.36251031, 8.49957028, 8.63887664, 8.7804662 , 8.92437639, 9.07064524, 9.21931141, 9.37041418, 9.52399351, 9.68008997, 9.83874482, 10. ])
- (spectrum, tof)DataArrayViewbinned data [len=0, len=0, ..., len=0, len=0]
dim='event', content=DataArray( dims=(event: 61), data=float32[counts], coords={'tof':float64[µs], 'pulse_time':datetime64[ns]})
Bin edges in scipp can be created from an arbitrary array with increasing values, the use of numpy.geomspace
is simply one example for generating bins spaced evenly on a log scale.
Note
Both scipp and Mantid support binary and in-place operations such as + and +=. Mantid’s binary operations call underlying algorithms as part of their implementation. This makes it difficult to change some default behaviour, for example if you want to prevent output workspaces from being registered in Mantid’s Analysis Data Service.
Scale (multiplication)#
[34]:
mantid.Scale(
InputWorkspace=input_point_data,
OutputWorkspace=input_point_data,
Factor=7.5,
Operation="Multiply",
)
Scale-[Notice] Scale started
Scale-[Notice] Scale successful, Duration 0.00 seconds
[34]:
Workspace2D
Title: Test Workspace
Histograms: 200
Bins: 100
Data points
X axis: Time-of-flight / microsecond
Y axis: Counts
Distribution: False
Instrument: basic_rect (1990-Jan-01 to 1990-Jan-01)
Run start: 2010-Jan-01 00:00:00
Run end: 2010-Jan-01 01:00:00
Equivalent in scipp:
[35]:
a_scipp['data'] *= 7.5
a_scipp
[35]:
- datascippDataArray(spectrum: 11, tof: 100)float64counts2.25, 2.25, ..., 2.25, 2.25
- samplescippVariable()PyObject<mantid.api._api.Sample object at 0x7f1e7e9e2a40>
- instrument_namestr()basic_rect
- run_titlescippVariable()string𝟙Test Workspace
- start_timescippVariable()string𝟙2010-01-01T00:00:00
- end_timescippVariable()string𝟙2010-01-01T01:00:00
- run_startscippVariable()string𝟙2010-01-01T00:00:00
- run_endscippVariable()string𝟙2010-01-01T01:00:00
Scale (addition)#
[36]:
mantid.Scale(
InputWorkspace=input_point_data,
OutputWorkspace='summed',
Factor=7.5,
Operation="Add",
)
Scale-[Notice] Scale started
Scale-[Notice] Scale successful, Duration 0.00 seconds
[36]:
Workspace2D
Title: Test Workspace
Histograms: 200
Bins: 100
Data points
X axis: Time-of-flight / microsecond
Y axis: Counts
Distribution: False
Instrument: basic_rect (1990-Jan-01 to 1990-Jan-01)
Run start: 2010-Jan-01 00:00:00
Run end: 2010-Jan-01 01:00:00
Equivalent in scipp:
[37]:
a_scipp['data'] += 7.5 * sc.units.counts
a_scipp
[37]:
- datascippDataArray(spectrum: 11, tof: 100)float64counts9.75, 9.75, ..., 9.75, 9.75
- samplescippVariable()PyObject<mantid.api._api.Sample object at 0x7f1e7e9e2a40>
- instrument_namestr()basic_rect
- run_titlescippVariable()string𝟙Test Workspace
- start_timescippVariable()string𝟙2010-01-01T00:00:00
- end_timescippVariable()string𝟙2010-01-01T01:00:00
- run_startscippVariable()string𝟙2010-01-01T00:00:00
- run_endscippVariable()string𝟙2010-01-01T01:00:00
If the data is not dimensionless, the correct unit must be specified:
[38]:
a_scipp['data'].unit = sc.units.us
try:
a_scipp['data'] += 7.5
except RuntimeError as err:
print(str(err))
a_scipp['data'] += 7.5 * sc.units.us # This is fine now RHS has units
Cannot add µs and dimensionless.
Mantid does not have this safety net.
ScaleX#
[39]:
mantid.ScaleX(
InputWorkspace=input_point_data,
OutputWorkspace='output',
Factor=7.5,
Operation="Multiply",
)
ScaleX-[Notice] ScaleX started
[39]:
Workspace2D
Title: Test Workspace
Histograms: 200
Bins: 100
Data points
X axis: Time-of-flight / microsecond
Y axis: Counts
Distribution: False
Instrument: basic_rect (1990-Jan-01 to 1990-Jan-01)
Run start: 2010-Jan-01 00:00:00
Run end: 2010-Jan-01 01:00:00
ScaleX-[Notice] ScaleX successful, Duration 0.00 seconds
Equivalent in scipp:
[40]:
data.coords['tof'] *= 7.5
SumSpectra#
[41]:
mantid.SumSpectra(
InputWorkspace=input_point_data,
OutputWorkspace='summed',
StartWorkspaceIndex=7,
EndWorkspaceIndex=88,
)
SumSpectra-[Notice] SumSpectra started
SumSpectra-[Notice] SumSpectra successful, Duration 0.00 seconds
[41]:
Workspace2D
Title: Test Workspace
Histograms: 1
Bins: 100
Data points
X axis: Time-of-flight / microsecond
Y axis: Counts
Distribution: False
Instrument: basic_rect (1990-Jan-01 to 1990-Jan-01)
Run start: 2010-Jan-01 00:00:00
Run end: 2010-Jan-01 01:00:00
Equivalent in scipp:
[42]:
sc.sum(a_scipp['data']['spectrum', 7:89], 'spectrum')
[42]:
- tof: 100
- sample_position()vector3m[0. 0. 0.]
Values:
array([0., 0., 0.]) - source_position()vector3m[ 0. 0. -10.]
Values:
array([ 0., 0., -10.]) - tof(tof)float64µs100.0, 300.0, ..., 1.970e+04, 1.990e+04
Values:
array([ 100., 300., 500., 700., 900., 1100., 1300., 1500., 1700., 1900., 2100., 2300., 2500., 2700., 2900., 3100., 3300., 3500., 3700., 3900., 4100., 4300., 4500., 4700., 4900., 5100., 5300., 5500., 5700., 5900., 6100., 6300., 6500., 6700., 6900., 7100., 7300., 7500., 7700., 7900., 8100., 8300., 8500., 8700., 8900., 9100., 9300., 9500., 9700., 9900., 10100., 10300., 10500., 10700., 10900., 11100., 11300., 11500., 11700., 11900., 12100., 12300., 12500., 12700., 12900., 13100., 13300., 13500., 13700., 13900., 14100., 14300., 14500., 14700., 14900., 15100., 15300., 15500., 15700., 15900., 16100., 16300., 16500., 16700., 16900., 17100., 17300., 17500., 17700., 17900., 18100., 18300., 18500., 18700., 18900., 19100., 19300., 19500., 19700., 19900.])
- (tof)float64µs69.0, 69.0, ..., 69.0, 69.0σ = 8.216, 8.216, ..., 8.216, 8.216
Values:
array([ 69., 69., 69., 69., 69., 69., 69., 69., 69., 69., 69., 69., 69., 69., 69., 69., 69., 69., 69., 69., 69., 69., 69., 69., 69., 69., 69., 69., 69., 69., 69., 69., 69., 69., 69., 69., 69., 69., 69., 69., 69., 69., 69., 69., 69., 69., 69., 69., 69., 69., 369., 69., 69., 69., 69., 69., 69., 69., 69., 69., 69., 69., 69., 69., 69., 69., 69., 69., 69., 69., 69., 69., 69., 69., 69., 69., 69., 69., 69., 69., 69., 69., 69., 69., 69., 69., 69., 69., 69., 69., 69., 69., 69., 69., 69., 69., 69., 69., 69., 69.])
Variances (σ²):
array([ 67.5, 67.5, 67.5, 67.5, 67.5, 67.5, 67.5, 67.5, 67.5, 67.5, 67.5, 67.5, 67.5, 67.5, 67.5, 67.5, 67.5, 67.5, 67.5, 67.5, 67.5, 67.5, 67.5, 67.5, 67.5, 67.5, 67.5, 67.5, 67.5, 67.5, 67.5, 67.5, 67.5, 67.5, 67.5, 67.5, 67.5, 67.5, 67.5, 67.5, 67.5, 67.5, 67.5, 67.5, 67.5, 67.5, 67.5, 67.5, 67.5, 67.5, 2317.5, 67.5, 67.5, 67.5, 67.5, 67.5, 67.5, 67.5, 67.5, 67.5, 67.5, 67.5, 67.5, 67.5, 67.5, 67.5, 67.5, 67.5, 67.5, 67.5, 67.5, 67.5, 67.5, 67.5, 67.5, 67.5, 67.5, 67.5, 67.5, 67.5, 67.5, 67.5, 67.5, 67.5, 67.5, 67.5, 67.5, 67.5, 67.5, 67.5, 67.5, 67.5, 67.5, 67.5, 67.5, 67.5, 67.5, 67.5, 67.5, 67.5])
Neutron-scattering specific algorithms#
ConvertUnits#
[43]:
mantid.ConvertUnits(
InputWorkspace=input_point_data, OutputWorkspace='dspacing', Target='dSpacing'
)
ConvertUnits-[Notice] ConvertUnits started
ConvertUnits-[Warning] Unable to calculate sample-detector distance for 2 spectra. Masking spectrum.
ConvertUnits-[Notice] ConvertUnits successful, Duration 0.00 seconds
[43]:
Workspace2D
Title: Test Workspace
Histograms: 200
Bins: 100
Data points
X axis: d-Spacing / Angstrom
Y axis: Counts
Distribution: False
Instrument: basic_rect (1990-Jan-01 to 1990-Jan-01)
Run start: 2010-Jan-01 00:00:00
Run end: 2010-Jan-01 01:00:00
Equivalent in scipp:
[44]:
dspacing_graph = {
**scn.conversion.graph.beamline.beamline(scatter=True),
**scn.conversion.graph.tof.elastic_dspacing('tof'),
}
[45]:
a_scipp['data'].transform_coords('dspacing', graph=dspacing_graph)
[45]:
- spectrum: 11
- dspacing: 100
- L1()float64m10.0
Values:
array(10.) - L2(spectrum)float64m5.0, 5.000, ..., 5.001, 5.000
Values:
array([5. , 5.0000064 , 5.0000256 , 5.0000576 , 5.0001024 , 5.00016 , 5.00023039, 5.00031359, 5.00040958, 5.00051837, 5.0000064 ]) - Ltotal(spectrum)float64m15.0, 15.000, ..., 15.001, 15.000
Values:
array([15. , 15.0000064 , 15.0000256 , 15.0000576 , 15.0001024 , 15.00016 , 15.00023039, 15.00031359, 15.00040958, 15.00051837, 15.0000064 ]) - dspacing(spectrum, dspacing)float64Åinf, inf, ..., 3247.246, 3280.213
Values:
array([[ inf, inf, inf, ..., inf, inf, inf], [1.64834838e+01, 4.94504515e+01, 8.24174192e+01, ..., 3.21427935e+03, 3.24724632e+03, 3.28021328e+03], [8.24175511e+00, 2.47252653e+01, 4.12087755e+01, ..., 1.60714225e+03, 1.62362576e+03, 1.64010927e+03], ..., [2.06050471e+00, 6.18151412e+00, 1.03025235e+01, ..., 4.01798418e+02, 4.05919427e+02, 4.10040436e+02], [1.83157634e+00, 5.49472902e+00, 9.15788171e+00, ..., 3.57157387e+02, 3.60820539e+02, 3.64483692e+02], [1.64834838e+01, 4.94504515e+01, 8.24174192e+01, ..., 3.21427935e+03, 3.24724632e+03, 3.28021328e+03]]) - incident_beam()vector3m[ 0. 0. 10.]
Values:
array([ 0., 0., 10.]) - position(spectrum)vector3m[0. 0. 5.], [0. 0.008 5. ], ..., [0. 0.072 5. ], [0.008 0. 5. ]
Values:
array([[0. , 0. , 5. ], [0. , 0.008, 5. ], [0. , 0.016, 5. ], [0. , 0.024, 5. ], [0. , 0.032, 5. ], [0. , 0.04 , 5. ], [0. , 0.048, 5. ], [0. , 0.056, 5. ], [0. , 0.064, 5. ], [0. , 0.072, 5. ], [0.008, 0. , 5. ]]) - sample_position()vector3m[0. 0. 0.]
Values:
array([0., 0., 0.]) - scattered_beam(spectrum)vector3m[0. 0. 5.], [0. 0.008 5. ], ..., [0. 0.072 5. ], [0.008 0. 5. ]
Values:
array([[0. , 0. , 5. ], [0. , 0.008, 5. ], [0. , 0.016, 5. ], [0. , 0.024, 5. ], [0. , 0.032, 5. ], [0. , 0.04 , 5. ], [0. , 0.048, 5. ], [0. , 0.056, 5. ], [0. , 0.064, 5. ], [0. , 0.072, 5. ], [0.008, 0. , 5. ]]) - source_position()vector3m[ 0. 0. -10.]
Values:
array([ 0., 0., -10.]) - spectrum(spectrum)int321, 2, ..., 10, 11
Values:
array([ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11], dtype=int32) - tof(dspacing)float64µs100.0, 300.0, ..., 1.970e+04, 1.990e+04
Values:
array([ 100., 300., 500., 700., 900., 1100., 1300., 1500., 1700., 1900., 2100., 2300., 2500., 2700., 2900., 3100., 3300., 3500., 3700., 3900., 4100., 4300., 4500., 4700., 4900., 5100., 5300., 5500., 5700., 5900., 6100., 6300., 6500., 6700., 6900., 7100., 7300., 7500., 7700., 7900., 8100., 8300., 8500., 8700., 8900., 9100., 9300., 9500., 9700., 9900., 10100., 10300., 10500., 10700., 10900., 11100., 11300., 11500., 11700., 11900., 12100., 12300., 12500., 12700., 12900., 13100., 13300., 13500., 13700., 13900., 14100., 14300., 14500., 14700., 14900., 15100., 15300., 15500., 15700., 15900., 16100., 16300., 16500., 16700., 16900., 17100., 17300., 17500., 17700., 17900., 18100., 18300., 18500., 18700., 18900., 19100., 19300., 19500., 19700., 19900.]) - two_theta(spectrum)float64rad0.0, 0.002, ..., 0.014, 0.002
Values:
array([0. , 0.0016 , 0.00319999, 0.00479996, 0.00639991, 0.00799983, 0.00959971, 0.01119953, 0.0127993 , 0.014399 , 0.0016 ])
- (spectrum, dspacing)float64µs17.25, 17.25, ..., 17.25, 17.25σ = 4.108, 4.108, ..., 4.108, 4.108
Values:
array([[17.25, 17.25, 17.25, ..., 17.25, 17.25, 17.25], [17.25, 17.25, 17.25, ..., 17.25, 17.25, 17.25], [17.25, 17.25, 17.25, ..., 17.25, 17.25, 17.25], ..., [17.25, 17.25, 17.25, ..., 17.25, 17.25, 17.25], [17.25, 17.25, 17.25, ..., 17.25, 17.25, 17.25], [17.25, 17.25, 17.25, ..., 17.25, 17.25, 17.25]])
Variances (σ²):
array([[16.875, 16.875, 16.875, ..., 16.875, 16.875, 16.875], [16.875, 16.875, 16.875, ..., 16.875, 16.875, 16.875], [16.875, 16.875, 16.875, ..., 16.875, 16.875, 16.875], ..., [16.875, 16.875, 16.875, ..., 16.875, 16.875, 16.875], [16.875, 16.875, 16.875, ..., 16.875, 16.875, 16.875], [16.875, 16.875, 16.875, ..., 16.875, 16.875, 16.875]])
Note
scipp has no equivalent to the EMode
and EFixed
settings of ConvertUnits
. Instead, this information is read from the input data, if available (note that currently only elastic scattering is supported).
Note
The scippneutron
module also provides a to_mantid
function, which has limited support for converting scipp data to Mantid workspaces. Because scipp offers a more flexible container than a Workspace, in particular MatrixWorkspace, it is not always possible to exactly convert all information to Mantid workspaces.