Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding CellBase-specific Preferences #8

Merged
merged 2 commits into from
May 8, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ function plot_mclust_projections(cellid)
% Only the first light evoked spike is selected for plotting. To account
% for drift, only spikes during the stimulation protocol are selected for
% plotting.
% SPR 2011-12-28
% SPR 2011-12-28, TO 5/2018

if nargin < 1,
help plot_mclust_projections
Expand Down Expand Up @@ -47,7 +47,7 @@ function plot_mclust_projections(cellid)
prop = 'Energy.fd';
% prop = 'Peak.fd';

propfn = [getpref('cellbase','cell_pattern') num2str(t) '_' prop];
propfn = [getcbpref('Spikes_cell_pattern') num2str(t) '_' prop];
propfn_path = [cellid2fnames(cellid,'sess') filesep propfn];
wf_prop = load(propfn_path,'-mat');
wf_prop1 = wf_prop.FeatureData(:,1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
% [email protected]
% 09-May-2012

% Edit log: BH 5/9/12, 6/20/12
% Edit log: BH 5/9/12, 6/20/12, TO 5/2018

% Input arguments
prs = inputParser;
Expand All @@ -40,7 +40,7 @@
% Load spikes from Ntt file.
Nttfn = cellid2fnames(cellid,'Ntt');
all_spikes = LoadTT_NeuralynxNT(Nttfn);
TIMEFACTOR = getpref('cellbase','timefactor'); % scaling factor to convert spike times into seconds
TIMEFACTOR = getcbpref('Spikes_timefactor'); % scaling factor to convert spike times into seconds
all_spikes = all_spikes * TIMEFACTOR;
spk = loadcb(cellid,'Spikes');

Expand Down Expand Up @@ -71,7 +71,7 @@
valid_channels = check_channel_validity(cellid); % valid channels
X = [];
for k = 1:length(g.feature_names)
basename = [getpref('cellbase','cell_pattern') num2str(t)];
basename = [getcbpref('Spikes_cell_pattern') num2str(t)];
propfn = [basename '_' g.feature_names{k}]; % name of feature file (e.g. TT1_Amplitude)
sessionpath = cellid2fnames(cellid,'sess');
propfn_path = [sessionpath filesep 'FD']; % where the feature file can be found
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
% Load Ntt file
Nttfn = cellid2fnames(cellid,'Ntt');
all_spikes = LoadTT_NeuralynxNT(Nttfn);
TIMEFACTOR = getpref('cellbase','timefactor'); % scaling factor to convert spike times into seconds
TIMEFACTOR = getcbpref('Spikes_timefactor'); % scaling factor to convert spike times into seconds
all_spikes = all_spikes * TIMEFACTOR;
spk = loadcb(cellid,'Spikes');
n = length(all_spikes); % avoid subsampling of spikes due to rounding errors
Expand All @@ -43,7 +43,7 @@
% Feature matrix
X = [];
for k = 1:length(feature_names)
basename = [getpref('cellbase','cell_pattern') num2str(t)];
basename = [getcbpref('Spikes_cell_pattern') num2str(t)];
propfn = [basename '_' feature_names{k}]; % name of feature file (e.g. TT1_Amplitude)
sessionpath = cellid2fnames(cellid,'sess');
propfn_path = [sessionpath filesep 'FD']; % where the feature file can be found
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
% Load Ntt file
Nttfn = cellid2fnames(cellid,'Ntt');
all_spikes = LoadTT_NeuralynxNT(Nttfn);
TIMEFACTOR = getpref('cellbase','timefactor'); % scaling factor to convert spike times into seconds
TIMEFACTOR = getcbpref('Spikes_timefactor'); % scaling factor to convert spike times into seconds
all_spikes = all_spikes * TIMEFACTOR;
spk = loadcb(cellid,'Spikes');
n = length(all_spikes);
Expand All @@ -49,7 +49,7 @@
% Feature matrix
X = [];
for k = 1:length(g.feature_names)
basename = [getpref('cellbase','cell_pattern') num2str(t)];
basename = [getcbpref('Spikes_cell_pattern') num2str(t)];
propfn = [basename '_' g.feature_names{k}]; % name of feature file (e.g. TT1_Amplitude)
sessionpath = cellid2fnames(cellid,'sess');
propfn_path = [sessionpath filesep 'FD']; % where the feature file can be found
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
[r,s,t,u] = cellid2tags(cellid);

% Load Energy
propfn = [getpref('cellbase','cell_pattern') num2str(t) '_Energy'];
propfn = [getcbpref('Spikes_cell_pattern') num2str(t) '_Energy'];
propfn_path = [cellid2fnames(cellid,'sess') filesep 'FD'];
if ~isdir(propfn_path)
propfn_path = cellid2fnames(cellid,'sess');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
% Load spikes from Ntt file.
Nttfn = cellid2fnames(cellid,'Ntt');
all_spikes = LoadTT_NeuralynxNT(Nttfn);
TIMEFACTOR = getpref('cellbase','timefactor'); % scaling factor to convert spike times into seconds
TIMEFACTOR = getcbpref('Spikes_timefactor'); % scaling factor to convert spike times into seconds
all_spikes = all_spikes * TIMEFACTOR;
val_spk_i = [find(all_spikes >= pon(1),1,'first') ...
find(all_spikes <= pon(end),1,'last')]; % consider spikes only within the stimulation protocol to account for drift
Expand Down Expand Up @@ -101,7 +101,7 @@
[r,s,t] = cellid2tags(cellid);
for k = 1:length(g.feature_names)
prop = [g.feature_names{k} '.fd'];
propfn = [getpref('cellbase','cell_pattern') num2str(t) '_' prop];
propfn = [getcbpref('Spikes_cell_pattern') num2str(t) '_' prop];
sessionpath = cellid2fnames(cellid,'sess');
propfn_path = [sessionpath filesep 'FD']; % where the feature file can be found
if ~isdir(propfn_path)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function MakeTrialEvents2_gonogo(sessionpath,varargin)
% file becomes the primary store of behavioral data for a particular
% session; it is retrieved by LOADCB via CELLID2FNAMES. This default
% file name is one of the preference settings of CellBase - type
% getpref('cellbase','session_filename');
% getcbpref('TrialEvents_filename');
%
% MAKETRIALEVENTS2_GONOGO(SESSIONPATH,'StimNttl',TTL) specifies the TTL
% channel which serves as the basis for synchronization.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

% Load waveform data (Ntt file)
Nttfile = cellid2fnames(cellid,'ntt');
TIMEFACTOR = getpref('cellbase','timefactor'); % scaling factor to convert spike times into seconds
TIMEFACTOR = getcbpref('Spikes_timefactor'); % scaling factor to convert spike times into seconds
[all_spikes all_waves] = LoadTT_NeuralynxNT(Nttfile);
[junk junk2 evoked_inx] = intersect(SpikeTimes,all_spikes*TIMEFACTOR);
if ~isequal(junk,SpikeTimes) % internal check for spike times
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ function addanalysis(funhandle,varargin)
copyfile(cb,backup_name) % make backup before overwriting

% SAVE CELLBASE
save(getpref('cellbase','fname'),'TheMatrix','ANALYSES','CELLIDLIST')
save(getpref('cellbase','fname'),'TheMatrix','ANALYSES','CELLIDLIST','PREFERENCES')

% -------------------------------------------------------------------------
function ts = timestamp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function delanalysis(funhandle)
%
% See also ADDANALYSIS and FINDANALYSIS.

% Edit log: BH 6/21/12
% Edit log: BH 6/21/12, TO 5/2018

% Load CellBase
load(getpref('cellbase','fname'));
Expand Down Expand Up @@ -73,4 +73,4 @@ function delanalysis(funhandle)
dsr = regexprep(dsr,':','_');
backup_name = fullfile(pth,[fnm '_' dsr ext]);
copyfile(cb,backup_name) % make backup before overwriting
save(getpref('cellbase','fname'),'TheMatrix','ANALYSES','CELLIDLIST')
save(getpref('cellbase','fname'),'TheMatrix','ANALYSES','CELLIDLIST','PREFERENCES')
Loading