recordingLength = 24*60;
lfp = bz_GetLFP(25,'basepath',basepath,'basename',basename);%currently cannot take path inputs
timestamps = lfp.timestamps;
filtered = bz_Filter(double(lfp.data),'filter','butter','passband',[120 180],'order', 3);
[ripples.maps,ripples.data,ripples.stats] = bz_RippleStats(filtered,timestamps,ripples,'durations',[0.05 0.15]);
save([basepath filesep basename '.ripples.events.mat'],'ripples');

recordingLength = 24*60;
ripples.Rate = zeros(1,recordingLength);
for i = 1:floor(recordingLength)
    edges = (i-1)*60+1:(i-1)*60+60;
    rippleok = histc(ripples.timestamps(:,1),edges);
    ripples.Rate(i) = sum(rippleok(1:length(edges)));
end

figure
plot(ripples.Rate)
yyaxis right
plot(thermistorC(3,1:60:recordingLength*60))

[c,lags] = xcorr(ripples.Rate,thermistorC(3,1:60:recordingLength*60),200);
figure
stem(lags,c)

