You are on page 1of 2

step.1 Calculate dF using original csv。Matlab.

-----------------------
d=readtable(‘fiberphotometrydata.csv’);
d2=table2array(d(:,1:3));
d3=str2double(d2); ##this command takes a lot of time (~2min)
d4=timeseries(d3(2:end,2:3),d3(2:end,1));
resv=[0:0.05:220]’;
##0 to 220 or the last second within the data.
d5=resample(d4,resv);
P=polyfit(d5.data(3:end,1),d5.data(3:end,2),1) ##you will get a,b ## Remember to
exclude first NaN values and eliminate eventual NaN in the end
d6=P(1)*d5.data(:,1)+P(2); ##get fitted control using y=ax+b formula
d7=d5.data(:,2)-d6; #Signal465-Fittedcontrl405
d8=d7./d6 #Needs “a period .” ## d8 = dF
dF=[d5.time d8];
writematrix(dF,'dF.csv')

---------------------
The above code is used for the original fiber photometry data csv.
Then, we obtain the csv from which the dF is derived. d5 is the data every 0.05
sec.

step2. extract median values over 3 epochs and calculate z score. Excel.
---------------
a. =median(Q4:Q6)
b. =(AE5-AVERAGE(AE$5:AE$4206))/STDEV.S(AE$5:AE$4206)
---------------

step3. derive 0.05sec data for SIT zone. matlab/excel.


--------------
##import your track report resampled file, specifically the page
"original_no_formula";
eliminate columns with words and rename the table "d"
d2=table2array(d(:,1:n));
##n=number of columns in d
d4=timeseries(d2(1:end,2:n),d2(1:end,1));
resv=[0:0.05:150]';
##0 to 150 or the last second within the data.
d5=resample(d4,resv)
## copy results back in your excel file
---------------

step4. match the calculation results of step2 and step3。


Example:
column A; time (0, 0.05, 0.1, 0.15, ...)
column B; z score of signals (1.2, 1.3, 0.2, -0.2, ...)
column C; SIT zone score (1, 1, 1, 0, 0, 1, -1, ...)

step5. extract the data for each of the avo and mid int zones.

If the data extracted in step 5 is set to 1 point per individual,


the data will be too sparse. Also, if all data per individual is used,
there will be inter-individual variation, so 30 percentile (0.032, 0.064, ...etc.)
values
are extracted from each point as data points.

AE: (1/31)*1, (1/31)*2, ...


=PERCENTILE.EXC(M$9:M$20000,$AE9)

You might also like