def _scale(self, state, workspace): instrument = state.data.instrument output_ws = scale_workspace(workspace=workspace, instrument=instrument, state_scale=state.scale) return output_ws
def _scale(self, state, ws_list: WsList): instrument = state.data.instrument for key, ws in ws_list.items(): output_ws = scale_workspace(instrument=instrument, state_scale=state.scale, workspace=ws) ws_list[key] = output_ws return ws_list
def test_that_scales_the_workspace_correctly(self): workspace = self._get_workspace() width = 1.0 height = 2.0 scale = 7.2 state = self._get_sample_state(width=width, height=height, thickness=3.0, scale=scale, shape=SampleShape.CYLINDER) output_workspace = scale_workspace(workspace=workspace, instrument=SANSInstrument.LOQ, state_scale=state.scale) # We have a LOQ data set, hence we need to divide by pi expected_value = 0.3 / (height * math.pi * math.pow(width, 2) / 4.0) * (scale / math.pi) * 100. data_y = output_workspace.dataY(0) tolerance = 1e-7 self.assertTrue(abs(data_y[0] - expected_value) < tolerance)