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

index error when mode=None in detect_badsegments #244

Closed
yingjoeyzhou opened this issue Dec 4, 2023 · 1 comment
Closed

index error when mode=None in detect_badsegments #244

yingjoeyzhou opened this issue Dec 4, 2023 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@yingjoeyzhou
Copy link

The following config

config = """
    preproc:
    - filter: {l_freq: 0.25, h_freq: 125, method: iir, iir_params: {order: 5, ftype: butter}}
    - notch_filter: {freqs: 50 100}
    - resample: {sfreq: 250}
    - bad_segments: {segment_len: 500, picks: mag, significance_level: 0.1}
    - bad_segments: {segment_len: 500, picks: grad, significance_level: 0.1}
    - bad_segments: {segment_len: 500, picks: mag, mode: diff, significance_level: 0.1}
    - bad_segments: {segment_len: 500, picks: grad, mode: diff, significance_level: 0.1}
    - bad_channels: {picks: mag, significance_level: 0.1}
    - bad_channels: {picks: grad, significance_level: 0.1}
    - ica_raw: {picks: meg, n_components: 0.99}
    - ica_autoreject: {picks: meg, ecgmethod: ctps, eogthreshold: auto}
    - interpolate_bads: {}
"""

returned the following error

index 167749 is out of bounds for axis 0 with size 153001
  File "/home/zhouj/osl/osl/preprocessing/batch.py", line 737, in run_proc_chain
    dataset = func(dataset, userargs)
  File "/home/zhouj/osl/osl/preprocessing/osl_wrappers.py", line 355, in run_osl_bad_segments
    dataset["raw"] = detect_badsegments(dataset["raw"], **userargs)
  File "/home/zhouj/osl/osl/preprocessing/osl_wrappers.py", line 177, in detect_badsegments
    onsets_secs = raw.first_samp/raw.info["sfreq"] + XX_times[onsets.astype(int)]

And I tried running the same code with this config (i.e., removed the bad segment detection using mode=None)

config = """
    preproc:
    - filter: {l_freq: 0.25, h_freq: 125, method: iir, iir_params: {order: 5, ftype: butter}}
    - notch_filter: {freqs: 50 100}
    - resample: {sfreq: 250}
    - bad_segments: {segment_len: 500, picks: mag, mode: diff, significance_level: 0.1}
    - bad_segments: {segment_len: 500, picks: grad, mode: diff, significance_level: 0.1}
    - bad_channels: {picks: mag, significance_level: 0.1}
    - bad_channels: {picks: grad, significance_level: 0.1}
    - ica_raw: {picks: meg, n_components: 0.99}
    - ica_autoreject: {picks: meg, ecgmethod: ctps, eogthreshold: auto}
    - interpolate_bads: {}
"""

the preprocessing was successful!

I have slacked @matsvanes and the data to reproduce this bug is in a temporal folder 4Mats under knobre on hbaws.

@matsvanes matsvanes added the bug Something isn't working label Jan 11, 2024
@cgohil8
Copy link
Collaborator

cgohil8 commented May 14, 2024

Looks like this issue has been resolved in the latest code. @yingjoeyzhou try git pull to get the latest code and reopen this issue if you're still getting an error. If not, please delete

/ohba/pi/knobre/4Mats

@cgohil8 cgohil8 closed this as completed May 14, 2024
@cgohil8 cgohil8 self-assigned this May 14, 2024
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

3 participants