Skip to content

Tutorial 2: Apply an epoch and get theta signal

William Chapman edited this page Jul 16, 2014 · 2 revisions
%% Setup:

% Set some arbitrary epochs
lv = root.epoch(end)-root.epoch(1);
sv = root.epoch(1);

root.epoch = [sv sv+lv/5; ...
              sv+2*lv/5 sv+3*lv/5; ...
              sv+4*lv/5 sv+lv];

root.cel = root.cells(1,:);         % set to first available cell
root.active_lfp = root.cells(1,1);   % get LFP from tetrode 1


%% Plot the LFP only during these epochs:
ts = CMBHOME.Utils.ContinuizeEpochs(root.lfp.ts);           
% Vector of the filtered ts
theta = CMBHOME.Utils.ContinuizeEpochs(root.lfp.theta);     
% vector of the filtered theta signal
c_ts = CMBHOME.Utils.ContinuizeEpochs(root.cel_ts);         
% vector of the timestamps of spikes within these epochs
c_theta = CMBHOME.Utils.ContinuizeEpochs(root.cel_theta);   
% vector of theta signal at spikes within these epochs

figure; plot(ts,theta);
hold on
plot(c_ts,c_theta,'r.')

%% Circular histogram of theta phase of firing
figure
thetaPhase = CMBHOME.Utils.ContinuizeEpochs(root.lfp.theta_phase);
c_thetaPhase = CMBHOME.Utils.ContinuizeEpochs(root.cel_thetaphase);
rose(c_thetaPhase)
Clone this wiki locally