[Mne_analysis] Empty room BTI-to-FIF error

Eric Larson larson.eric.d at gmail.com
Thu Sep 27 11:23:06 EDT 2018
Search archives:

        External Email - Use Caution        

If this is a standard output of the BTi system (for example if all your
empty-room recordis are thsi way) and we can figure out the correct way to
deal with it, then yes it shouldn't be too difficult to fix the reader to
deal with this case.

Eric


On Thu, Sep 27, 2018 at 11:21 AM Bear, Joshua <JOSHUA.BEAR at ucdenver.edu>
wrote:

> Hi Alex,
>
> Thank you for looking into this!
>
> I also don’t know why BTI does that but could ask our MEG physicist. I
> wonder if it is linked to the head shape information and, since this had no
> subject, it uses nans to show that.
>
> Would it be relatively trivial to hack the reader? My FieldTrip workaround
> is effective but a bit clunky and cumbersome, and it would be great to keep
> everything in python.
>
> Thanks,
> Josh
>
>
>
>
> Joshua Bear, MD, MA | Assistant Professor, Pediatric Neurology and Epilepsy
> 13123 East 16th Avenue, Box B-155 | Aurora, CO 80045 | Phone: 720-777-6138
> | Fax: 720-777-7285
>
>
>
> On Sep 27, 2018, at 6:53 AM, Alexandre Gramfort <
> alexandre.gramfort at inria.fr> wrote:
>
>        External Email - Use Caution
>
> hi Josh,
>
> we can replicate the problem with Denis. For some reason your config file
> has a transform matrix (dev_ctf_t) that contains NaN:
>
> bti_info['bti_transform'][0]
> array([[ 1.        ,  0.        ,  0.        ,         nan],
>      [-0.        ,  0.70710678,  0.70710678,         nan],
>      [ 0.        , -0.70710678,  0.70710678,         nan],
>      [ 1.        ,  1.        ,  1.        ,  1.        ]])
>
> this pops up when reading the bytes from your config file. You can
> also use the follow
> lines to debug:
>
> ------
> from mne.io.bti.read import read_char, read_uint32, read_transform,
> read_float
> from mne.io.bti.read import read_int16, read_str, read_int32
>
>
> with open('config', 'rb') as fid:
>
>    cfg = dict()
>    cfg['hdr'] = {'version': read_int16(fid),
>                  'site_name': read_str(fid, 32),
>                  'dap_hostname': read_str(fid, 16),
>                  'sys_type': read_int16(fid),
>                  'sys_options': read_int32(fid),
>                  'supply_freq': read_int16(fid),
>                  'total_chans': read_int16(fid),
>                  'system_fixed_gain': read_float(fid),
>                  'volts_per_bit': read_float(fid),
>                  'total_sensors': read_int16(fid),
>                  'total_user_blocks': read_int16(fid),
>                  'next_der_chan_no': read_int16(fid)}
>
>    fid.seek(2, 1)
>    cfg['checksum'] = read_uint32(fid)
>    cfg['reserved'] = read_char(fid, 32)
>    cfg['transforms'] = [read_transform(fid) for t in
>                         range(cfg['hdr']['total_sensors'])]
>    print(cfg['transforms'])
> ------
>
> I don't know enough about BTi system to have a clue of how to fix this
> besides hacking the reader to replace NaNs by zeros.
>
> Alex
> On Wed, Sep 26, 2018 at 9:31 PM Bear, Joshua <JOSHUA.BEAR at ucdenver.edu>
> wrote:
>
>
> Alex, thank you for the response. I’ve sent another email with files.
>
> Denis, yes, I just checked the empty room recordings for the other
> subjects in this study as well as a recording I obtained some months ago. I
> am able to open them in Brainstorm but get the same error across all files
> in MNE-python. I thought I had previously pulled the older empty room
> recording into a prior version of MNE-Python, but I can’t remember with
> certainty.
>
> Cheers,
> Josh
>
>
>
>
> Joshua Bear, MD, MA | Assistant Professor, Pediatric Neurology and Epilepsy
> 13123 East 16th Avenue, Box B-155 | Aurora, CO 80045 | Phone: 720-777-6138
> | Fax: 720-777-7285
>
>
>
> On Sep 26, 2018, at 1:25 PM, Denis-Alexander Engemann <
> denis.engemann at gmail.com> wrote:
>
>        External Email - Use Caution
>
>
> Keep me in the loop. I may be able to help. Can you btw. exclude that it
> is an issue for that particular file?
> On Wed 26 Sep 2018 at 21:02, Alexandre Gramfort <
> alexandre.gramfort at inria.fr> wrote:
>
>
>        External Email - Use Caution
>
> hi Josh,
>
> can you share the empty room data with a script crashes?
>
> thanks
> Alex
>
>
> On Wed, Sep 26, 2018 at 7:57 PM Bear, Joshua <JOSHUA.BEAR at ucdenver.edu>
> wrote:
>
>
> Hello everyone,
>
> I’m working with some BTI data and would like to include empty room
> recordings done prior to the patient recordings for my noise covariance.
> When importing the data using mne.io.read_raw_bti() I have to set
> convert=False or I get an error. Then, when trying to save the data to the
> FIF format, I will get the same error, presumably because it is now trying
> to perform the conversion function that I had previously avoided.
>
> I do not have any problems with the actual subject recordings, only the
> empty room one.
>
> I’ve included the error message below. Has anyone seen this before and/or
> have suggestions on how to get my empty room data converted to FIF?
>
> Thank you for your help,
> Josh
>
>
>
>
> This is the error that appears to occur during BTI to FIF conversion:
>
> Reading 4D PDF file /mystudy/06%29%18 at 13:28/1/c,rfhp0.1Hz...
> Creating Neuromag info structure ...
> ... Setting channel info structure.
> ... putting coil transforms in Neuromag coordinates
> Traceback (most recent call last):
>  File "<stdin>", line 1, in <module>
>  File "<string>", line 2, in read_raw_bti
>  File
> "/Users/joshbear/bin/anaconda3/envs/mne/lib/python3.6/site-packages/mne/utils.py",
> line 729, in verbose
>    return function(*args, **kwargs)
>  File
> "/Users/joshbear/bin/anaconda3/envs/mne/lib/python3.6/site-packages/mne/io/bti/bti.py",
> line 1398, in read_raw_bti
>    eog_ch=eog_ch, preload=preload, verbose=verbose)
>  File "<string>", line 2, in __init__
>  File
> "/Users/joshbear/bin/anaconda3/envs/mne/lib/python3.6/site-packages/mne/utils.py",
> line 729, in verbose
>    return function(*args, **kwargs)
>  File
> "/Users/joshbear/bin/anaconda3/envs/mne/lib/python3.6/site-packages/mne/io/bti/bti.py",
> line 1031, in __init__
>    sort_by_ch_name=sort_by_ch_name, eog_ch=eog_ch)
>  File
> "/Users/joshbear/bin/anaconda3/envs/mne/lib/python3.6/site-packages/mne/io/bti/bti.py",
> line 1209, in _get_bti_info
>    t = _convert_coil_trans(t, dev_ctf_t, bti_dev_t)
>  File
> "/Users/joshbear/bin/anaconda3/envs/mne/lib/python3.6/site-packages/mne/io/bti/bti.py",
> line 250, in _convert_coil_trans
>    t = combine_transforms(invert_transform(dev_ctf_t), bti_dev_t,
>  File
> "/Users/joshbear/bin/anaconda3/envs/mne/lib/python3.6/site-packages/mne/transforms.py",
> line 576, in invert_transform
>    return Transform(trans['to'], trans['from'], linalg.inv(trans['trans']))
>  File
> "/Users/joshbear/bin/anaconda3/envs/mne/lib/python3.6/site-packages/scipy/linalg/basic.py",
> line 946, in inv
>    a1 = _asarray_validated(a, check_finite=check_finite)
>  File
> "/Users/joshbear/bin/anaconda3/envs/mne/lib/python3.6/site-packages/scipy/_lib/_util.py",
> line 238, in _asarray_validated
>    a = toarray(a)
>  File
> "/Users/joshbear/bin/anaconda3/envs/mne/lib/python3.6/site-packages/numpy/lib/function_base.py",
> line 1233, in asarray_chkfinite
>    "array must not contain infs or NaNs")
> ValueError: array must not contain infs or NaNs
>
>
>
>
>
> Joshua Bear, MD, MA | Assistant Professor, Pediatric Neurology and Epilepsy
> 13123 East 16th Avenue, Box B-155 | Aurora, CO 80045 | Phone: 720-777-6138
> | Fax: 720-777-7285
>
>        External Email - Use Caution
>
> _______________________________________________
> Mne_analysis mailing list
> Mne_analysis at nmr.mgh.harvard.edu
> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis
>
>
> _______________________________________________
> Mne_analysis mailing list
> Mne_analysis at nmr.mgh.harvard.edu
> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis
>
>
> _______________________________________________
> Mne_analysis mailing list
> Mne_analysis at nmr.mgh.harvard.edu
> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis
>
>
>        External Email - Use Caution
>
> _______________________________________________
> Mne_analysis mailing list
> Mne_analysis at nmr.mgh.harvard.edu
> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis
>
>
> _______________________________________________
> Mne_analysis mailing list
> Mne_analysis at nmr.mgh.harvard.edu
> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis
>
>
>         External Email - Use Caution
>
> _______________________________________________
> Mne_analysis mailing list
> Mne_analysis at nmr.mgh.harvard.edu
> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20180927/c462dfcc/attachment-0001.html 


More information about the Mne_analysis mailing list