Orientation and direction tuning

Here is a code snipped to extract Orientation and Direction index values, depths, and circular variance values from a set of experiments:

( prefix should be the location of the files on disk, e.g., prefix='/Volumes/Data1/'; expernames should be a cell list of all your experiments, e.g., expernames = {'2011-04-13','2011-04-14','2011-04-15'} )

[oi,di,depth,putativelayer,cv,f1f0,cellnamelist] = readoridirtuningfromexperiments(prefix, expernames)

cells = {}; cellnames = {};

oi = []; di = []; putativelayer = []; cv = []; f1f0 = []; expernum = []; depth = [];

cellnamelist = {};

for i=1:length(expernames),

ds = dirstruct([prefix filesep expernames{i}]);

[cells,cellnames]=load2celllist(getexperimentfile(ds),'cell*','-mat');

% loop through all cells

for j=1:length(cells),

[f1f0c,dirprefc,oiindc,tunewidthc,cvc,dic] = f1f0ratio(cells{j});

if ~isempty(f1f0c),

putativelayer_c = tscelllayer(cells{j});

end;

depth_assoc = findassociate(cells{j},'depth','','');

if ~isempty(f1f0c)&~isempty(depth_assoc),

expernum(end+1) = i;

oi(end+1) = oiindc;

di(end+1) = dic;

f1f0(end+1) = f1f0c;

if ~isempty(putativelayer_c),

putativelayer(end+1) = putativelayer_c;

else,

putativelayer(end+1) = NaN;

end;

depth(end+1) = depth_assoc.data;

cv(end+1) = cvc;

cellnamelist{end+1} = cellnames{j};

end;

end;

end;