Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion nipy/algorithms/utils/pca.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ def _get_covariance(data, UX, rmse_scales_func, mask):
# If we have more then 2D, then we iterate over slices in the second
# dimension, in order to save memory
slices = [slice(i,i+1) for i in range(data.shape[1])]
for i, s_slice in enumerate(slices):
for s_slice in slices:
Y = data[:,s_slice].reshape((n_pts, -1))
# project data into required space
YX = np.dot(UX, Y)
Expand Down
4 changes: 2 additions & 2 deletions nipy/algorithms/utils/tests/test_pca_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ def test_other_axes(data_dict):
assert_almost_equal(pos_dp['basis_vectors'], pos_p[bv_key])
assert_almost_equal(pos_dp['basis_projections'], img_bps.get_fdata())
# And we've replaced the expected axis
exp_coords = in_coords[:]
exp_coords = in_coords.copy()
exp_coords[exp_coords.index(axis_name)] = 'PCA components'
assert img_bps.axes.coord_names == tuple(exp_coords)
# If the affine is not diagonal, we'll get an error
Expand All @@ -323,6 +323,6 @@ def test_other_axes(data_dict):
pytest.raises(AxisError, pca_image, nd_img, axis_name)
for axis_name in 'kt':
p = pca_image(img, axis_name, ncomp=ncomp)
exp_coords = in_coords[:]
exp_coords = in_coords.copy()
exp_coords[exp_coords.index(axis_name)] = 'PCA components'
assert p['basis_projections'].axes.coord_names == tuple(exp_coords)
2 changes: 1 addition & 1 deletion nipy/core/utils/generators.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ def slice_generator(data, axis=0):
slice_template = [slice(0, s) for s in data.shape]

for n in range(nmax):
slices = slice_template[:]
slices = slice_template.copy()
for (a, div, mod) in zip(axis, divs, mods):
x = int(n / div % mod)
slices[a] = x
Expand Down
2 changes: 1 addition & 1 deletion nipy/labs/mask.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ def compute_mask_sessions(session_images, m=0.2, M=0.9, cc=1, threshold=0.5,
The mean image
"""
mask, mean = None, None
for index, session in enumerate(session_images):
for session in session_images:
if hasattr(session, 'get_fdata'):
mean = session.get_fdata()
if mean.ndim > 3:
Expand Down
2 changes: 1 addition & 1 deletion nipy/modalities/fmri/tests/test_glm.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def write_fake_fmri_data(shapes, rk=3, affine=np.eye(4)):
def generate_fake_fmri_data(shapes, rk=3, affine=np.eye(4)):
fmri_data = []
design_matrices = []
for i, shape in enumerate(shapes):
for shape in shapes:
data = 100 + np.random.randn(*shape)
data[0] -= 10
fmri_data.append(Nifti1Image(data, affine))
Expand Down
Loading