Ticket #3778 (closed: fixed)

Opened 9 years ago

Last modified 5 years ago

WorkspaceGroups don't work with binary operations

Reported by: Martyn Gigg Owned by: Martyn Gigg
Priority: critical Milestone: Release 2.0
Component: Mantid Keywords:
Cc: Blocked By:
Blocking: Tester: Michael Reuter

Description

FileName="D:/data/cycle_11_2/POLREF00004711.raw"
Load(Filename=FileName,OutputWorkspace="_Raw")
ConvertUnits(InputWorkspace="_Raw",OutputWorkspace="_Raw",Target="Wavelength")
NormaliseByCurrent(InputWorkspace="_Raw",OutputWorkspace="_D")

Io=CropWorkspace('_D','Io',StartWorkspaceIndex=2,EndWorkspaceIndex=2)
I=CropWorkspace('_D','I',StartWorkspaceIndex=4)

I=mtd['I'];Io=mtd['Io']
R=I/Io


Fails with error:


Python.ArgumentError on line 10: "Python argument types in
    MantidPythonAPI._binary_op(WorkspaceGroup, WorkspaceGroup, str, str, bool, bool)
did not match C++ signature:
    _binary_op(class boost::shared_ptr<class Mantid::API::MatrixWorkspace>, double, class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >, class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >, bool, bool)
    _binary_op(class boost::shared_ptr<class Mantid::API::MatrixWorkspace>, class boost::shared_ptr<class Mantid::API::MatrixWorkspace>, class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >, class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >, bool, bool)" in file 'MantidFramework.py' at line 459


This is true for +,-,/,*, Divide(‘I’,’Io’,’R’), Divide(‘I’,’Io’,’R’,AllowDifferentNumberSpectra=True),

The binary operations all assume a MatrixWorkspace as a decendent which disallows two WorkspaceGroup objects as inputs. This needs to be made more general.

Change History

comment:1 Changed 9 years ago by Nick Draper

  • Priority changed from major to critical
  • Status changed from new to assigned
  • Owner set to Martyn Gigg

comment:2 Changed 9 years ago by Martyn Gigg

  • Status changed from assigned to accepted

comment:3 Changed 9 years ago by Martyn Gigg

  • Status changed from accepted to verify
  • Resolution set to fixed

In [15027]:

Fix binary operations with WorkspaceGroup objects from Python. Fixes #3778

comment:4 Changed 9 years ago by Michael Reuter

  • Status changed from verify to verifying
  • Tester set to Michael Reuter

comment:5 Changed 9 years ago by Michael Reuter

  • Status changed from verifying to reopened
  • Resolution fixed deleted

Using either PythonAPI, I'm getting the following error:

The sizes of the two workspaces (I_1: 242 spectra, blocksize 1000) and (Io_1: 1 spectra, blocksize 1000) are not compatible for algorithm Divide
Logic Error in execution of algorithm Divide
The sizes of the two workspaces (I_1: 242 spectra, blocksize 1000) and (Io_1: 1 spectra, blocksize 1000) are not compatible for algorithm Divide
Error in execution of algorithm Divide
Execution failed for the algorithm Divide

comment:6 Changed 9 years ago by Martyn Gigg

  • Status changed from reopened to accepted

comment:7 Changed 9 years ago by Martyn Gigg

  • Status changed from accepted to verify
  • Resolution set to fixed

This is actually more of a problem with the error that Divide reports. The X bin values don't match so a Rebin is necessary before the Divide. I have created #4489 to deal with that but I think this should pass as the original problem is solved.

comment:8 Changed 9 years ago by Michael Reuter

  • Status changed from verify to verifying

comment:9 Changed 9 years ago by Michael Reuter

  • Status changed from verifying to closed

Yes, the original issue was solved and the above will be treated later.

comment:10 Changed 5 years ago by Stuart Campbell

This ticket has been transferred to github issue 4625

Note: See TracTickets for help on using tickets.