def import_swc(swcs): db = Database(db_name="postgresql://hal08.g-node.pri/lehmann", exec_role="morphjokey_admin", exec_path="morphjokey") swc_parser = SwcParser() for swc in swcs: print(swc) m_swc = swc_parser.parse(swc) db.store(m_swc) print("start to commit data according to '%s'." % (swc)) tic = time.time() db.session.commit() toc = time.time() print("Done. It took %s seconds." % (toc - tic))
# -*- coding: utf-8 -*- from mrj.io.swc import SwcParser from mrj.io.database import Database db = Database( db_name='postgresql://hal08.g-node.pri/lehmann', exec_role='morphjokey_admin', exec_path='morphjokey') swc_parser = SwcParser(db) m = swc_parser.parse('../../../Data/example_morph.swc') #print( m ) #print( m._compartments[0]) db.store( m ) #db.create_subtree( m ) # morphology_key mapped via sqlalchemy: print m.morphology_key m = db.load_morphology( m.morphology_key ) print( m ) # contains ALL auto calculated data from database #print( m._compartments[0]) #print "\n\n\ncompartments as dicts:" #for c in m._compartments: # print c.info.__dict__ #a = db.session.execute("SELECT compartment_id,compartment_parent_id,children FROM morphjokey.mrj_v_compartments_children WHERE morphology_key = 150;") #b = a.fetchall()
# -*- coding: utf-8 -*- ''' @author: stransky ''' from mrj.io.swc import SwcParser from mp.model.synapse import Synapse from mp.model.synapse import getSynapticActivity from mrj.model.experiment import IClamp 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()