12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- function PlotSortedSeqDecoding( tcs, deconv, behavior, varargin )
- % default parameters
- n_smooth = 3;
- n_lowpass = 0.1;
- ts_beh_int = 0:0.02:behavior.ts(end);
- spd_int = interp1(behavior.ts, behavior.speed, ts_beh_int, 'linear');
- order_idx = 1:size(tcs.ratio,2);
- unit_list = 1:size(tcs.ratio, 2);
- % parse input parameters
- % Parse parameter list
- for i = 1:2:length(varargin),
- if ~ischar(varargin{i}),
- error(['Parameter ' num2str(i+2) ' is not a property']);
- end
- switch(lower(varargin{i}))
- case 'sort_order',
- o = varargin{i+1};
- if ~isvector(o),
- error('Incorrect value for property ''sort_order''');
- end
- case 'unit_list'
- unit_list = varargin{i+1};
- if ~isvector(unit_list),
- error('Incorrect value for property ''unit_list''');
- end
- case 'order_idx'
- order_idx = varargin{i+1};
- if ~isvector(order_idx),
- error('Incorrect value for property ''order_idx''');
- end
- otherwise,
- error(['Unknown property ''' num2str(varargin{i}) '''']);
- end
- end
- % ratio_lp = lowpass(tcs.ratio(:,:), n_lowpass);
- ratio_lp = lowpass(double(tcs.ratio(:,unit_list)), n_lowpass);
- figure;
- ax1 = subplot(7,1,1:5);
- zz = (ratio_lp(:,order_idx))';
- % zz = (Smooth(deconv(:,order_idx),[3 0]))';
- imagesc(tcs.tt, 1:length(order_idx), zz, [-80 80]);
- % imagesc(tcs.tt, 1:length(order_idx), zz, [-2 2]);
- colormap bluered
- set(gca, 'box', 'on', 'YDir', 'normal', 'xtick', []);
- set(gca, 'YTick', [1 length(order_idx)])
- ylabel('Neuron no.(sorted)')
- % colormap bluered
- ax2 = subplot(7,1,6);
- plot(ts_beh_int, Smooth(spd_int, n_smooth), 'k', 'LineWidth', 2)
- set(gca, 'box', 'off', 'YDir', 'normal', 'xtick', [])
- ylabel('Speed (cm/s)')
- ax3 = subplot(7,1,7);
- for iTrial = 1:max(behavior.trial)
- ok = behavior.trial == iTrial;
- plot(behavior.ts(ok), behavior.pos_norm(ok), 'k', 'LineWidth', 2);
- hold on
- end
- ylabel('Position (cm)')
- linkaxes([ax1, ax2, ax3], 'x');
- end
|