Ticket #6163 (closed: fixed)
CreateWorkspace running slow
Reported by: | Owen Arnold | Owned by: | Owen Arnold |
---|---|---|---|
Priority: | major | Milestone: | Release 2.4 |
Component: | Mantid | Keywords: | |
Cc: | Blocked By: | ||
Blocking: | Tester: | Jose Borreguero |
Description (last modified by Owen Arnold) (diff)
Worth investigating. apparently this is running really slow:
ws=Load('\\\\isis\inst$\NDXENGINX\Instrument\data\cycle_11_4\ENGINX00176388.raw',LoadMonitors='Include') import numpy as np x=np.array(ws.extractX()) y=np.array(ws.extractY()) e=np.array(ws.extractE()) newws=CreateWorkspace(x,y,e,UnitX='newdspacing',NSpec=2513)
Change History
comment:4 Changed 8 years ago by Owen Arnold
- Status changed from accepted to verify
- Resolution set to fixed
1) The example code provided contains a bug. Numpy arrays should be flattened before being passed to CreateWorkspace.
2) The slow behaviour is to be expected. This algorithm was not designed for importing large amounts of input data, and CreateWorkspace does some internal copying that extends the amount of memory required for these operations to work. A better solution would be to clone the input workspace and then make in-place modification to each of the arrays using numpy. I've updated http://www.mantidproject.org/CreateWorkspace on the wiki to demonstrate such an approach.
comment:5 Changed 8 years ago by Owen Arnold
Tester. There's not much to test here other than that the wiki page looks sensible.