Repository navigation
allow reading of certain IDL 8.0 .sav files - #5801
Merged
Merged
Conversation
registration case follows #/usr/bin/env python3 """ scipy.io.readsav registration test illustrates IDL 8.0 .sav file bug workaround Michael Hirsch https://scivision.co This test fails with SciPy 0.16.1 and the latest Git, but will pass after patching either version with the one line patch below. In git rev 9e86073, line 283 of scipy.io.readsav, change to warnings.warn("Error occurred while reading byte array") """ from six.moves import urllib from scipy.io import readsav from numpy import isclose def reg_readsav(fn): dat = readsav(fn) assert isclose(dat['skymap']['full_azimuth'][0][128,128],235.79643) if __name__ =='__main__': url='http://data.phys.ucalgary.ca/sort_by_project/THEMIS/asi/skymaps/new_style/mcgr_20110305/themis_skymap_mcgr_20110305-+_vXX.sav' fn = url.rsplit('/',1)[-1] try: reg_readsav(fn) except IOError: urllib.request.urlretrieve(url,fn) reg_readsav(fn)
@@ master #5801 diff @@
======================================
Files 235 235
Stmts 43348 43347 -1
Branches 8165 8165
Methods 0 0
======================================
+ Hit 33723 33725 +2
Partial 2594 2594
+ Missed 7031 7028 -3
|
Member
|
@scienceopen thanks for the fix. Could you please turn the example above into a self-contained regression test (in |
Author
|
@rgommers added IDL 8.0 style struct byte array file and regression test that trips error in existing code (but not in my patched version of readsav). Does that suffice? Thanks for your help. |
pv
added a commit
that referenced
this pull request
Feb 13, 2016
ENH: io: allow reading of certain IDL 8.0 .sav files
Member
|
Thanks, looks good to me. Merged. |
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.
Some IDL anonymous structures throw an exception needlessly in readsav, the structures read fine when the Exception is turned into a warning. Registration case to verify this patch follows
"""
scipy.io.readsav registration test
illustrates IDL 8.0 .sav file bug workaround
Michael Hirsch
https://scivision.co
This test fails with SciPy 0.16.1 and the latest Git, but will pass
after patching either version with the one line patch below.
In git rev 9e86073, line 283 of scipy.io.readsav, change to
warnings.warn("Error occurred while reading byte array")