Ticket #5986 (closed: fixed)
Export of Signal/nEvents/Error array to python looks incorrect
Reported by: | Alex Buts | Owned by: | Alex Buts |
---|---|---|---|
Priority: | major | Milestone: | Release 2.3 |
Component: | VATES | Keywords: | |
Cc: | martyn.gigg@… | Blocked By: | |
Blocking: | #5971 | Tester: | Andrei Savici |
Description
e.g. mixes array dimensions.
If I try to extract slice (see attached picture 1) from Mantid to Python using script below, the row and column dimensions of this array look mixed (see attached picture 2)
from numpy import * def write_slice(eMin,eMax): EnRange='DeltaE,'+str(eMin)+','+str(eMax)+',1' if eMin<0: eTag = 'm'+str(abs(eMin)); else: eTag = str(eMin) slice_name = 'sliceE'+eTag hw=BinMD(InputWorkspace='mdws4D',AlignedDim0='[H,0,0],-1,5,121',AlignedDim1='[0,K,0],-3,5,161',AlignedDim2='[0,0,L],-0.2,0.2,1',AlignedDim3=EnRange,OutputWorkspace=slice_name) signal=hw.getSignalArray(); nEvents=hw.getNumEventsArray(); f=open(slice_name+'.txt','w') ranges = signal.shape; print ranges; for j in range(0,ranges[1]): for i in range(0,ranges[0]): if (nEvents[i,j,0,0]>0): rez = signal[i,j,0,0]/nEvents[i,j,0,0] f.write('%10g' % rez); else: rez= 0 f.write('%10g' % rez); f.write('\n') f.close(); write_slice(30,40)
Attachments
Change History
Changed 8 years ago by Alex Buts
- Attachment sliceE30.png added
comment:4 Changed 8 years ago by Alex Buts
refs #5986 unit tests for suspicious behavior.
and some code rearrangement.
Changeset: 177a3c94902090861ea125163507665489acd28b
comment:5 Changed 8 years ago by Alex Buts
refs #5986 inverted dimensions in numpy converter
to make Histo-workspace accessible from Numpy in a C-way.
Changeset: 42ea268b0b472f7c3149bd49fc2cc468c11189f5
comment:6 Changed 8 years ago by Alex Buts
refs #5986 some tests to changed python import
not all yet run correctly
Changeset: 04e5fed762656fb72e5f610dce4a571a3da2eb14
comment:7 Changed 8 years ago by Alex Buts
refs #5986 Modified FakeMDEventData to generate desired data kind
which needed for testing python classes and heterogeneous data arrays
Changeset: 0f0ecc82e16cfe8a15a1180976cf0362558d40f2
comment:8 Changed 8 years ago by Alex Buts
refs #5986 more tests (failing)
Changeset: d057149f47643f339716fb1b6e12d18e83e6b26d
comment:9 Changed 8 years ago by Alex Buts
refs #5986 temporary disabling number of failing tests
(to be able to commit on another ticket)
Changeset: c48b82a50896cf9b32b46635ca3b3806251e2257
comment:10 Changed 8 years ago by Alex Buts
refs #5986 fixing Unix warnings
Changeset: 8ed3744dbdf2be2b7cccddf6c4d4c872b5a8f6b7
comment:11 Changed 8 years ago by Alex Buts
refs #5986 Added getNEvents to IMDWorkspace.h
Changeset: d48d70d13373e0f587cce914cc4db4236b409b5b
comment:12 Changed 8 years ago by Alex Buts
refs #5986 test for BinMD fixed
and python uncommented
Changeset: 836e57db4c448a73209b63c5f66d9be6b2604685
comment:13 Changed 8 years ago by Alex Buts
refs #5986 Rumbling around
Changeset: 98db3508a5117ea7a5bf6fbb064c1f62c1c2d064
comment:14 Changed 8 years ago by Alex Buts
refs #5986 Tests for C++ and MDHistoWorkspaceTest.py
seems all work as expected
Changeset: 25460d7b73b88a14ed061e037a491af280e8e6cd
comment:15 Changed 8 years ago by Alex Buts
Internal structure of MDHisto data array looks rather like fortran array If it right or wrong -- is different question.
Meanwhile, export behaves correctly
comment:16 Changed 8 years ago by Alex Buts
- Status changed from accepted to verify
- Resolution set to fixed
comment:17 Changed 8 years ago by Andrei Savici
- Status changed from verify to verifying
- Tester set to Andrei Savici
comment:18 Changed 8 years ago by Andrei Savici
- Status changed from verifying to closed
The file I save, when read in IDL, looks like my original data
comment:19 Changed 8 years ago by Alex Buts
refs #5986 unit tests for suspicious behavior.
and some code rearrangement.
Changeset: 177a3c94902090861ea125163507665489acd28b
comment:20 Changed 8 years ago by Alex Buts
refs #5986 inverted dimensions in numpy converter
to make Histo-workspace accessible from Numpy in a C-way.
Changeset: 42ea268b0b472f7c3149bd49fc2cc468c11189f5
comment:21 Changed 8 years ago by Alex Buts
refs #5986 some tests to changed python import
not all yet run correctly
Changeset: 04e5fed762656fb72e5f610dce4a571a3da2eb14
comment:22 Changed 8 years ago by Alex Buts
refs #5986 Modified FakeMDEventData to generate desired data kind
which needed for testing python classes and heterogeneous data arrays
Changeset: 0f0ecc82e16cfe8a15a1180976cf0362558d40f2
comment:23 Changed 8 years ago by Alex Buts
refs #5986 more tests (failing)
Changeset: d057149f47643f339716fb1b6e12d18e83e6b26d
comment:24 Changed 8 years ago by Alex Buts
refs #5986 temporary disabling number of failing tests
(to be able to commit on another ticket)
Changeset: c48b82a50896cf9b32b46635ca3b3806251e2257
comment:25 Changed 8 years ago by Alex Buts
refs #5986 fixing Unix warnings
Changeset: 8ed3744dbdf2be2b7cccddf6c4d4c872b5a8f6b7
comment:26 Changed 8 years ago by Alex Buts
refs #5986 Added getNEvents to IMDWorkspace.h
Changeset: d48d70d13373e0f587cce914cc4db4236b409b5b
comment:27 Changed 8 years ago by Alex Buts
refs #5986 test for BinMD fixed
and python uncommented
Changeset: 836e57db4c448a73209b63c5f66d9be6b2604685
comment:28 Changed 8 years ago by Alex Buts
refs #5986 Rumbling around
Changeset: 98db3508a5117ea7a5bf6fbb064c1f62c1c2d064
comment:29 Changed 8 years ago by Alex Buts
refs #5986 Tests for C++ and MDHistoWorkspaceTest.py
seems all work as expected
Changeset: 25460d7b73b88a14ed061e037a491af280e8e6cd
comment:30 Changed 5 years ago by Stuart Campbell
This ticket has been transferred to github issue 6832
fig1