Ticket #5989 (closed: invalid)

Opened 8 years ago

Last modified 5 years ago

Investigate 1D arrangement of multidimensional MD Histo workspace arrays

Reported by: Alex Buts Owned by: Alex Buts
Priority: major Milestone: Release 2.6
Component: Framework Keywords: CORE
Cc: martyn.gigg@… Blocked By:
Blocking: Tester: Andrei Savici

Description (last modified by Alex Buts) (diff)

MD histo workspace can be produced by rebinning suitable MD workspace using BinMD algorithm in the form:

BinMD(InputWorkspace=wsName,AlignedDim0='x,x_min,x_max,nd[0]',AlignedDim1='y,y_min,y_max,nd[1]',AlignedDim2='z,z_min,z_max,nd[2]'OutputWorkspace=ResultingHisto_WS_Name)

The array nd[3] describes the dimensions of the resulting multidimensional MD Histo workspace array: array. The access to the data of this array currently can be arranged by the code:

for(int k=0;k<nd[2];k++)
{
  for(int j=0;j<nd[1];j++)
  {
     for(int i=0;i<nd[0];i++)
     {
        // linear index:
        int index=i+nd[0]*(j+k*nd[1]);
        data = array[index];
     }
  }
}

to export this array to Numpy for one accessing it in C-way data=array[k,j,i], i is the fastest index, one has to invert the index array nd and give it to python API as

nd_numpy[0]=nd[2];
nd_numpy[1]=nd[1];
nd_numpy[2]=nd[0];

Is it the most natural way of working with 1D array in C++? What should be changed to do it natural way?

Change History

comment:1 Changed 8 years ago by Alex Buts

  • Description modified (diff)

comment:2 Changed 8 years ago by Nick Draper

  • Keywords CORE added

This should be done, but it is purely internal and therefore can be considered low priority.

However this should be considered a CORE FUNCTIONALITY change

comment:4 Changed 8 years ago by Nick Draper

  • Milestone changed from Ongoing to Release 2.4

comment:5 Changed 8 years ago by Nick Draper

  • Owner set to Alex Buts
  • Status changed from new to assigned

comment:6 Changed 8 years ago by Alex Buts

  • Milestone changed from Release 2.4 to Release 2.5

comment:7 Changed 7 years ago by Alex Buts

  • Milestone changed from Release 2.5 to Release 2.6

comment:8 Changed 7 years ago by Nick Draper

  • Status changed from assigned to new

comment:9 Changed 7 years ago by Alex Buts

  • Status changed from new to verify
  • Resolution set to invalid
  • Description modified (diff)

Current way is around for a while and number of user scripts is based on it. Hassle of changing at current stage grossly overweights all questionable benefits new users can get from this change.

I think it lost all relevance at the moment -- C access to indexes of multidimensional arrays may be considered the Mantid standard.

comment:10 Changed 7 years ago by Andrei Savici

  • Status changed from verify to verifying
  • Tester set to Andrei Savici

comment:11 Changed 7 years ago by Andrei Savici

  • Status changed from verifying to closed

comment:12 Changed 7 years ago by Nick Draper

  • Component changed from Mantid to Framework

comment:13 Changed 5 years ago by Stuart Campbell

This ticket has been transferred to github issue 6835

Note: See TracTickets for help on using tickets.