Commit 0646aaf9 authored by Paul McCarthy's avatar Paul McCarthy 🚵
Browse files

ENH: New makeWriteable function

parent fd0b848f
......@@ -9,4 +9,5 @@ models, constants, and other data-like things used throughout ``fslpy``.
from .utils import guessType # noqa
from .utils import (guessType, # noqa
......@@ -10,7 +10,7 @@ with the data types defined in the :mod:`` package.
import os.path as op
import numpy as np
def guessType(path):
"""A convenience function which, given the name of a file or directory,
......@@ -77,3 +77,14 @@ def guessType(path):
# Otherwise, I don't
# know what to do
return None, path
def makeWriteable(array):
"""Updates the given ``numpy.array`` so that it is writeable. If this
is not possible, a copy is created and returned.
array.flags['WRITEABLE'] = True
except ValueError:
array = np.array(array)
return array
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment