function [ output_args ] = sloPhoBoPhotoPref( data,minY,maxY ) %sloPhoBoPhotoPref breaks down the output of the slow photo box LabView .vi %program and returns a MATLAB struct with useful metrics % function name = SLOw PHOto BOx PHOTOtactic PREFerence %========================================================================= % Usage: % output_args = sloPhoBoPhotoPref( data,minY,maxY ) % Inputs: % * data = t x N matrix of tracking centroid position values, where t % is number of data points recorded in each experiment, normally 24 % * minY = lowest value of the .vi ROI bounds (bottom of the tubes) % * maxY = highest value of the .vi ROI bounds (top of the tubes) % Output structure contains these objects: % * .prefs = vector of the light choice probabilities of each fly. % * .count = number of trials completed by each fly. % * .raw = the original data, stripped of timestamps. % * .thresh = choices thresholded by the edge of the shade, but without missing value NaNs. % * .flyID = matrix with index row, prefs and count %calculate shade boundary position edgeShade=(maxY-minY)/2; % discard first two rows (which are timekeeping and indexing), detect missing values data=data(:,3:end); data(data==32767)=NaN; %convert positions into shade/light scores based on edgeShade cutoff, retain missing values dataThresholded=data