pace-neutrons / pace-python

Python module of the PACE inelastic neutron data analysis suite of programs.
GNU General Public License v3.0
3 stars 4 forks source link

Error in handling 2D numpy arrays #22

Closed mducle closed 2 years ago

mducle commented 2 years ago

Issue

The data encoder / decoder is failing for 2D non-float numpy arrays.

How to reproduce

Run this

import numpy as np
from pace_neutrons import Matlab
m = Matlab()

bragg_peaks = np.array([[4,0,0], [2,0,0], [1,1,0], [4,4,0], [1,0,1]]).T
m.svd(bragg_peaks)

which will fail with a ValueError: initializer must be a rectangular nested sequence in line 47 of DataTypes.py.

If the values in the array are doubles (e.g. bragg_peaks = np.array([[4.,0.,0.], [2.,0.,0.], [1.,1.,0.], [4.,4.,0.], [1.,0.,1.]]).T) then the script will work.

System details (version, OS)

v0.2.0 on IDAaaS (SL7)