Repository navigation
Conversation
|
... forgot to add to todo:
|
|
... almost there. Some dirty padding issue is left which messes up some of the channel names / transforms read from the config file. Also I started organizing the code toward the io API change. As we switch, the new bit submodule, a directory below fife, will move to IO. I will acquire some testdata tomorrow and start with nosetests then, as soon as the missing last bytes unpack correctly. I will probably remove a decent part of the BTI constants, as those arent that constant as I just learned. It turned out that debugging was easier with just the byte jumps and read counts visible. Also, to improve readibility I chose the classical dicitonary style, due to the color scheme implied It helps a lot reading the code which is in big parts nothing but seemingly endless mapping. So the left side has a color different from the right side. I'll let you know as soon as this is ready for review. |
|
Hooray! Debugged the config reading, now I can read in all we need to calibrate the measurement data from short int to float and ale I get the channel transforms. Fiff from binary bti is coming ;-) |
|
Note. Also I included a tiny bti raw file, a config, and a headshape file for unititests. Al are below 1MB. @agramfort that should be ok, shouldn't it? |
|
left to do:
|
|
I'm almost there. The raw file nicely constructs from the bti test file. But there is one failing test. On reading the saved tmp fiff the mne.fiff.Raw would throw an exception because nchan is not found. ERROR: Test conversion to Raw object
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/nose-1.2.1-py2.7.egg/nose/case.py", line 197, in runTest
self.test(*self.arg)
File "/Users/denisaengemann/python/mne-python/mne/fiff/bti/tests/test_bti.py", line 57, in test_raw
with Raw_(tmp_raw_fname) as r:
File "/Users/denisaengemann/python/mne-python/mne/utils.py", line 229, in dec
return function(*args, **kwargs)
File "/Users/denisaengemann/python/mne-python/mne/fiff/raw.py", line 86, in __init__
for fname in fnames]
File "/Users/denisaengemann/python/mne-python/mne/utils.py", line 229, in dec
return function(*args, **kwargs)
File "/Users/denisaengemann/python/mne-python/mne/fiff/raw.py", line 158, in _read_raw_file
info, meas = read_meas_info(fid, tree)
File "/Users/denisaengemann/python/mne-python/mne/utils.py", line 229, in dec
return function(*args, **kwargs)
File "/Users/denisaengemann/python/mne-python/mne/fiff/meas_info.py", line 107, in read_meas_info
raise ValueError('Number of channels in not defined')
ValueError: Number of channels in not definedThis is weird because info['nchan'] is set and I included two passing assert statemets checking for correspondence of nchan and len(channels) as well as completeness of the raw.info. @agramfort @mluessi @Eric89GXL do you have an idea what's going on here? |
|
looking into it now apparently a first problem is that your info['dig'][k]['r'] is not of length 3 so write_dig_point does not do what it's supposed to do. Also to be consistent with fif files info['dig'][k]['r'].dtype should be np.float32 you also have a problem with write_ch_info. Not sure what yet. |
|
oh, indeed, sth. went wrong with the dig. |
|
yeah, the fiducials are telescoped together in the first dig point's 'r' field. should not be. |
|
info['chs'][270]['loc'] is None |
|
appart from that the info seem correct |
|
Yeah, that's a reference channel that apparently has no transform. What to do with this? Can I substitute, e.g. a simply an array of mock loc values? Yes should work |
|
fill it with np.zeros(12, dtype=np.float32) |
|
@agramfort could you drop some general comment on the style of mne/fiff/bti / the API? Would be helpful for finalizing this one. And thanks for the first aid. |
|
... the 'f4' / 'f8' issue leaves me with the general question how to handle casting, etc. So do we always store 'f4' floats in a riff or is it only for some parts of the info structure? |
There was a problem hiding this comment.
ref_mag, ref_grad, eog, ext = [count(1) for _ in range(4)]
|
it should not matter much as a cast is done when writing but ideally it On Sun, Jan 20, 2013 at 3:16 PM, Denis A. Engemann <[email protected]
|
There was a problem hiding this comment.
would you mind using a dict here? Bunch can lead to problems eg when pickling.
There was a problem hiding this comment.
Sure, was more a debugging thing.
On Sun, Jan 20, 2013 at 3:27 PM, Alexandre Gramfort <
[email protected]> wrote:
In mne/fiff/bti/raw.py:
- """Read BTi system config file
- Parameters
- fname : str
The absolute path to the config file
- Returns
- cfg : Bunch
A dict like structure including the config blocks found.
- """
- fid = open(fname, 'rb')
- cfg = Bunch()
would you mind using a dict here? Bunch can lead to problems eg when
pickling.—
Reply to this email directly or view it on GitHubhttps://github.com//pull/385/files#r2707225.
|
let me know when tests pass so we can check coverage + tests for linux |
There was a problem hiding this comment.
You need to pass this ecg_ch and eog_ch, right?
There was a problem hiding this comment.
On Wed, Jan 30, 2013 at 12:02 AM, Eric89GXL [email protected]:
In mne/fiff/bti/raw.py:
if 'high_freq' in step:hp, lp = step['high_freq'], step['low_freq']elif 'hp' in step['process_type']:hp = step['freq']elif 'lp' in step['process_type']:lp = step['freq']
info['highpass'] = hpinfo['lowpass'] = lpinfo['acq_pars'], info['acq_stim'] = None, Noneinfo['filename'] = Noneinfo['filenames'] = []chs = []
ch_names = [ch['name'] for ch in bti_info['chs']]info['ch_names'] = _rename_channels(ch_names)You need to pass this ecg_ch and eog_ch, right?
Oh yes ;-) Thanks!
I think, anyways that's just an interims security measure. On the long run
these arguments will disappear.
—
Reply to this email directly or view it on GitHubhttps://github.com//pull/385/files#r2818060.
|
Now that I've gone through the code, here are a few issues:
|
|
thanks for the in-depth review, Eric! all points should be inside my ballpark ;-) On 30.01.2013, at 01:03, Eric89GXL [email protected] wrote:
|
There was a problem hiding this comment.
PEP8, this one's 81 char long.
There was a problem hiding this comment.
yeah, you found one ;-)
On 30.01.2013, at 01:39, Eric89GXL [email protected] wrote:
In mne/fiff/bti/raw.py:
info['dev_ctf_t']['trans'] = dev_ctf_tinfo['ctf_head_t'] = dict()info['ctf_head_t']['from'] = FIFF.FIFFV_MNE_COORD_CTF_HEADinfo['ctf_head_t']['to'] = FIFF.FIFFV_COORD_HEADinfo['ctf_head_t']['trans'] = ctf_head_tlogger.info('Done.')
if False: # reminds us to support this as we go# include digital weights from reference channelcomps = info['comps'] = list()weights = bti_info['weights']by_name = lambda x: x[1]chn = dict(ch_mapping)columns = [chn[k] for k in weights['dsp_ch_names']]rows = [chn[k] for k in weights['ch_names']] PEP8, this one's 81 char long.col_order, col_names = zip(*sorted(enumerate(columns), key=by_name))—
Reply to this email directly or view it on GitHub.
There was a problem hiding this comment.
also see my reviews. the nitpickers united
On 30.01.2013, at 01:42, Eric89GXL [email protected] wrote:
In mne/fiff/bti/raw.py:
info['dev_ctf_t']['trans'] = dev_ctf_tinfo['ctf_head_t'] = dict()info['ctf_head_t']['from'] = FIFF.FIFFV_MNE_COORD_CTF_HEADinfo['ctf_head_t']['to'] = FIFF.FIFFV_COORD_HEADinfo['ctf_head_t']['trans'] = ctf_head_tlogger.info('Done.')
if False: # reminds us to support this as we go# include digital weights from reference channelcomps = info['comps'] = list()weights = bti_info['weights']by_name = lambda x: x[1]chn = dict(ch_mapping)columns = [chn[k] for k in weights['dsp_ch_names']]rows = [chn[k] for k in weights['ch_names']] I had to beat @agramfort to it :)col_order, col_names = zip(*sorted(enumerate(columns), key=by_name))—
Reply to this email directly or view it on GitHub.
|
Tests pass over here. Nice work! |
|
Thanks!! On 30.01.2013, at 01:40, Eric89GXL [email protected] wrote:
|
|
On 30.01.2013, at 01:03, Eric89GXL [email protected] wrote:
btw. this is definitely planned. Already created an eligible ethically legally unambiguous real sample dataset. It's just that our analogue eeg device broke and still there's no routine available for merging the new digital ecg / eog traces with the megdata. Should not be difficult, but will comsume a few additional hours. Therefore I postponed this..
|
|
merged after a crazy rebase to avoid pushed the large files in the history ! awesome work ! |
|
damn it this wasn't ready... many comments put forward by @Eric89GXL were not yet addressed. D On 10.02.2013, at 18:39, Alexandre Gramfort [email protected] wrote:
|
no release planned and tests passed with a good coverage. I don't feel back :) |
|
Yes, that's reasonable. Actually it's sometimes easier to have minimum working version merged and improve / polish it incrementally. |
This includes the functions and the class from #248
and binary readers -- disclaimer -- inspired by / refactored from python-megdata, a module hosted by the ynic york group.
Works:
Written, but untested:
To be done: