From 3a69ee84b46e3f5d02a766f95729f72211b80272 Mon Sep 17 00:00:00 2001 From: "Brian Y. Li" Date: Tue, 30 Jun 2026 14:43:26 -0400 Subject: [PATCH] Updated old naming of EMGHist* to newer MotionHist*. --- .../ClusterStates_MakeFigure.m | 46 +++++++++---------- .../SleepScoreMaster/SleepScoreMaster.m | 15 +++--- 2 files changed, 31 insertions(+), 30 deletions(-) diff --git a/detectors/detectStates/SleepScoreMaster/ClusterStates_MakeFigure.m b/detectors/detectStates/SleepScoreMaster/ClusterStates_MakeFigure.m index a9f1a774..596d6dfc 100755 --- a/detectors/detectStates/SleepScoreMaster/ClusterStates_MakeFigure.m +++ b/detectors/detectStates/SleepScoreMaster/ClusterStates_MakeFigure.m @@ -21,10 +21,8 @@ function ClusterStates_MakeFigure(SleepState,basePath,noprompts) [zFFTspec,mu,sig] = zscore(log10(swFFTspec)'); if sum(isinf(log10(thFFTspec(:))))==0 [~,mu_th,sig_th] = zscore(log10(thFFTspec)'); - disp('im in the if') else %For Theta over PSS (ThIRASA) - [~,mu_th,sig_th] = zscore(thFFTspec); - disp('im in the else') + [~,mu_th,sig_th] = zscore((thFFTspec)'); end viewwin =[t_clus(1) t_clus(end)]; @@ -36,28 +34,30 @@ function ClusterStates_MakeFigure(SleepState,basePath,noprompts) axis xy set(gca,'YTick',(log2([1 2 4 8 16 32 64 128]))) set(gca,'YTickLabel',{'1','2','4','8','16','32','64','128'}) - clim([3.5 6.5]) - clim(double([min(mu)-2*max(sig) max(mu)+2*max(sig)])) + % clim([3.5 6.5]) + clim(double([min(mu)-1.5*max(sig) max(mu)+1.5*max(sig)])) xlim(viewwin) colorbar('east') ylim([log2(swFFTfreqs(1)) log2(swFFTfreqs(end))+0.2]) set(gca,'XTickLabel',{}) ylabel({'swLFP','f (Hz)'}) title([recordingname,': State Scoring Results']); + subplot(8,1,3) imagesc(t_clus,log2(thFFTfreqs),log10(thFFTspec)) axis xy set(gca,'YTick',(log2([1 2 4 8 16 32 64 128]))) set(gca,'YTickLabel',{'1','2','4','8','16','32','64','128'}) - caxis(double([min(mu_th)-2*max(sig_th) max(mu_th)+2*max(sig_th)])) + % clim([3.5 6.5]) + clim(double([min(mu_th)-1.5*max(sig_th) max(mu_th)+1.5*max(sig_th)])) xlim(viewwin) - %colorbar('east') + % colorbar('east') ylim([log2(thFFTfreqs(1)) log2(thFFTfreqs(end))+0.2]) ylabel({'thLFP','f (Hz)'}) set(gca,'XTickLabel',{}) subplot(8,1,4) - %plot(t_clus,-IDX,'LineWidth',2) + % plot(t_clus,-IDX,'LineWidth',2) hold on plot(states{1}',-1*ones(size(states{1}))','k','LineWidth',8) plot(states{2}',-2*ones(size(states{2}))','b','LineWidth',8) @@ -71,7 +71,7 @@ function ClusterStates_MakeFigure(SleepState,basePath,noprompts) subplot(6,1,4) hold on plot(t_clus,broadbandSlowWave,'k') - %plot(synchtimes',thresh*ones(size(synchtimes))','r') + % plot(synchtimes',thresh*ones(size(synchtimes))','r') ylabel('SW') box on ylim([0 1]) @@ -81,7 +81,7 @@ function ClusterStates_MakeFigure(SleepState,basePath,noprompts) subplot(6,1,5) hold on plot(t_clus,thratio,'k') - %plot(synchtimes',thresh*ones(size(synchtimes))','r') + % plot(synchtimes',thresh*ones(size(synchtimes))','r') ylabel('Theta') box on ylim([0 1]) @@ -91,7 +91,7 @@ function ClusterStates_MakeFigure(SleepState,basePath,noprompts) subplot(6,1,6) hold on plot(t_clus,EMG,'k') - %plot(synchtimes',thresh*ones(size(synchtimes))','r') + % plot(synchtimes',thresh*ones(size(synchtimes))','r') ylabel('EMG') box on ylim([0 1]) @@ -125,14 +125,14 @@ function ClusterStates_MakeFigure(SleepState,basePath,noprompts) xlabel('Broadband Slow Wave') title('Step 1: Broadband for NREM') - - subplot(3,2,3) + subplot(3,2,3) hold on - bar(EMGhistbins(EMGhistbins>EMGthresh),EMGhist(EMGhistbins>EMGthresh),'FaceColor','k','barwidth',0.9,'linewidth',1) - bar(EMGhistbins(EMGhistbins<=EMGthresh),EMGhist(EMGhistbins<=EMGthresh),'FaceColor',0.9*[1 1 1],'barwidth',0.9,'linewidth',1) - plot([EMGthresh EMGthresh],[0 max(EMGhist)],'r','LineWidth',1) + bar(MotionHistBins(MotionHistBins>MotionThresh),MotionHist(MotionHistBins>MotionThresh),'FaceColor','k','barwidth',0.9,'linewidth',1) + bar(MotionHistBins(MotionHistBins<=MotionThresh),MotionHist(MotionHistBins<=MotionThresh),'FaceColor',0.9*[1 1 1],'barwidth',0.9,'linewidth',1) + plot([MotionThresh MotionThresh],[0 max(MotionHist)],'r','LineWidth',1) xlabel('EMG') title('Step 2: EMG for Muscle Tone') + subplot(3,2,5) hold on bar(THhistbins(THhistbins>=THthresh),THhist(THhistbins>=THthresh),'FaceColor','r','barwidth',0.9,'linewidth',1) @@ -149,11 +149,11 @@ function ClusterStates_MakeFigure(SleepState,basePath,noprompts) % hold on plot(broadbandSlowWave(IDX==3,1),EMG(IDX==3),'b.','markersize',0.1) hold on - plot(broadbandSlowWave(EMG>EMGthresh & IDX==1,1),EMG(EMG>EMGthresh & IDX==1),'k.','markersize',0.1) - plot(broadbandSlowWave(EMGMotionThresh & IDX==1,1),EMG(EMG>MotionThresh & IDX==1),'k.','markersize',0.1) + plot(broadbandSlowWave(EMG