def test_brunel_round_trip(self): path = 'network/Brunel2000/SR' brunel = lookup(path) save(brunel, path) reloaded_brunel = lookup(path) # FIXME: Should check a modified version of the model and then resave # the original self.assertEqual(brunel, reloaded_brunel)
def test_liaf_round_trip(self): path = 'neuron/LeakyIntegrateAndFire' name = 'LeakyIntegrateAndFire' liaf_doc = lookup(path) liaf = lookup(path, name) save(liaf, path, name) reloaded_doc = lookup(path) # FIXME: Should check a modified version of the model and then resave # the original self.assertEqual(liaf_doc, reloaded_doc)
if args.mode == 'print': document = Document() print( etree.tostring(E.NineML(create_static().to_xml(document), parameterise_static().to_xml(document)), encoding="UTF-8", pretty_print=True, xml_declaration=True)) elif args.mode == 'compare': if ninemlcatalog is None: raise Exception("NineML catalog is not installed") local_version = create_static() catalog_version = ninemlcatalog.load(catalog_path, local_version.name) mismatch = local_version.find_mismatch(catalog_version) if mismatch: print("Local version differs from catalog version:\n{}".format( mismatch)) else: print("Local version matches catalog version") elif args.mode == 'save': if ninemlcatalog is None: raise Exception("NineML catalog is not installed") dynamics = create_static() ninemlcatalog.save(dynamics, catalog_path, dynamics.name) params = parameterise_static( ninemlcatalog.load(catalog_path, dynamics.name)) ninemlcatalog.save(params, catalog_path, params.name) print("Saved '{}' and '{}' to catalog".format(dynamics.name, params.name))
document = Document() print(etree.tostring( E.NineML( create_static().to_xml(document), parameterise_static().to_xml(document)), encoding="UTF-8", pretty_print=True, xml_declaration=True)) elif args.mode == 'compare': if ninemlcatalog is None: raise Exception( "NineML catalog is not installed") local_version = create_static() catalog_version = ninemlcatalog.load(catalog_path, local_version.name) mismatch = local_version.find_mismatch(catalog_version) if mismatch: print ("Local version differs from catalog version:\n{}" .format(mismatch)) else: print("Local version matches catalog version") elif args.mode == 'save': if ninemlcatalog is None: raise Exception( "NineML catalog is not installed") dynamics = create_static() ninemlcatalog.save(dynamics, catalog_path, dynamics.name) params = parameterise_static( ninemlcatalog.load(catalog_path, dynamics.name)) ninemlcatalog.save(params, catalog_path, params.name) print("Saved '{}' and '{}' to catalog".format(dynamics.name, params.name))