Stanford-STAGES / stanford-stages

Automated sleep staging scoring and narcolepsy identification
76 stars 26 forks source link

Filtering will not be done if index is 0 #9

Closed hsgarciacaballero closed 4 years ago

hsgarciacaballero commented 4 years ago

Recently, I started running this model with some data of my own and I noticed that for some subjects the model was always predicting awake. After a thorough debugging, I found out the cause of my problem.

How to reproduce the error

Specify in your JSON configuration object a channel with index 0. Additionally, it might also require that the channel has quite high values (haven't tested exact numbers, but I would say above the values that are filtered out in the "filtering" step).

How to solve the problem

In file "inf_hypnodensity.py", method "filtering" we can find this:

if ch_idx:

This will evaluate to False when index is 0, skipping the filtering of this channel. By just changing it to something similar to what is done in other parts of the code fixes the problem:

if isinstance(ch_idx, int):

informaton commented 4 years ago

Humberto! Thank you for this catch and fix. I'll work on the fix now.

informaton commented 4 years ago

I just committed (cf80dd4) the fix, but will leave the issue open for a bit longer in case there are any other comments or related issues. Thanks again.