Ticket #6015 (closed: fixed)
Binary operations in python don't return the desired workspace type
Reported by: | Russell Taylor | Owned by: | Martyn Gigg |
---|---|---|---|
Priority: | major | Milestone: | Release 2.3 |
Component: | Python | Keywords: | |
Cc: | Blocked By: | ||
Blocking: | Tester: | Nick Draper |
Description
I'm not sure if this is always the case or not, but the following scriptlets will at the last line give back a workspace of type IMDWorkspace rather than MatrixWorkspace:
ws2d = Load('LOQ48127') column = Integration(ws2d) column = ws2d / column
ws2d = Load('LOQ48127') singlespec = SumSpectra(ws2d) singlespec += ws2d
The expected fix was to make the following change around line 81 of _workspaceops.py:
# Do the operation _performBinaryOp(self,rhs, op, output_name, inplace, reverse) resultws = AnalysisDataService[output_name]
However, this leads to a hang/crash of the VanillaPythonInterfaceTest unit test suite (apparently for some problem relating to the algorithm history propagation), so some investigation is required.
Change History
comment:2 Changed 8 years ago by Martyn Gigg
- Owner set to Martyn Gigg
- Status changed from new to accepted
This will need to be fixed or else the result workspace is essentially useless.
comment:3 Changed 8 years ago by Martyn Gigg
Ensure Python binary ops return the correct ptr type. Refs #6015
Changeset: 90a7818bd34e144c320cc5cec2e55f08d96c57f4
comment:4 Changed 8 years ago by Martyn Gigg
- Status changed from accepted to verify
- Resolution set to fixed
comment:5 Changed 8 years ago by Vickie Lynch
- Status changed from verify to verifying
- Tester set to Vickie Lynch
comment:6 Changed 8 years ago by Vickie Lynch
- Status changed from verifying to verify
- Tester Vickie Lynch deleted
comment:7 Changed 8 years ago by Nick Draper
- Status changed from verify to verifying
- Tester set to Nick Draper
comment:8 Changed 8 years ago by Nick Draper
- Status changed from verifying to closed
tested with the following script
ws2d = Load('LOQ48127') column = Integration(ws2d) column = ws2d / column print column column print type(column) <class 'mantid.api._api.MatrixWorkspace'> ws2d = Load('LOQ48127') singlespec = SumSpectra(ws2d) singlespec += ws2d print type(singlespec) <class 'mantid.api._api.MatrixWorkspace'> print type(ws2d) <class 'mantid.api._api.MatrixWorkspace'> ws2d = Load('LOQ48127') column = Integration(ws2d) column = ws2d / column print column column print type(column) <class 'mantid.api._api.MatrixWorkspace'> ws2d = Load('LOQ48127') singlespec = SumSpectra(ws2d) singlespec += ws2d print type(singlespec) <class 'mantid.api._api.MatrixWorkspace'> print type(ws2d) <class 'mantid.api._api.MatrixWorkspace'>
comment:9 Changed 8 years ago by Martyn Gigg
Ensure Python binary ops return the correct ptr type. Refs #6015
Changeset: 90a7818bd34e144c320cc5cec2e55f08d96c57f4
comment:10 Changed 5 years ago by Stuart Campbell
This ticket has been transferred to github issue 6861
Here's a stack trace of the point the VanillaPythonInterfaceTest.py crashes on my mac build. The point at which it crashes is in this function:
I suspect that 'other' has been deleted by the point this function is being called.