def _slice(self, state, workspace, monitor_workspace, data_type_as_string): returned = slice_sans_event(state_slice=state.slice, input_ws=workspace, input_ws_monitor=monitor_workspace, data_type_str=data_type_as_string) workspace = returned["OutputWorkspace"] monitor_workspace = returned["OutputWorkspaceMonitor"] slice_event_factor = returned["SliceEventFactor"] return workspace, monitor_workspace, slice_event_factor
def test_that_event_workspace_of_isis_instrument_is_sliced(self): workspace, monitor_workspace = self._provide_workspaces(is_event=True) state = self._get_state(start_time=[1.0], end_time=[3.0]) returned = slice_sans_event(state_slice=state.slice, input_ws=workspace, input_ws_monitor=monitor_workspace) output_workspace = returned["OutputWorkspace"] output_workspace_monitor = returned["OutputWorkspaceMonitor"] slice_factor = returned["SliceEventFactor"] self.assertEqual(slice_factor, 0.2) self.assertLess(output_workspace.getNumberEvents(), workspace.getNumberEvents()) self.assertLess(output_workspace_monitor.dataY(0)[0], monitor_workspace.dataY(0)[0])
def test_that_histogram_workspace_is_not_sliced(self): workspace, monitor_workspace = self._provide_workspaces(is_event=False) state = self._get_state(start_time=[1.0], end_time=[2.0]) returned = slice_sans_event(state_slice=state.slice, input_ws=workspace, input_ws_monitor=monitor_workspace) output_workspace = returned["OutputWorkspace"] output_workspace_monitor = returned["OutputWorkspaceMonitor"] slice_factor = returned["SliceEventFactor"] # We expect a scale factor of 1 and an output workspace which is Workspace2D self.assertEqual(slice_factor, 1.0) self.assertTrue(isinstance(output_workspace, Workspace2D)) self.assertTrue(isinstance(output_workspace_monitor, Workspace2D))