cortex-lab / Rigbox

A MATLAB toolbox for running behavioral neuroscience experiments and managing data
GNU General Public License v3.0
33 stars 16 forks source link

dat.loadBlock should folder by expDef type #283

Open k1o0 opened 4 years ago

k1o0 commented 4 years ago

Is your feature request related to a problem? Please describe. dat.loadBlock can't filter by expDef type, only 'expType'.

Describe the solution you'd like The signals expType should be the expDef name or 'custom' if the expDef is an anonymous function. This should be added in exp.SignalsExp/cleanup. The 'type' field in the Signals parameters should be changed too (it is set in exp.inferParameters). Whether it is a signals experiment can already be determined by the presence of the expDef field.

Describe alternatives you've considered Another solution would be to change the filterFun in dat.loadBlock to something like this:

function TF = filterFun(b, expType)
if isfield(b, 'expType')
  TF = strcmp(b.expType, expType);
elseif isfield(block, 'expDef')
  if strcmp(expType, 'custom')
    TF = true;
  else
    TF = endsWith(b.expDef, expType);
  end
end

Additional context People filter blocks to ensure that all selected blocks have the same fields. The filterFun could also be an optional input arg.