Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

941 append scaling to ws name #951

Open
wants to merge 20 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
ab02ddf
Introduced class that appends to suffixes to workspaces
GuiMacielPereira Oct 10, 2023
29ded70
Removed commented out sections
GuiMacielPereira Oct 10, 2023
1719bff
Changed main ws operations and started looking into hidden ws
GuiMacielPereira Nov 7, 2023
0f687d3
Changed methods to suitable variable names
GuiMacielPereira Nov 9, 2023
a6b9d1b
Removed artifact comment
GuiMacielPereira Nov 9, 2023
5a703ca
Changed naming of scaling ws and added two more methods
GuiMacielPereira Nov 10, 2023
b9b4a0c
Updated unit tests
GuiMacielPereira Nov 10, 2023
37beb37
Fixed ws names for scaling
GuiMacielPereira Nov 13, 2023
633ea86
Merge branch 'main' into 941_append_scaling_to_ws_name
GuiMacielPereira Nov 13, 2023
fda5254
Fixed artifacts from merge
GuiMacielPereira Nov 13, 2023
83ba1b2
Fixed long line and removed unused import
GuiMacielPereira Nov 13, 2023
f2b2527
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 13, 2023
abdb380
Fixed missing blank line
GuiMacielPereira Nov 13, 2023
4e214dc
Updated class for clearer usability
GuiMacielPereira Jan 10, 2024
9883cf5
Fixed Flake8 issues
GuiMacielPereira Jan 10, 2024
84d3fe7
Revert "Fixed Flake8 issues"
GuiMacielPereira Jan 10, 2024
dfe981a
Corrected fix for flake8 issues
GuiMacielPereira Jan 10, 2024
9a68e1a
Merge branch 'main' into 941_append_scaling_to_ws_name
GuiMacielPereira Jan 11, 2024
f29879e
Updated a recent commit to use the new ws name format
GuiMacielPereira Jan 11, 2024
2b12bdc
Removed outdated comment
GuiMacielPereira Jan 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/mslice/cli/_mslice_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from mslice.cli.helperfunctions import (_string_to_integration_axis, _process_axis, _check_workspace_name,
_check_workspace_type, _correct_intensity)
from mslice.workspace.pixel_workspace import PixelWorkspace
from mslice.workspace.helperfunctions import WorkspaceNameHandler
from mslice.util.qt.qapp import QAppThreadCall, mainloop
from six import string_types
from mslice.workspace.histogram_workspace import HistogramWorkspace
Expand Down Expand Up @@ -87,7 +88,7 @@ def Load(Filename, OutputWorkspace=None):
if OutputWorkspace is not None:
old_name = ospath.splitext(ospath.basename(Filename))[0]
if merge:
old_name = old_name + '_merged'
old_name = WorkspaceNameHandler(old_name).merged()
name = rename_workspace(workspace=old_name, new_name=OutputWorkspace).name

return get_workspace_handle(name)
Expand Down
7 changes: 4 additions & 3 deletions src/mslice/models/cut/cut_algorithm.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from mslice.models.units import EnergyUnits
from mslice.workspace.helperfunctions import attribute_to_log
from .cut_normalisation import normalize_workspace
from mslice.workspace.helperfunctions import WorkspaceNameHandler


class Cut(PythonAlgorithm):
Expand Down Expand Up @@ -87,17 +88,17 @@ def _compute_cut_nonPSD(selected_workspace, cut_axis, integration_axis, emode, a
integration_axis.end_meV)))
idx = 0 if 'Rebin' in algo else 1
unit = 'DeltaE'
name = '__MSL_EnergyTransfer'
name = WorkspaceNameHandler('_EnergyTransfer').hideMslInAds()
if is_momentum(cut_axis.units):
ws_out = _cut_nonPSD_momentum(cut_binning, int_binning, emode, selected_workspace, algo)
idx = 1
unit = 'MomentumTransfer'
name = '__MSL_|Q|'
name = WorkspaceNameHandler('_|Q|').hideMslInAds()
elif is_twotheta(cut_axis.units):
ws_out = _cut_nonPSD_theta(int_binning, cut_binning, selected_workspace, algo)
idx = 1 if 'Rebin' in algo else 0
unit = 'Degrees'
name = '__MSL_Theta'
name = WorkspaceNameHandler('_Theta').hideMslInAds()
elif integration_axis.units == '|Q|':
ws_out = _cut_nonPSD_momentum(int_binning, cut_binning, emode, selected_workspace, algo)
else:
Expand Down
3 changes: 2 additions & 1 deletion src/mslice/models/intensity_correction_algs.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from mslice.models.cut.cut_algorithm import _cut_nonPSD_general
from math import trunc, ceil

from mslice.workspace.helperfunctions import WorkspaceNameHandler

KB_MEV = constants.value('Boltzmann constant in eV/K') * 1000
E_TO_K = np.sqrt(2 * constants.neutron_mass * constants.elementary_charge / 1000) / constants.hbar
Expand Down Expand Up @@ -141,7 +142,7 @@ def _cut_compute_gdos(scattering_data, sample_temp, q_axis, e_axis, rotated, nor
def _cut_compute_gdos_pixel(scattering_data, sample_temp, q_axis, e_axis, rotated, norm_to_one, algorithm, is_icut):
pixel_ws = get_workspace_handle(scattering_data.parent)
if is_icut:
slice_ws = get_workspace_handle("__" + scattering_data.parent)
slice_ws = get_workspace_handle(WorkspaceNameHandler(scattering_data.parent).hideInAds())
slice_rotated = not _is_momentum_or_two_theta(slice_ws.raw_ws.getXDimension().getUnits()) # fn arg rotated refers to cut.
else:
slice_rotated = not _is_momentum_or_two_theta(pixel_ws.raw_ws.getXDimension().getUnits()) # no pre existing slice, use pixel ws.
Expand Down
3 changes: 2 additions & 1 deletion src/mslice/models/slice/slice_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@

from mslice.workspace.pixel_workspace import PixelWorkspace
from mslice.workspace.workspace import Workspace
from mslice.workspace.helperfunctions import WorkspaceNameHandler


def compute_slice(selected_workspace, x_axis, y_axis, norm_to_one, store_in_ADS=True):
workspace = get_workspace_handle(selected_workspace)
slice = mantid_algorithms.Slice(OutputWorkspace='__' + workspace.name, InputWorkspace=workspace,
slice = mantid_algorithms.Slice(OutputWorkspace=WorkspaceNameHandler(workspace.name).hideInAds(), InputWorkspace=workspace,
XAxis=x_axis.to_dict(), YAxis=y_axis.to_dict(), PSD=workspace.is_PSD,
EMode=workspace.e_mode, NormToOne=norm_to_one, StoreInADS=store_in_ADS)
propagate_properties(workspace, slice)
Expand Down
18 changes: 10 additions & 8 deletions src/mslice/models/workspacemanager/workspace_algorithms.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
from mslice.workspace.pixel_workspace import PixelWorkspace
from mslice.workspace.histogram_workspace import HistogramWorkspace
from mslice.workspace.workspace import Workspace
from mslice.workspace.helperfunctions import WorkspaceNameHandler

from .file_io import save_ascii, save_matlab, save_nexus, save_nxspe

Expand Down Expand Up @@ -198,27 +199,27 @@ def combine_workspace(selected_workspaces, new_name):


def add_workspace_runs(selected_ws):
out_ws_name = selected_ws[0] + '_sum'
sum_ws = MergeRuns(OutputWorkspace=out_ws_name, InputWorkspaces=selected_ws)
sum_ws = MergeRuns(OutputWorkspace=WorkspaceNameHandler(selected_ws[0]).summed(),
InputWorkspaces=selected_ws)
propagate_properties(get_workspace_handle(selected_ws[0]), sum_ws)


def subtract(workspaces, background_ws, ssf):
scaled_bg_ws = Scale(OutputWorkspace=str(background_ws) + '_scaled',
scaled_bg_ws = Scale(OutputWorkspace=WorkspaceNameHandler(background_ws).scaled(ssf),
InputWorkspace=str(background_ws), Factor=ssf, store=False)
try:
for ws_name in workspaces:
result = Minus(OutputWorkspace=ws_name + '_subtracted', LHSWorkspace=ws_name,
RHSWorkspace=scaled_bg_ws)
result = Minus(OutputWorkspace=WorkspaceNameHandler(ws_name).subtracted(ssf),
LHSWorkspace=ws_name, RHSWorkspace=scaled_bg_ws)
propagate_properties(get_workspace_handle(ws_name), result)
except ValueError as e:
raise ValueError(e)


def rebose_single(ws, from_temp, to_temp):
ws = get_workspace_handle(ws)
results = Rebose(InputWorkspace=ws, CurrentTemperature=from_temp, TargetTemperature=to_temp,
OutputWorkspace=ws.name+'_bosed')
results = Rebose(OutputWorkspace=WorkspaceNameHandler(ws.name).rebosed(),
InputWorkspace=ws, CurrentTemperature=from_temp, TargetTemperature=to_temp)
propagate_properties(ws, results)
return results

Expand All @@ -232,7 +233,8 @@ def scale_workspaces(workspaces, scale_factor=None, from_temp=None, to_temp=None
else:
for ws_name in workspaces:
ws = get_workspace_handle(ws_name)
result = Scale(InputWorkspace=ws.raw_ws, Factor=scale_factor, OutputWorkspace=ws_name+'_scaled')
result = Scale(OutputWorkspace=WorkspaceNameHandler(ws_name).scaled(scale_factor),
InputWorkspace=ws.raw_ws, Factor=scale_factor)
propagate_properties(ws, result)


Expand Down
3 changes: 2 additions & 1 deletion src/mslice/presenters/data_loader_presenter.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from mslice.presenters.interfaces.data_loader_presenter import DataLoaderPresenterInterface
from mslice.presenters.presenter_utility import PresenterUtility
from mslice.models.workspacemanager.file_io import load_from_ascii
from mslice.workspace.helperfunctions import WorkspaceNameHandler


def apply_fixed_final_energy_to_a_valid_workspace(workspace_name, fixed_final_energy: float):
Expand Down Expand Up @@ -39,7 +40,7 @@ def load_workspace(self, file_paths, merge=False, force_overwrite=False):
if not self.file_types_match(file_paths):
self._view.error_merge_different_file_formats()
return
ws_names = [ws_names[0] + '_merged']
ws_names = [WorkspaceNameHandler(ws_names[0]).merged()]
file_paths = ['+'.join(file_paths)]
self._load_ws(file_paths, ws_names, force_overwrite)

Expand Down
7 changes: 4 additions & 3 deletions src/mslice/presenters/slice_plotter_presenter.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from mslice.models.workspacemanager.workspace_provider import get_workspace_handle
from mslice.plotting.plot_window.overplot_interface import plot_overplot_line, remove_line
from mslice.presenters.presenter_utility import PresenterUtility
from mslice.workspace.helperfunctions import WorkspaceNameHandler


class SlicePlotterPresenter(PresenterUtility):
Expand All @@ -31,19 +32,19 @@ def create_slice(self, selected_ws, x_axis, y_axis, intensity_start, intensity_e
return slice

def plot_from_cache(self, workspace):
ws_name = workspace.name.lstrip('__')
ws_name = WorkspaceNameHandler(workspace.name).makeVisibleInAds()
create_slice_figure(ws_name, self)
self.show_scattering_function(ws_name)

def change_intensity(self, workspace_name, intensity_start, intensity_end):
workspace_name = workspace_name.lstrip('__')
workspace_name = WorkspaceNameHandler(workspace_name).makeVisibleInAds()
intensity_start, intensity_end = self.validate_intensity(intensity_start, intensity_end)
norm = Normalize(vmin=intensity_start, vmax=intensity_end)
self._slice_cache[workspace_name].norm = norm

def change_colourmap(self, workspace_name, colourmap):
if colourmap in ALLOWED_CMAPS:
workspace_name = workspace_name.lstrip('__')
workspace_name = WorkspaceNameHandler(workspace_name).makeVisibleInAds()
self._slice_cache[workspace_name].colourmap = colourmap
else:
raise ValueError('colourmap not recognised')
Expand Down
3 changes: 2 additions & 1 deletion src/mslice/presenters/workspace_manager_presenter.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from six import string_types

from .busy import show_busy
from mslice.workspace.helperfunctions import WorkspaceNameHandler
from mslice.widgets.workspacemanager.command import Command
from mslice.widgets.workspacemanager import TAB_2D, TAB_NONPSD
from mslice.models.workspacemanager.file_io import get_save_directory
Expand Down Expand Up @@ -141,7 +142,7 @@ def _combine_workspace(self):
return
elif len(selected_workspaces) == 1:
selected_workspaces.append(str(self._workspace_manager_view.add_workspace_dialog()))
new_workspace = selected_workspaces[0] + '_combined'
new_workspace = WorkspaceNameHandler(selected_workspaces[0]).combined()
if all([is_pixel_workspace(workspace) for workspace in selected_workspaces]):
combine_workspace(selected_workspaces, new_workspace)
else:
Expand Down
9 changes: 6 additions & 3 deletions src/mslice/scripting/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from mslice.models.workspacemanager.workspace_provider import get_workspace_handle
from mslice.scripting.helperfunctions import add_plot_statements, replace_ws_special_chars
from mslice.app.presenters import get_cut_plotter_presenter
from mslice.workspace.helperfunctions import WorkspaceNameHandler
from six import string_types


Expand Down Expand Up @@ -76,12 +77,14 @@ def _parse_prop(prop):
pname = prop.name()
hidden = False
output_ws = None

if isinstance(pval, string_types):
pval = pval.replace("__MSL", "").replace("_HIDDEN", "")
pval = WorkspaceNameHandler(pval).removeHideFlags()

if prop.name() == "OutputWorkspace":
output_ws = replace_ws_special_chars(pval)
if "_HIDDEN" in prop.value():
hidden = True
hidden = WorkspaceNameHandler(prop.value()).isHiddenFromMsl()

return pname, pval, output_ws, hidden


Expand Down
3 changes: 2 additions & 1 deletion src/mslice/util/mantid/_workspace_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from mantid.api._workspaceops import _do_binary_operation
from mantid.kernel.funcinspect import lhs_info
from mslice.workspace.workspace import WorkspaceOperatorMixin
from mslice.workspace.helperfunctions import WorkspaceNameHandler

_binary_operator_map = {
"Plus": operator.add,
Expand Down Expand Up @@ -65,7 +66,7 @@ def op_wrapper(self, other):
result_info = lhs_info()
# Replace output workspace name with a unique temporary name hidden in ADS
if result_info[0] > 0:
result_info = (result_info[0], ('__MSLTMP' + str(uuid4())[:8],) + result_info[1][1:])
result_info = (result_info[0], (WorkspaceNameHandler(str(uuid4())[:8]).hideTmpMslInAds(),) + result_info[1][1:])
return _binary_op(self, other, algorithm, result_info, inplace, reverse)

op_wrapper.__name__ = attr
Expand Down
18 changes: 11 additions & 7 deletions src/mslice/util/mantid/algorithm_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
from mslice.workspace.base import WorkspaceBase as MsliceWorkspace
from mslice.workspace.workspace import Workspace as MsliceWorkspace2D

from mslice.workspace.helperfunctions import WorkspaceNameHandler


def _parse_ws_names(args, kwargs):
input_workspace = kwargs.get('InputWorkspace', None)
Expand All @@ -20,9 +22,7 @@ def _parse_ws_names(args, kwargs):
input_workspace = get_workspace_handle(args[0])
args = (_name_or_wrapper_to_workspace(args[0]),) + args[1:]

output_name = ''
if 'OutputWorkspace' in kwargs:
output_name = kwargs.pop('OutputWorkspace')
output_name = kwargs.pop('OutputWorkspace', '')

for key in kwargs.keys():
if input_workspace is None and 'LHS' in key:
Expand All @@ -49,14 +49,18 @@ def alg_wrapper(*args, **kwargs):
kwargs['InputWorkspaces'] = [_name_or_wrapper_to_workspace(arg) for arg in kwargs['InputWorkspaces']]

for ky in [k for k in kwargs.keys() if 'Workspace' in k]:
if isinstance(kwargs[ky], string_types) and '__MSL' not in kwargs[ky]:
if isinstance(kwargs[ky], string_types) and not WorkspaceNameHandler(kwargs[ky]).isMslHiddenInAds():
kwargs[ky] = _name_or_wrapper_to_workspace(kwargs[ky])

if _alg_has_outputws(algorithm):
ads_name = '__MSL' + output_name if output_name else '__MSLTMP' + str(uuid4())[:8]
if output_name:
ads_name = WorkspaceNameHandler(output_name).hideMslInAds()
else:
ads_name = WorkspaceNameHandler(str(uuid4())[:8]).hideTmpMslInAds()

store = kwargs.pop('store', True)
if not store:
ads_name += '_HIDDEN'
ads_name = WorkspaceNameHandler(ads_name).hideFromMsl()
result = algorithm(*args, OutputWorkspace=ads_name, **kwargs)
else:
result = algorithm(*args, **kwargs)
Expand Down Expand Up @@ -93,5 +97,5 @@ def add_to_ads(workspaces):
except TypeError:
workspaces = [workspaces]
for workspace in workspaces:
startid = (5 if workspace.name.startswith('__mat') else 2) if workspace.name.startswith('__') else 0
startid = (5 if workspace.name.startswith('__mat') else 2) if WorkspaceNameHandler(workspace.name).isHiddenInAds() else 0
AnalysisDataService.Instance().addOrReplace(workspace.name[startid:], workspace.raw_ws)
60 changes: 58 additions & 2 deletions src/mslice/workspace/helperfunctions.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import pickle
import codecs

from mantid.simpleapi import DeleteWorkspace, RenameWorkspace


Expand Down Expand Up @@ -85,7 +84,7 @@ def attribute_to_log(attrdict, raw_ws, append=False):

def delete_workspace(workspace, ws):
try:
if hasattr(workspace, str(ws)) and ws is not None and ws.name().endswith('_HIDDEN'):
if hasattr(workspace, str(ws)) and ws is not None and WorkspaceNameHandler(ws.name()).isHiddenFromMsl():
DeleteWorkspace(ws)
ws = None
except RuntimeError:
Expand Down Expand Up @@ -116,3 +115,60 @@ def __exit__(self, exc_type, exc_val, exc_tb):
if self.workspace:
self.workspace.remove_saved_attributes()
return True


class WorkspaceNameHandler:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm surprised there are so many options! I don't think it's ideal to have a separate function for each combination of functions. It's plausible in the future we have to add more, and therefore the number of combination functions will increase exponentially.

I wonder if it's a good idea to instead have a WorkspaceNameOptions class, that has a constructor that default sets everything to false via named arguments.

We could then do a combination of functions by doing:
WorkspaceNameHandler.set_workspace_options(workspace.name, WorkSpaceOptions(hidden_from_mslice=True, hidden_from_ADS=True))

You would then only need individual functions in the WorkspaceNameHandler class, and these would not have to be exposed.

Perhaps when checking we could then do:
WorkspaceNameHandler.assert_workspace_options(workspace, WorkspaceOptions(hidden_from_mslice=True, hidden_from_ADS=True)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have now implemented these suggestions, but instead of creating and entirely separate WorkspaceOptions class, I preferred to opt for two methods get_name and assert_name that mimicks this. So in this case one would do WorkspaceNameHandler(workspace.name).get_name(hidden_from_mslice=True, hidden_from_ADS=True and WorkspaceNameHandler(workspace.name).assert_name(hidden_from_mslice=True, hiddden_from_ADS=True).


def __init__(self, ws_name: str):
self.ws_name = ws_name

def add_prefix(self, prefix) -> str:
return prefix + self.ws_name

def add_sufix(self, sufix) -> str:
return self.ws_name + sufix

def scaled(self, scaling_factor: float) -> str:
return self.add_sufix("_ssf_" + f"{scaling_factor:.2f}".replace('.', '_'))

def subtracted(self, scaling_factor: float) -> str:
return self.add_sufix("_minus_ssf_" + f"{scaling_factor:.2f}".replace('.', '_'))

def summed(self) -> str:
return self.add_sufix("_sum")

def rebosed(self) -> str:
return self.add_sufix('_bosed')

def combined(self) -> str:
return self.add_sufix('_combined')

def merged(self) -> str:
return self.add_sufix('_merged')

def isHiddenFromMsl(self) -> bool:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You've swapped from snake case to camel case here, worth having a flick through these if you haven't already: https://developer.mantidproject.org/Standards/PythonStandards.html

return '_HIDDEN' in self.ws_name

def hideFromMsl(self) -> str:
return self.add_sufix('_HIDDEN')

def removeHideFlags(self) -> str:
return self.ws_name.replace('__MSL', '').replace('_HIDDEN', '')

def hideMslInAds(self) -> str:
return self.add_prefix('__MSL')

def isMslHiddenInAds(self) -> bool:
return '__MSL' in self.ws_name

def hideTmpMslInAds(self) -> str:
return self.add_prefix('__MSLTMP')

def hideInAds(self) -> str:
return self.add_prefix('__')

def isHiddenInAds(self) -> bool:
return self.ws_name.startswith('__')

def makeVisibleInAds(self) -> str:
return self.ws_name.lstrip('__')
7 changes: 4 additions & 3 deletions tests/workspace_provider_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from mslice.widgets.workspacemanager.command import Command
from mantid.simpleapi import AddSampleLog
from mslice.views.interfaces.workspace_view import WorkspaceView
from mslice.workspace.helperfunctions import WorkspaceNameHandler


class MantidWorkspaceProviderTest(unittest.TestCase):
Expand Down Expand Up @@ -44,16 +45,16 @@ def test_delete_workspace(self):

def test_subtract_workspace(self):
subtract(['test_ws_2d'], 'test_ws_2d', 0.95)
result = get_workspace_handle('test_ws_2d_subtracted')
result = get_workspace_handle(WorkspaceNameHandler('test_ws_2d').subtracted(0.95))
np.testing.assert_array_almost_equal(result.raw_ws.dataY(0), [0.05] * 20)
np.testing.assert_array_almost_equal(self.test_ws_2d.raw_ws.dataY(0), [1] * 20)
self.assertFalse('test_ws_2d_scaled' in get_visible_workspace_names())
self.assertFalse(WorkspaceNameHandler('test_ws_2d').scaled(0.95) in get_visible_workspace_names())
self.assertRaises(ValueError, subtract, ['test_ws_2d'], 'test_ws_md', 1.0)

def test_add_workspace(self):
original_data = self.test_ws_2d.raw_ws.dataY(0)
add_workspace_runs(['test_ws_2d', 'test_ws_2d'])
result = get_workspace_handle('test_ws_2d_sum')
result = get_workspace_handle(WorkspaceNameHandler('test_ws_2d').summed())
np.testing.assert_array_almost_equal(result.raw_ws.dataY(0), [2.0] * 20)
np.testing.assert_array_almost_equal(original_data, [1] * 20)

Expand Down
Loading