Esempio n. 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()
Esempio n. 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"