Skip to content

Commit 616695b

Browse files
Nabarbm053m716
andauthored
Bugfix/subsref (#71)
* Issue #67 solved This fixes both the infinite loop and the error on direct pars loading. Corrected a typo and swapped a line, nothing to see here! * Basically rewritten the subsref of tank and animal I've rewritten the subsref of tank and animal to take care of some unexpected behavior. A Block revision will follow soon. To summarize: the {} operator can be used to access the children object in the layer below or two layers below. That means that you can access blocks and animals directly from the tank level. eg tankObj{aa} is equivalent to tankObj.Children(aa) tankObj{aa,bb} is equivalent to tankObj.Children(aa).Children(bb) animalObj changes it's behavior depending on the fact that's a scalar or a vector: Scalar case animalObj{bb} is equivalent to animalObj.Children(bb) animalObj(bb,cc) is unsupported. Issues a warning and ignores all the indexes except bb, that means that is equivalent to animalObj.Children(bb). Vector case animalObj(bb) is unsupported. Issues an error.* animalObj(aa,bb) is equivalent to animalObj(aa).Children(bb). This is equivalent to tankObj{aa,bb} Advanced Indexing: You can address multiple objects at the same time, just use vectors as indexes. E.g. aa = [1,2]; bb = 1; tankObj{aa,bb} will return the first block from the first two animals. aa = [1,2]; bb = [1,3]; tankObj{aa,bb} will return the first and third block from the first two animals. Indexes ('aa' and 'bb') can be numbers or Public Keys. They work both interchangeably: this means you can use numerical indexes as first index and keys as second index. To address multiple objects at once using keys, stack them in cell arrays. E.g. aa=[1,2]; bb=key1; tankObj{aa,bb} will look for key1 in all the blocks in animal 1 and 2. aa = [1,2]; bb={key1,key2}; tankObj{aa,bb} will look for key1 and key2 in all the blocks in animal 1 and 2. Asymmetrical indexing. This will be documented later on. * defaults to test demo_nigelab + small bugfix Updated defaults to test everything properly. Swapped the order of a if elseif statemetn for advanced indexing. * blockObj subsref update BlockObj subsref is now working as intended (I believe) By using {} in conjunction with defaults.Shortcuts, it is possible to access elements two levels under the current hierarchy level. - Shortcurts now has a new format. The struct format uses the shortcut keyword as the struct fieldname, Below that you can customize the fields to access and specify if those fields are indexable or not. E.g let's say you wanted to access the first 100 samples in the Raw data. You would have to write: blockObj.Channels(iCh).Raw(1:100); With the shortcuts you configure the defaults by adding : pars.raw.subfields = {'Channels', 'Raw'}; pars.raw.indexable = [true , true]; to the config file. Once that's done you can just call blockObj{'raw',iCh,1:100}; let's explore another case. Let's say you wanted to access blockObj.Streams.DigIO(iCh).data(1:100); You would need to add to the config file pars.digIO.subsfield = {'Streams', 'DigIO', 'data'}; pars.digIO.indexable = [false , true , true]; Streams is a not indexable field because is not vectorial. No () follows it. Now typing blockObj{'digIO',iCh,1:100}; will lead to the desired result. - Advanced indexing. Doc will be added later. - Direct Channels access All fields in Channels are also accessible directly from block: E.g. blockObj.raw(iCh,1:100) is equivalent to blockObj.Channels(iCh).Raw(1:100); The operator **end** is not available in shortcuts! * Bugfixes, updates ------------------ # Bugfixes # ** Bugfixes ** ## Major ## ** Major Bugs ** * Fixed issue where `B = tankObj{[1,2],key};` was throwing an error due to improper arrayfun indexing of substruct argument array. ## Minor ## ** Minor Bugs ** * `nigeLab.nigelObj/getPropertyGroups` + Call of tankObj{1} threw error because of unexpected naming convention used on demo dataset. Changed method to account for case where '+', '&', or '|' is used in addition to ' ' or '-' characters. * `nigeLab.nigelObj/addPropListeners` + Getting an error I hadn't seen previously where it couldn't find the `checkBlocksForClones` or `checkAnimalsForClones` methods. Changed syntax in listener call and that fixed it even though effectively it should be the same reference? Not sure if this is related to subsref changes yet. ------------------ # Updates # ** Updates ** ## Notable ## ** Notable Updates ** * Moved `IsRightKeyFormat` to be a method of `nigeLab.nigelObj`. ## Minor ## ** Minor Updates ** * Changed formatting on some comments, as well as indent stuff that I'm apparently retentive about. * Fixed typos Co-authored-by: Maxwell Murphy <max.murphy11@gmail.com>
1 parent f79a88d commit 616695b

16 files changed

Lines changed: 760 additions & 351 deletions

File tree

+nigeLab/+defaults/Animal.m

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,18 @@
2222

2323
%% Name parsing: see '~/+defaults/Block.m' for detailed documentation
2424
% This works the same way, but applies to Animal name
25-
pars.DynamicVarExp={'$SurgYear','$SurgNumber'};
26-
pars.NamingConvention={'SurgYear','SurgNumber'};
25+
pars.DynamicVarExp={'$AnimalID'};
26+
pars.NamingConvention={'AnimalID'};
2727

2828
pars.SpecialMeta = struct;
29-
pars.SpecialMeta.SpecialVars = {'AnimalID'};
29+
pars.SpecialMeta.SpecialVars = {};
3030
pars.SpecialMeta.AnimalID.cat = '-'; % Concatenater (if used) for names
3131
pars.SpecialMeta.AnimalID.vars = {'SurgYear','SurgNumber'}; % KUMC "standard"
3232
% pars.SpecialMeta.AnimalID.vars = {'Project','SurgNumber'}; % KUMC "RC"
3333

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

+nigeLab/+defaults/Block.m

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,12 @@
7070
% pars.DynamicVarExp={'$Project' '$SurgNumber' '$Year' '$Month' '$Day'}; % KUMC "RC" proj (and MM stuff)
7171
% pars.DynamicVarExp={'$SurgYear' '$SurgNumber' '$RecDate' '$RecTime'}; % KUMC R03
7272
% pars.DynamicVarExp={'$SurgYear' '$SurgNumber' '$RecID' '&info'}; % iit chronics
73-
% pars.DynamicVarExp={'$AnimalID' '$Year' '$Month' '$Day' '$SessionID' '~RecDate' '$RecTime'}; % FB?
74-
pars.DynamicVarExp={'$SurgYear' '$SurgNumber' '$Year' '$Month' '$Day' '$SessionID' '~RecDate' '$RecTime'}; % KUMC
73+
pars.DynamicVarExp={'$AnimalID' '$Year' '$Month' '$Day' '$RecID' '$RecDate' '$RecTime'}; % KUMC
7574

7675
%% Common NamingConvention values
7776
% pars.NamingConvention={'AnimalID','RecID'}; % IIT tdt
78-
% pars.NamingConvention={'AnimalID','Year','Month','Day','RecID','RecTime'}; % FB stuff
79-
pars.NamingConvention={'AnimalID','Year','Month','Day','SessionID'}; % MM stuff
80-
% pars.NamingConvention={'AnimalID','Year','Month','Day'}; % KUMC "RC" proj
77+
pars.NamingConvention={'AnimalID','Year','Month','Day','RecID','RecDate','RecTime'}; % MM Audio stuff
78+
% pars.NamingConvention={'AnimalID','Year','Month','Day'}; % KUMC "RC" proj (and MM stuff)
8179
% pars.NamingConvention={'AnimalID','Year','Month','Day','RecID', 'RecDate' 'RecTime'}; % KUMC
8280
% pars.NamingConvention={'AnimalID','RecID','RecDate','RecTime'}; % IIT intan
8381

@@ -93,14 +91,14 @@
9391
% pars.SpecialMeta.SpecialVars = {}; % Default case
9492

9593
% (All must be included in DynamicVarExp):
96-
pars.SpecialMeta.RecID.vars = {'Month','Day','SessionID'}; % KUMC "RC"
94+
pars.SpecialMeta.RecID.vars = {}; % KUMC "RC"
9795
% pars.SpecialMeta.RecID.vars = {'Year','Month','Day'}; % KUMC "RC"
98-
pars.SpecialMeta.AnimalID.vars = {'SurgYear','SurgNumber'}; % KUMC "standard"
96+
pars.SpecialMeta.AnimalID.vars = {}; % KUMC "standard"
9997
% pars.SpecialMeta.AnimalID.vars = {'Project','SurgNumber'}; % KUMC "RC"
10098

10199
pars.Delimiter = '_'; % delimiter for variables in BLOCK name
102100
pars.Concatenater = '_'; % concatenater for variables INCLUDED in BLOCK name
103-
pars.VarExprDelimiter = {'-','_'}; % Delimiter for parsing "special" vars
101+
pars.VarExprDelimiter = {'_'}; % Delimiter for parsing "special" vars
104102
pars.IncludeChar='$'; % Delimiter for INCLUDING vars in name
105103
pars.DiscardChar='~'; % Delimiter for excluding vars entirely (don't keep in meta either)
106104

+nigeLab/+defaults/Queue.m

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
% Only specify this field if you want to force use of a single cluster
1313
% pars.Cluster = 'CPLMJS';
1414
pars.UseParallel = true; % set to false to switch to serial processing mode
15-
pars.UseRemote = true;
15+
pars.UseRemote = false;
1616
% pars.UseParallel = false;
1717
% pars.UseRemote = false;
1818

@@ -32,7 +32,7 @@
3232

3333
% pars.RemoteRepoPath = '';
3434
pars.RemoteRepoPath = ...
35-
{'//kumc.edu/data/research/SOM RSCH/NUDOLAB/Scripts_Circuits/Communal_Code/nigeLab/'};
35+
{'C:\Users\fbarban\Documents\MATLAB\ePhys_packages'};
3636

3737
%% Parse output
3838
if nargin < 1
@@ -49,5 +49,6 @@
4949
end
5050

5151

52+
5253
end
5354

+nigeLab/+defaults/SD.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
pars.ARTIFACT_SPACE = 4; % Window to ignore around artifact (suggest: 4 ms MIN for stim rebound)
4242
pars.MULTCOEFF = 4.5; % Multiplication coefficient for noise
4343
pars.PKDURATION = 1.0; % Pulse lifetime period (suggest: 2 ms MAX)
44-
pars.REFRTIME = 2.0; % Refractory period (suggest: 2 ms MAX).
44+
pars.REFRTIME = 0.5; % Refractory period (suggest: 2 ms MAX).
4545
pars.PKDETECT = 'sneo';% 'both' or 'pos' or 'neg' or 'adapt' or 'sneo' for peak type
4646
pars.ADPT_N = 60; % Number of ms to use for adaptive filter
4747
pars.SNEO_N = 5; % Number of samples to use for smoothed nonlinear energy operator window

+nigeLab/+defaults/Shortcuts.m

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,29 @@
1818
};
1919
else
2020
pars = struct;
21-
pars.raw = 'Channels(%d).Raw.data';
22-
pars.filt = 'Channels(%d).Filt.data';
23-
pars.car = 'Channels(%d).CAR.data';
24-
pars.lfp = 'Channels(%d).LFP.data';
25-
pars.spk = 'Channels(%d).Spikes';
26-
pars.srt = 'Channels(%d).Sorted';
27-
pars.clst = 'Channels(%d).Clusters';
21+
pars.raw.subfields = {'Channels', 'Raw'};
22+
pars.raw.indexable = [true , true];
23+
24+
pars.filt.subfields = {'Channels', 'Filt'};
25+
pars.filt.indexable = [true , true];
26+
27+
pars.car.subfields = {'Channels', 'CAR'};
28+
pars.car.indexable = [true , true];
29+
30+
pars.lfp.subfields = {'Channels', 'LFP'};
31+
pars.lfp.indexable = [true , true];
32+
33+
pars.spk.subfields = {'Channels', 'Spikes'};
34+
pars.spk.indexable = [true , true];
35+
36+
pars.srt.subfields = {'Channels', 'Sorted'};
37+
pars.srt.indexable = [true , true];
38+
39+
pars.clst.subfields = {'Channels', 'Clusters'};
40+
pars.clst.indexable = [true , true];
41+
42+
pars.digIO.subsfield = {'Streams', 'DigIO', 'data'};
43+
pars.digIO.indexable = [false , true , true];
2844
end
2945

3046
end

+nigeLab/+defaults/Video.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@
7878
% videos, not for things like "beam-break" etc. that are in the separate
7979
% FieldType of Streams.
8080
pars = struct;
81-
pars.HasVideo = true;
82-
pars.HasVidStreams = true;
81+
pars.HasVideo = false;
82+
pars.HasVidStreams = false;
8383

8484
% % % -- For Video Scoring -- % % %
8585

+nigeLab/@Animal/Animal.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@
9393
error(['nigeLab:' mfilename ':initFailed'],...
9494
'Could not initialize ANIMAL object.');
9595
end
96+
animalObj.Key = nigeLab.nigelObj.InitKey;
9697
end
9798

9899
% Modify behavior of 'end' keyword in indexing expressions

0 commit comments

Comments
 (0)