Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
fslpy
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Analyze
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
FSL
fslpy
Commits
0646aaf9
Commit
0646aaf9
authored
5 years ago
by
Paul McCarthy
Browse files
Options
Downloads
Patches
Plain Diff
ENH: New makeWriteable function
parent
fd0b848f
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
fsl/data/__init__.py
+2
-1
2 additions, 1 deletion
fsl/data/__init__.py
fsl/data/utils.py
+12
-1
12 additions, 1 deletion
fsl/data/utils.py
with
14 additions
and
2 deletions
fsl/data/__init__.py
+
2
−
1
View file @
0646aaf9
...
...
@@ -9,4 +9,5 @@ models, constants, and other data-like things used throughout ``fslpy``.
"""
from
.utils
import
guessType
# noqa
from
.utils
import
(
guessType
,
# noqa
makeWriteable
)
This diff is collapsed.
Click to expand it.
fsl/data/utils.py
+
12
−
1
View file @
0646aaf9
...
...
@@ -10,7 +10,7 @@ with the data types defined in the :mod:`fsl.data` 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.
"""
try
:
array
.
flags
[
'
WRITEABLE
'
]
=
True
except
ValueError
:
array
=
np
.
array
(
array
)
return
array
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment