visual_behavior_analysis icon indicating copy to clipboard operation
visual_behavior_analysis copied to clipboard

Exact zeros in dff traces

Open alexpiet opened this issue 5 years ago • 5 comments

@matchings @jeromelecoq I've noticed something odd, and I'm not sure if its a bug, but I can't think of a reason why it might be true. Some sessions have df/f values that are exactly equal to zero. These values do not happen at the start or end of the session, and are randomly intermixed. Its extremely odd to me that the values could be exactly 0.

import numpy as np from visual_behavior.ophys.io.convert_level_1_to_level_2 import convert_level_1_to_level_2 from visual_behavior.ophys.dataset.visual_behavior_ophys_dataset import VisualBehaviorOphysDataset from visual_behavior.ophys.response_analysis.response_analysis import ResponseAnalysis experiment_id = 787498309 cache_dir = r'/allen/programs/braintv/workgroups/nc-ophys/visual_behavior/visual_behavior_production_analysis' dataset = VisualBehaviorOphysDataset(experiment_id, cache_dir=cache_dir) dff = dataset.dff_traces np.sum(dff == 0) 413594 float(np.sum(dff == 0))/np.prod(np.shape(dff)) 0.009877768012380826 np.sum((dff[0:-1] == 0) & (dff[1:] == 0)) 4170 float(np.sum((dff[0:-1] == 0) & (dff[1:] == 0)))/np.prod(np.shape(dff)) 9.959112707541222e-05 0.00987*0.00987 9.741690000000001e-05

This last check demonstrates that the exact 0s are randomly intermixed

alexpiet avatar Jun 12 '19 18:06 alexpiet