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

Eog features #850

Open
VladimirR46 opened this issue Jun 23, 2023 · 13 comments
Open

Eog features #850

VladimirR46 opened this issue Jun 23, 2023 · 13 comments
Labels
wontfix This will not be worked on

Comments

@VladimirR46
Copy link

VladimirR46 commented Jun 23, 2023

Good afternoon! When I try to use the eog_features function I get the following error.

TypeError: only size-1 arrays can be converted to Python scalars

eog_cleaned = nk.eog_clean(ica0, sampling_rate=1000, method='neurokit')
peaks = nk.eog_findpeaks(eog_cleaned, sampling_rate=1000)
info = nk.eog_features(eog_cleaned, peaks,sampling_rate=1000)

But if I change sampling_rate to 100, for example, it works.

info = nk.eog_features(eog_cleaned, peaks,sampling_rate=100)

But I have a frequency of 1000 Hz.

eog_cleaned and peaks have the right data type

@welcome
Copy link

welcome bot commented Jun 23, 2023

Hi 👋 Thanks for reaching out and opening your first issue here! We'll try to come back to you as soon as possible. ❤️ kenobi

@danibene
Copy link
Collaborator

Would it be possible for you to share some example data? I ran your code with other data and did not get the same error:
https://gist.github.com/danibene/595f281bc118541e49b7d4462633d8ad

@VladimirR46
Copy link
Author

VladimirR46 commented Aug 1, 2023

Of course!
You can open the file as:

with open('EOG.npy', 'rb') as f:
    eog_v = np.load(f)

sampling_rate=500

EOG.zip

@danibene
Copy link
Collaborator

danibene commented Aug 2, 2023

But if I change sampling_rate to 100, for example, it works.

info = nk.eog_features(eog_cleaned, peaks,sampling_rate=100)

But I have a frequency of 1000 Hz.

Thanks @VladimirR46 ! Could you please clarify what you meant by a frequency of 1000 Hz / why you set the sampling_rate to 1000 in your code above if the sampling rate=500?

It would also be helpful if you could provide the error message received and the versions of your dependencies.

@VladimirR46
Copy link
Author

Hi. It's just another (new) dataset that has a sampling rate of 500 Hz.
But here I get the same error message.

eog_cleaned = nk.eog_clean(eog_v, sampling_rate=500, method='mne')
peaks = nk.eog_findpeaks(eog_cleaned, method='neurokit', sampling_rate=500)
info = nk.eog_features(eog_cleaned, peaks,sampling_rate=500)

image

I also need to get the "positive amplitude velocity ratio (pAVR)" characterization as in "Robbins, K. A. (2017). BLINKER: automated extraction of ocular indices from EEG enabling large-scale analysis."

image

But the resulting values are very different, i.e. I mean the value on the X-axis.

mean (matlab) == 5.3034
mean (neurokit2) == 9715.09827

@VladimirR46
Copy link
Author

Hey, everybody! I think I've solved my problem.

  1. I set threshold=0.3 for the function nk.eog_findpeaks
eog_cleaned = nk.eog_clean(eog_v, sampling_rate=500, method='mne')
peaks = nk.eog_findpeaks(eog_cleaned, method='neurokit', threshold=0.3, sampling_rate=500)
info = nk.eog_features(eog_cleaned, peaks,sampling_rate=500)
  1. I changed the formula for calculating pAVR
#pAVR = abs(change_close.max() / duration_close) * 100
pAVR = abs(blink_close.max() / change_close.max())/sampling_rate * 100
pAVR_list.append(pAVR)

image

@VladimirR46
Copy link
Author

VladimirR46 commented Aug 10, 2023

Good day! @danibene

# Neurokit2
pAVR = abs(change_close.max() / duration_close) * 100

# My Fix
pAVR = abs(blink_close.max() / change_close.max())/sampling_rate * 100  

Could you explain why the equation doesn't match the original article?

@danibene
Copy link
Collaborator

Hi @VladimirR46 thanks for sharing your solution and error, it's very appreciated!

I'm not the person who originally wrote this code and am not familiar with the article so it's hard for me to say off the top of my head (and I don't have time to look into it currently).

@DominiqueMakowski are you more familiar with this?

In any case I would suggest we keep the issue open so that we eventually either change the code for calculation or give a more informative error message.

@stale
Copy link

stale bot commented Oct 15, 2023

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@stale stale bot added the wontfix This will not be worked on label Oct 15, 2023
@VladimirR46
Copy link
Author

Yes, this question is still relevant.

@stale stale bot removed the wontfix This will not be worked on label Oct 16, 2023
Copy link

stale bot commented Mar 17, 2024

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@stale stale bot added the wontfix This will not be worked on label Mar 17, 2024
@VladimirR46
Copy link
Author

Yes, this question is still relevant.

@stale stale bot removed the wontfix This will not be worked on label Mar 17, 2024
Copy link

stale bot commented Jan 31, 2025

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@stale stale bot added the wontfix This will not be worked on label Jan 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants