Bug #1646

Feature #1290: === Core: framework ===

Feature #1572: == Python ==

Reversed order numpy array

Added by a.glavic about 3 years ago. Updated over 1 year ago.

Status:RejectedStart date:17 Nov 2016
Priority:NormalDue date:
Assignee:juan% Done:

100%

Category:-Estimated time:0.00 hour
Target version:-

Description

Since version 1.6 (I think) the returned array from the simulation result using .getArray() is reversed in the first dimension. This means that the first index (alpha_f in GISAS and off-specular) runs from larger to smaller values while the second index from smaller to larger. So to get the intensity corresponding to smallest positions on both axes you would need "data[-1,0]", not "data[0,0]".

I suppose this was a decision to simplify the plotting with imshow in the example scripts by getting rid of the rotation function.
However, the issue is not the data array but the default behavior of imshow. The function has the keyword argument 'origin' with the default value "upper", which defines if the first data index is to be plotted in the upper left or lower left corner of the graph. The default behavior makes sense when plotting actual pictures, while one should set it to "lower" for normal data arrays.
(see e.g. http://stackoverflow.com/questions/14320159/matplotlib-imshow-data-rotated)

As the current behavior is unexpected and inconsistent when using further data analysis or other plotting functions/libraries I would propose to change it back to the old behavior. (If the keyword is not used in imshow it is also easier to just reverse the first array indices with 'data[::-1]' instead of using the rotate function.)

History

#1 Updated by wuttke about 3 years ago

  • Parent task set to #1572

#2 Updated by juan over 1 year ago

  • Status changed from New to Resolved
  • Assignee set to juan
  • Target version set to Sprint 39
  • % Done changed from 0 to 100
  • Estimated time set to 8.00

#3 Updated by juan over 1 year ago

  • Status changed from Resolved to Rejected
  • Target version deleted (Sprint 39)
  • Estimated time changed from 8.00 to 0.00

the returned array from the simulation result using .getArray() is reversed in the first dimension.

Is this true?

I suppose this was a decision to simplify the plotting with imshow in the example scripts by getting rid of the rotation function.
However, the issue is not the data array but the default behavior of imshow.

OK, so it is not our task. Is it?

The function has the keyword argument 'origin' with the default value "upper", which defines if the first data index is to be plotted in the upper left or lower left corner of the graph. The default behavior makes sense when plotting actual pictures, while one should set it to "lower" for normal data arrays.
(see e.g. http://stackoverflow.com/questions/14320159/matplotlib-imshow-data-rotated)

As the current behavior is unexpected and inconsistent [...]

Is it inconsistent?

[...] when using further data analysis or other plotting functions/libraries I would propose to change it back to the old behavior. (If the keyword is not used in imshow it is also easier to just reverse the first array indices with 'data[::-1]' instead of using the rotate function.)

Rejected because it is not an actual bug to fix.

Also available in: Atom PDF