-
Notifications
You must be signed in to change notification settings - Fork 261
Fs surf metadata #458
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
Fs surf metadata #458
Conversation
I see some debugging things in there, I assume you want someone to take over? |
Ugh. Running up against Python 2.6's lack of OrderedDict. I guess we could just do a list of 2-tuples? If someone wants to access by name on 2.7+, they can just do |
|
postlude = [b'\x00\x00\x00\x14'] | ||
for key, val in volume_info.items(): | ||
if key in ('voxelsize', 'xras', 'yras', 'zras', 'cras'): | ||
val = '{:.3f} {:.3f} {:.3f}'.format(*val) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Realized these should be .4f
.
We have our own copy of ordereddict for Python 2.6 in externals. But it's OK to drop Python 2.6 too. |
import numpy as np | ||
import getpass | ||
import time | ||
from collections import OrderedDict |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as in from nibabel.externals import OrderedDict
comments addressed. Let's see if travis is happy. @Eric89GXL what debug statements do you see? |
Current coverage is 93.74%@@ master #458 diff @@
==========================================
Files 147 147
Lines 19181 19233 +52
Methods 0 0
Messages 0 0
Branches 2029 2042 +13
==========================================
+ Hits 17988 18030 +42
- Misses 796 803 +7
- Partials 397 400 +3
|
if len(line) == 0: | ||
continue | ||
key, val = map(bytes.strip, line.split(b'=', 1)) | ||
print(key, val) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
print statement
@agramfort - there are a few lines not covered by the tests here - see https://codecov.io/gh/nipy/nibabel/compare/791b10f7bc08c3f5ef5ae1e74d8b38e52158265e...63fd6c979cf27f51ad36a125973b60d8e40c7826 |
|
||
Returns | ||
------- | ||
coords : numpy array | ||
nvtx x 3 array of vertex (x, y, z) coordinates | ||
faces : numpy array | ||
nfaces x 3 array of defining mesh triangles | ||
volume_info : dict-like |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Say it's an ordered dict, given that we know that is the case?
appveyor error seems unrelated I have no idea why my last commit was necessary. |
val = val.astype(np.int) | ||
volume_info[key] = val | ||
except ValueError: | ||
raise ValueError("Error parsing volume info") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a lot of lines to be put in try
. Which line is expected to fail? If it's only one (hopefully) then it's better to only have that line in the try
clause.
If you're trying to catch any possible error on the other hand, then except Exception
is more appropriate, and it would be good to do "Error parsing volume info: '%s'" % err
@agramfort while you're in there are you up for adding the |
take over if you have time. I have some more urgent matter to take care of
in the next couple of days :(
|
Commit added to take care of my last comments (taking over for @agramfort). Ready for review/merge from my end. |
Whoops, didn't mean to make that comment. Just meant to close. Closing in favor of #460 |
cc @effigies @kingjr @jaeilepp
closes #456