Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IndexError during import SLEAP Analysis H5 file #1507

Closed
4 tasks
ohmstead opened this issue Sep 18, 2023 · 3 comments · Fixed by #1695
Closed
4 tasks

IndexError during import SLEAP Analysis H5 file #1507

ohmstead opened this issue Sep 18, 2023 · 3 comments · Fixed by #1695
Assignees
Labels
bug Something isn't working waiting for user input

Comments

@ohmstead
Copy link

ohmstead commented Sep 18, 2023

Bug description

I'm trying to import a video and SLEAP predictions that were created using command-line sleap-track. I have tried importing the h5 file and associated video into both existing and new projects. This error appears after I identify the location of the video file associated with the h5 file and click "import" after the "Video Import Options" window.

Unfortunately I can't attach my h5 file, since it's a binary file.

Traceback (most recent call last):
  File "C:\mambaforge\envs\sleap\lib\site-packages\sleap\gui\commands.py", line 321, in importAnalysisFile
    self.execute(ImportAnalysisFile)
  File "C:\mambaforge\envs\sleap\lib\site-packages\sleap\gui\commands.py", line 242, in execute
    command().execute(context=self, params=kwargs)
  File "C:\mambaforge\envs\sleap\lib\site-packages\sleap\gui\commands.py", line 139, in execute
    self.do_with_signal(context, params)
  File "C:\mambaforge\envs\sleap\lib\site-packages\sleap\gui\commands.py", line 163, in do_with_signal
    cls.do_action(context, params)
  File "C:\mambaforge\envs\sleap\lib\site-packages\sleap\gui\commands.py", line 1018, in do_action
    video=params["video"],
  File "C:\mambaforge\envs\sleap\lib\site-packages\sleap\io\format\main.py", line 103, in read
    return disp.read(filename, *args, **kwargs)
  File "C:\mambaforge\envs\sleap\lib\site-packages\sleap\io\format\dispatch.py", line 56, in read
    return adaptor.read(file, *args, **kwargs)
  File "C:\mambaforge\envs\sleap\lib\site-packages\sleap\io\format\sleap_analysis.py", line 115, in read
    track=tracks[track_idx],
IndexError: list index out of range

Expected behaviour

Actual behaviour

Your personal set up

installed with mamba

  • OS:
  • Version(s):
Environment packages
# packages in environment at C:\mambaforge\envs\sleap:
#
# Name                    Version                   Build  Channel
absl-py                   1.0.0                    pypi_0    pypi
astunparse                1.6.3                    pypi_0    pypi
attrs                     21.4.0             pyhd8ed1ab_0    conda-forge
backports-zoneinfo        0.2.1                    pypi_0    pypi
brotli                    1.0.9                hcfcfb64_9    conda-forge
brotli-bin                1.0.9                hcfcfb64_9    conda-forge
ca-certificates           2023.08.22           haa95532_0
cached-property           1.5.2                    pypi_0    pypi
cachetools                4.2.4                    pypi_0    pypi
cattrs                    1.1.1              pyhd8ed1ab_0    conda-forge
certifi                   2020.6.20          pyhd3eb1b0_3
charset-normalizer        2.0.9                    pypi_0    pypi
cloudpickle               2.2.1              pyhd8ed1ab_0    conda-forge
cuda-nvcc                 11.3.58              hb8d16a4_0    nvidia
cudatoolkit               11.3.1              hf2f0253_12    conda-forge
cudnn                     8.2.1.32             h754d62a_0    conda-forge
cycler                    0.11.0             pyhd8ed1ab_0    conda-forge
cytoolz                   0.12.0           py37hcc03f2d_0    conda-forge
dask-core                 2022.2.0           pyhd8ed1ab_0    conda-forge
efficientnet              1.0.0                    pypi_0    pypi
ffmpeg                    4.2.2                he774522_0
flatbuffers               2.0                      pypi_0    pypi
fonttools                 4.38.0           py37h51bd9d9_0    conda-forge
freeglut                  3.2.2                h63175ca_2    conda-forge
freetype                  2.12.1               h546665d_1    conda-forge
fsspec                    2023.1.0           pyhd8ed1ab_0    conda-forge
gast                      0.4.0                    pypi_0    pypi
geos                      3.11.0               h39d44d4_0    conda-forge
google-auth               2.3.3                    pypi_0    pypi
google-auth-oauthlib      0.4.6                    pypi_0    pypi
google-pasta              0.2.0                    pypi_0    pypi
grpcio                    1.43.0                   pypi_0    pypi
h5py                      3.1.0                    pypi_0    pypi
hdmf                      3.6.1                    pypi_0    pypi
icu                       69.1                 h0e60522_0    conda-forge
idna                      3.3                      pypi_0    pypi
image-classifiers         1.0.0                    pypi_0    pypi
imagecodecs-lite          2019.12.3        py37h0b711f8_5    conda-forge
imageio                   2.31.1             pyh24c5eb1_0    conda-forge
imgaug                    0.4.0              pyhd8ed1ab_1    conda-forge
imgstore                  0.2.9                    pypi_0    pypi
importlib-metadata        4.2.0                    pypi_0    pypi
importlib-resources       5.12.0                   pypi_0    pypi
intel-openmp              2023.2.0         h57928b3_49496    conda-forge
jasper                    2.0.33               hc2e4405_1    conda-forge
joblib                    1.3.2              pyhd8ed1ab_0    conda-forge
jpeg                      9e                   hcfcfb64_3    conda-forge
jsmin                     3.0.1              pyhd8ed1ab_0    conda-forge
jsonpickle                1.2                        py_0    conda-forge
jsonschema                4.17.3                   pypi_0    pypi
keras                     2.7.0                    pypi_0    pypi
keras-applications        1.0.8                    pypi_0    pypi
keras-preprocessing       1.1.2                    pypi_0    pypi
kiwisolver                1.4.4            py37h8c56517_0    conda-forge
lcms2                     2.14                 h90d422f_0    conda-forge
lerc                      4.0.0                h63175ca_0    conda-forge
libblas                   3.9.0              17_win64_mkl    conda-forge
libbrotlicommon           1.0.9                hcfcfb64_9    conda-forge
libbrotlidec              1.0.9                hcfcfb64_9    conda-forge
libbrotlienc              1.0.9                hcfcfb64_9    conda-forge
libcblas                  3.9.0              17_win64_mkl    conda-forge
libclang                  12.0.0                   pypi_0    pypi
libdeflate                1.14                 hcfcfb64_0    conda-forge
libhwloc                  2.9.2           nocuda_h15da153_1008    conda-forge
libiconv                  1.17                 h8ffe710_0    conda-forge
liblapack                 3.9.0              17_win64_mkl    conda-forge
liblapacke                3.9.0              17_win64_mkl    conda-forge
libopencv                 4.5.5           py37h542666b_10    conda-forge
libpng                    1.6.39               h19919ed_0    conda-forge
libprotobuf               3.20.3               h12be248_0    conda-forge
libsodium                 1.0.18               h8d14728_1    conda-forge
libsqlite                 3.42.0               hcfcfb64_0    conda-forge
libtiff                   4.4.0                hc4f729c_5    conda-forge
libwebp-base              1.3.1                hcfcfb64_0    conda-forge
libxcb                    1.13              hcd874cb_1004    conda-forge
libxml2                   2.11.5               hc3477c8_0    conda-forge
libzlib                   1.2.13               hcfcfb64_5    conda-forge
locket                    1.0.0              pyhd8ed1ab_0    conda-forge
m2w64-gcc-libgfortran     5.3.0                         6    conda-forge
m2w64-gcc-libs            5.3.0                         7    conda-forge
m2w64-gcc-libs-core       5.3.0                         7    conda-forge
m2w64-gmp                 6.1.0                         2    conda-forge
m2w64-libwinpthread-git   5.0.0.4634.697f757               2    conda-forge
markdown                  3.3.6                    pypi_0    pypi
markdown-it-py            2.2.0              pyhd8ed1ab_0    conda-forge
matplotlib-base           3.5.3            py37hbaab90a_2    conda-forge
mdurl                     0.1.0              pyhd8ed1ab_0    conda-forge
mkl                       2022.1.0           h6a75c08_874    conda-forge
msys2-conda-epoch         20160418                      1    conda-forge
munkres                   1.1.4              pyh9f0ad1d_0    conda-forge
ndx-pose                  0.1.1                    pypi_0    pypi
networkx                  2.6.3              pyhd8ed1ab_1    conda-forge
nixio                     1.5.3                    pypi_0    pypi
numpy                     1.19.5                   pypi_0    pypi
oauthlib                  3.1.1                    pypi_0    pypi
opencv                    4.5.5           py37h03978a9_10    conda-forge
opencv-python-headless    4.2.0.34                 pypi_0    pypi
openjpeg                  2.5.0                hc9384bd_1    conda-forge
openssl                   1.1.1v               h2bbff1b_0
opt-einsum                3.3.0                    pypi_0    pypi
packaging                 21.3                     pypi_0    pypi
pandas                    1.3.5            py37h9386db6_0    conda-forge
partd                     1.4.0              pyhd8ed1ab_0    conda-forge
patsy                     0.5.3              pyhd8ed1ab_0    conda-forge
pillow                    9.2.0            py37h42a8222_2    conda-forge
pip                       23.2.1             pyhd8ed1ab_0    conda-forge
pkgutil-resolve-name      1.3.10                   pypi_0    pypi
protobuf                  3.19.1                   pypi_0    pypi
psutil                    5.9.3            py37h51bd9d9_0    conda-forge
pthread-stubs             0.4               hcd874cb_1001    conda-forge
pthreads-win32            2.9.1                hfa6e2cd_3    conda-forge
py-opencv                 4.5.5           py37h90c5f73_10    conda-forge
pyasn1                    0.4.8                    pypi_0    pypi
pyasn1-modules            0.2.8                    pypi_0    pypi
pygments                  2.16.1             pyhd8ed1ab_0    conda-forge
pykalman                  0.9.5                      py_1    conda-forge
pynwb                     2.3.3                    pypi_0    pypi
pyparsing                 3.0.6                    pypi_0    pypi
pyrsistent                0.19.3                   pypi_0    pypi
pyside2                   5.13.1           py37hd7ce7fb_3    conda-forge
python                    3.7.12          h7840368_100_cpython    conda-forge
python-dateutil           2.8.2              pyhd8ed1ab_0    conda-forge
python-rapidjson          1.9              py37h7f67f24_0    conda-forge
python_abi                3.7                     3_cp37m    conda-forge
pytz                      2023.3             pyhd8ed1ab_0    conda-forge
pywavelets                1.3.0            py37h3a130e4_1    conda-forge
pyyaml                    6.0              py37hcc03f2d_4    conda-forge
pyzmq                     24.0.1           py37h7347f05_0    conda-forge
qimage2ndarray            1.10.0                   pypi_0    pypi
qt                        5.12.9               h556501e_6    conda-forge
qtpy                      2.3.1              pyhd8ed1ab_0    conda-forge
requests                  2.26.0                   pypi_0    pypi
requests-oauthlib         1.3.0                    pypi_0    pypi
rich                      13.5.1             pyhd8ed1ab_0    conda-forge
ruamel-yaml               0.17.32                  pypi_0    pypi
ruamel-yaml-clib          0.2.7                    pypi_0    pypi
scikit-image              0.19.3           py37h3182a2c_1    conda-forge
scikit-learn              1.0              py37ha78be43_1    conda-forge
scikit-video              1.1.11             pyh24bf2e0_0    conda-forge
scipy                     1.7.3            py37hb6553fb_0    conda-forge
seaborn                   0.12.2               hd8ed1ab_0    conda-forge
seaborn-base              0.12.2             pyhd8ed1ab_0    conda-forge
segmentation-models       1.0.1                    pypi_0    pypi
setuptools                59.8.0           py37h03978a9_1    conda-forge
setuptools-scm            6.3.2                    pypi_0    pypi
shapely                   1.8.5            py37h475e9a0_0    conda-forge
six                       1.16.0             pyh6c4a22f_0    conda-forge
sleap                     1.3.1                    pypi_0    pypi
sqlite                    3.42.0               hcfcfb64_0    conda-forge
statsmodels               0.13.2           py37h3a130e4_0    conda-forge
tbb                       2021.10.0            h91493d7_0    conda-forge
tensorboard               2.7.0                    pypi_0    pypi
tensorboard-data-server   0.6.1                    pypi_0    pypi
tensorboard-plugin-wit    1.8.0                    pypi_0    pypi
tensorflow                2.7.0                    pypi_0    pypi
tensorflow-estimator      2.7.0                    pypi_0    pypi
tensorflow-hub            0.12.0             pyhca92ed8_0    conda-forge
tensorflow-io-gcs-filesystem 0.23.1                   pypi_0    pypi
termcolor                 1.1.0                    pypi_0    pypi
threadpoolctl             3.1.0              pyh8a188c0_0    conda-forge
tifffile                  2020.6.3                   py_0    conda-forge
tk                        8.6.12               h8ffe710_0    conda-forge
tomli                     2.0.0                    pypi_0    pypi
toolz                     0.12.0             pyhd8ed1ab_0    conda-forge
typing-extensions         4.0.1                    pypi_0    pypi
typing_extensions         4.7.1              pyha770c72_0    conda-forge
tzdata                    2023.3                   pypi_0    pypi
tzlocal                   5.0.1                    pypi_0    pypi
ucrt                      10.0.22621.0         h57928b3_0    conda-forge
unicodedata2              14.0.0           py37hcc03f2d_1    conda-forge
urllib3                   1.26.7                   pypi_0    pypi
vc                        14.3                h64f974e_17    conda-forge
vc14_runtime              14.36.32532         hfdfe4a8_17    conda-forge
vs2015_runtime            14.36.32532         h05e6639_17    conda-forge
werkzeug                  2.0.2                    pypi_0    pypi
wheel                     0.41.1             pyhd8ed1ab_0    conda-forge
wrapt                     1.13.3                   pypi_0    pypi
xorg-libxau               1.0.11               hcd874cb_0    conda-forge
xorg-libxdmcp             1.1.3                hcd874cb_0    conda-forge
xz                        5.2.6                h8d14728_0    conda-forge
yaml                      0.2.5                h8ffe710_2    conda-forge
zeromq                    4.3.4                h0e60522_1    conda-forge
zipp                      3.15.0                   pypi_0    pypi
zstd                      1.5.2                h12be248_7    conda-forge```

</details>

<details><summary>Logs</summary>
<!--
Please share any applicable terminal logs. optionally share output from sleap-diagnostic
-->

paste relevant logs here, if any


</details>

## Screenshots

<!-- Provide any relevant screenshots -->

## How to reproduce

<!-- Use this section to describe the steps that a user would take to experience this bug. eg:-->

File > Import > SLEAP analysis HDF5 > identify location > identify video location > error
@ohmstead ohmstead added the bug Something isn't working label Sep 18, 2023
@roomrys
Copy link
Collaborator

roomrys commented Sep 25, 2023

Hi @ohmstead,

If you are trying to open an .slp file (which is what is output from sleap-track), then you can select File > Open Project from the GUI or from the CLI, you can use

sleap-label <path/to/file/use/double/quotes/if/spaces/in/path>

The Import selection is for non-slp files and will not invoke the correct file reader. If you would like an analysis file (.analysis.h5), the you can use the sleep-convert command, but this is only recommended for doing analysis after the pose estimation and tracking look good.

Let us know how that goes!

Thanks,
Liezl

@roomrys roomrys added waiting for user input migrate to discussions? Issues that may not require code changes and should possibly be migrated to discussions. and removed bug Something isn't working labels Sep 25, 2023
@ohmstead
Copy link
Author

Hi @roomrys, I'm trying to import an HDF5 file that was produced from a .slp using sleap-convert.

@roomrys
Copy link
Collaborator

roomrys commented Sep 26, 2023

Ok, thanks for clarifying! Apologies for the misunderstanding.

Do you mind uploading the .slp file and the .analysis.h5 to this upload form for troubleshooting?

I'm not sure if this work-around will work as I don't have the means to test it yet... but I wonder if things would run smoothly if you

  1. Open the .slp file
  2. Tracks > Delete Multiple Tracks > Unused (or if you have a single-animal project: All)
  3. Save As...
  4. File > Export Analysis HDF5...

And then try to File > Import > SLEAP Analysis HDF5 on the newly exported file containing only the used tracks.

Regardless if the workaround above helps, I'd still like to troubleshoot your file if that's okay.

Thanks,
Liezl

@roomrys roomrys added bug Something isn't working waiting for user input and removed waiting for user input migrate to discussions? Issues that may not require code changes and should possibly be migrated to discussions. labels Sep 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working waiting for user input
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants