Ticket #9957 (new)

Opened 6 years ago

Last modified 5 years ago

Binary operations over array of workspaces do not work similar to them working on a single workspace from Python

Reported by: Alex Buts Owned by: Martyn Gigg
Priority: major Milestone: Backlog
Component: Framework Keywords:
Cc: Blocked By:
Blocking: Tester:

Description

lets assume workspaces w1, w1s, w2 and w2s are loaded in Mantid and can be added together

then the script:

w1=mtd['w1']
ws=mtd['w1s']
w2=mtd['w2']
w2s=mtd['w2s']


ws+=w1;
w2s+=w2;

works as expected and ws and w2s after the script are the sum of the initial workspace and the addendum.

If, from other side, one tries to work like this:

w1=[mtd['w1'],mtd['w2']]
ws=[mtd['ws'],mtd['w2s']]

for i in xrange(len(ws)):
   ws[i]+=w1[i]
   print "Sum workspace has {0} events in it".format(ws[i].getNumberEvents())

result will be different and ws and w2s in Mantid will remain unchanged despite print row in the loop would report that the workspaces are added together (print will work if the workspaces are event workspaces).

Change History

comment:1 Changed 6 years ago by Alex Buts

  • Summary changed from Binary operations over array of workspaces do not work similar to a then on a single workspace from Python to Binary operations over array of workspaces do not work similar to them working on a single workspace from Python

comment:2 Changed 5 years ago by Stuart Campbell

This ticket has been transferred to github issue 10799

Note: See TracTickets for help on using tickets.