Repository navigation
Always open FITS files with memmap=False - #1407
Merged
Merged
Conversation
cdeil
commented
May 6, 2018
|
|
||
| return spec | ||
| with fits.open(str(filename), memmap=False) as hdulist: | ||
| return cls.from_hdulist(hdulist, hdu1=hdu1, hdu2=hdu2) |
Contributor
Author
There was a problem hiding this comment.
@joleroi - Was there a good reason to catch the KeyError and raise a ValueError instead?
My suggestion would be that here in gammapy.spectrum we just let the KeyError appear if users try to access HDUs that aren't there; otherwise we get mixed behaviour / errors from Gammapy read methods.
This was referenced May 7, 2018
alexcervino
pushed a commit
to alexcervino/gammapy
that referenced
this pull request
Jul 4, 2026
Always open FITS files with memmap=False
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR changes all read methods in Gammapy to use
with fits.open(filename, memmap=False).See discussion in #1055 and astropy/astropy#7440 .
I plan to merge if CI passes.
But comments are still welcome of course. Especially @woodmd or anyone, if you know of cases where
memmap=Trueshould definitely be used (e.g. for maps) for performance reasons. My understanding is that the performance difference should be small for most of our use cases, and thus given thatmemmap=Falseleads to predictable behaviour of FITS files always being closed at the end ofreadmethods, just puttingmemmap=Falseeverywhere is somehow the simple & safe default to put for now.