<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div class="">Hi Alex,&nbsp;<div class=""><br class=""></div><div class="">Thank you for looking into this!&nbsp;</div><div class=""><br class=""></div><div class="">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.&nbsp;</div><div class=""><br class=""></div><div class="">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.&nbsp;</div><div class=""><br class=""></div><div class="">Thanks,</div><div class="">Josh</div><div class=""><br class=""></div></div><div class=""><br class=""></div><div class=""><br class=""></div><br class=""><div class="">
<div style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-decoration: none;">Joshua Bear, MD, MA | Assistant Professor, Pediatric Neurology and Epilepsy<br class="">13123 East 16th Avenue, Box B-155 | Aurora,&nbsp;CO 80045 | Phone: 720-777-6138 | Fax:&nbsp;720-777-7285&nbsp;<br class="">&nbsp;<br class=""></div><br class=""></div>
<div><br class=""><blockquote type="cite" class=""><div class="">On Sep 27, 2018, at 6:53 AM, Alexandre Gramfort &lt;<a href="mailto:alexandre.gramfort@inria.fr" class="">alexandre.gramfort@inria.fr</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div class=""> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;External Email - Use Caution &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br class=""><br class="">hi Josh,<br class=""><br class="">we can replicate the problem with Denis. For some reason your config file<br class="">has a transform matrix (dev_ctf_t) that contains NaN:<br class=""><br class=""> bti_info['bti_transform'][0]<br class="">array([[ 1. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;, &nbsp;0. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;, &nbsp;0. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;, &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;nan],<br class=""> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[-0. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;, &nbsp;0.70710678, &nbsp;0.70710678, &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;nan],<br class=""> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[ 0. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;, -0.70710678, &nbsp;0.70710678, &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;nan],<br class=""> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[ 1. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;, &nbsp;1. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;, &nbsp;1. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;, &nbsp;1. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;]])<br class=""><br class="">this pops up when reading the bytes from your config file. You can<br class="">also use the follow<br class="">lines to debug:<br class=""><br class="">------<br class="">from mne.io.bti.read import read_char, read_uint32, read_transform, read_float<br class="">from mne.io.bti.read import read_int16, read_str, read_int32<br class=""><br class=""><br class="">with open('config', 'rb') as fid:<br class=""><br class=""> &nbsp;&nbsp;&nbsp;cfg = dict()<br class=""> &nbsp;&nbsp;&nbsp;cfg['hdr'] = {'version': read_int16(fid),<br class=""> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'site_name': read_str(fid, 32),<br class=""> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'dap_hostname': read_str(fid, 16),<br class=""> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'sys_type': read_int16(fid),<br class=""> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'sys_options': read_int32(fid),<br class=""> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'supply_freq': read_int16(fid),<br class=""> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'total_chans': read_int16(fid),<br class=""> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'system_fixed_gain': read_float(fid),<br class=""> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'volts_per_bit': read_float(fid),<br class=""> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'total_sensors': read_int16(fid),<br class=""> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'total_user_blocks': read_int16(fid),<br class=""> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'next_der_chan_no': read_int16(fid)}<br class=""><br class=""> &nbsp;&nbsp;&nbsp;fid.seek(2, 1)<br class=""> &nbsp;&nbsp;&nbsp;cfg['checksum'] = read_uint32(fid)<br class=""> &nbsp;&nbsp;&nbsp;cfg['reserved'] = read_char(fid, 32)<br class=""> &nbsp;&nbsp;&nbsp;cfg['transforms'] = [read_transform(fid) for t in<br class=""> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;range(cfg['hdr']['total_sensors'])]<br class=""> &nbsp;&nbsp;&nbsp;print(cfg['transforms'])<br class="">------<br class=""><br class="">I don't know enough about BTi system to have a clue of how to fix this<br class="">besides hacking the reader to replace NaNs by zeros.<br class=""><br class="">Alex<br class="">On Wed, Sep 26, 2018 at 9:31 PM Bear, Joshua &lt;<a href="mailto:JOSHUA.BEAR@ucdenver.edu" class="">JOSHUA.BEAR@ucdenver.edu</a>&gt; wrote:<br class=""><blockquote type="cite" class=""><br class="">Alex, thank you for the response. I’ve sent another email with files.<br class=""><br class="">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.<br class=""><br class="">Cheers,<br class="">Josh<br class=""><br class=""><br class=""><br class=""><br class="">Joshua Bear, MD, MA | Assistant Professor, Pediatric Neurology and Epilepsy<br class="">13123 East 16th Avenue, Box B-155 | Aurora, CO 80045 | Phone: 720-777-6138 | Fax: 720-777-7285<br class=""><br class=""><br class=""><br class="">On Sep 26, 2018, at 1:25 PM, Denis-Alexander Engemann &lt;<a href="mailto:denis.engemann@gmail.com" class="">denis.engemann@gmail.com</a>&gt; wrote:<br class=""><br class=""> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;External Email - Use Caution<br class=""><br class=""><br class="">Keep me in the loop. I may be able to help. Can you btw. exclude that it is an issue for that particular file?<br class="">On Wed 26 Sep 2018 at 21:02, Alexandre Gramfort &lt;<a href="mailto:alexandre.gramfort@inria.fr" class="">alexandre.gramfort@inria.fr</a>&gt; wrote:<br class=""><blockquote type="cite" class=""><br class=""> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;External Email - Use Caution<br class=""><br class="">hi Josh,<br class=""><br class="">can you share the empty room data with a script crashes?<br class=""><br class="">thanks<br class="">Alex<br class=""><br class=""><br class="">On Wed, Sep 26, 2018 at 7:57 PM Bear, Joshua &lt;<a href="mailto:JOSHUA.BEAR@ucdenver.edu" class="">JOSHUA.BEAR@ucdenver.edu</a>&gt; wrote:<br class=""><blockquote type="cite" class=""><br class="">Hello everyone,<br class=""><br class="">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.<br class=""><br class="">I do not have any problems with the actual subject recordings, only the empty room one.<br class=""><br class="">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?<br class=""><br class="">Thank you for your help,<br class="">Josh<br class=""><br class=""><br class=""><br class=""><br class="">This is the error that appears to occur during BTI to FIF conversion:<br class=""><br class="">Reading 4D PDF file /mystudy/06%29%18@13:28/1/c,rfhp0.1Hz...<br class="">Creating Neuromag info structure ...<br class="">... Setting channel info structure.<br class="">... putting coil transforms in Neuromag coordinates<br class="">Traceback (most recent call last):<br class=""> &nbsp;File "&lt;stdin&gt;", line 1, in &lt;module&gt;<br class=""> &nbsp;File "&lt;string&gt;", line 2, in read_raw_bti<br class=""> &nbsp;File "/Users/joshbear/bin/anaconda3/envs/mne/lib/python3.6/site-packages/mne/utils.py", line 729, in verbose<br class=""> &nbsp;&nbsp;&nbsp;return function(*args, **kwargs)<br class=""> &nbsp;File "/Users/joshbear/bin/anaconda3/envs/mne/lib/python3.6/site-packages/mne/io/bti/bti.py", line 1398, in read_raw_bti<br class=""> &nbsp;&nbsp;&nbsp;eog_ch=eog_ch, preload=preload, verbose=verbose)<br class=""> &nbsp;File "&lt;string&gt;", line 2, in __init__<br class=""> &nbsp;File "/Users/joshbear/bin/anaconda3/envs/mne/lib/python3.6/site-packages/mne/utils.py", line 729, in verbose<br class=""> &nbsp;&nbsp;&nbsp;return function(*args, **kwargs)<br class=""> &nbsp;File "/Users/joshbear/bin/anaconda3/envs/mne/lib/python3.6/site-packages/mne/io/bti/bti.py", line 1031, in __init__<br class=""> &nbsp;&nbsp;&nbsp;sort_by_ch_name=sort_by_ch_name, eog_ch=eog_ch)<br class=""> &nbsp;File "/Users/joshbear/bin/anaconda3/envs/mne/lib/python3.6/site-packages/mne/io/bti/bti.py", line 1209, in _get_bti_info<br class=""> &nbsp;&nbsp;&nbsp;t = _convert_coil_trans(t, dev_ctf_t, bti_dev_t)<br class=""> &nbsp;File "/Users/joshbear/bin/anaconda3/envs/mne/lib/python3.6/site-packages/mne/io/bti/bti.py", line 250, in _convert_coil_trans<br class=""> &nbsp;&nbsp;&nbsp;t = combine_transforms(invert_transform(dev_ctf_t), bti_dev_t,<br class=""> &nbsp;File "/Users/joshbear/bin/anaconda3/envs/mne/lib/python3.6/site-packages/mne/transforms.py", line 576, in invert_transform<br class=""> &nbsp;&nbsp;&nbsp;return Transform(trans['to'], trans['from'], linalg.inv(trans['trans']))<br class=""> &nbsp;File "/Users/joshbear/bin/anaconda3/envs/mne/lib/python3.6/site-packages/scipy/linalg/basic.py", line 946, in inv<br class=""> &nbsp;&nbsp;&nbsp;a1 = _asarray_validated(a, check_finite=check_finite)<br class=""> &nbsp;File "/Users/joshbear/bin/anaconda3/envs/mne/lib/python3.6/site-packages/scipy/_lib/_util.py", line 238, in _asarray_validated<br class=""> &nbsp;&nbsp;&nbsp;a = toarray(a)<br class=""> &nbsp;File "/Users/joshbear/bin/anaconda3/envs/mne/lib/python3.6/site-packages/numpy/lib/function_base.py", line 1233, in asarray_chkfinite<br class=""> &nbsp;&nbsp;&nbsp;"array must not contain infs or NaNs")<br class="">ValueError: array must not contain infs or NaNs<br class=""><br class=""><br class=""><br class=""><br class=""><br class="">Joshua Bear, MD, MA | Assistant Professor, Pediatric Neurology and Epilepsy<br class="">13123 East 16th Avenue, Box B-155 | Aurora, CO 80045 | Phone: 720-777-6138 | Fax: 720-777-7285<br class=""><br class=""> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;External Email - Use Caution<br class=""><br class="">_______________________________________________<br class="">Mne_analysis mailing list<br class=""><a href="mailto:Mne_analysis@nmr.mgh.harvard.edu" class="">Mne_analysis@nmr.mgh.harvard.edu</a><br class="">https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis<br class=""></blockquote><br class="">_______________________________________________<br class="">Mne_analysis mailing list<br class=""><a href="mailto:Mne_analysis@nmr.mgh.harvard.edu" class="">Mne_analysis@nmr.mgh.harvard.edu</a><br class="">https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis<br class=""></blockquote><br class="">_______________________________________________<br class="">Mne_analysis mailing list<br class=""><a href="mailto:Mne_analysis@nmr.mgh.harvard.edu" class="">Mne_analysis@nmr.mgh.harvard.edu</a><br class="">https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis<br class=""><br class=""><br class=""> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;External Email - Use Caution<br class=""><br class="">_______________________________________________<br class="">Mne_analysis mailing list<br class="">Mne_analysis@nmr.mgh.harvard.edu<br class="">https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis<br class=""></blockquote><br class="">_______________________________________________<br class="">Mne_analysis mailing list<br class=""><a href="mailto:Mne_analysis@nmr.mgh.harvard.edu" class="">Mne_analysis@nmr.mgh.harvard.edu</a><br class="">https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis</div></div></blockquote></div><br class=""></body></html>