[indexing] maybe? cannot tell, tests are broken

This commit is contained in:
mzwiessele 2014-09-04 18:01:33 +01:00
parent e49bef9b94
commit 4886dfde08

View file

@ -246,6 +246,15 @@ class Param(Parameterizable, ObsAr):
# get a int-array containing all indices in the first axis. # get a int-array containing all indices in the first axis.
if slice_index is None: if slice_index is None:
slice_index = self._current_slice_ slice_index = self._current_slice_
try:
indices = np.indices(self._realshape_, dtype=int)
indices = indices[(slice(None),)+slice_index]
indices = np.rollaxis(indices, 0, indices.ndim).reshape(-1,2)
#print indices_
#if not np.all(indices==indices__):
# import ipdb; ipdb.set_trace()
except:
print "Warning: extended indexing was used"
indices = np.indices(self._realshape_, dtype=int) indices = np.indices(self._realshape_, dtype=int)
indices = indices[(slice(None),)+slice_index] indices = indices[(slice(None),)+slice_index]
indices = np.rollaxis(indices, 0, indices.ndim) indices = np.rollaxis(indices, 0, indices.ndim)