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: positional indexers are out-of-bounds #43

Closed
czisou opened this issue Oct 24, 2023 · 12 comments
Closed

IndexError: positional indexers are out-of-bounds #43

czisou opened this issue Oct 24, 2023 · 12 comments
Assignees
Labels
bug Something isn't working

Comments

@czisou
Copy link

czisou commented Oct 24, 2023

I believe this is also a matter of better error handling.

This bug can be reproduced e.g. with the file "ukb/accelerometer/group5/3801805_90001_0_0.cwa.gz"

See attached file for the log.
index_error_log.txt

@LeandroCasiraghi
Copy link
Contributor

LeandroCasiraghi commented Mar 11, 2024

Hi, I've been having the exact same issue on different computers (both on Windows and Linux systems).
Now trying to run asleep on a fresh Windows 10 install on an Anaconda virtual environment with openjdk 11.0.13 and python 3.8.18, and getting the same.
Not sure what additional information I could supply to help figure this out.

@angerhang
Copy link
Member

Now trying to run asleep on a fresh Windows 10 install on an Anaconda virtual environment with openjdk 11.0.13 and python 3.8.18, and getting the same.

weird, this should have been sorted. Could you provide me with a sample file?

@LeandroCasiraghi
Copy link
Contributor

Hi! Of course, here's one:
https://drive.google.com/file/d/1-8D2SXm_B6NCvTh_3cCtEl2ZIM0PGNTc/view?usp=sharing

I do have one computer in which I can run asleep with no issues; but I haven't been able to get it to work anywhere else.
I'm trying to set up a new computer in my lab for people to be able to work with their AX3 data, and having the same issue I had elsewhere in other computers, Win or Linux based.

@LeandroCasiraghi
Copy link
Contributor

Coming back with a weirder (if that´s even possible) update on this issue:
Yesterday I run asleep on a bunch of files in the lab computer where it works with no problems. Then I moved to a second set of files (same AX3 devices, same participants, but recorded just after the others) and started getting the "indexers out of bounds" error...

Now, for more weirdness, I'm running asleep in my personal laptop at home... and it's running on both set of files with no errors. I'm trying to come up with theories about where this error is arising from, but I have no clue.
Maybe date or time formats, being read differently on different systems? This wouldn't explain why one computer would be able to process one set of files and not the other.
Something to do with the size of files and RAM? This also wouldn't explain why my lab computer wouldn't do it while my personal laptop does (both are 16gb DDR4).

@angerhang
Copy link
Member

Now, for more weirdness, I'm running asleep in my personal laptop at home... and it's running on both set of files with no errors. I'm trying to come up with theories about where this error is arising from, but I have no clue.

Hey @LeandroCasiraghi thanks for getting in touch again. I suspect it might be due to your local python environment. If you verify that all of your systems have the same python version and dependencies, then it should work.

By any chance if you are using any virtual environment to help you manage your dependencies, if you haven't. That might be a good thing to try.

@LeandroCasiraghi
Copy link
Contributor

@angerhang thanks for the reply. Indeed, I'm working on virtual environments on all devices.
I will check the matching of dependencies on each computer and see what comes out and report it here.

@BernieVA
Copy link

BernieVA commented May 12, 2024

I had the same exception and did some digging and found out day interval calculation had a bug, the first interval starts at noon of the previous day and ends at noon of the first day of wearing. However, if you started to wear after noon of the first day, there is no data in the first interval.
What I did is to add the following code to the file "\AppData\Local\anaconda3\envs\asleep\Lib\site-packages\asleep\sleep_window.py"

after line 272:

if start_date.hour < 12:
    my_day_start = start_date.replace(
        hour=12, minute=0, second=0, microsecond=0)
    my_day_start = my_day_start - timedelta(hours=24)
else:
    my_day_start = start_date.replace(
        hour=12, minute=0, second=0, microsecond=0)

it worked then.

@angerhang
Copy link
Member

I had the same exception and did some digging and found out day interval calculation had a bug, the first interval starts at noon of the previous day and ends at noon of the first day of wearing. However, if you started to wear after noon of the first day, there is no data in the first interval. What I did is to add the following code to the file "\AppData\Local\anaconda3\envs\asleep\Lib\site-packages\asleep\sleep_window.py"

after line 272:

if start_date.hour < 12:
    my_day_start = start_date.replace(
        hour=12, minute=0, second=0, microsecond=0)
    my_day_start = my_day_start - timedelta(hours=24)
else:
    my_day_start = start_date.replace(
        hour=12, minute=0, second=0, microsecond=0)

it worked then.

Thanks for the clarification. Indeed this is the expected behaviour. If you have the time to make a PR, happy to take a look :D

@LeandroCasiraghi
Copy link
Contributor

Hi all, again. I updated the package to the latest version today on my personal and encountered this error on a file I had processed succesfully just yesterday. I'm trying to implement @BernieVA 's solution now, but I'm seeing that line 272 is not a clear position anymore, after the last update. Would you clarify where to modify the sleep_window.py file to make it work now?
Thanks!

@BernieVA
Copy link

BernieVA commented Jul 15, 2024 via email

@angerhang
Copy link
Member

@LeandroCasiraghi and @BernieVA thanks for reporting. Indeed, a couple of our members have also reported the same error which seems to be strange. I suspect it might because some dependencies have changed to make new installation break. I will investigate this issue tomorrow and provide a patch

@angerhang angerhang self-assigned this Jul 15, 2024
@angerhang angerhang added the bug Something isn't working label Jul 15, 2024
angerhang added a commit that referenced this issue Jul 16, 2024
@angerhang
Copy link
Member

angerhang commented Jul 16, 2024

Hey all, I believe the recent PR should have fixed this issue.

You could test it out with the least release

 pip install --upgrade asleep

If the issue still persists, please provide me with a sample file when reopening this issue. Thanks for all of your feedback again ;D @LeandroCasiraghi @BernieVA @aidanacquah

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants