nipy/nipy — Issue #130: space_time_realign  and strange byte order
Author: satra
Created: 2012-02-09 02:51:15+00:00
State: open

@alexis-roche, @matthew-brett we are running into a byte order issue with space_time_realign followed by an SVD. This happens on our ubuntu system which has the various versions listed below. matthew: it might be a good idea to include the git hash in the version string from git-describe if one is installing from a git repo. this does not happen on my local OSX EPD 7.2 install which has numpy 1.6.1 and scipy 0.10. i'm going try and upgrade EPD on our cluster and test.

this is a stripped down version to demonstrate the error.

```python
from nipy.algorithms.registration import FmriRealign4d
from nibabel import load
from nipy import save_image
R = FmriRealign4d([load('f.nii')], tr=2.5, slice_order='ascending', interleaved=True)
R.estimate(refscan=None)
corr_run = R.resample()
save_image(corr_run[0], 'realigned_f.nii.gz')
import scipy as sp
imgseries = load('realigned_f.nii.gz')
import numpy as np
std = np.std(imgseries.get_data(), axis=3)
voxel_timecourses = imgseries.get_data()[np.nonzero(std>250.)]
u,s,v = sp.linalg.svd(voxel_timecourses, full_matrices=False)
```

results in:

```
LapackError Traceback (most recent call last)
/mindhive/scratch/satra/nipype-test/testerror/ in ()
1 std = np.std(imgseries.get_data(), axis=3)
2 voxel_timecourses = imgseries.get_data()[np.nonzero(std>250.)]
----> 3 u,s,v = sp.linalg.svd(voxel_timecourses, full_matrices=False)

/software/python/EPD/7.1/lib/python2.7/site-packages/scipy/linalg/decomp_svd.pyc in svd(a, full_matrices, compute_uv, overwrite_a)
69 if full_matrices == 0:
70 import numpy.linalg
---> 71 return numpy.linalg.svd(a, full_matrices=0, compute_uv=compute_uv)
72 a1 = asarray_chkfinite(a)
73 if len(a1.shape) != 2:

/software/python/EPD/7.1/lib/python2.7/site-packages/numpy/linalg/linalg.pyc in svd(a, full_matrices, compute_uv)
1313 work = zeros((lwork,), t)
1314 results = lapack_routine(option, m, n, a, m, s, u, m, vt, nvt,
-> 1315 work, -1, iwork, 0)
1316 lwork = int(work[0])
1317 work = zeros((lwork,), t)

LapackError: Parameter a has non-native byte order in lapack_lite.dgesdd
```

I also received this warning when saving the image.

```
save_image(corr_run[0], 'realigned_f.nii.gz')
/software/virtualenvs.EPD/7.2/devpype/lib/python2.7/site-packages/nipy/io/nifti_ref.py:126: UserWarning: range is not LPS or RAS, assuming LPS
warnings.warn('range is not LPS or RAS, assuming LPS')
```

Versions

```
In [5]: nipy.__version__
Out[5]: '0.1.9999.dev'

neurospin-cleanup-517-g6dd79fa

In [8]: nibabel.__version__
Out[8]: '1.2.0.dev'

1.1.0-150-g2a96c40

In [10]: numpy.__version__
Out[10]: '1.6.0'

In [11]: sp.__version__
Out[11]: '0.9.0'
```