Skip to content

MRG: mmap keyword for loading images #268

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Nov 12, 2014

Conversation

matthew-brett
Copy link
Member

Add mmap keyword to control memory mapping on image load.

API as discussed on the nipy list.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.15%) when pulling 3d5940b on matthew-brett:mmap-api into 5d085c6 on nipy:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.15%) when pulling 7dad228 on matthew-brett:mmap-api into 5d085c6 on nipy:master.

Add memory mapping keyword to array_from_file getting ready to add this
to the image loading API.
Give array proxy class ability to tune memory mapping via `mmap`
keyword-only argument.
Allow specifying mmap flags when loading Analyze-type images.
Check this works for mmap keyword argument to top-level load.
I want to use the arrayproxy tests for other ArrayProxy objects,
particularly the PARRECArrayProxy. Refactor to make this easier.
Refactor image arrayproxy test mixin to make it easier to deal with the
case where we can't easily make a new image from scratch, and we might
want to use some example image instead.
Use refactored tests to test PARREC mmap interface.
I copy / pasted docstrings leaving the original argument name `infile`,
for methods / functions where this is not the argument name.  Fix.
@coveralls
Copy link

Coverage Status

Coverage increased (+0.08%) when pulling 744c631 on matthew-brett:mmap-api into 5c15ed8 on nipy:master.

@matthew-brett matthew-brett changed the title WIP: mmap keyword for loading images MRG: mmap keyword for loading images Nov 12, 2014
@matthew-brett
Copy link
Member Author

Pretty please for a review?

We should be ready for release after this one is in.

`mmap` controls the use of numpy memory mapping for reading image
array data. If False, do not try numpy ``memmap`` for data array.
If one of {'c', 'r'}, try numpy memmap with ``mode=mmap``. A `mmap`
value of True gives the same behavior as ``mmap='c'``. If image
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why even allow mmap=True if it just wraps to mmap='c'? Can't you just say the default is 'c'?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was a discussion we had on the mailing list. The idea was that someone might want to turn on memory mapping, but not know about 'mode', so True is there as a convenience for that person. I don't feel crazy strongly about it though.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh, I suppose that makes sense. Makes sense to leave it that way, then.

@larsoner
Copy link
Contributor

I didn't follow the discussion on the list too closely, but from what I did understand this LGTM other than my minor gripes.

Use 'A is not None' instead of 'not A is None'.

Fix incorrect docstring mentions of 'r+'.
@matthew-brett
Copy link
Member Author

Did I get everything with the new commit?

@coveralls
Copy link

Coverage Status

Coverage increased (+0.08%) when pulling cca7371 on matthew-brett:mmap-api into 5c15ed8 on nipy:master.

@larsoner
Copy link
Contributor

Yep, LGTM

@matthew-brett
Copy link
Member Author

Thanks for the review, it was very useful.

matthew-brett added a commit that referenced this pull request Nov 12, 2014
MRG: mmap keyword for loading images

Add mmap keyword to control memory mapping on image load.

API as discussed on the nipy list.
@matthew-brett matthew-brett merged commit cc93272 into nipy:master Nov 12, 2014
@matthew-brett matthew-brett deleted the mmap-api branch November 12, 2014 19:28
grlee77 pushed a commit to grlee77/nibabel that referenced this pull request Mar 15, 2016
MRG: mmap keyword for loading images

Add mmap keyword to control memory mapping on image load.

API as discussed on the nipy list.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants