Ticket #6163 (closed: fixed)

Opened 8 years ago

Last modified 5 years ago

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:1 Changed 8 years ago by Owen Arnold

  • type changed from enhancement to defect

comment:2 Changed 8 years ago by Owen Arnold

  • Description modified (diff)

comment:3 Changed 8 years ago by Owen Arnold

  • Status changed from new to accepted

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.

comment:6 Changed 8 years ago by Jose Borreguero

  • Status changed from verify to verifying
  • Tester set to Jose Borreguero

comment:7 Changed 8 years ago by Jose Borreguero

  • Status changed from verifying to closed

comment:8 Changed 5 years ago by Stuart Campbell

This ticket has been transferred to github issue 7009

Note: See TracTickets for help on using tickets.