diff --git a/mne/_freesurfer.py b/mne/_freesurfer.py index 67a27d59860..7fd4559cf00 100644 --- a/mne/_freesurfer.py +++ b/mne/_freesurfer.py @@ -141,7 +141,7 @@ def _get_mri_info_data(mri, data): if data: assert mgz is not None out["mri_vox_t"] = invert_transform(out["vox_mri_t"]) - out["data"] = np.asarray(mgz.dataobj) + out["data"] = np.array(mgz.dataobj) return out diff --git a/mne/source_space/_source_space.py b/mne/source_space/_source_space.py index 11834cc7631..eaaf77bf2ca 100644 --- a/mne/source_space/_source_space.py +++ b/mne/source_space/_source_space.py @@ -1377,7 +1377,7 @@ def _write_one_source_space(fid, this, verbose=None): mri_width, mri_height, mri_depth, nvox = _src_vol_dims(this) interpolator = this.get("interpolator") if interpolator is None: - interpolator = csr_matrix((nvox, this["np"])) + interpolator = csr_matrix((nvox, this["np"]), copy=True) write_float_sparse_rcs( fid, FIFF.FIFF_MNE_SOURCE_SPACE_INTERPOLATOR, interpolator ) @@ -2390,7 +2390,9 @@ def _add_interpolator(sp): indices = interp.indices[mask] data = interp.data[mask] assert data.shape == indices.shape == (indptr[-1],) - this_interp = csr_matrix((data, indices, indptr), shape=interp.shape) + this_interp = csr_matrix( + (data, indices, indptr), shape=interp.shape, copy=True + ) s["interpolator"] = this_interp logger.info( " %d/%d nonzero values for %s" @@ -2415,7 +2417,7 @@ def _grid_interp(from_shape, to_shape, trans, order=1, inuse=None): data = np.concatenate(data) indices = np.concatenate(indices) indptr = np.cumsum(indptr) - interp = csr_matrix((data, indices, indptr), shape=shape) + interp = csr_matrix((data, indices, indptr), shape=shape, copy=True) return interp