Esempio n. 1
0
from Balanced import generate


nml_doc, nml_file_name, lems_file_name = generate(num_bbp =10,
     scalePops = 20,
     scalex=2,
     scalez=2,
     connections=True,
     format='hdf5')
     
from neuroml.loaders import NeuroMLHdf5Loader

nml_doc2 = NeuroMLHdf5Loader.load(nml_file_name)


for doc in [nml_doc,nml_doc2]:
    doc.summary()
    
Esempio n. 2
0
    input = Input(id=pre_index,
                  target="../%s/%i/%s" % (from_pop, pre_index, pop.component),
                  destination="synapses")
    input_list.input.append(input)

nml_file = 'tmp/testh5.nml'
writers.NeuroMLWriter.write(nml_doc, nml_file)

print("Written network file to: " + nml_file)

nml_h5_file = 'tmp/testh5.nml.h5'
writers.NeuroMLHdf5Writer.write(nml_doc, nml_h5_file)

print("Written H5 network file to: " + nml_h5_file)

sum2 = nml_doc.summary()

from neuroml.loaders import NeuroMLHdf5Loader

nml_doc2 = NeuroMLHdf5Loader.load(nml_h5_file)

sum1 = nml_doc2.summary()

assert (sum1 == sum2)

###### Validate the NeuroML ######

from neuroml.utils import validate_neuroml2

validate_neuroml2(nml_file)
nml_file = 'tmp/testh5.nml'
writers.NeuroMLWriter.write(nml_doc, nml_file)


print("Written network file to: "+nml_file)

nml_h5_file = 'tmp/testh5.nml.h5'
writers.NeuroMLHdf5Writer.write(nml_doc, nml_h5_file)


print("Written H5 network file to: "+nml_h5_file)

sum2 = nml_doc.summary()

from neuroml.loaders import NeuroMLHdf5Loader

nml_doc2 = NeuroMLHdf5Loader.load(nml_h5_file)

sum1 = nml_doc2.summary()

assert(sum1==sum2)


###### Validate the NeuroML ######    

from neuroml.utils import validate_neuroml2

validate_neuroml2(nml_file)