seqasim / LFPAnalysis

6 stars 7 forks source link

n_cycles in computing wavelet transforms is slightly misleading when determining minimum time length #58

Open seqasim opened 8 months ago

seqasim commented 8 months ago

I've been assuming the wavelet length is n_cycles/freq. it's not (https://mne.discourse.group/t/help-understanding-tfr-n-cycles/7257)

would be good to hard code this in somewhere so people know how many cycles to use based on how long their data is

seqasim commented 6 months ago

This is a reasonable point to clarify in the TFR notebook (and in fact, raises the notion of adding a wiki-like page for "Common points of confusion" like this one).

However, the backend computation of wavelengths goes back to issues of first principles that I wouldn't force my way around. If you're getting length errors, your lower-end frequency is too low for the length of data you have - you shouldn't lower your n_cycles, you should look at longer epochs or higher frequencies

Or, if you want to do neither, you can compute TFRs using multitapers instead, which I think utilize precise windows of length cycle/freqs (though I'd double check this)