\(\renewcommand\AA{\unicode{x212B}}\)
ReflectometrySliceEventWorkspace v1¶
Summary¶
Split an input workspace into multiple slices according to time or log values
See Also¶
GenerateEventsFilter, FilterEvents, ReflectometryReductionOneAuto
Properties¶
Name |
Direction |
Type |
Default |
Description |
---|---|---|---|---|
InputWorkspace |
Input |
Mandatory |
An input Matrix workspace. |
|
StartTime |
Input |
string |
The start time, such that all events before this time are filtered out: it could be (1) relative time to run start time in unit as specified property ‘UnitOfTime’ (2) absolute time Absolute time takes a string in format as 1990-01-01T00:00:00, while the relative time takes a string representing an integer or a floating-point number. |
|
StopTime |
Input |
string |
The stop time, such that all events after this time are filtered out: it could be (1) relative time to run start time in unit as specified property ‘UnitOfTime’ (2) absolute time Absolute time takes a string in format as 1990-01-01T00:00:00, while the relative time takes a string representing an integer or a floating-point number. |
|
TimeInterval |
Input |
dbl list |
Array for lengths of time intervals for splitters: if the array is empty, then there will be one splitter created from StartTime and StopTime; if the array has one value, then if this value is positive, all splitters will have same time intervals, else the time intervals will be exponentially increasing; if the size of the array is larger than one, then the splitters can have various time interval values. |
|
LogName |
Input |
string |
Name of the sample log to use to filter - for example, the pulse charge is recorded in ‘ProtonCharge’. |
|
MinimumLogValue |
Input |
number |
Optional |
Minimum log value for which to keep events. |
MaximumLogValue |
Input |
number |
Optional |
Maximum log value for which to keep events. |
LogValueInterval |
Input |
number |
Optional |
Delta of log value to be sliced into from min log value and max log value; if not given, then only value |
LogBoundary |
Input |
string |
Centre |
How to treat log values as being measured in the centre of time. There are three options, ‘Centre’, ‘Left’ and ‘Other’. This value must be set to Left if the sample log is recorded upon changing,which applies to most of the sample environment devices in SNS. Allowed values: [‘Centre’, ‘Left’, ‘Other’] |
LogValueTolerance |
Input |
number |
Optional |
Tolerance of the log value to be included in filter, used in the case to filter by multiple values. |
MonitorWorkspace |
Input |
Mandatory |
Input monitor workspace |
|
OutputWorkspace |
Output |
WorkspaceGroup |
Mandatory |
Group name for the output workspace(s). |
UseNewFilterAlgorithm |
Input |
boolean |
True |
If true, use the new FilterEvents algorithm instead of FilterByTime. |
ReflectometrySliceEventWorkspace¶
This algorithm slices an input workspace into one or more grouped output workspaces based on input filtering properties.
It uses GenerateEventsFilter v1 to define the way splitting should be done and exposes the relevant input properties for that algorithm. It then performs the filtering using FilterEvents v1.
The sliced workspaces are then rebinned to histogram data and combined with the given monitor workspace, to produce a workspace suitable for input to ReflectometryReductionOneAuto v3. The monitors for each slice are scaled according to the percentage of proton_charge
in that slice.
Usage¶
Example: slice by time interval
input_ws = CreateSampleWorkspace("Event",BankPixelWidth=1,BinWidth=20000)
AddTimeSeriesLog(input_ws, Name="proton_charge", Time="2010-01-01T00:00:00", Value=100)
AddTimeSeriesLog(input_ws, Name="proton_charge", Time="2010-01-01T00:10:00", Value=100)
AddTimeSeriesLog(input_ws, Name="proton_charge", Time="2010-01-01T00:20:00", Value=80)
AddTimeSeriesLog(input_ws, Name="proton_charge", Time="2010-01-01T00:30:00", Value=80)
AddTimeSeriesLog(input_ws, Name="proton_charge", Time="2010-01-01T00:40:00", Value=15)
AddTimeSeriesLog(input_ws, Name="proton_charge", Time="2010-01-01T00:50:00", Value=100)
monitor_ws = CreateSampleWorkspace(NumBanks=0, NumMonitors=3, BankPixelWidth=1, NumEvents=10000)
output = ReflectometrySliceEventWorkspace(InputWorkspace=input_ws, MonitorWorkspace=monitor_ws,
TimeInterval=600, StartTime='1800', StopTime='3300')
print(str(output.getNumberOfEntries()) + ' slices')
print(str(output[0].getNumberHistograms()) + ' spectra')
print('Y values for first bin:')
for i in range(output.getNumberOfEntries()):
print('Slice ' + str(i))
for j in range(output[i].getNumberHistograms()):
print('{:.8f}'.format(output[i].dataY(j)[0]))
Output:
3 slices
5 spectra
Y values for first bin:
Slice 0
0.05052632
0.05052632
0.05052632
4.00000000
4.00000000
Slice 1
0.00947368
0.00947368
0.00947368
4.00000000
4.00000000
Slice 2
0.06315789
0.06315789
0.06315789
1.00000000
1.00000000
Categories: AlgorithmIndex | Reflectometry