return "<span %s><i>%s</i></span>"%(greyStyleDark, desc2) def formatDescriptionSmall(element): if element.getDescription() is None: return "" return "<br/>%s<span %s><i>%s</i></span>"%(spacer4,greySmallStyleDark, element.getDescription()) files = ["Cells", "Synapses", "Channels", "Inputs", "Networks", "PyNN", "NeuroMLCoreDimensions", "NeuroMLCoreCompTypes"] compTypes = {} compTypeSrc = {} compTypeDesc = {} for file in files: lemscontents = lemsutil.readLems("../../../NeuroML2CoreTypes/%s.xml"%file, incIncludes=False) for compType in lemscontents.getComponentType(): compTypes[compType.getName()] = compType compTypeSrc[compType.getName()] = file compTypeDesc[compType.getName()] = compType.getDescription() if compType.getDescription() is not None else "ComponentType: "+compType.getName() print compTypeSrc def compTypeLink(name): if name is None or name == "none" or not compTypeSrc.has_key(name): return "???" compName = name if name.startswith("base"): compName = "<span %s>%s</span>"% (greyBlueStyle, name) desc= replaceUnderscoresAndUrls(compTypeDesc[name], False) return "<a href=\"%s.html#%s\" title=\"%s\">%s</a>"%(compTypeSrc[name],name,desc,compName)
filename = "../../examples/NML2_AbstractCells.nml" reader = lnml.NeuroMLReader() nml2Doc = reader.readNeuroML(filename) print "Read in cells in v2: "+nml2Doc.getId() #print nml2Doc.__class__ iaf0 = nml2Doc.getIafCell()[0] iafTau0 = nml2Doc.getIafTauCell()[0] iz0 = nml2Doc.getIzhikevichCell()[0] lemsDoc = lemsutil.readLems("../../NeuroML2CoreTypes/Cells.xml") izCompType = lemsutil.getComponentType(lemsDoc, iz0.__class__.__name__) iafCompType = lemsutil.getComponentType(lemsDoc, iaf0.__class__.__name__) iafTauCompType = lemsutil.getComponentType(lemsDoc, iafTau0.__class__.__name__) eqnsIaf = n2brian.toBrianEqnsResetThresh(lemsDoc, iaf0, iafCompType) eqnsIafTau = n2brian.toBrianEqnsResetThresh(lemsDoc, iafTau0, iafTauCompType) eqnsIz = n2brian.toBrianEqnsResetThresh(lemsDoc, iz0, izCompType) print eqnsIafTau[0] print eqnsIafTau[1] print eqnsIafTau[2]