示例#1
0
 def distribute_spines(self, spine_dist, big_spine):
     """Attach spines to the dendrites"""
     self.spines = {}
     if spine_dist == 'zero':
       pass  
     elif spine_dist == 'two':
         ## Trying some spines only for test
         spine_positions = [0.3, 0.5]
         self.populate_dend(spine_positions, 
                             [h.MSP_Cell[0].dend3_1[1]],
                             big_spine)
     elif spine_dist == 'onebranch' :
         # This one populate one branch only for testing purpose
         l = Loader()
         
         if big_spine:
             # Mid:
             spines_pos_mid = l.load('branch_dist/mid_spines_per_branch.pickle')
             first_half = [h.MSP_Cell[0].dend3_1[0]]
         
             self.populate_dend(spines_pos_mid[0], 
                                 first_half, 
                                 big_spine)
         
             # Distal:
             spines_pos_dist = l.load('branch_dist/dist_spines_per_branch.pickle')
             
             first_dist = [h.MSP_Cell[0].dend3_1[1]] 
             
             self.populate_dend(spines_pos_dist[0], first_dist, big_spine)
         else:
             s = "Small spine not yet implemented for spine_dist: %s" %spine_dist
             raise NotImplementedError(s)
         
     elif spine_dist == 'all':
         l = Loader()
         
         if big_spine:
             # Mid:
             spines_pos_mid = l.load('branch_dist/mid_spines_per_branch.pickle')
             
             first_half = [h.MSP_Cell[0].dend1_1[0], h.MSP_Cell[0].dend2_1[0], h.MSP_Cell[0].dend3_1[0],
             h.MSP_Cell[0].dend4_1[0]]
             
             self.populate_dend(spines_pos_mid[0], first_half, big_spine)
             
             second_half = [h.MSP_Cell[0].dend1_2[0], h.MSP_Cell[0].dend2_2[0], h.MSP_Cell[0].dend3_2[0],
             h.MSP_Cell[0].dend4_2[0]]
             
             self.populate_dend(spines_pos_mid[1], second_half, big_spine)
             
             # Distal:
             spines_pos_dist = l.load('branch_dist/dist_spines_per_branch.pickle')
             
             first_dist = [h.MSP_Cell[0].dend1_1[1], h.MSP_Cell[0].dend2_1[1],
                           h.MSP_Cell[0].dend3_1[1], h.MSP_Cell[0].dend4_1[1]] 
             
             self.populate_dend(spines_pos_dist[0], first_dist, big_spine)
             
             second_dist = [h.MSP_Cell[0].dend1_1[2], h.MSP_Cell[0].dend2_2[2], 
                            h.MSP_Cell[0].dend3_2[2], h.MSP_Cell[0].dend4_2[2]]
             
             self.populate_dend(spines_pos_dist[1], second_dist, big_spine)
             
             third_dist = [h.MSP_Cell[0].dend1_2[1], h.MSP_Cell[0].dend2_2[1], 
                           h.MSP_Cell[0].dend3_2[1], h.MSP_Cell[0].dend4_2[1]]
             
             self.populate_dend(spines_pos_dist[2], third_dist, big_spine)
             
             fourth_dist = [h.MSP_Cell[0].dend1_2[2], h.MSP_Cell[0].dend2_1[2], 
                            h.MSP_Cell[0].dend3_1[2], h.MSP_Cell[0].dend4_1[2]]
             
             self.populate_dend(spines_pos_dist[3], fourth_dist, big_spine)
         else:
             s = "Small spine not yet implemented for spine_dist: %s" %spine_dist
             raise NotImplementedError(s)
     else:
         print "Value for the spine not understood"
         sys.exit()
示例#2
0
                 label="bio calcium")
        plt.title("Total Calcium in the biochemical ")
        plt.xlim(xlim)
        plt.xlabel("Time [ms]")
        plt.ylabel("Concentration [uM]")
        plt.legend()
        plt.ylim(-0.1, 5)
        if dir is not None:
            for format in [".png", ".pdf"]:
                filename = spine + "_biochemical_free_and_buffered_calcium_subtracted" + format
                plt.savefig(os.path.join(dir, filename))


if __name__ == "__main__":

    if len(sys.argv) == 2:

        filename = sys.argv[1]
        l = Loader()
        ecp = EcellPlotter()
        timecourses = l.load(filename)
        ecp.plot_timeCourses(timecourses, name='test_spine')
        print "Time courses loaded in 'timecourses' object. Easy plotting \n\
        with 'ecp' object. Have fun."

        plt.show()

    else:
        print "Tell me which file with ecell Timeseries to load."
        print "visualizatorBiochemical.py path/to/timecourses\n"
示例#3
0
        calcium_bio_and_calcium_calmodulin_buffered_subtracted = ((conc_tot_calcium_bound_to_cam - conc_tot_calcium_bound_to_cam[489]) + ca_conc.read()) * 1e6 
        plt.plot(t_bio_ms, calcium_bio_and_calcium_calmodulin_buffered_subtracted, 
                 label="bio calcium")
        plt.title("Total Calcium in the biochemical ")
        plt.xlim(xlim)
        plt.xlabel("Time [ms]")
        plt.ylabel("Concentration [uM]")
        plt.legend()
        plt.ylim(-0.1, 5)
        if dir is not None:
            for format in [".png", ".pdf"]:
                filename = spine + "_biochemical_free_and_buffered_calcium_subtracted" + format
                plt.savefig(os.path.join(dir, filename))

if __name__ == "__main__":

    if len(sys.argv) == 2:
        
        filename = sys.argv[1]
        l = Loader()
        ecp = EcellPlotter()
        timecourses = l.load(filename)
        ecp.plot_timeCourses(timecourses, name='test_spine')
        print "Time courses loaded in 'timecourses' object. Easy plotting \n\
        with 'ecp' object. Have fun."
        plt.show()
    
    else:
        print "Tell me which file with ecell Timeseries to load."
        print "visualizatorBiochemical.py path/to/timecourses\n"
示例#4
0
                shortest.append(x)
    
    
        # Insert the spines in perc
    def calc_perc_pos(self, start, end, value):
        """Calc the percentual of the spine in the dends
        lenght : 1 = value : x
        x = value/lenght 
        """
        real_value = value - start
        length = end -start
        x = real_value/length
        return x
        
if __name__ == "__main__":
    l = Loader()
    
    spines_pos = l.load('spines_pos.pickle')
    plt.hist(spines_pos, bins=30, label='normal')
    
    spinePer = spinePercentual()
    spines_pos = spinePer.reduce_noise(spines_pos)
    
    plt.hist(spines_pos, bins=30, label='noise red')
    plt.legend()
    
    print "Calculating the spines pos normalized to 1"
    spinePer.convert_to_perc(spines_pos)
    l.save(spinePer.mids, '.', 'mid_spines_per_branch.pickle')
    l.save(spinePer.dists, '.', 'dist_spines_per_branch.pickle')
    plt.show()