[Bug]: IndexError: list index out of range, .abf conversion #1183
Description
What happened?
Trying to convert .abf to nwb, I run into an IndexError: list index out of range at (I believe) the conversion step. In my environment I installed the tdt conversion package first and then the abf conversion package to work around an issue I ran into when I tried running the code having installed the abf package only. I will submit a second bug report for that if it will be helpful.
Steps to Reproduce
from datetime import datetime
from zoneinfo import ZoneInfo
from pathlib import Path
from neuroconv.datainterfaces import AbfInterface
# Metadata info
icephys_metadata = {
"cell_id": "20220818001",
"slice_id": "20220818001",
"targeted_layer": "L2-3(medial)",
"inferred_layer": "",
"recording_sessions": [
{
"abf_file_name": "File_axon_5.abf",
"stimulus_type": "long_square",
"icephys_experiment_type": "voltage_clamp"
}
]
}
# Instantiate data interface
interface = AbfInterface(
file_paths=[fr"C:\Users\eastm\OneDrive\Desktop\2024_06_07_0000.abf"],
icephys_metadata=icephys_metadata
)
# Get metadata from source data and modify any values you want
metadata = interface.get_metadata()
metadata['NWBFile'].update(
identifier="ID1234",
session_description="Intracellular electrophysiology experiment.",
lab="my lab name", # <-- optional
institution="My University", # <-- optional
experimenter=["John Doe", "Jane Doe"], # <-- optional
)
metadata["Subject"] = dict(
subject_id="subject_ID123",
species="Mus musculus",
sex="M",
date_of_birth="2022-03-15T00:00:00"
)
# Run conversion
nwbfile_path = r'C:/Users/eastm/OneDrive/Desktop/test_nwb_2024_06_07_0000.nwb'
interface.run_conversion(nwbfile_path=nwbfile_path, metadata=metadata)
Traceback
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
Cell In[25], line 45
43 # Run conversion
44 nwbfile_path = r'C:/Users/eastm/OneDrive/Desktop/test_nwb_2024_06_07_0000.nwb'
---> 45 interface.run_conversion(nwbfile_path=nwbfile_path, metadata=metadata)
File ~\.conda\envs\neuroconv_tdt\Lib\site-packages\neuroconv\basedatainterface.py:196, in BaseDataInterface.run_conversion(self, nwbfile_path, nwbfile, metadata, overwrite, backend, backend_configuration, **conversion_options)
192 append_mode = file_initially_exists and not overwrite
194 self.validate_metadata(metadata=metadata, append_mode=append_mode)
--> 196 with make_or_load_nwbfile(
197 nwbfile_path=nwbfile_path,
198 nwbfile=nwbfile,
199 metadata=metadata,
200 overwrite=overwrite,
201 backend=backend,
202 verbose=getattr(self, "verbose", False),
203 ) as nwbfile_out:
204 if no_nwbfile_provided:
205 self.add_to_nwbfile(nwbfile=nwbfile_out, metadata=metadata, **conversion_options)
File ~\.conda\envs\neuroconv_tdt\Lib\contextlib.py:137, in _GeneratorContextManager.__enter__(self)
135 del self.args, self.kwds, self.func
136 try:
--> 137 return next(self.gen)
138 except StopIteration:
139 raise RuntimeError("generator didn't yield") from None
File ~\.conda\envs\neuroconv_tdt\Lib\site-packages\neuroconv\tools\nwb_helpers\_metadata_and_file_helpers.py:235, in make_or_load_nwbfile(nwbfile_path, nwbfile, metadata, overwrite, backend, verbose)
229 assert (
230 len(backends_that_can_read) <= 1
231 ), "More than one backend is capable of reading the file! Please raise an issue describing your file."
232 if backend not in backends_that_can_read:
233 raise IOError(
234 f"The chosen backend ('{backend}') is unable to read the file! "
--> 235 f"Please select '{backends_that_can_read[0]}' instead."
236 )
237 else:
238 load_kwargs.update(mode="w")
IndexError: list index out of range
Operating System
Windows
Python Executable
Conda
Python Version
3.11
Package Versions
annotated-types==0.7.0
anyio @ file:///C:/b/abs_31grv7a7bl/croot/anyio_1729121290992/work
argon2-cffi @ file:///opt/conda/conda-bld/argon2-cffi_1645000214183/work
argon2-cffi-bindings @ file:///C:/b/abs_f11axiliot/croot/argon2-cffi-bindings_1736182463870/work
asciitree==0.3.3
asttokens @ file:///opt/conda/conda-bld/asttokens_1646925590279/work
async-lru @ file:///C:/b/abs_e0hjkvwwb5/croot/async-lru_1699554572212/work
attrs @ file:///C:/b/abs_89hmquz5ga/croot/attrs_1734533130810/work
babel @ file:///C:/b/abs_ffzt1bmjth/croot/babel_1737454394148/work
beautifulsoup4 @ file:///C:/b/abs_d5wytg_p0w/croot/beautifulsoup4-split_1718029833749/work
bleach @ file:///C:/b/abs_925i9psm3u/croot/bleach_1732292896852/work
Brotli @ file:///C:/b/abs_c415aux9ra/croot/brotli-split_1736182803933/work
certifi @ file:///C:/b/abs_59o0xj7aav/croot/certifi_1734473304008/work/certifi
cffi @ file:///C:/b/abs_29_b57if3f/croot/cffi_1736184144340/work
charset-normalizer @ file:///croot/charset-normalizer_1721748349566/work
click==8.1.8
colorama @ file:///C:/ci_311/colorama_1676422310965/work
comm @ file:///C:/b/abs_67a8058udb/croot/comm_1709322909844/work
debugpy @ file:///C:/b/abs_bf9oo2vhxp/croot/debugpy_1736269476451/work
decorator @ file:///opt/conda/conda-bld/decorator_1643638310831/work
defusedxml @ file:///tmp/build/80754af9/defusedxml_1615228127516/work
Deprecated==1.2.15
docstring_parser==0.16
executing @ file:///opt/conda/conda-bld/executing_1646925071911/work
fasteners==0.19
fastjsonschema @ file:///C:/b/abs_4ev90296ly/croot/python-fastjsonschema_1731939386416/work
h11 @ file:///C:/b/abs_1czwoyexjf/croot/h11_1706652332846/work
h5py==3.12.1
hdmf==3.14.5
hdmf_zarr==0.9.0
httpcore @ file:///C:/b/abs_55n7g233bw/croot/httpcore_1706728507241/work
httpx @ file:///C:/b/abs_43e135shby/croot/httpx_1723474830126/work
idna @ file:///C:/b/abs_aad84bnnw5/croot/idna_1714398896795/work
ipykernel @ file:///C:/b/abs_5etv6sld_j/croot/ipykernel_1728665608850/work
ipython @ file:///C:/b/abs_8eyhzleyrk/croot/ipython_1734548134403/work
ipywidgets==8.1.5
jedi @ file:///C:/b/abs_3a2kbnlclc/croot/jedi_1733987412687/work
Jinja2 @ file:///C:/b/abs_ddyeze2h6_/croot/jinja2_1730903330414/work
json5 @ file:///C:/b/abs_743lprxrv5/croot/json5_1730786818336/work
jsonschema @ file:///C:/b/abs_394_t6__xq/croot/jsonschema_1728486718320/work
jsonschema-specifications @ file:///C:/b/abs_0brvm6vryw/croot/jsonschema-specifications_1699032417323/work
jupyter-events @ file:///C:/b/abs_c2m9s5b5m5/croot/jupyter_events_1718738115254/work
jupyter-lsp @ file:///C:/b/abs_ecle3em9d4/croot/jupyter-lsp-meta_1699978291372/work
jupyter_client @ file:///C:/b/abs_a6h3c8hfdq/croot/jupyter_client_1699455939372/work
jupyter_core @ file:///C:/b/abs_beftpbuevw/croot/jupyter_core_1718818307097/work
jupyter_server @ file:///C:/b/abs_9a333nh6yu/croot/jupyter_server_1718827092223/work
jupyter_server_terminals @ file:///C:/b/abs_ec0dq4b50j/croot/jupyter_server_terminals_1686870763512/work
jupyterlab @ file:///C:/b/abs_88qjk9lo2r/croot/jupyterlab_1725895228333/work
jupyterlab-pygments @ file:///tmp/build/80754af9/jupyterlab_pygments_1601490720602/work
jupyterlab_server @ file:///C:/b/abs_fdi5r_tpjc/croot/jupyterlab_server_1725865372811/work
jupyterlab_widgets==3.0.13
MarkupSafe @ file:///C:/b/abs_a9k8j__c_q/croot/markupsafe_1736370039866/work
matplotlib-inline @ file:///C:/ci_311/matplotlib-inline_1676425798036/work
mistune @ file:///C:/ci_311/mistune_1676425111783/work
nbclient @ file:///C:/b/abs_cal0q5fyju/croot/nbclient_1698934263135/work
nbconvert @ file:///C:/b/abs_ac6qnzi3no/croot/nbconvert_1728050663985/work
nbformat @ file:///C:/b/abs_c2jkw46etm/croot/nbformat_1728050303821/work
ndx-dandi-icephys==0.4.0
neo==0.14.0
nest-asyncio @ file:///C:/b/abs_65d6lblmoi/croot/nest-asyncio_1708532721305/work
neuroconv==0.6.7
notebook @ file:///C:/b/abs_feeub5ouq6/croot/notebook_1727197380211/work
notebook_shim @ file:///C:/b/abs_a5xysln3lb/croot/notebook-shim_1699455926920/work
numcodecs==0.15.0
numpy==1.26.4
overrides @ file:///C:/b/abs_cfh89c8yf4/croot/overrides_1699371165349/work
packaging @ file:///C:/b/abs_3by6s2fa66/croot/packaging_1734472138782/work
pandas==2.2.3
pandocfilters @ file:///opt/conda/conda-bld/pandocfilters_1643405455980/work
parse==1.20.2
parso @ file:///C:/b/abs_834b4mj92b/croot/parso_1733963322289/work
platformdirs @ file:///C:/b/abs_b6z_yqw_ii/croot/platformdirs_1692205479426/work
probeinterface==0.2.24
prometheus_client @ file:///C:/b/abs_e7l07zkc4b/croot/prometheus_client_1731961599071/work
prompt-toolkit @ file:///C:/b/abs_68uwr58ed1/croot/prompt-toolkit_1704404394082/work
psutil @ file:///C:/b/abs_b5gv3mn55h/croot/psutil_1736371546320/work
pure-eval @ file:///opt/conda/conda-bld/pure_eval_1646925070566/work
pycparser @ file:///tmp/build/80754af9/pycparser_1636541352034/work
pydantic==2.10.5
pydantic_core==2.27.2
Pygments @ file:///C:/b/abs_fay9dpq4n_/croot/pygments_1684279990574/work
pynwb==2.8.3
PySocks @ file:///C:/ci_311/pysocks_1676425991111/work
python-dateutil @ file:///C:/b/abs_3au_koqnbs/croot/python-dateutil_1716495777160/work
python-json-logger @ file:///C:/b/abs_0cm_mnox0z/croot/python-json-logger_1734370042436/work
pytz==2024.2
pywin32==308
pywinpty @ file:///C:/b/abs_6696uz5mru/croot/pywinpty_1733514639618/work
PyYAML @ file:///C:/b/abs_14xkfs39bx/croot/pyyaml_1728657968772/work
pyzmq @ file:///C:/b/abs_f3yte6j5yn/croot/pyzmq_1734711069724/work
quantities==0.16.1
referencing @ file:///C:/b/abs_09f4hj6adf/croot/referencing_1699012097448/work
requests @ file:///C:/b/abs_c3508vg8ez/croot/requests_1731000584867/work
rfc3339-validator @ file:///C:/b/abs_ddfmseb_vm/croot/rfc3339-validator_1683077054906/work
rfc3986-validator @ file:///C:/b/abs_6e9azihr8o/croot/rfc3986-validator_1683059049737/work
rpds-py @ file:///C:/b/abs_0c6z5kcdb6/croot/rpds-py_1736545465023/work
ruamel.yaml==0.18.10
ruamel.yaml.clib==0.2.12
scipy==1.15.1
Send2Trash @ file:///C:/b/abs_7e73ol18dl/croot/send2trash_1736542724140/work
six @ file:///tmp/build/80754af9/six_1644875935023/work
sniffio @ file:///C:/b/abs_3akdewudo_/croot/sniffio_1705431337396/work
soupsieve @ file:///C:/b/abs_bbsvy9t4pl/croot/soupsieve_1696347611357/work
spikeinterface==0.101.2
stack-data @ file:///opt/conda/conda-bld/stack_data_1646927590127/work
terminado @ file:///C:/ci_311/terminado_1678228513830/work
threadpoolctl==3.5.0
tinycss2 @ file:///C:/ci_311/tinycss2_1676425376744/work
tornado @ file:///C:/b/abs_7cyu943ybx/croot/tornado_1733960510898/work
tqdm==4.67.1
traitlets @ file:///C:/b/abs_bfsnoxl4pq/croot/traitlets_1718227069245/work
typing_extensions @ file:///C:/b/abs_0ffjxtihug/croot/typing_extensions_1734714875646/work
tzdata==2025.1
urllib3 @ file:///C:/b/abs_7bst06lizn/croot/urllib3_1737133657081/work
wcwidth @ file:///Users/ktietz/demo/mc3/conda-bld/wcwidth_1629357192024/work
webencodings==0.5.1
websocket-client @ file:///C:/b/abs_5dmnxxoci9/croot/websocket-client_1715878351319/work
widgetsnbextension==4.0.13
win-inet-pton @ file:///C:/ci_311/win_inet_pton_1676425458225/work
wrapt==1.17.2
zarr==2.17.2
Code of Conduct
- I agree to follow this project's Code of Conduct
- Have you ensured this bug was not already reported?