Closed scho97 closed 9 months ago
I left this in because having no state activation probably indicates the HMM fit didn't go so well. Getting an error makes this ver obvious, otherwise the user might think everything's fine.
I guess would eventually realise the HMM fit's off based on the spectra being full of zeros.
Maybe we should add nan_to_num
for the PSDs. @RukuangHuang what do you think?
nan_to_num
will be good. But I think we should add a warning that warns the user of potential poor HMM fit. And maybe suggest solutions like training multiple times and get the lowert FE run.
Okay, I can make a pull request with nan_to_num
and a detailed warning message, and perhaps both of you can review it?
When calculating a multitaper spectrogram, the following error can arise:
which occurred in
spectral.py
(L1727-L1728). This affects subsequent analysis and plotting.Here, the resulting
psd_
value is an array ofnp.nan
, and this turns out to be becausefo_ = 0
andpsd_
is an array of zeroes. This was a very specific case, occurring for a single subject within a model single run (so far). In such case, it seems like one state did not activate over entire time points.For this, I wasn't sure if we should consider this as a poor model fit (and therefore train the model again) or we should fix it with something like
as we did for the coherence in
spectral.py
(L855-L856).