Repository navigation
WIP mne_kit2fiff - #366
WIP mne_kit2fiff#366teonbrooks wants to merge 104 commits into
Conversation
|
Hi @t3on great you work on this. I will have a deeper look soon. Just two tiny remarks. If it's meant to be a script, you should add option parsers and line calling the classes. Second as it looks, the stuff for reading kit files is almost there here. We should think about a module then like mne/fiff/kit.py. Finally, (ok, a third point), think about minimizing adding new classes. E.g. the head shape certainly don't needs a class. As you proceed, don't forget to add tests, if you can add a test-dataset. |
|
.... finally, finally. doc strings are missing in some functions. even if its a private function, tell the visitors of the code by adding """Aux function""" or so. |
|
Thanks @dengemann for the comments. I was wondering if you or anyone else knew how the channel coil transformation is calculated. Tangentially, do you know about the three unit vectors that follow the coordinates for the sensors? Are they actually used? If so, how are they calculated and where are they applied? |
|
Hi @t3on, it may be a bit convolved, but the bti example demonstrates how this can achieved, at least when coming from bti data. Now I don't know, which coord system the KIT uses. Much depends on that. |
|
sorry, wrong button, reopened. |
|
Basically you have to know how kit coordinates map on neuromag coordinates and you have to know whether the coordinates are in head or in sensor space. Depending on the ensuing 'case matrix' you have to do less or more work ;-) |
|
Some general comments, before we get too in-depth on the review:
Incidentally, when I go about adding new functionality, I sometimes actually start with step (4), above. That is, I write or modify |
|
Incidentally @agramfort @dengemann, how do you think on starting a new, more generic |
|
I think we already discussed it somewhere that this is the way to go. At least something like fiff/kit.py fiff/bti.py Maybe 'import' might not be the best choice though for a name, as import already is a keyword... On 11.01.2013, at 10:47, Eric89GXL [email protected] wrote:
|
|
so to be a bit more clear my proposal would be to integrate support for other systems with our fiff eco system as densely as possible. On 11.01.2013, at 10:47, Eric89GXL [email protected] wrote:
|
|
on the other hand side a submodule in fiff to mark this functionality / put it in an extra name space is probably a good idea. both could work together. as an alternative we could call
but maybe mne/fiff/import would be fine import. would then harbor submodules for each vendor / system type but we would try as much as possible to use a similar aproach as in constants, write, tag, open, read, etc. either by reproducing similar modules in the import name space or by adding to the existing ones, On 11.01.2013, at 10:47, Eric89GXL [email protected] wrote:
|
What would be the rationale for this? Wouldn't it be cleaner to have separate modules for separate file types? About the location, what about |
|
More or less. But what we will support is creating fiffs from other foreing On Fri, Jan 11, 2013 at 3:01 PM, Christian Brodbeck <
|
Yes that makes sense as long as file formats are sufficiently similar
It just seems somewhat strange to have code for reading other file types under the fiff module, or is that just me? :) |
|
I mean, we already have ctf.py, this is why I started having this idea. But On Fri, Jan 11, 2013 at 3:35 PM, Christian Brodbeck <
|
|
I think eventually we will rename fiff to something like io. And I didn't If we do want a unified "fiff/convert.py" or whatever we could still do it, |
|
@Eric89GXL yeayeah, glad I could convey the point. On Fri, Jan 11, 2013 at 6:19 PM, Eric89GXL [email protected] wrote:
|
|
Although the ctf.py --admittedly-- does not doe conversion, as I understood it, it's for offline compensation. Bu this shouldn't change too much, the point remains valid, I think. So let's go with fiff/whatever_system.py and try do distribute common tasks like reading, constants, etc. across the related fiff submodules and only keep the most idiosyncratic stuff in the related whatever.py modules. Any bin we might provide should import the functionality from there. Believe me, it will look more beautiful and less hakish. |
There was a problem hiding this comment.
These statements seem somewhat redundant :)
There was a problem hiding this comment.
Lol, yeah...true. You make a very strong argument.
Teon
Sent from an iPhone
On Feb 16, 2013, at 10:36, Christian Brodbeck [email protected]
wrote:
In mne/fiff/kit/kit.py:
If not None, override default verbose level (see mne.verbose).
- See Also
- mne.fiff.Raw : Documentation of attribute and methods.
- """
- @verbose
- def init(self, input_fname, mrk_fname, elp_fname, hsp_fname, sns_fname,
stim, data=None, stimthresh=3.5, verbose=None):
logger.info('Extracting SQD Parameters from %s...' % input_fname)sqd = _get_sqd_params(input_fname)mrk_fname = mrk_fnameelp_fname = elp_fnamehsp_fname = hsp_fnamesns_fname = sns_fname
These statements seem somewhat redundant :)
—
Reply to this email directly or view it on
GitHubhttps://github.com//pull/366/files#r3039523.
That would make it more consistent with the other reader (BTi) and presumably less confusing. Data should come from an sqd file if it is a KIT, right? |
ENH fit_matched_pts: add tolerance parameter
Would'nt that be a transient issue since the previous original self._data is left to the GC? Initializing with extra row makes sense if stim channel is always added. |
|
I think that the stim channel is always created. On Sat, Feb 16, 2013 at 11:32 AM, Denis A. Engemann <
|
Yes, the problem is that for large sqd files, python became slow and consumed large quantities of memory, so that might also be improved by having fewer large arrays at a time(?) |
If you know beforehand how many samples are going to be in the data, you can preallocate with |
There was a problem hiding this comment.
Also here you could use data *= conv_factor to avoid duplicating the array
|
If you know beforehand how many samples are going to be in the data, you Would then say, data[:192,:] = np.fromfile(...), reshape to the allotted |
|
|
On Sat, Feb 16, 2013 at 6:57 PM, Christian Brodbeck <
|
|
@dengemann I am not saying these are necessary changes, but @t3on mentioned performance issues with his files (which are quite big) so I am making suggestions on things that might help |
|
My files are half his size so I don't personally care :P |
Btw. how big are the files creating problems, just out of curiosity. The files I use are often around 1GB. |
|
Around 1 hour at 1000 Hz |
|
That makes really big files, I suppose ;-) |
|
Thanks @christianmbrodbeck , @dengemann . Those issues have now been addressed. |
There was a problem hiding this comment.
Another minor comment, couldn't this be achieved with fid.seek(..., os.SEEK_CUR)? (http://docs.python.org/2/library/stdtypes.html#bltin-file-objects)
There was a problem hiding this comment.
Are you talking about the dumping of the values? I could say fid.seek(mrk_offset + KIT.INT + (2*KIT.DOUBLE*4**2)) to seek over those values.
There was a problem hiding this comment.
Yes, or with os.SEEK_CUR you can move by a relative offset. I am not sure, but I would assume it's more efficient than reading data you don't need.
There was a problem hiding this comment.
if you guys are happy with this PR I'll squash a few commits to remove the
large files from the history and merge.
There was a problem hiding this comment.
Tests pass here, +1 for squash/merge
|
just spent 30mins trying to merge this branch by rebase but due to the previous merge with master it's a nightmare. @t3on would you mind reopening a new clean PR ? the idea is to have no diff between a new branch kit_clean so |
|
See #475. |
Very much still WIP.
Hi everyone,
I have been working on a python implementation of the mne_kit2fiff for the KIT MEG system. I have completed a large portion of it but I may need some help with a few tweaks and final steps:
-channel coil transformation
-channel unit vectors of coord_frame.
-fix dev_head_t
-creating a synthetic trigger channel
Feedback is welcome.