Skip to content

Commit

Permalink
Fix demo and new features
Browse files Browse the repository at this point in the history
* Merge for release v1.1.0-alpha
* Fix so that demo script now runs more consistently
  • Loading branch information
m053m716 committed Apr 13, 2020
2 parents a85d002 + 2176040 commit 5d36310
Show file tree
Hide file tree
Showing 213 changed files with 26,978 additions and 10,623 deletions.
11 changes: 7 additions & 4 deletions +nigeLab/+defaults/Animal.m
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,21 @@

%% Name parsing: see '~/+defaults/Block.m' for detailed documentation
% This works the same way, but applies to Animal name
pars.DynamicVarExp={'$SurgYear','$SurgNumber'};
pars.NamingConvention={'SurgYear','SurgNumber'};
% pars.DynamicVarExp={'$AnimalID'}; % (FB)
pars.DynamicVarExp={'$SurgYear','$SurgNumber'}; % (MM)
pars.NamingConvention={'AnimalID'}; % (FB,MM)

pars.SpecialMeta = struct;
pars.SpecialMeta.SpecialVars = {'AnimalID'};
% pars.SpecialMeta.SpecialVars = {}; % (FB)
pars.SpecialMeta.SpecialVars = {'AnimalID'}; % (MM)
pars.SpecialMeta.AnimalID.cat = '-'; % Concatenater (if used) for names
pars.SpecialMeta.AnimalID.vars = {'SurgYear','SurgNumber'}; % KUMC "standard"
% pars.SpecialMeta.AnimalID.vars = {'Project','SurgNumber'}; % KUMC "RC"

pars.Delimiter = '-'; % delimiter for variables in ANIMAL name
pars.Concatenater = '-'; % concatenater for variables INCLUDED in ANIMAL name
pars.VarExprDelimiter = {'-','_'}; % Delimiter for parsing "special" vars
% pars.VarExprDelimiter = {'_'}; % Delimiter for parsing "special" vars (FB)
pars.VarExprDelimiter = {'-','_'}; % (MM)
pars.IncludeChar='$'; % Delimiter for INCLUDING vars in name
pars.DiscardChar='~'; % Delimiter for excluding vars entirely (don't keep in meta either)

Expand Down
36 changes: 22 additions & 14 deletions +nigeLab/+defaults/Block.m
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,14 @@
% pars.DynamicVarExp={'$Project' '$SurgNumber' '$Year' '$Month' '$Day'}; % KUMC "RC" proj (and MM stuff)
% pars.DynamicVarExp={'$SurgYear' '$SurgNumber' '$RecDate' '$RecTime'}; % KUMC R03
% pars.DynamicVarExp={'$SurgYear' '$SurgNumber' '$RecID' '&info'}; % iit chronics
% pars.DynamicVarExp={'$AnimalID' '$Year' '$Month' '$Day' '$SessionID' '~RecDate' '$RecTime'}; % FB?
pars.DynamicVarExp={'$SurgYear' '$SurgNumber' '$Year' '$Month' '$Day' '$SessionID' '~RecDate' '$RecTime'}; % KUMC
% pars.DynamicVarExp={'$AnimalID' '$Year' '$Month' '$Day' '$RecID' '$RecDate' '$RecTime'}; % ???? (FB, for these just comment out the one if you are replacing it please)
pars.DynamicVarExp={'$SurgYear','$SurgNumber','$Year','$Month','$Day','$RecID','$RecDate','$RecTime'};

%% Common NamingConvention values
% pars.NamingConvention={'AnimalID','RecID'}; % IIT tdt
% pars.NamingConvention={'AnimalID','Year','Month','Day','RecID','RecTime'}; % FB stuff
pars.NamingConvention={'AnimalID','Year','Month','Day','SessionID'}; % MM stuff
% pars.NamingConvention={'AnimalID','Year','Month','Day'}; % KUMC "RC" proj
% pars.NamingConvention={'AnimalID','Year','Month','Day','RecID','RecDate','RecTime'}; % (FB/KUMC R03) Since these are different for different configs, please keep commented lines instead of changing directly
pars.NamingConvention={'AnimalID','Year','Month','Day','RecID'}; % MM Audio stuff
% pars.NamingConvention={'AnimalID','Year','Month','Day'}; % KUMC "RC" proj (and MM stuff)
% pars.NamingConvention={'AnimalID','Year','Month','Day','RecID', 'RecDate' 'RecTime'}; % KUMC
% pars.NamingConvention={'AnimalID','RecID','RecDate','RecTime'}; % IIT intan

Expand All @@ -86,21 +86,29 @@
% used). The same goes for "AnimalID"

pars.SpecialMeta = struct;
pars.SpecialMeta.SpecialVars = {};
pars.SpecialMeta.RecID.cat = '-'; % Concatenater (if used) for names
pars.SpecialMeta.AnimalID.cat = '-'; % Concatenater (if used) for names

% pars.SpecialMeta.SpecialVars = {}; % Default case
% Note that RecTag (if created) replaces 'RecID' in DashBoard
% pars.SpecialMeta.SpecialVars = {'RecTag'}; % FB ~!!
pars.SpecialMeta.SpecialVars = {'AnimalID','RecTag'}; % MM
pars.SpecialMeta.RecTag.cat = '-';
% pars.SpecialMeta.RecID.cat = '-'; % Concatenater (if used) for names
pars.SpecialMeta.AnimalID.cat = '-'; % Concatenater (if used) for names

% pars.SpecialMeta.SpecialVars = {'AnimalID','RecID'}; % KUMC "RC"

% (All must be included in DynamicVarExp):
pars.SpecialMeta.RecID.vars = {'Month','Day','SessionID'}; % KUMC "RC"
% pars.SpecialMeta.RecID.vars = {'Year','Month','Day'}; % KUMC "RC"
pars.SpecialMeta.AnimalID.vars = {'SurgYear','SurgNumber'}; % KUMC "standard"
% pars.SpecialMeta.RecTag.vars = {'RecID'}; % FB
% pars.SpecialMeta.RecID.vars = {}; % FB/KUMC-R03/MM
% pars.SpecialMeta.RecTag.vars = {'Year','Month','Day'}; % KUMC "RC"
pars.SpecialMeta.RecTag.vars = {'Year','Month','Day','RecID'}; % KUMC "MM"
% pars.SpecialMeta.AnimalID.vars = {}; % FB/KUMC-R03 Keep commented
% pars.SpecialMeta.AnimalID.vars = {'Project','SurgNumber'}; % KUMC "RC"
pars.SpecialMeta.AnimalID.vars = {'SurgYear','SurgNumber'}; % MM Audio stuff

pars.Delimiter = '_'; % delimiter for variables in BLOCK name
pars.Concatenater = '_'; % concatenater for variables INCLUDED in BLOCK name
pars.VarExprDelimiter = {'-','_'}; % Delimiter for parsing "special" vars
% pars.VarExprDelimiter = {'_'}; % Delimiter for parsing "special" vars -- (FB)
pars.VarExprDelimiter = {'_','-'}; % Since these are different for different configs, please keep commented lines instead of changing directly
pars.IncludeChar='$'; % Delimiter for INCLUDING vars in name
pars.DiscardChar='~'; % Delimiter for excluding vars entirely (don't keep in meta either)

Expand Down Expand Up @@ -136,7 +144,7 @@
pars.Delimiter 'Stream.mat'];
TAG.Videos = ... % Videos: behavioral videos
[pars.Delimiter '%s', ...
pars.Delimiter '%g.%s']; % "Video_Left-A_0.mp4" "Video_Left-A_1.mp4"
pars.Delimiter '%s.%s']; % "Video_Left-A_0.mp4" "Video_Left-A_1.mp4"

Fields = { ...
'Raw'; % 1 - hard-coded for extraction
Expand Down
56 changes: 42 additions & 14 deletions +nigeLab/+defaults/Event.m
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,16 @@
% 'Support'; % 15)
% 'Complete'; % 16)
% };
pars.Name = {... % Example B (RHD)
'trialrunning'; % 1) Trial running "HIGH" events
'beambreak'; % 2) Beam break events
'nosepoke'; % 3) Nose-poke beam break
'Reach'; % 4) Reach scored onset
'Grasp'; % 5) Grasp scored onset
'Support'; % 6) Support scored onset
'Complete'; % 7) Complete scored onset
pars.Name = {... % Example B (RHD)
'trial-running'; % 1) Trial running "HIGH" events
'beam-break'; % 2) Beam break events
'nose-poke'; % 3) Nose-poke beam break
'Init'; % 4) "Initialize" trial (e.g. tone cue or whatever)
'Nose'; % 5) Nose poke through reach slot scored onset
'Reach'; % 6) Reach scored onset
'Grasp'; % 7) Grasp scored onset
'Support'; % 8) Support scored onset
'Complete'; % 9) Complete scored onset
};
% pars.Name = {... % Example B (KUMC: "RC" project -- MM) Note: each 'Event' with different timestamps needs its own 'Events' element
% 'Reach'; % 1)
Expand Down Expand Up @@ -76,6 +78,8 @@
'ScoredEvents'; % 5)
'ScoredEvents'; % 6)
'ScoredEvents'; % 7)
'ScoredEvents'; % 8)
'ScoredEvents'; % 9)
};

% pars.Fields = {... % KUMC: "RC" project (MM)
Expand Down Expand Up @@ -138,18 +142,42 @@
% 'Falling'; % 11)
% 'Level'; % 12) (skip 13-16 because not 'auto' field)
% };
% pars.EventSource = {... % Example A (RHS)
% 'Channels'; % 1) 'Stim' is associated with channels
% 'Streams'; % 2)
% 'Streams'; % 3)
% 'Streams'; % 4)
% 'Streams'; % 5)
% 'Streams'; % 6)
% 'Streams'; % 7)
% 'Streams'; % 8)
% 'Streams'; % 9)
% 'Streams'; % 10)
% 'Streams'; % 11)
% 'Streams'; % 12) (skip 13-16 because not 'auto' field)
% };
pars.TrialDetectionInfo = struct(... % For sync using LED (Example B)
'Field','DigIO',...
'Name','trialrunning',...
'Name','trial-running',...
'Source',[],...
'Debounce',0.250,...
'Threshold',0.5,...
'Debounce',0.100,...% Used in parsing other 'auto' events as well
'Threshold',0.5,... % Used in parsing other 'auto' events as well
'Type','Rising');
pars.EventDetectionType = {... % Example B (RHD)
'Rising'; % 1)
'Rising'; % 2)
'Rising'; % 3) (skip 4-7 because not 'auto' fields)
'Falling'; % 1)
'Rising'; % 2)
'Rising'; % 3) (skip 4-7 because not 'auto' fields)
};
pars.EventSource = {...
'Streams'; % 1)
'Streams'; % 2)
'Streams'; % 3) (skip 4-7 because not 'auto' fields)
};
pars.UseAutoAsDefaultScoredEvent = {... % Example B (RHD)
'Complete'; ... % 1) trial-running already related to special "Trial" field
'Reach'; ... % 2) beam-break
'Init' % 3) nose-poke: should be essentially same as trial-running
};

%% Error parsing (do not change)
% Check that number of elements of Name matches that of Fields
Expand Down
7 changes: 6 additions & 1 deletion +nigeLab/+defaults/Experiment.m
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,16 @@
pars.StandardPortNames = {'A','B','C','D'};
pars.DefaultAcquisitionSystem = 'RHD'; % Important if things go wrong
pars.SupportedFormats = {'.rhs','.rhd','tdt'};
pars.User = 'MM'; % Default user
pars.User = ''; % Default user is now parsed from local machine

%% Parse output
if nargin < 1
varargout = {pars};
if strcmpi(pars.User,'demo')
nigeLab.utils.cprintf('Errors*','\n\t[+defaults/Experiment.m]: ');
nigeLab.utils.cprintf('[0.5 0.5 0.5]',...
'Running using `''demo''` "User"\n');
end
else
varargout = cell(1,nargin);
f = fieldnames(pars);
Expand Down
15 changes: 11 additions & 4 deletions +nigeLab/+defaults/Queue.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
% Only specify this field if you want to force use of a single cluster
% pars.Cluster = 'CPLMJS';
pars.UseParallel = true; % set to false to switch to serial processing mode
pars.UseRemote = true;
% pars.UseParallel = false;
% pars.UseRemote = false;
% pars.UseParallel = false;
pars.UseRemote = true;

% Local path equivalents for remote; these will be replaced if
% .OnRemote flag is true (if the job is run via "qWrapper" generated by
Expand All @@ -25,14 +25,20 @@
pars.Remote.RecRoot = 'P:/Recorded_Data';
pars.Remote.SaveRoot = 'P:/Processed_Data';

pars.ClusterList = {'CPLMJS'; 'CPLMJS2'; 'CPLMJS3'};
% pars.ClusterList = {'CPLMJS';'CPLMJS2';'CPLMJS3'};
pars.ClusterList = {'CPLMJS';'CPLMJS2'};
pars.NWorkerMinMax = [1,1]; % Min & Max # workers to assign to a job
pars.WaitTimeSec = 1; % Time to wait between checking for new cluster
pars.InitTimeSec = 5; % Time to wait when initializing cluster

% pars.RemoteRepoPath = '';
% pars.RemoteRepoPath = ...
% {'C:\Users\fbarban\Documents\MATLAB\ePhys_packages'}; % FB
pars.RemoteRepoPath = ...
{'//kumc.edu/data/research/SOM RSCH/NUDOLAB/Scripts_Circuits/Communal_Code/nigeLab/'};
{'T:\Communal_Code\nigeLab'}; % MM (KUMC Isilon)
% Note: if using older versions (such as v1.1.0-alpha), you will need to
% install the package on the remote repository as well, and set that path
% here (in pars.RemoteRepoPath)

%% Parse output
if nargin < 1
Expand All @@ -49,5 +55,6 @@
end



end

2 changes: 1 addition & 1 deletion +nigeLab/+defaults/SD.m
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
pars.ARTIFACT_SPACE = 4; % Window to ignore around artifact (suggest: 4 ms MIN for stim rebound)
pars.MULTCOEFF = 4.5; % Multiplication coefficient for noise
pars.PKDURATION = 1.0; % Pulse lifetime period (suggest: 2 ms MAX)
pars.REFRTIME = 2.0; % Refractory period (suggest: 2 ms MAX).
pars.REFRTIME = 0.5; % Refractory period (suggest: 2 ms MAX).
pars.PKDETECT = 'sneo';% 'both' or 'pos' or 'neg' or 'adapt' or 'sneo' for peak type
pars.ADPT_N = 60; % Number of ms to use for adaptive filter
pars.SNEO_N = 5; % Number of samples to use for smoothed nonlinear energy operator window
Expand Down
30 changes: 23 additions & 7 deletions +nigeLab/+defaults/Shortcuts.m
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,29 @@
};
else
pars = struct;
pars.raw = 'Channels(%d).Raw.data';
pars.filt = 'Channels(%d).Filt.data';
pars.car = 'Channels(%d).CAR.data';
pars.lfp = 'Channels(%d).LFP.data';
pars.spk = 'Channels(%d).Spikes';
pars.srt = 'Channels(%d).Sorted';
pars.clst = 'Channels(%d).Clusters';
pars.raw.subfields = {'Channels', 'Raw'};
pars.raw.indexable = [true , true];

pars.filt.subfields = {'Channels', 'Filt'};
pars.filt.indexable = [true , true];

pars.car.subfields = {'Channels', 'CAR'};
pars.car.indexable = [true , true];

pars.lfp.subfields = {'Channels', 'LFP'};
pars.lfp.indexable = [true , true];

pars.spk.subfields = {'Channels', 'Spikes'};
pars.spk.indexable = [true , true];

pars.srt.subfields = {'Channels', 'Sorted'};
pars.srt.indexable = [true , true];

pars.clst.subfields = {'Channels', 'Clusters'};
pars.clst.indexable = [true , true];

pars.digIO.subsfield = {'Streams', 'DigIO', 'data'};
pars.digIO.indexable = [false , true , true];
end

end
Expand Down
Loading

0 comments on commit 5d36310

Please sign in to comment.