We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e2873a0 commit 50805f5Copy full SHA for 50805f5
nibabel/fileslice.py
@@ -767,9 +767,12 @@ def strided_scalar(shape, scalar=0.):
767
strided_arr : array
768
Array of shape `shape` for which all values == `scalar`, built by
769
setting all strides of `strided_arr` to 0, so the scalar is broadcast
770
- out to the full array `shape`.
+ out to the full array `shape`. `strided_arr` is flagged as not
771
+ `writeable`.
772
"""
773
shape = tuple(shape)
774
scalar = np.array(scalar)
775
strides = [0] * len(shape)
- return np.lib.stride_tricks.as_strided(scalar, shape, strides)
776
+ strided_scalar = np.lib.stride_tricks.as_strided(scalar, shape, strides)
777
+ strided_scalar.flags.writeable = False
778
+ return strided_scalar
0 commit comments