

%%
THLFPs = THLFPs;
thetarange = linspace(0.5,250,1000);
lfp = double(THLFPs.data);
lfp(abs(lfp)>8000) = nan;
lfp = fillmissing(lfp,'linear');
[ss,ft,tt] = spectrogram(lfp,2*THLFPs.samplingRate,0.6*THLFPs.samplingRate,thetarange,THLFPs.samplingRate);
[spectrogrammt,tm,fm] = MTSpectrogram(lfp,'window',2);
bands = SpectrogramBands(spectrogrammt,fm);

figure;
colormap('jet')
imagesc(tt,thetarange,abs(ss));clim([0,8e4]);
yticks([0.5,20,50,100,200]); ylabel('Frequency (Hz)'); xlabel('Time (s)');
set(gca,'YDir','normal');

hold on;
plot([1:length(dFoverF)]/100+lfp_fbtime(1)/20000, dFoverF*500+150,'w');
hold on;
plot([1:length(sleep_)]/100, sleep_*10+50,'w');
hold on
locs_tt = locs/100;
for kk = 1:length(locs_tt)
    hold on
    xline(locs_tt(kk)+lfp_fbtime(1)/20000,'w--')
end


plot(accel.timestamps, accel.acceleration.motion/100+120,'y')