def setUp(self): PyOpenWorm.connect(conf=Configure( **{ 'rdf.store_conf': 'tests/test.db', 'rdf.source': 'ZODB' })) self.g = PyOpenWorm.config("rdf.graph")
def main(): c = Configure() c['neuronscsv'] = 'https://raw.github.com/openworm/data-viz/master/HivePlots/neurons.csv' c['connectomecsv'] = 'https://raw.github.com/openworm/data-viz/master/HivePlots/connectome.csv' c['sqldb'] = '/home/markw/work/openworm/PyOpenWorm/db/celegans.db' c = Data(c) net = PyOpenWorm.Network(c) nml_doc = NeuroMLDocument(id="IafNet") ns = net.neurons() nml_net = neuroml.Network(id="IafNet") nml_doc.networks.append(nml_net) for n in [net.aneuron_nocheck(n) for n in ns]: s(nml_doc, nml_net, n) syn0 = ExpOneSynapse(id="syn0", gbase="65nS", erev="0mV", tau_decay="3ms") for k in net.synapses(): n1 = net.aneuron_nocheck(k[0]) n2 = net.aneuron_nocheck(k[1]) connect(nml_net, n1, n2, 'syn0') f = "test.nml" writers.NeuroMLWriter.write(nml_doc, f) v(f)
def test_init_config_no_Data(self): """ Should fail if given a non-Data configuration """ # XXX: This test touches some machinery in # PyOpenWorm/__init__.py. Feel like it's a bad test tmp = Configureable.conf Configureable.conf = Configure() with self.assertRaises(BadConf): DataUser() Configureable.conf = tmp
def setUpClass(cls): import csv PyOpenWorm.connect(conf=Configure( **{ 'rdf.store_conf': 'tests/test.db', 'rdf.source': 'ZODB' })) PyOpenWorm.loadData(skipIfNewer=False) PyOpenWorm.disconnect() # grab the list of the names of the 302 neurons csvfile = open('OpenWormData/aux_data/neurons.csv', 'r') reader = csv.reader(csvfile, delimiter=';', quotechar='|') # array that holds the names of the 302 neurons at class-level scope cls.neurons = [] for row in reader: if len(row[0]) > 0: # Only saves valid neuron names cls.neurons.append(row[0])