Hello,
I encounter the following error when I try to launch the mark electrodes gui:
patient.mark_electrodes()
Launching electrode picker
Traceback (most recent call last):
File "/data/u_forster_software/anaconda3/envs/img_pipe_py3/lib/python3.5/site-packages/img_pipe/SupplementalScripts/electrode_picker.py", line 887, in
e = electrode_picker(subj_dir = subj_dir, hem = hem)
File "/data/u_forster_software/anaconda3/envs/img_pipe_py3/lib/python3.5/site-packages/img_pipe/SupplementalScripts/electrode_picker.py", line 215, in init
ct_data[ct_data < 1000] = np.nan
ValueError: cannot convert float NaN to integer
Any ideas?
Thank you
Carina
UPDATE:
I set ct_data[ct_data < 1000] = 1
further there is an issue in the anatomical marker function:
np.genfromtxt is deprecated in python 3:
this is a nice workaround that worked for me (otherwise updating numpy might help)
import functools
import io
import numpy as np
import sys
genfromtxt_old = np.genfromtxt
@functools.wraps(genfromtxt_old)
def genfromtxt_py3_fixed(f, encoding="utf-8", *args, **kwargs):
if isinstance(f, io.TextIOBase):
if hasattr(f, "buffer") and hasattr(f.buffer, "raw") and
isinstance(f.buffer.raw, io.FileIO):
# Best case: get underlying FileIO stream (binary!) and use that
fb = f.buffer.raw
# Reset cursor on the underlying object to match that on wrapper
fb.seek(f.tell())
result = genfromtxt_old(fb, *args, **kwargs)
# Reset cursor on wrapper to match that of the underlying object
f.seek(fb.tell())
else:
# Not very good but works: Put entire contents into BytesIO object,
# otherwise same ideas as above
old_cursor_pos = f.tell()
fb = io.BytesIO(bytes(f.read(), encoding=encoding))
result = genfromtxt_old(fb, *args, **kwargs)
f.seek(old_cursor_pos + fb.tell())
else:
result = genfromtxt_old(f, *args, **kwargs)
return result
if sys.version_info >= (3,):
np.genfromtxt = genfromtxt_py3_fixed
Hello,
I encounter the following error when I try to launch the mark electrodes gui:
patient.mark_electrodes()
Launching electrode picker
Traceback (most recent call last):
File "/data/u_forster_software/anaconda3/envs/img_pipe_py3/lib/python3.5/site-packages/img_pipe/SupplementalScripts/electrode_picker.py", line 887, in
e = electrode_picker(subj_dir = subj_dir, hem = hem)
File "/data/u_forster_software/anaconda3/envs/img_pipe_py3/lib/python3.5/site-packages/img_pipe/SupplementalScripts/electrode_picker.py", line 215, in init
ct_data[ct_data < 1000] = np.nan
ValueError: cannot convert float NaN to integer
Any ideas?
Thank you
Carina
UPDATE:
I set ct_data[ct_data < 1000] = 1
further there is an issue in the anatomical marker function:
np.genfromtxt is deprecated in python 3:
this is a nice workaround that worked for me (otherwise updating numpy might help)
import functools
import io
import numpy as np
import sys
genfromtxt_old = np.genfromtxt
@functools.wraps(genfromtxt_old)
def genfromtxt_py3_fixed(f, encoding="utf-8", *args, **kwargs):
if isinstance(f, io.TextIOBase):
if hasattr(f, "buffer") and hasattr(f.buffer, "raw") and
isinstance(f.buffer.raw, io.FileIO):
# Best case: get underlying FileIO stream (binary!) and use that
fb = f.buffer.raw
# Reset cursor on the underlying object to match that on wrapper
fb.seek(f.tell())
result = genfromtxt_old(fb, *args, **kwargs)
# Reset cursor on wrapper to match that of the underlying object
f.seek(fb.tell())
else:
# Not very good but works: Put entire contents into BytesIO object,
# otherwise same ideas as above
old_cursor_pos = f.tell()
fb = io.BytesIO(bytes(f.read(), encoding=encoding))
result = genfromtxt_old(fb, *args, **kwargs)
f.seek(old_cursor_pos + fb.tell())
else:
result = genfromtxt_old(f, *args, **kwargs)
return result
if sys.version_info >= (3,):
np.genfromtxt = genfromtxt_py3_fixed