-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathTW_define_filters2.m
48 lines (36 loc) · 1.26 KB
/
TW_define_filters2.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
function [ filt_struct ] = TW_define_filters2( num_nrn, num_bf, plot_filt, dt )
% Defines how to filter the covariates for the Associative Learning
% analysis projects
% Order of original X: neural data, CS on, CS off, US on, US off, blink
% amplitude
% NOTE: All original covariates will be removed. In order to keep an
% original covariate as-is, explicitly filter it with a 1
if nargin < 3
plot_filt = false;
dt = .01;
disp(['Using 10 ms time bins by default'])
end
%% Initialization
idx = 1;
%% Assign movement filters
time_window = 0.2; % 200 ms; temporal extent of spike history terms
% Get basis
rcos_basis = getBasis('rcos',num_bf,round(time_window/dt))'; % Ian's function
% [~,rcos_basis] = rcosbasis(1:80,[20 20 20 20],[3 5 7.5 10]); % 1 = 200ms total width, 2 = 300, 3 = 400ms;
% Loop through for each temporal basis function
for i = 1:num_bf
filt_struct(idx).filt_name = ['Spike history ' num2str(i)];
filt_struct(idx).cov_num_in = [1:num_nrn];
filt_struct(idx).filt_func = rcos_basis(:,i);
filt_struct(idx).filt_shift = 0;
idx = idx + 1;
end
%% Plot filters
if plot_filt
for filt_num = 1:length(filt_struct)
figure()
plot(filt_struct(filt_num).filt_func)
title(filt_struct(filt_num).filt_name)
end
end
end