コード例 #1
0
    def __init__(self, tstop=100, dt=0.005, activity_file=None, verbose=True):

        #from LEMS_c302_C1_Full_nrn import NeuronSimulation
        from LEMS_c302_nrn import NeuronSimulation

        import neuron
        self.h = neuron.h

        self.verbose = verbose

        self.ns = NeuronSimulation(tstop, dt)
        print_(
            "Initialised C302NRNSimulation of length %s ms and dt = %s ms..." %
            (tstop, dt))
コード例 #2
0
ファイル: main_sim.py プロジェクト: openworm/sibernetic
 def __init__(self, tstop=100, dt=0.005, activity_file=None, verbose=True):
     
     #from LEMS_c302_C1_Full_nrn import NeuronSimulation
     from LEMS_c302_nrn import NeuronSimulation
     
     import neuron
     self.h = neuron.h
     
     self.verbose = verbose
     
     self.ns = NeuronSimulation(tstop, dt)
     print_("Initialised C302NRNSimulation of length %s ms and dt = %s ms..."%(tstop,dt))
コード例 #3
0
class C302NRNSimulation():

    max_ca = 4e-7
    max_ca_found = -1

    def __init__(self, tstop=100, dt=0.005, activity_file=None, verbose=True):

        #from LEMS_c302_C1_Full_nrn import NeuronSimulation
        from LEMS_c302_nrn import NeuronSimulation

        import neuron
        self.h = neuron.h

        self.verbose = verbose

        self.ns = NeuronSimulation(tstop, dt)
        print_(
            "Initialised C302NRNSimulation of length %s ms and dt = %s ms..." %
            (tstop, dt))

    def save_results(self):

        print_("> Saving results at time: %s" % self.h.t)

        self.ns.save_results()

    def run(self, skip_to_time=-1):

        print_("> Current NEURON time: %s ms" % self.h.t)

        self.ns.advance()

        print_("< Current NEURON time: %s ms" % self.h.t)

        values = list([self._scale(self.h.a_MDR01[0].soma.cai,print_it=True), \
                 self._scale(self.h.a_MVR01[0].soma.cai), \
                 self._scale(self.h.a_MVL01[0].soma.cai), \
                 self._scale(self.h.a_MDL01[0].soma.cai), \
                 self._scale(self.h.a_MDR02[0].soma.cai), \
                 self._scale(self.h.a_MVR02[0].soma.cai), \
                 self._scale(self.h.a_MVL02[0].soma.cai), \
                 self._scale(self.h.a_MDL02[0].soma.cai), \
                 self._scale(self.h.a_MDR03[0].soma.cai), \
                 self._scale(self.h.a_MVR03[0].soma.cai), \
                 self._scale(self.h.a_MVL03[0].soma.cai), \
                 self._scale(self.h.a_MDL03[0].soma.cai), \
                 self._scale(self.h.a_MDR04[0].soma.cai), \
                 self._scale(self.h.a_MVR04[0].soma.cai), \
                 self._scale(self.h.a_MVL04[0].soma.cai), \
                 self._scale(self.h.a_MDL04[0].soma.cai), \
                 self._scale(self.h.a_MDR05[0].soma.cai), \
                 self._scale(self.h.a_MVR05[0].soma.cai), \
                 self._scale(self.h.a_MVL05[0].soma.cai), \
                 self._scale(self.h.a_MDL05[0].soma.cai), \
                 self._scale(self.h.a_MDR06[0].soma.cai), \
                 self._scale(self.h.a_MVR06[0].soma.cai), \
                 self._scale(self.h.a_MVL06[0].soma.cai), \
                 self._scale(self.h.a_MDL06[0].soma.cai), \
                 self._scale(self.h.a_MDR07[0].soma.cai), \
                 self._scale(self.h.a_MVR07[0].soma.cai), \
                 self._scale(self.h.a_MVL07[0].soma.cai), \
                 self._scale(self.h.a_MDL07[0].soma.cai), \
                 self._scale(self.h.a_MDR08[0].soma.cai), \
                 self._scale(self.h.a_MVR08[0].soma.cai), \
                 self._scale(self.h.a_MVL08[0].soma.cai), \
                 self._scale(self.h.a_MDL08[0].soma.cai), \
                 self._scale(self.h.a_MDR09[0].soma.cai), \
                 self._scale(self.h.a_MVR09[0].soma.cai), \
                 self._scale(self.h.a_MVL09[0].soma.cai), \
                 self._scale(self.h.a_MDL09[0].soma.cai), \
                 self._scale(self.h.a_MDR10[0].soma.cai), \
                 self._scale(self.h.a_MVR10[0].soma.cai), \
                 self._scale(self.h.a_MVL10[0].soma.cai), \
                 self._scale(self.h.a_MDL10[0].soma.cai), \
                 self._scale(self.h.a_MDR11[0].soma.cai), \
                 self._scale(self.h.a_MVR11[0].soma.cai), \
                 self._scale(self.h.a_MVL11[0].soma.cai), \
                 self._scale(self.h.a_MDL11[0].soma.cai), \
                 self._scale(self.h.a_MDR12[0].soma.cai), \
                 self._scale(self.h.a_MVR12[0].soma.cai), \
                 self._scale(self.h.a_MVL12[0].soma.cai), \
                 self._scale(self.h.a_MDL12[0].soma.cai), \
                 self._scale(self.h.a_MDR13[0].soma.cai), \
                 self._scale(self.h.a_MVR13[0].soma.cai), \
                 self._scale(self.h.a_MVL13[0].soma.cai), \
                 self._scale(self.h.a_MDL13[0].soma.cai), \
                 self._scale(self.h.a_MDR14[0].soma.cai), \
                 self._scale(self.h.a_MVR14[0].soma.cai), \
                 self._scale(self.h.a_MVL14[0].soma.cai), \
                 self._scale(self.h.a_MDL14[0].soma.cai), \
                 self._scale(self.h.a_MDR15[0].soma.cai), \
                 self._scale(self.h.a_MVR15[0].soma.cai), \
                 self._scale(self.h.a_MVL15[0].soma.cai), \
                 self._scale(self.h.a_MDL15[0].soma.cai), \
                 self._scale(self.h.a_MDR16[0].soma.cai), \
                 self._scale(self.h.a_MVR16[0].soma.cai), \
                 self._scale(self.h.a_MVL16[0].soma.cai), \
                 self._scale(self.h.a_MDL16[0].soma.cai), \
                 self._scale(self.h.a_MDR17[0].soma.cai), \
                 self._scale(self.h.a_MVR17[0].soma.cai), \
                 self._scale(self.h.a_MVL17[0].soma.cai), \
                 self._scale(self.h.a_MDL17[0].soma.cai), \
                 self._scale(self.h.a_MDR18[0].soma.cai), \
                 self._scale(self.h.a_MVR18[0].soma.cai), \
                 self._scale(self.h.a_MVL18[0].soma.cai), \
                 self._scale(self.h.a_MDL18[0].soma.cai), \
                 self._scale(self.h.a_MDR19[0].soma.cai), \
                 self._scale(self.h.a_MVR19[0].soma.cai), \
                 self._scale(self.h.a_MVL19[0].soma.cai), \
                 self._scale(self.h.a_MDL19[0].soma.cai), \
                 self._scale(self.h.a_MDR20[0].soma.cai), \
                 self._scale(self.h.a_MVR20[0].soma.cai), \
                 self._scale(self.h.a_MVL20[0].soma.cai), \
                 self._scale(self.h.a_MDL20[0].soma.cai), \
                 self._scale(self.h.a_MDR21[0].soma.cai), \
                 self._scale(self.h.a_MVR21[0].soma.cai), \
                 self._scale(self.h.a_MVL21[0].soma.cai), \
                 self._scale(self.h.a_MDL21[0].soma.cai), \
                 self._scale(self.h.a_MDR22[0].soma.cai), \
                 self._scale(self.h.a_MVR22[0].soma.cai), \
                 self._scale(self.h.a_MVL22[0].soma.cai), \
                 self._scale(self.h.a_MDL22[0].soma.cai), \
                 self._scale(self.h.a_MDR23[0].soma.cai), \
                 self._scale(self.h.a_MVR23[0].soma.cai), \
                 self._scale(self.h.a_MVL23[0].soma.cai), \
                 self._scale(self.h.a_MDL23[0].soma.cai), \
                 self._scale(self.h.a_MDR24[0].soma.cai), \
                 self._scale(0), \
                 self._scale(self.h.a_MVL24[0].soma.cai), \
                 self._scale(self.h.a_MDL24[0].soma.cai)])

        if self.verbose:
            print_("Returning %s values: %s" % (len(values), values))
        return values

    def _scale(self, ca, print_it=False):

        self.max_ca_found = max(ca, self.max_ca_found)
        scaled = min(1, (ca / self.max_ca))
        if print_it:
            print_("- Scaling %s to %s (max found: %s)" %
                   (ca, scaled, self.max_ca_found))
        return scaled
コード例 #4
0
ファイル: main_sim.py プロジェクト: openworm/sibernetic
class C302NRNSimulation():

    max_ca = 4e-7
    max_ca_found = -1
    
    def __init__(self, tstop=100, dt=0.005, activity_file=None, verbose=True):
        
        #from LEMS_c302_C1_Full_nrn import NeuronSimulation
        from LEMS_c302_nrn import NeuronSimulation
        
        import neuron
        self.h = neuron.h
        
        self.verbose = verbose
        
        self.ns = NeuronSimulation(tstop, dt)
        print_("Initialised C302NRNSimulation of length %s ms and dt = %s ms..."%(tstop,dt))
        
        
    def save_results(self):
        
        print_("> Saving results at time: %s"%self.h.t)
        
        self.ns.save_results()
        
    def run(self, skip_to_time=-1):
        
        print_("> Current NEURON time: %s ms"%self.h.t)
        
        self.ns.advance()
        
        print_("< Current NEURON time: %s ms"%self.h.t)
                  
        values = list([self._scale(self.h.a_MDR01[0].soma.cai,print_it=True), \
                 self._scale(self.h.a_MVR01[0].soma.cai), \
                 self._scale(self.h.a_MVL01[0].soma.cai), \
                 self._scale(self.h.a_MDL01[0].soma.cai), \
                 self._scale(self.h.a_MDR02[0].soma.cai), \
                 self._scale(self.h.a_MVR02[0].soma.cai), \
                 self._scale(self.h.a_MVL02[0].soma.cai), \
                 self._scale(self.h.a_MDL02[0].soma.cai), \
                 self._scale(self.h.a_MDR03[0].soma.cai), \
                 self._scale(self.h.a_MVR03[0].soma.cai), \
                 self._scale(self.h.a_MVL03[0].soma.cai), \
                 self._scale(self.h.a_MDL03[0].soma.cai), \
                 self._scale(self.h.a_MDR04[0].soma.cai), \
                 self._scale(self.h.a_MVR04[0].soma.cai), \
                 self._scale(self.h.a_MVL04[0].soma.cai), \
                 self._scale(self.h.a_MDL04[0].soma.cai), \
                 self._scale(self.h.a_MDR05[0].soma.cai), \
                 self._scale(self.h.a_MVR05[0].soma.cai), \
                 self._scale(self.h.a_MVL05[0].soma.cai), \
                 self._scale(self.h.a_MDL05[0].soma.cai), \
                 self._scale(self.h.a_MDR06[0].soma.cai), \
                 self._scale(self.h.a_MVR06[0].soma.cai), \
                 self._scale(self.h.a_MVL06[0].soma.cai), \
                 self._scale(self.h.a_MDL06[0].soma.cai), \
                 self._scale(self.h.a_MDR07[0].soma.cai), \
                 self._scale(self.h.a_MVR07[0].soma.cai), \
                 self._scale(self.h.a_MVL07[0].soma.cai), \
                 self._scale(self.h.a_MDL07[0].soma.cai), \
                 self._scale(self.h.a_MDR08[0].soma.cai), \
                 self._scale(self.h.a_MVR08[0].soma.cai), \
                 self._scale(self.h.a_MVL08[0].soma.cai), \
                 self._scale(self.h.a_MDL08[0].soma.cai), \
                 self._scale(self.h.a_MDR09[0].soma.cai), \
                 self._scale(self.h.a_MVR09[0].soma.cai), \
                 self._scale(self.h.a_MVL09[0].soma.cai), \
                 self._scale(self.h.a_MDL09[0].soma.cai), \
                 self._scale(self.h.a_MDR10[0].soma.cai), \
                 self._scale(self.h.a_MVR10[0].soma.cai), \
                 self._scale(self.h.a_MVL10[0].soma.cai), \
                 self._scale(self.h.a_MDL10[0].soma.cai), \
                 self._scale(self.h.a_MDR11[0].soma.cai), \
                 self._scale(self.h.a_MVR11[0].soma.cai), \
                 self._scale(self.h.a_MVL11[0].soma.cai), \
                 self._scale(self.h.a_MDL11[0].soma.cai), \
                 self._scale(self.h.a_MDR12[0].soma.cai), \
                 self._scale(self.h.a_MVR12[0].soma.cai), \
                 self._scale(self.h.a_MVL12[0].soma.cai), \
                 self._scale(self.h.a_MDL12[0].soma.cai), \
                 self._scale(self.h.a_MDR13[0].soma.cai), \
                 self._scale(self.h.a_MVR13[0].soma.cai), \
                 self._scale(self.h.a_MVL13[0].soma.cai), \
                 self._scale(self.h.a_MDL13[0].soma.cai), \
                 self._scale(self.h.a_MDR14[0].soma.cai), \
                 self._scale(self.h.a_MVR14[0].soma.cai), \
                 self._scale(self.h.a_MVL14[0].soma.cai), \
                 self._scale(self.h.a_MDL14[0].soma.cai), \
                 self._scale(self.h.a_MDR15[0].soma.cai), \
                 self._scale(self.h.a_MVR15[0].soma.cai), \
                 self._scale(self.h.a_MVL15[0].soma.cai), \
                 self._scale(self.h.a_MDL15[0].soma.cai), \
                 self._scale(self.h.a_MDR16[0].soma.cai), \
                 self._scale(self.h.a_MVR16[0].soma.cai), \
                 self._scale(self.h.a_MVL16[0].soma.cai), \
                 self._scale(self.h.a_MDL16[0].soma.cai), \
                 self._scale(self.h.a_MDR17[0].soma.cai), \
                 self._scale(self.h.a_MVR17[0].soma.cai), \
                 self._scale(self.h.a_MVL17[0].soma.cai), \
                 self._scale(self.h.a_MDL17[0].soma.cai), \
                 self._scale(self.h.a_MDR18[0].soma.cai), \
                 self._scale(self.h.a_MVR18[0].soma.cai), \
                 self._scale(self.h.a_MVL18[0].soma.cai), \
                 self._scale(self.h.a_MDL18[0].soma.cai), \
                 self._scale(self.h.a_MDR19[0].soma.cai), \
                 self._scale(self.h.a_MVR19[0].soma.cai), \
                 self._scale(self.h.a_MVL19[0].soma.cai), \
                 self._scale(self.h.a_MDL19[0].soma.cai), \
                 self._scale(self.h.a_MDR20[0].soma.cai), \
                 self._scale(self.h.a_MVR20[0].soma.cai), \
                 self._scale(self.h.a_MVL20[0].soma.cai), \
                 self._scale(self.h.a_MDL20[0].soma.cai), \
                 self._scale(self.h.a_MDR21[0].soma.cai), \
                 self._scale(self.h.a_MVR21[0].soma.cai), \
                 self._scale(self.h.a_MVL21[0].soma.cai), \
                 self._scale(self.h.a_MDL21[0].soma.cai), \
                 self._scale(self.h.a_MDR22[0].soma.cai), \
                 self._scale(self.h.a_MVR22[0].soma.cai), \
                 self._scale(self.h.a_MVL22[0].soma.cai), \
                 self._scale(self.h.a_MDL22[0].soma.cai), \
                 self._scale(self.h.a_MDR23[0].soma.cai), \
                 self._scale(self.h.a_MVR23[0].soma.cai), \
                 self._scale(self.h.a_MVL23[0].soma.cai), \
                 self._scale(self.h.a_MDL23[0].soma.cai), \
                 self._scale(self.h.a_MDR24[0].soma.cai), \
                 self._scale(0), \
                 self._scale(self.h.a_MVL24[0].soma.cai), \
                 self._scale(self.h.a_MDL24[0].soma.cai)])
                 
        if self.verbose:
            print_("Returning %s values: %s"%(len(values),values))
        return values
        
    
    def _scale(self,ca,print_it=False):
        
        self.max_ca_found = max(ca,self.max_ca_found)
        scaled = min(1,(ca/self.max_ca))
        if print_it: 
            print_("- Scaling %s to %s (max found: %s)"%(ca,scaled,self.max_ca_found))
        return scaled