예제 #1
0
 def base_define(self):  #得到基准F值,用来计算dF/F
     self.base_F = np.zeros(shape=len(self.cell_group))
     self.spike_train = np.zeros(shape=(len(self.cell_group),
                                        len(self.aligned_frame_name)))
     for i in range(0, len(self.cell_group)):
         self.base_F[i] = pp.sum_a_frame(self.graph_after_align,
                                         self.cell_group[i])
예제 #2
0
 def dF_calculation(self, frame_i):
     #        for frame_i in range(0,len(self.aligned_frame_name)):# 减少读取次数,每次将一张图的细胞数目读取完
     current_frame = cv2.imread(self.aligned_frame_name[frame_i], -1)
     target_F = np.zeros(shape=len(self.cell_group))
     for j in range(0, len(self.cell_group)):
         target_F[j] = pp.sum_a_frame(current_frame, self.cell_group[j])
     dF_per_frame = (target_F - self.base_F) / self.base_F
     return dF_per_frame
예제 #3
0
    def F_calculation(
            self
    ):  # Calculate F value of every cell, in order to produce F series

        ###############Calculate F first
        self.F_series = np.zeros(shape=(self.frame_Num, len(self.cell_group)),
                                 dtype=np.float64)
        for i in range(self.frame_Num):  #Cycle all cells
            for j in range(len(self.cell_group)):  #Cycle all frames
                self.F_series[i, j] = pp.sum_a_frame(self.frame_sets[i, :, :],
                                                     self.cell_group[j])
        ###################Then calculate dF/F
        self.sub_series = np.zeros(shape=(self.frame_Num,
                                          len(self.cell_group)),
                                   dtype=np.float64)
        for i in range(self.frame_Num):
            for j in range(len(self.cell_group)):
                cell_average = self.F_series[:, j].mean()
                self.sub_series[i, j] = (self.F_series[i, j] -
                                         cell_average) / cell_average