Skip to content

Commit

Permalink
fixed xaxis into pi units and setup to run double width tmax
Browse files Browse the repository at this point in the history
  • Loading branch information
droumis committed May 8, 2020
1 parent 2c55a52 commit b679970
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 10 deletions.
11 changes: 11 additions & 0 deletions DFAnalysis/dfa_phaseXcorr.m
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,16 @@
% out.xcShfLag0 = xcShfLag0;
out.excesscorr = nanmean(exc); % nanmean in case there are two bins equally near lag zero
out.xcrms = xcrms;
% so now 1 period (lick to lick duration) of the cycle is length 1 rot == 2pi
% so tmax 1 is actually 1 rot on either side of center ~ 2*2pi total
% the range is then -2pi : 2pi
% since bin of .01 sec will be .01 * 2pi rad, x axis will be
% -2pi:.01*2pi:2pi, which is 200 total bins
% so return out.xrad = -2pi*tmax:bin*2pi:2pi*tmax
% why is this 201 bins??
% i fixed it.. it was using edges instead of bin centers
brad = bin*2*pi;
out.xrad = -2*pi*tmax+brad/2:brad:2*pi*tmax-brad/2;

end

Expand All @@ -197,4 +207,5 @@
% out.expProb = expProb;
out.excesscorr = nan;
out.xcrms = nan;
out.xrad = nan;
end
7 changes: 7 additions & 0 deletions DFFunctions/load_filter_params.m
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@
tetfilter = '(isequal($valid,''yes'') && (isequal($area,''ca1'') || isequal($area,''mec'')))';
%% ========= XP pairwise phase corr =========
case 'dfa_phaseXcorr'
bin = 0.01; % fraction of full rotations
sw1 = bin*3;
sw2 = 0.250;
rmstmax = 0.1;
rmsmincounts = 50;
tmax = 2; % full rotations

iterator = 'iter_multiEpoch_multiCluster';
filtfunction = 'dfa_phaseXcorr';

Expand Down
2 changes: 1 addition & 1 deletion Functions/spikexcorr.m
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
% xcorrstruct = spikexcorr(spiketimes1, spiketimes2, bin, tmax)
% Computes the unnormalized cross correlation histogram of the spike
% trains given by spiketimes1 and 2
% Note that bin and tmax are given in seconds
% Note that bin and tmax are given in seconds. tmax each side of center
%Returns a cross correlation structure with the following fields:
% time - the time correponding to the center of each bin
% c1vsc2 - the unnormalized cross-correlation histogram.
Expand Down
21 changes: 12 additions & 9 deletions notebooks/pairwisePPC_04262020.m
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,17 @@
run_ff = 1;
load_ffdata = 0;

savefigs = 0;
pausefigs = 1;
showfigs = 1;
savefigs = 1;
pausefigs = 0;
showfigs = 0;
savefigas = {'png','pdf'};

plot_phaseXcorr = 0;
plot_phaseXcorr = 1;
plot_maris = 0;
run_test_epoch = 0;
%% Define Filter Params
pconf = paramconfig('Demetris'); % globals per user
Fp.animals = {'D10'};
Fp.animals = {'D10', 'JZ1', 'JZ4'};
eventType = 'lick';
Fp.filtfunction = 'dfa_phaseXcorr';
Fp.Label = 'wtrackLickTrigSpiking'; % used for filename/plots
Expand Down Expand Up @@ -195,7 +195,13 @@
sf = subaxis(1,1,1,Pp.posparams{:});
sf.Tag = 'xcorr';

plot(linspace(-pi, pi, 101), idata.normxc_sm(50:150))
brad = bin*2*pi;
xrad = -2*pi*tmax+brad/2:brad:2*pi*tmax-brad/2;
plot(xrad, idata.normxc_sm) %(50:150)
% make xaxis into pi/2 ticks
xticks([-2*pi -pi 0 pi 2*pi])
xticklabels({'-2\pi','-\pi','0','\pi','2\pi'})

xlabel('radians')
ylabel('standardized cross-corr')
yl = ylim;
Expand All @@ -213,9 +219,6 @@
% save figures to stelmo
save_figure([pconf.andef{4} '/' figname '/' an], ...
stit, 'savefigas', savefigas);
% % also save figures to dropbox
% save_figure(['/media/droumis/data_derecho/Dropbox/figures/' '/' figname '/' animal], ...
% stit, 'savefigas');
end
end
end
Expand Down

0 comments on commit b679970

Please sign in to comment.