Re: [Numpy-discussion] Quaternion type @ rosettacode.org

2014-01-03 Thread David Goldsmith
Thanks Anthony and Paul! OlyDLG ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion

Re: [Numpy-discussion] Padding An Array Along A Single Axis

2014-01-03 Thread Joe Kington
You can use np.pad for this: In [1]: import numpy as np In [2]: x = np.ones((3, 3)) In [3]: np.pad(x, [(0, 0), (0, 1)], mode='constant') Out[3]: array([[ 1., 1., 1., 0.], [ 1., 1., 1., 0.], [ 1., 1., 1., 0.]]) Each item of the pad_width (second) argument is a tuple of bef

[Numpy-discussion] Padding An Array Along A Single Axis

2014-01-03 Thread Freddie Witherden
Hi all, This should be an easy one but I can not come up with a good solution. Given an ndarray with a shape of (..., X) I wish to zero-pad it to have a shape of (..., X + K), presumably obtaining a new array in the process. My best solution this far is to use np.zeros(curr.shape[:-1] + (curr

Re: [Numpy-discussion] Loading large NIfTI file -> MemoryError

2014-01-03 Thread Matthew Brett
Hi, On Tue, Dec 31, 2013 at 1:29 PM, Julian Taylor wrote: > > On 31.12.2013 14:13, Amira Chekir wrote: > > Hello together, > > > > I try to load a (large) NIfTI file (DMRI from Human Connectome Project, > > about 1 GB) with NiBabel. > > > > import nibabel as nib > > img = nib.load("dmri.nii.gz")