Skip to content

Commit e7ed534

Browse files
committed
Bugfixes and Updates (LARGE)
--KEY THINGS-- * `nigeLab.libs.DiskData` re-work + Now, clear reason for three obj.type_ categories: - 'MatFile' : Files that should not grow or shrink once they have been allocated on the disk (such as from the already-known number of samples in the record) - 'Hybrid': "Vector" style file that can be expanded along columns. This should be used for data streams such as RawData or DigIO. - 'Event': "Matrix" style file that can be expanded along rows. This should be used for things like 'Spikes' or 'ScoredEvents'. + Split `subsref` and `subsasgn` into more modular design to make it clearer what logic is in those methods. + Initialization for all three types of input arguments (single, two inputs, or three inputs) should all work now (previously, it didn't seem the single-input case worked). + Now no longer creates a matfile (.diskfile_); instead, uses hdf5 handling for everything. * Bug with doRawExtraction should be resolved + May need to re-run extraction for STREAMS (it was incorrectly using 8-bit values that resulted in empty streams which otherwise contained data) ----------------------------- * `nigeLab.defaults` + Add flag to skip UI Prompt for videos in `+defaults/Videos` + Update `+defaults/doActions` so each struct field that corresponds to a `doMethod` has a third field: `batch` - This field is checked for example if it is expected that many important Blocks may need to have a particular field (such as .Videos) but that not every Block in a Tank is expected to have it. Instead of throwing an error, `checkActionIsValid` will return a flag as false if the .Status of .Fields listed in .batch are not completed. * `nigeLab.libs` + Update .empty() methods of `.VidStreamsType` and `.VideosFieldType` + `nigeLab.libs.VidStreamsType` and `nigeLab.libs.VideosFieldType` should now initialize correctly. - Unfortunately, once they started initializing correctly, it caused the _Obj.mat files to expand in size by an order of magnitude. Re-worked how data pointers are handled for these classes, so they should no longer be as inefficient * `nigeLab.Block` + Update a bunch of the Block methods that referenced deprecated parameters fields (`VideoPars` and `SortPars`). + Remove deprecated methods: - `nigeLab.Block/getFileType()` - `nigeLab.Block/getFieldType()` - `nigeLab.Block/getFieldTypeIndex()` + Corresponding methods are implemented in `nigeLab.nigelObj` + `nigelab.Block/doVidInfoExtraction` is now working more-or-less as intended. + `nigeLab.Block/getStatus()` this method is a mess and needs to be moved to `nigelObj` soon. Basically, we want it to behave the same way when we call it at all levels otherwise it gets too confusing. - For now, just put some shitty code in there to make it work for the time-being. * `nigeLab.Tank` + Add `varargin` to `nigeLab.Tank/runFun()` method, which allows it to supply input Additions * `nigeLab.nigelObj/getFieldInfo()` and `nigeLab.libs.nigelButtonArray` + Were supposed to work in combination to make mouse-over and clickable things happen for DashBoard but I think it's too messy and didn't want to waste time on it. Regardless, they exist (and that's why). * Added `.empty` methods to a few other Classes so their validation doesn't screw up other working classes. Update Update * Bugfix again on doRawExtraction * Add parsing from Buccelli & Murphy 2019 FSM to Intan RHS header parse Update * Fix initEvents * Add RHS parsing for intan2Block for modified FSM thing * Fix doEventDetection and doEventHeaderExtraction
1 parent f79a88d commit e7ed534

77 files changed

Lines changed: 7363 additions & 2887 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

+nigeLab/+defaults/Block.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@
136136
pars.Delimiter 'Stream.mat'];
137137
TAG.Videos = ... % Videos: behavioral videos
138138
[pars.Delimiter '%s', ...
139-
pars.Delimiter '%g.%s']; % "Video_Left-A_0.mp4" "Video_Left-A_1.mp4"
139+
pars.Delimiter '%s.%s']; % "Video_Left-A_0.mp4" "Video_Left-A_1.mp4"
140140

141141
Fields = { ...
142142
'Raw'; % 1 - hard-coded for extraction

+nigeLab/+defaults/Event.m

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@
3333
% 'Complete'; % 16)
3434
% };
3535
pars.Name = {... % Example B (RHD)
36-
'trialrunning'; % 1) Trial running "HIGH" events
37-
'beambreak'; % 2) Beam break events
38-
'nosepoke'; % 3) Nose-poke beam break
36+
'trial-running'; % 1) Trial running "HIGH" events
37+
'beam-break'; % 2) Beam break events
38+
'nose-poke'; % 3) Nose-poke beam break
3939
'Reach'; % 4) Reach scored onset
4040
'Grasp'; % 5) Grasp scored onset
4141
'Support'; % 6) Support scored onset
@@ -138,18 +138,37 @@
138138
% 'Falling'; % 11)
139139
% 'Level'; % 12) (skip 13-16 because not 'auto' field)
140140
% };
141+
% pars.EventSource = {... % Example A (RHS)
142+
% 'Channels'; % 1) 'Stim' is associated with channels
143+
% 'Streams'; % 2)
144+
% 'Streams'; % 3)
145+
% 'Streams'; % 4)
146+
% 'Streams'; % 5)
147+
% 'Streams'; % 6)
148+
% 'Streams'; % 7)
149+
% 'Streams'; % 8)
150+
% 'Streams'; % 9)
151+
% 'Streams'; % 10)
152+
% 'Streams'; % 11)
153+
% 'Streams'; % 12) (skip 13-16 because not 'auto' field)
154+
% };
141155
pars.TrialDetectionInfo = struct(... % For sync using LED (Example B)
142156
'Field','DigIO',...
143-
'Name','trialrunning',...
157+
'Name','trial-running',...
144158
'Source',[],...
145-
'Debounce',0.250,...
146-
'Threshold',0.5,...
159+
'Debounce',0.100,...% Used in parsing other 'auto' events as well
160+
'Threshold',0.5,... % Used in parsing other 'auto' events as well
147161
'Type','Rising');
148162
pars.EventDetectionType = {... % Example B (RHD)
149163
'Rising'; % 1)
150164
'Rising'; % 2)
151165
'Rising'; % 3) (skip 4-7 because not 'auto' fields)
152166
};
167+
pars.EventSource = {...
168+
'Streams'; % 1)
169+
'Streams'; % 2)
170+
'Streams'; % 3) (skip 4-7 because not 'auto' fields)
171+
};
153172

154173
%% Error parsing (do not change)
155174
% Check that number of elements of Name matches that of Fields

+nigeLab/+defaults/Queue.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@
2525
pars.Remote.RecRoot = 'P:/Recorded_Data';
2626
pars.Remote.SaveRoot = 'P:/Processed_Data';
2727

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

+nigeLab/+defaults/Video.m

Lines changed: 31 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@
8080
pars = struct;
8181
pars.HasVideo = true;
8282
pars.HasVidStreams = true;
83+
pars.UseVideoPromptOnEmpty = false;
8384

8485
% % % -- For Video Scoring -- % % %
8586

@@ -160,8 +161,8 @@
160161
% to toggle it.
161162

162163
pars.VidFilePath = { ... % "Includes" for where videos might be. Stops after first non-empty path.
163-
'K:\Rat\Video\BilateralReach\Murphy';
164-
'K:\Rat\Video\BilateralReach\RC';
164+
... 'K:\Rat\Video\BilateralReach\Murphy';
165+
... 'K:\Rat\Video\BilateralReach\RC';
165166
'K:\Rat\Video\Audio Discrimination Task\post-surg'
166167
};
167168

@@ -172,12 +173,14 @@
172173
'*_0.MP4','First Video Only';...
173174
'*.MP4;*.mp4;*.avi','Video Files (*.mp4,*.avi)';...
174175
'*.*','All Files (*.*)'};
175-
pars.SelectionUITitle = 'No Videos Found - Select VIDEO associated with BLOCK';
176-
177176
pars.FileExt = '.MP4';
178-
% For DynamicVars expressions, see 'Metadata parsing' below
179-
pars.DynamicVars = {'$AnimalID','$Year','$Month','$Day','$SessionID','$View','$MovieID'}; % KUMC: "Murphy"
180-
% pars.DynamicVars = {'$AnimalID','$Year','$Month','$Day','&MovieID'}; % KUMC: "RC"
177+
% For DynamicVars expressions, see 'Metadata parsing' below; main
178+
% difference here is that ALL variables (if there are enough tokens) are
179+
% included as metadata variables; '$' vs '~' only denotes whether to use
180+
% that particular variable in figuring out other videos belonging to a
181+
% given recording.
182+
pars.DynamicVars = {'$AnimalID','$Year','$Month','$Day','$SessionID','~View','~MovieID'}; % KUMC: "Murphy"
183+
% pars.DynamicVars = {'$AnimalID','$Year','$Month','$Day','~MovieID'}; % KUMC: "RC"
181184
pars.MovieIndexVar = 'MovieID'; % KUMC: "RC" (and in general)
182185

183186
% Information about video scoring
@@ -197,14 +200,10 @@
197200
pars.Alignment_FS = struct('TDT',125,'RHD',100,'RHS',100);
198201

199202
%% Less-likely to change these parameters
200-
% Paths information
201-
pars.File = [];
202-
203203
% Metadata parsing
204204
pars.Delimiter = '_'; % Break filename "variables" by this
205205
pars.IncludeChar = '$'; % Include data from these variables
206206
pars.ExcludeChar = '~'; % Exclude data from these variables
207-
pars.Meta = [];
208207

209208
pars.ValueShortcutFcn = @nigeLab.workflow.defaultVideoScoringShortcutFcn;
210209
pars.VideoScoringStringsFcn = @nigeLab.workflow.defaultVideoScoringStrings;
@@ -219,17 +218,35 @@
219218
(~isempty(pars.VidStreamName));
220219

221220
if pars.HasVidStreams
221+
dyVar = cellfun(@(x)x(2:end),pars.DynamicVars,'UniformOutput',false);
222+
if ismember('Key',dyVar)
223+
error(['nigeLab:' mfilename ':BadConfig'],...
224+
'[DEFAULTS/VIDEO]: Invalid use of reserved meta variable (''Key'')');
225+
end
226+
227+
% Check that the CameraSourceVar and MovieIndexVar were added to `pars`
228+
if ~isfield(pars,'CameraSourceVar')
229+
error(['nigeLab:' mfilename ':BadConfig'],...
230+
['CameraSourceVar parameter field is missing\n' ...
231+
'->\t(can be left as [] if unwanted)']);
232+
end
233+
if ~isfield(pars,'MovieIndexVar')
234+
error(['nigeLab:' mfilename ':BadConfig'],...
235+
['MovieIndexVar parameter field is missing\n' ...
236+
'->\t(can be left as [] if unwanted)']);
237+
end
238+
222239
n = numel(pars.VidStreamName);
223240
if ~isempty(pars.CameraSourceVar)
224241
pars.VidStreamField = cell(n,1);
225242
pars.VidStreamFieldType = cell(n,1);
226243

227244
% Check that the CameraSourceVar is good
228-
dyVar = cellfun(@(x)x(2:end),pars.DynamicVars,'UniformOutput',false);
229245
idx = ismember(dyVar,pars.CameraSourceVar);
230246
if sum(idx) ~= 1
231-
error('CameraSourceVar (%s) is not a member of pars.DynamicVars (%s)',...
232-
pars.CameraSourceVar,dyVar);
247+
error(['nigeLab:' mfilename ':BadConfig'],...
248+
'CameraSourceVar (%s) is not a member of pars.DynamicVars',...
249+
pars.CameraSourceVar);
233250
end
234251

235252
% For each Cell corresponding to a different subset of markings,

+nigeLab/+defaults/doActions.m

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,16 @@
1818
%% Set "dependencies" for checking that stages are valid for `doMethods`
1919
pars = struct;
2020
pars.doAutoClustering = doAction({'Spikes'},true);
21-
pars.doBehaviorSync= doAction({'Video'});
22-
pars.doEventDetection = doAction();
23-
pars.doEventHeaderExtraction = doAction({'Video'});
21+
pars.doBehaviorSync= doAction({},false,{'Raw','Video'});
22+
pars.doEventDetection = doAction({'Raw'},true);
23+
pars.doEventHeaderExtraction = doAction({},false,{'Raw','Video'});
2424
pars.doLFPExtraction = doAction({'Raw'},true);
2525
pars.doRawExtraction = doAction({},true);
2626
pars.doReReference = doAction({'Filt'},true);
2727
pars.doSD = doAction({'CAR'},true);
2828
pars.doUnitFilter = doAction({'Raw'},true);
29-
pars.doVidInfoExtraction = doAction({'Video'});
30-
pars.doVidSyncExtraction = doAction({'Video'});
29+
pars.doVidInfoExtraction = doAction({},true,{});
30+
pars.doVidSyncExtraction = doAction({},false,{'Raw','Video'});
3131

3232
%% Parse output
3333
if nargin < 1
@@ -44,7 +44,7 @@
4444
end
4545

4646
% Helper function to make `doAction` param struct
47-
function doStruct = doAction(required,en)
47+
function doStruct = doAction(required,en,to_check_on_batch_run)
4848
%DOACTION Helper function to create doAction struct
4949
%
5050
% doStruct = doAction({'field1',...,'fieldk'}); Sets required fields
@@ -58,9 +58,20 @@
5858
en = false;
5959
end
6060

61+
if nargin < 3
62+
to_check_on_batch_run = {};
63+
end
64+
65+
if ~isempty(to_check_on_batch_run) && ~isempty(required)
66+
error(['nigeLab:' mfilename ':BadConfig'],...
67+
'[DOACTIONS]: If .batch has members, .required should be empty.');
68+
end
69+
6170
doStruct = struct;
6271
doStruct.required = required;
6372
doStruct.enabled = en;
73+
doStruct.batch = to_check_on_batch_run;
74+
6475
end
6576

6677
end

0 commit comments

Comments
 (0)