Schroeder-Lab / Data

For pre-processing raw data (two-photon, ephys, bonsai, ...) and loading/saving data.
0 stars 3 forks source link

function remove_zcorrected_faults #39

Closed mariacozan closed 1 year ago

mariacozan commented 1 year ago

I have a question regarding a part in the function remove_zcorrected_faults: In the final part of the function, it checks if the differential is positive or negative before the crossing: if dif[planeCrossingInd, i] < 0:

Why is the plane crossing index used instead of the plane crossing variable? If I understood correctly, the plane crossing index simply is the index of the crossing closest to the imaging plane, which would be a meaningless index for the dif variable since this indicates the change in fluorescence between planes and has the planes along the first axis.

As an example I will use ROI 5 from the first plane of Glaucus 2022-08-18. This is the z profile of the ROI: image And the differential values: image

As can be seen, it has multiple zero crossings. The zero crossing planes for this ROI = [3 13 14] Given that in this example the imaging plane (given by the median of all planes) is 15, the distance from the planes = [12 2 1] The plane crossing index will then be: planeCrossingInd = np.argmin(abs(distFromPlane)) which gives 2 (as the last item with index 2 in the array above is the closest to the planes).

Therefore using this index in dif would simply give the differential for the 3rd plane, not for the plane where there was a meaningful crossing.

liadJB commented 1 year ago

Fixed it, it's true, the planeCrossing variable rather than the index should have been used