AccuSleep icon indicating copy to clipboard operation
AccuSleep copied to clipboard

Feature Request: Power Spectrum into Accusleep Viewer

Open matiasandina opened this issue 3 years ago • 0 comments

Not sure this is doable but it would also help to hand score if we had either of these two plots

  • pwelch plot for the epoch
  • Theta/Delta power ratio for epoch

Maybe something like

% line 29
F_welch = figure("Name", "Welch");
axes_welch = axes;
        % Plot welch --- Line 378
        % pwelch signal
        n = round((G.epochLen)/G.dt/2); % number of samples on either side to show
        i = round(tp / G.dt);
        ii = i-n:i+n; % choose indices to show
        st_EEG = standardizeSR(G.EEG(ii), G.originalSR, G.SR);
        [pxx,f] = pwelch(st_EEG);
        plot(axes_welch,f,10*log10(pxx))
        ylabel(axes_welch, "10*log10(pxx)")
        xlabel(axes_welch, "Frequency (Hz)")

This is working somewhat OK on my end (meaning it updates when moving the cursor). I am not familiar enough with the epochs variables and the indexing to be sure this is plotting the exact window that corresponds to the other figure. I would also like to have the x axis of the spectrum in frequency but haven't figured out the proper way to call pwelch in this scenario

matiasandina avatar Apr 15 '22 20:04 matiasandina