<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 Eric and Alex,</div><div class=""><br class=""></div><div class="">I heard back from Eugene Kronberg, our MEG physicist, who confirmed that this transformation matrix will contain nans with any empty room recordings (unless you chose to record with the head frame system in place despite the absence of a head, I suppose). I’ve attached his response below.&nbsp;</div><div class=""><br class=""></div><div class="">Regards,</div><div class="">Josh</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><blockquote type="cite" class="">Hi Josh,<br class=""><br class="">Well, the empty room is an empty room, there is no patient and there is no head frame system of coordinates. Transformation matrix in the config file is for rotation&nbsp;and translation between sensor frame and head frame system of coordinates. That's why there are nan(s) in the transformation.<br class=""><br class="">The right thing would be not to use transformation matrix for the empty room recordings. Otherwise, you could try to replace nan(s) with something else.<br class=""><br class="">Good luck,<br class="">Eugene</blockquote></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></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 9:23 AM, Eric Larson &lt;<a href="mailto:larson.eric.d@gmail.com" class="">larson.eric.d@gmail.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html; charset=utf-8" class=""><p class=""><span style="padding: 3px 10px; border-radius: 5px; color: #ffffff; font-weight: bold; display: inline-block; background-color: #ff0000;" class="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;External Email - Use Caution&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></p><div class=""><br class="webkit-block-placeholder"></div><div dir="ltr" class="">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&nbsp;it, then yes it shouldn't be too difficult to fix the reader to deal with this case.<div class=""><br class=""></div><div class="">Eric</div><div class=""><br class=""></div></div><br class=""><div class="gmail_quote"><div dir="ltr" class="">On Thu, Sep 27, 2018 at 11:21 AM Bear, Joshua &lt;<a href="mailto:JOSHUA.BEAR@ucdenver.edu" class="">JOSHUA.BEAR@ucdenver.edu</a>&gt; wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word;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="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; text-decoration: none;" class="">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 class=""><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" target="_blank" class="">alexandre.gramfort@inria.fr</a>&gt; wrote:</div><br class="m_-8566560899522673812Apple-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" target="_blank" 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" target="_blank" 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" target="_blank" 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" target="_blank" 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" target="_blank" class="">Mne_analysis@nmr.mgh.harvard.edu</a><br class=""><a href="https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis" target="_blank" class="">https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis</a><br class=""></blockquote><br class="">_______________________________________________<br class="">Mne_analysis mailing list<br class=""><a href="mailto:Mne_analysis@nmr.mgh.harvard.edu" target="_blank" class="">Mne_analysis@nmr.mgh.harvard.edu</a><br class=""><a href="https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis" target="_blank" class="">https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis</a><br class=""></blockquote><br class="">_______________________________________________<br class="">Mne_analysis mailing list<br class=""><a href="mailto:Mne_analysis@nmr.mgh.harvard.edu" target="_blank" class="">Mne_analysis@nmr.mgh.harvard.edu</a><br class=""><a href="https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis" target="_blank" class="">https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis</a><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=""><a href="mailto:Mne_analysis@nmr.mgh.harvard.edu" target="_blank" class="">Mne_analysis@nmr.mgh.harvard.edu</a><br class=""><a href="https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis" target="_blank" class="">https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis</a><br class=""></blockquote><br class="">_______________________________________________<br class="">Mne_analysis mailing list<br class=""><a href="mailto:Mne_analysis@nmr.mgh.harvard.edu" target="_blank" class="">Mne_analysis@nmr.mgh.harvard.edu</a><br class=""><a href="https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis" target="_blank" class="">https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis</a></div></div></blockquote></div><br class=""></div><p class=""><span style="padding:3px 10px;border-radius:5px;color:#ffffff;font-weight:bold;display:inline-block;background-color:#ff0000" class="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;External Email - Use Caution&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></p><div class=""><br class="webkit-block-placeholder"></div>_______________________________________________<br class="">
Mne_analysis mailing list<br class="">
<a href="mailto:Mne_analysis@nmr.mgh.harvard.edu" target="_blank" class="">Mne_analysis@nmr.mgh.harvard.edu</a><br class="">
<a href="https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis" rel="noreferrer" target="_blank" class="">https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis</a></blockquote></div>
_______________________________________________<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></blockquote></div><br class=""></body></html>