from mrj.model.experiment import Experiment
from mrj.model.experiment import Neuron_passive_parameter
from mrj.model.experiment import plot

swc_parser  = SwcParser()
m_swc   = swc_parser.parse("../../../Data/test.swc") #slow swc_parser.parse("../../Data/MSO_Neurone/P09/ohne_axon_SkeletonTree_0015_2-1G.swc")
m_swc.neuron_create() # initialisiert die Synapse in NEURON
compartment = m_swc.compartments[5]

s = Synapse(compartment, 0.5, syntimes=getSynapticActivity(f=200, duration=5, sigma=0, fireing_rate=1, delay=0))#TODO: ??delta_time > 5
s.neuron_create()

clamp = IClamp(compartment=compartment, position=0.5, delay=1,amplitude=0,duration=3)#VClamp
neuron_passive_parameter = \
    Neuron_passive_parameter(Ra=1, g=0.004, e=-60, nseg=10)

f = Experiment(m_swc, clamp, neuron_passive_parameter, 
               description='passive channels')

f.neuron_create()
r_in, tau_eff = f.run_simulation(duration=20,dt=0.001)
tau_eff_fit     = f.tau_fit()
#TODO: ?why can linfit fail?
import math
if math.isnan(tau_eff_fit):
    tau_eff_fit = 1
print (tau_eff, tau_eff_fit)
#print (r_in, tau_eff, f.tau_fit());
#f.plot_fit(r_in, tau_eff, tau_eff_fit, save=False)
plot( [f] );#[e] works, (e) is flattend
Beispiel #2
0
morphology = db.load_morphology( 256 )
print morphology 

#morphology.create_tree()
clamp   = IClamp(morphology.root.children[0])

neuron_passive_parameter    = Neuron_passive_parameter(Ra=80)
experiment  = Experiment(morphology, clamp, neuron_passive_parameter)
print experiment
db.store( experiment )

#TODO: change compartments needs group group mapping
#c   = m.getCompartment( 5 )
#c   = m.getCompartment( 7 )

experiment.neuron_create()
experiment.run_simulation()
result   = experiment.get_result()
print result
db.store( result )

e = db.load_experiment( experiment.experiment_key )
print e

e.run_simulation()
r   = e.get_result()
print r

experiment.plot_fit(r.r_in, r.tau_eff, r.tau_eff_fit)
plot( [experiment] )    # [e] works, (e) is flattend