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

find_intersecting_intervals needs a strict mode to rule out partial overlaps #42

Open
kushaangupta opened this issue Dec 2, 2024 · 2 comments · May be fixed by #43
Open

find_intersecting_intervals needs a strict mode to rule out partial overlaps #42

kushaangupta opened this issue Dec 2, 2024 · 2 comments · May be fixed by #43

Comments

@kushaangupta
Copy link
Collaborator

import nelpy as nel
import neuro_py as npy

npy.process.find_intersecting_intervals(nel.EpochArray([1, 3]), nel.EpochArray([0, 2]))

Returns True but doesn't discriminate if overlap is partial

@ryanharvey1
Copy link
Owner

Wouldn't this additional line of code do what you want?

import nelpy as nel
import neuro_py as npy

set_1 = nel.EpochArray([[1, 2], [5, 6]])
set_2 = nel.EpochArray([[1, 3], [10, 11], [15, 16]])
overlap = npy.process.find_intersecting_intervals(set_1, set_2, return_indices=False)

# intervals in set 1 that completely overlap with set 2
set_1.lengths == overlap

array([1, 0])

@kushaangupta
Copy link
Collaborator Author

Umm.. It works perfectly. I still added the PR as this way adds a few extra lines in my use case

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants