diff --git a/moose-core/.gitignore b/moose-core/.gitignore index 6208aede5114ca1007ed37ca018466eb50b37e60..2c567e30400282f320d954ba5b6b71f98c862176 100644 --- a/moose-core/.gitignore +++ b/moose-core/.gitignore @@ -133,3 +133,15 @@ Session.vim *.clean /VERSION +/_build +/python/moose/neuroml2/*.dat +/python/moose/neuroml2/test_files/*.dat +/python/moose/neuroml2/schema/Cells.xml +/python/moose/neuroml2/schema/Channels.xml +/python/moose/neuroml2/schema/Inputs.xml +/python/moose/neuroml2/schema/Networks.xml +/python/moose/neuroml2/schema/NeuroML2CoreTypes.xml +/python/moose/neuroml2/schema/NeuroMLCoreCompTypes.xml +/python/moose/neuroml2/schema/PyNN.xml +/python/moose/neuroml2/schema/Simulation.xml +/python/moose/neuroml2/schema/Synapses.xml diff --git a/moose-core/.travis.yml b/moose-core/.travis.yml index f43c248d974eb15afc2b79e98cff0c21fb8de908..f38c78cc58ebcdb6b26d6b499187f9e0cc48e36a 100644 --- a/moose-core/.travis.yml +++ b/moose-core/.travis.yml @@ -11,8 +11,8 @@ notifications: email: recipients: - bhalla@ncbs.res.in - - hrani@ncbs.res.in - dilawar.s.rajput@gmail.com + - hrani@ncbs.res.in on_success: change on_failure: always diff --git a/moose-core/.travis/travis_build_linux.sh b/moose-core/.travis/travis_build_linux.sh index 141cad7b8bdad51e7ad58f3a8f55011f2d3ffec8..83cce12028721c2bf551f2b6b9579761237c1663 100755 --- a/moose-core/.travis/travis_build_linux.sh +++ b/moose-core/.travis/travis_build_linux.sh @@ -29,11 +29,9 @@ MAKEFLAGS="-j4" # python executable. ( - # Old makefile based flow. $PYTHON2 -m compileall -q . if type $PYTHON3 > /dev/null; then $PYTHON3 -m compileall -q . ; fi - ## CMAKE based flow mkdir -p _GSL_BUILD && cd _GSL_BUILD && \ cmake -DDEBUG=ON -DPYTHON_EXECUTABLE="$PYTHON2" .. make && ctest --output-on-failure @@ -44,7 +42,7 @@ MAKEFLAGS="-j4" cd .. # This is only applicable on linux build. - echo "Python3 support. Removed python2-networkx and install python3" + echo "Python3: Removed python2-networkx and install python3" if type $PYTHON3 > /dev/null; then sudo apt-get remove -qq python-networkx sudo apt-get install -qq python3-networkx diff --git a/moose-core/.travis/travis_build_osx.sh b/moose-core/.travis/travis_build_osx.sh index f021ef26333f8ebbda5a115a72f0812e66c8e9e3..44ff04c8ab44657ef88f2960fb971726853bd043 100755 --- a/moose-core/.travis/travis_build_osx.sh +++ b/moose-core/.travis/travis_build_osx.sh @@ -31,4 +31,9 @@ set -e -DPYTHON_EXECUTABLE=`which python` .. make && ctest --output-on-failure cd .. + + # Now test the brew formula + cd ~ + brew tap BhallaLab/moose + brew install moose ) diff --git a/moose-core/.travis/travis_prepare_linux.sh b/moose-core/.travis/travis_prepare_linux.sh index 5f0a31608863151c8473f8f80348a29f3fac83ea..f2110440121110a95f0ad3f64c60ffb78ac6864c 100755 --- a/moose-core/.travis/travis_prepare_linux.sh +++ b/moose-core/.travis/travis_prepare_linux.sh @@ -23,9 +23,13 @@ set +e # Let installation fail in some command apt-get install -qq libxml2-dev libbz2-dev apt-get install -qq libhdf5-serial-dev apt-get install -qq make cmake -apt-get install -qq python-numpy python-matplotlib python-networkx +apt-get install -qq python-numpy python-matplotlib python-networkx python-pip apt-get install -qq python3-numpy python3-matplotlib python3-dev apt-get install -qq libboost-all-dev apt-get install -qq libgsl0-dev apt-get install -qq python-pip python3-pip apt-get install -qq libgraphviz-dev + +# Dependencies for NML2 +apt-get install -qq python-scipy python3-scipy +pip install pyNeuroML libNeuroML diff --git a/moose-core/.travis/travis_prepare_osx.sh b/moose-core/.travis/travis_prepare_osx.sh index b7e0fe3f76c1be14ae51101905f2479755e6cd41..8c95810b76ce59ea217537a933b1bbd471b63f27 100755 --- a/moose-core/.travis/travis_prepare_osx.sh +++ b/moose-core/.travis/travis_prepare_osx.sh @@ -35,3 +35,5 @@ echo 'import sys; sys.path.insert(1, "/usr/local/lib/python2.7/site-packages")' # ensurepip #python -m ensurepip pip2 install matplotlib --user +pip2 install pyNeuroML libNeuroML --user +pip2 install scipy --user diff --git a/moose-core/AUTHROS b/moose-core/AUTHROS new file mode 100644 index 0000000000000000000000000000000000000000..f568c742ebe5fc90330f250c3c5e035224fed581 --- /dev/null +++ b/moose-core/AUTHROS @@ -0,0 +1,9 @@ +Upinder S. Bhalla Primary Architect +Niraj Dudani Neuronal solver +Subhasis Ray Python interface +Aditya Gilra NeuroML support +Aviral Goel Moogli +HarshaRani. G.V Designing of Website,read and write SBML and + Graphical User Interface for moose +Dilawar Singh Packaging, BOOST solvers +Dharma Teja GPU parallelization using CUDA diff --git a/moose-core/CMakeLists.txt b/moose-core/CMakeLists.txt index b9b807ff48d7e86759953e8f6269cba6860b9c85..f91b68e213f79a13762f83b5446734edfa703129 100644 --- a/moose-core/CMakeLists.txt +++ b/moose-core/CMakeLists.txt @@ -12,9 +12,11 @@ if(COMMAND cmake_policy) endif(COMMAND cmake_policy) +set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules") include(CheckCXXCompiler.cmake) include(CheckIncludeFileCXX) include(FindPkgConfig) +include(GetRevision) # If from command line, version info is not passed, use the git to generate a # version file. If GIT fails, use the previous known version. @@ -22,6 +24,11 @@ set(MOOSE_VERSION 3.2-git) add_definitions( -DMOOSE_VERSION="${MOOSE_VERSION}") message( STATUS "MOOSE Version ${MOOSE_VERSION}" ) +# Write VERSION to a file VERSION so that setup.py can use it. +set(VERSION_FILE ${CMAKE_CURRENT_SOURCE_DIR}/VERSION) +message(STATUS "+ Writing ${MOOSE_VERSION} to ${VERSION_FILE}" ) +file(WRITE ${VERSION_FILE} ${MOOSE_VERSION} ) + # This snippet is from LLVM project. # Sanity check our source directory to make sure that we are not trying to # generate an in-tree build (unless on MSVC_IDE, where it is ok), and to make @@ -74,9 +81,6 @@ option(WITH_GSL "Use gsl-library. Alternative is WITH_BOOST" ON) option(PARALLELIZED_SOLVERS "Use parallel version of GSOLVE. (alpha)" OFF ) option(PARALLELIZED_CLOCK "High level parallelization of moose::Clock (alpha)" OFF ) -################################# CMKAE MACROS ################################# - -set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules") ############################ BUILD CONFIGURATION ################################# @@ -285,15 +289,9 @@ if(WITH_MPI) endif() endif(WITH_MPI) -pkg_check_modules(MUPARSER muparser) -if(MUPARSER_FOUND) - message(STATUS "Using system muparser ${MUPARSER_VERSION}") - list(APPEND SYSTEM_SHARED_LIBS ${MUPARSER_LIBRARIES}) -else() - message(STATUS "Using private muparser") - add_subdirectory(external/muparser) - list(APPEND MOOSE_LIBRARIES muparser) -endif() +# Always use private version of muparser. We have some custom edits. +add_subdirectory(external/muparser) +list(APPEND MOOSE_LIBRARIES muparser) # Add subdirectroeis add_subdirectory(basecode) @@ -411,18 +409,16 @@ message( STATUS "Platform ${_platform_desc}" ) # is most likely to be --install-layout=deb . set(EXTRA_ARGS "--prefix ${CMAKE_INSTALL_PREFIX} ${DISTUTILS_EXTRA_ARGS}") -## NOTE: Disable it here. It must be handled by moose repository CMakeLists.txt -## which is used in created packages. For normal user, it should install in -## site-packages. -#if( ${_platform_desc} MATCHES ".*(Ubuntu|Debian).*" ) -# list( APPEND EXTRA_ARGS "--install-layout=deb" ) -#endif( ) +# On Debian/Ubuntu install using debian layout +if( ${_platform_desc} MATCHES ".*(Ubuntu|Debian).*" ) + list( APPEND EXTRA_ARGS "--install-layout=deb" ) +endif( ) # If make is called with sudo, install in system directories. Otherwise use # --user to install in user home. install(CODE "execute_process( - COMMAND ${PYTHON_EXECUTABLE} setup.cmake.py install ${EXTRA_ARGS} + COMMAND ${PYTHON_EXECUTABLE} setup.cmake.py install ${EXTRA_ARGS} ${PYMOOSE_EXTRA_INSTALL_ARGS} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/python )" ) diff --git a/moose-core/Jenkinsfile b/moose-core/Jenkinsfile new file mode 100644 index 0000000000000000000000000000000000000000..2b8f686e173b685a42466d93da4128042eeca188 --- /dev/null +++ b/moose-core/Jenkinsfile @@ -0,0 +1,15 @@ +pipeline { + agent any + stages { + stage('Build') { + steps { + sh 'mkdir -p _build && cd _build && cmake .. && make -j4' + } + } + stage('Test'){ + steps { + sh 'cd _build && ctest --output-on-failure' + } + } + } +} diff --git a/moose-core/basecode/global.h b/moose-core/basecode/global.h index 1cfef1647f3f29f6788287dd895327987babf316..761a310f89f73cf6b4499a559ad3c206191fb78e 100644 --- a/moose-core/basecode/global.h +++ b/moose-core/basecode/global.h @@ -48,9 +48,6 @@ extern unsigned int totalTests; #define TEST_END totalTests++; \ cout << std::right << setw(20) << "test of " << SIMPLE_CURRENT_FUNCTION << " finished."; -/*----------------------------------------------------------------------------- - * Global functions in namespace moose - *-----------------------------------------------------------------------------*/ #define MISSING_BRACKET_AT_END -1 #define EMPTY_PATH -2 #define SPACES_AT_THE_BEGINING -3 @@ -59,6 +56,9 @@ extern unsigned int totalTests; #define BAD_CHARACTER_IN_PATH -6 +/*----------------------------------------------------------------------------- + * Global functions in namespace moose + *-----------------------------------------------------------------------------*/ namespace moose { diff --git a/moose-core/ksolve/Stoich.cpp b/moose-core/ksolve/Stoich.cpp index 198f1978f1acce36a84d62b2f8c24de970341ea0..a94dfff9d6143a8e9b19d2a2080d8ef19fa7bd86 100644 --- a/moose-core/ksolve/Stoich.cpp +++ b/moose-core/ksolve/Stoich.cpp @@ -75,6 +75,19 @@ const Cinfo* Stoich::initCinfo() &Stoich::getCompartment ); + static ValueFinfo< Stoich, bool > allowNegative( + "allowNegative", + "Flag: allow negative values if true. Default is false." + " This is used to protect the chemical system from going unstable" + " in cases where the numerical integration gives a negative value." + " Typically it is a small negative value but is obviously" + " physically impossible. In some cases we want to use the " + " solvers to handle general systems of equations (not purely " + " chemical ones), so we have this flag to allow it.", + &Stoich::setAllowNegative, + &Stoich::getAllowNegative + ); + static ReadOnlyValueFinfo< Stoich, unsigned int > numVarPools( "numVarPools", "Number of time-varying pools to be computed by the " @@ -220,6 +233,7 @@ const Cinfo* Stoich::initCinfo() &ksolve, // Value &dsolve, // Value &compartment, // Value + &allowNegative, // Value &numVarPools, // ReadOnlyValue &numBufPools, // ReadOnlyValue &numAllPools, // ReadOnlyValue @@ -258,7 +272,8 @@ static const Cinfo* stoichCinfo = Stoich::initCinfo(); Stoich::Stoich() : - useOneWay_( 0 ), + useOneWay_( false ), + allowNegative_( false ), path_( "" ), ksolve_(), // Must be reassigned to build stoich system. dsolve_(), // Must be assigned if diffusion is planned. @@ -310,6 +325,16 @@ bool Stoich::getOneWay() const return useOneWay_; } +void Stoich::setAllowNegative( bool v ) +{ + allowNegative_ = v; +} + +bool Stoich::getAllowNegative() const +{ + return allowNegative_; +} + void Stoich::setPath( const Eref& e, string v ) { if ( path_ != "" && path_ != v ) @@ -634,7 +659,7 @@ const FuncTerm* Stoich::funcs( unsigned int i ) const bool Stoich::isFuncTarget( unsigned int poolIndex ) const { assert( poolIndex < funcTarget_.size() ); - return ( funcTarget_[poolIndex] != ~0 ); + return ( funcTarget_[poolIndex] != ~0U ); } vector< int > Stoich::getMatrixEntry() const diff --git a/moose-core/ksolve/Stoich.h b/moose-core/ksolve/Stoich.h index 6dbe51de34bea6d86df19a2c32005ed2fd58b978..ea5177093e7b18a99f858df0614f3e270cf98986 100644 --- a/moose-core/ksolve/Stoich.h +++ b/moose-core/ksolve/Stoich.h @@ -59,6 +59,10 @@ class Stoich void setOneWay( bool v ); bool getOneWay() const; + // Flag that defines permission for pool values to go negative. + void setAllowNegative( bool v ); + bool getAllowNegative() const; + /// Returns number of local pools that are updated by solver unsigned int getNumVarPools() const; @@ -510,6 +514,15 @@ class Stoich * reactions, as is needed in the case of the Gillespie algorithm. */ bool useOneWay_; + + /** + * True if pools are permitted to take negative concentrations. + * This may happen if solver is handling a general equation system + * that is not constrained by chemical rules. + * Defaults to False, so that we cannot have negative concs. + */ + bool allowNegative_; + string path_; /// This contains the Id of the Kinetic solver. diff --git a/moose-core/ksolve/VoxelPools.cpp b/moose-core/ksolve/VoxelPools.cpp index c71dc797e5298022bf61a1d3ee99f37b494ff2e7..88405e72994e7f1196152349a8904d2adc13e391 100644 --- a/moose-core/ksolve/VoxelPools.cpp +++ b/moose-core/ksolve/VoxelPools.cpp @@ -215,6 +215,14 @@ void VoxelPools::advance( const ProcInfo* p ) , p->dt ); #endif + if ( !stoichPtr_->getAllowNegative() ) { // clean out negatives + unsigned int nv = stoichPtr_->getNumVarPools(); + double* vs = varS(); + for ( unsigned int i = 0; i < nv; ++i ) { + if ( signbit(vs[i]) ) + vs[i] = 0.0; + } + } } void VoxelPools::setInitDt( double dt ) diff --git a/moose-core/pymoose/CMakeLists.txt b/moose-core/pymoose/CMakeLists.txt index 7f08aab1c500d9c01f4417d9ba70d3169026568d..d7c5c3c93f13d06713473e8537397fb9ee64f888 100644 --- a/moose-core/pymoose/CMakeLists.txt +++ b/moose-core/pymoose/CMakeLists.txt @@ -96,9 +96,9 @@ add_dependencies(_moose copy_python_files) add_custom_command( TARGET _moose POST_BUILD COMMAND ${CMAKE_COMMAND} -E cmake_echo_color --cyan "MOOSE python extention is successfully built. Now " - " 1. Run 'make install' to install it single user. " + " 1. Run 'make install' to install it for single user. " " 2. Run 'sudo make install' to install it system-wide. " " " - " After installation, 'pip uninstall moose' will uninstall moose. " + "NOTE: Run 'pip uninstall moose' to uninstall moose." VERBATIM ) diff --git a/moose-core/python/moose/SBML/readSBML.py b/moose-core/python/moose/SBML/readSBML.py index 59caa670774be16183199448d7e61102754c3518..ff7b7dbc5d9bcefb3754ba172b17618f51ed396b 100644 --- a/moose-core/python/moose/SBML/readSBML.py +++ b/moose-core/python/moose/SBML/readSBML.py @@ -13,10 +13,12 @@ ** copyright (C) 2003-2017 Upinder S. Bhalla. and NCBS Created : Thu May 13 10:19:00 2016(+0530) Version -Last-Updated: Wed Oct 4 14:50:00 2017(+0530) - +Last-Updated: Sat Jan 6 1:21:00 2018(+0530) By:HarshaRani **********************************************************************/ +2018 +Jan6 : - only if valid model exists, then printing the no of compartment,pool,reaction etc + - at reaction level a check made to see if path exist while creating a new reaction 2017 Oct 4 : - loadpath is cleaned up Sep 13: - After EnzymaticReaction's k2 is set, explicity ratio is set to 4 to make sure it balance. @@ -75,6 +77,8 @@ except ImportError: pass def mooseReadSBML(filepath, loadpath, solver="ee"): + """Load SBML model + """ global foundLibSBML_ if not foundLibSBML_: print('No python-libsbml found.' @@ -106,33 +110,7 @@ def mooseReadSBML(filepath, loadpath, solver="ee"): print("No model present.") return moose.element('/') else: - print((" model: " + str(model))) - print(("functionDefinitions: " + - str(model.getNumFunctionDefinitions()))) - print((" unitDefinitions: " + - str(model.getNumUnitDefinitions()))) - print((" compartmentTypes: " + - str(model.getNumCompartmentTypes()))) - print((" specieTypes: " + - str(model.getNumSpeciesTypes()))) - print((" compartments: " + - str(model.getNumCompartments()))) - print((" species: " + - str(model.getNumSpecies()))) - print((" parameters: " + - str(model.getNumParameters()))) - print((" initialAssignments: " + - str(model.getNumInitialAssignments()))) - print((" rules: " + - str(model.getNumRules()))) - print((" constraints: " + - str(model.getNumConstraints()))) - print((" reactions: " + - str(model.getNumReactions()))) - print((" events: " + - str(model.getNumEvents()))) - print("\n") - + if (model.getNumCompartments() == 0): return moose.element('/'), "Atleast one compartment is needed" else: @@ -185,6 +163,32 @@ def mooseReadSBML(filepath, loadpath, solver="ee"): # as while reading in GUI the model will show up untill # built which is not correct print "Deleted rest of the # model" + print((" model: " + str(model))) + print(("functionDefinitions: " + + str(model.getNumFunctionDefinitions()))) + print((" unitDefinitions: " + + str(model.getNumUnitDefinitions()))) + print((" compartmentTypes: " + + str(model.getNumCompartmentTypes()))) + print((" specieTypes: " + + str(model.getNumSpeciesTypes()))) + print((" compartments: " + + str(model.getNumCompartments()))) + print((" species: " + + str(model.getNumSpecies()))) + print((" parameters: " + + str(model.getNumParameters()))) + print((" initialAssignments: " + + str(model.getNumInitialAssignments()))) + print((" rules: " + + str(model.getNumRules()))) + print((" constraints: " + + str(model.getNumConstraints()))) + print((" reactions: " + + str(model.getNumReactions()))) + print((" events: " + + str(model.getNumEvents()))) + print("\n") moose.delete(basePath) loadpath = moose.Shell('/') #return basePath, "" @@ -639,11 +643,14 @@ def createReaction(model, specInfoMap, modelAnnotaInfo, globparameterIdValue,fun sp = react.getSpecies() sp = str(idBeginWith(sp)) speCompt = specInfoMap[sp]["comptId"].path + if group: if moose.exists(speCompt+'/'+group): speCompt = speCompt+'/'+group else: speCompt = (moose.Neutral(speCompt+'/'+group)).path + if moose.exists(speCompt + '/' + rName): + rName =rId reaction_ = moose.Reac(speCompt + '/' + rName) reactionCreated = True reactSBMLIdMooseId[rName] = { @@ -847,16 +854,13 @@ def unitsforRates(model): def getMembers(node, ruleMemlist): msg = "" found = True - if node.getType() == libsbml.AST_LAMBDA: - #In lambda get Bvar values and getRighChild which will be kineticLaw - if node.getNumBvars() == 0: - print ("0") - return False - - for i in range (0,node.getNumBvars()): - ruleMemlist.append(node.getChild(i).getName()) - #funcD[funcName] = {"bvar" : bvar, "MathML":node.getRightChild()} + if node == None: + pass + elif node.getType() == libsbml.AST_POWER: + pass + elif node.getType() == libsbml.AST_FUNCTION: + #print " function" #funcName = node.getName() #funcValue = [] #functionfound = False @@ -868,8 +872,9 @@ def getMembers(node, ruleMemlist): #funcKL[node.getName()] = funcValue elif node.getType() == libsbml.AST_PLUS: + #print " plus ", node.getNumChildren() if node.getNumChildren() == 0: - print ("0") + #print ("0") return False getMembers(node.getChild(0), ruleMemlist) for i in range(1, node.getNumChildren()): @@ -880,11 +885,10 @@ def getMembers(node, ruleMemlist): pass elif node.getType() == libsbml.AST_NAME: # This will be the ci term" - ruleMemlist.append(node.getName()) elif node.getType() == libsbml.AST_MINUS: if node.getNumChildren() == 0: - print("0") + #print("0") return False else: lchild = node.getLeftChild() @@ -894,7 +898,7 @@ def getMembers(node, ruleMemlist): elif node.getType() == libsbml.AST_DIVIDE: if node.getNumChildren() == 0: - print("0") + #print("0") return False else: lchild = node.getLeftChild() @@ -904,7 +908,7 @@ def getMembers(node, ruleMemlist): elif node.getType() == libsbml.AST_TIMES: if node.getNumChildren() == 0: - print ("0") + #print ("0") return False getMembers(node.getChild(0), ruleMemlist) for i in range(1, node.getNumChildren()): @@ -912,13 +916,21 @@ def getMembers(node, ruleMemlist): getMembers(node.getChild(i), ruleMemlist) elif node.getType() == libsbml.AST_LAMBDA: + #In lambda get Bvar values and getRighChild which will be kineticLaw if node.getNumChildren() == 0: - print ("0") + #print ("0") + return False + if node.getNumBvars() == 0: + #print ("0") return False + ''' getMembers(node.getChild(0), ruleMemlist) for i in range(1, node.getNumChildren()): getMembers(node.getChild(i), ruleMemlist) - + ''' + for i in range (0,node.getNumBvars()): + ruleMemlist.append(node.getChild(i).getName()) + #funcD[funcName] = {"bvar" : bvar, "MathML":node.getRightChild()} elif node.getType() == libsbml.AST_FUNCTION_POWER: msg = msg + "\n moose is yet to handle \""+node.getName() + "\" operator" found = False diff --git a/moose-core/python/moose/SBML/validation.py b/moose-core/python/moose/SBML/validation.py index ee2b2cae90c9a239784e17710def616bdf826bc8..e9670fa175949a8cb00b747ebad0e010cf03b3c8 100644 --- a/moose-core/python/moose/SBML/validation.py +++ b/moose-core/python/moose/SBML/validation.py @@ -113,4 +113,4 @@ def validateModel(sbmlDoc): if __name__ == '__main__': sbmlDoc = libsbml.readSBML('00001-sbml-l3v1.xml') - validateModel(sbmlDoc) \ No newline at end of file + validateModel(sbmlDoc) diff --git a/moose-core/python/moose/SBML/writeSBML.py b/moose-core/python/moose/SBML/writeSBML.py index 99fb3f21e7b678197e8b5d20336d7b6ce78073c9..8491b46a8aba3bfb9b2359fddce84931da0c3e28 100644 --- a/moose-core/python/moose/SBML/writeSBML.py +++ b/moose-core/python/moose/SBML/writeSBML.py @@ -13,12 +13,16 @@ ** copyright (C) 2003-2017 Upinder S. Bhalla. and NCBS Created : Friday May 27 12:19:00 2016(+0530) Version -Last-Updated: Tue 8 Aug 11:10:00 2017(+0530) +Last-Updated: Sat 6 Jan 01:10:00 2018(+0530) By: HarshaRani **********************************************************************/ /**************************** - +2018 +Jan 6: for Product_formation_, k3 units depends on noofSub, prd was passed which is fixed 2017 +Dec 15: If model path exists is checked + Enz cplx is written only if enz,cplx,sub, prd exist, a clean check is made + Checked if function exist inputs and also if expr is exist, then written. Aug 8 : removed "findCompartment" function to chemConnectUtil and imported the function from the same file convertSpecialChar for setId and convertSpecialCharshot for setName. specialChar like /,\,[,],space are not allowed as moose doesn't take @@ -62,7 +66,6 @@ def mooseWriteSBML(modelpath, filename, sceneitems={}): filename = filenameExt[:filenameExt.find('.')] else: filename = filenameExt - # validatemodel sbmlOk = False global spe_constTrue @@ -71,7 +74,9 @@ def mooseWriteSBML(modelpath, filename, sceneitems={}): nameList_ = [] xcord,ycord = [],[] - if moose.exists(moose.element(modelpath).path): + if not moose.exists(modelpath): + return False, "Path doesn't exist" + elif moose.exists(modelpath): mObj = moose.wildcardFind(moose.element(modelpath).path+'/##[ISA=PoolBase]'+','+ moose.element(modelpath).path+'/##[ISA=ReacBase]'+','+ moose.element(modelpath).path+'/##[ISA=EnzBase]'+','+ @@ -81,7 +86,7 @@ def mooseWriteSBML(modelpath, filename, sceneitems={}): if moose.exists(p.path+'/info'): xcord.append(moose.element(p.path+'/info').x) ycord.append(moose.element(p.path+'/info').y) - recalculatecoordinates(mObj,xcord,ycord) + recalculatecoordinates(modelpath,mObj,xcord,ycord) positionInfoexist = False xmlns = SBMLNamespaces(3, 1) @@ -121,7 +126,6 @@ def mooseWriteSBML(modelpath, filename, sceneitems={}): cremodel_.setAnnotation(modelAnno) groupInfo = {} compartexist, groupInfo = writeCompt(modelpath, cremodel_) - if compartexist == True: species = writeSpecies( modelpath,cremodel_,sbmlDoc,sceneitems,groupInfo) if species: @@ -136,7 +140,10 @@ def mooseWriteSBML(modelpath, filename, sceneitems={}): name = str(idBeginWith(moose.element(key).name)) group.setId(name) group.setKind("collection") - ginfo = moose.element(key.path+'/info') + if moose.exists(key.path+'/info'): + ginfo = moose.element(key.path+'/info') + else: + moose.Annotator(key.path+'/info') groupCompartment = findCompartment(key) if ginfo.color != '': grpAnno = "<moose:GroupAnnotation>" @@ -215,12 +222,8 @@ def writeEnz(modelpath, cremodel_, sceneitems,groupInfo): enzGpnCorCol = enzGpnCorCol + "<moose:textColor>" + \ Anno.textColor + "</moose:textColor>\n" if (enz.className == "Enz" or enz.className == "ZombieEnz"): - enzyme = cremodel_.createReaction() - if notesE != "": - cleanNotesE = convertNotesSpecialChar(notesE) - notesStringE = "<body xmlns=\"http://www.w3.org/1999/xhtml\">\n \t \t" + \ - cleanNotesE + "\n\t </body>" - enzyme.setNotes(notesStringE) + # Enz cplx is written into 2 reaction S+E-> SE*, SE* -> E+P + foundEnzymeComplex = False comptVec = findCompartment(moose.element(enz)) if not isinstance(moose.element(comptVec), moose.ChemCompt): return -2 @@ -228,158 +231,187 @@ def writeEnz(modelpath, cremodel_, sceneitems,groupInfo): compt = comptVec.name + "_" + \ str(comptVec.getId().value) + "_" + \ str(comptVec.getDataIndex()) + "_" + + #Writting out S+E -> SE* enzsetId = str(idBeginWith(cleanEnzname + - "_" + - str(enz.getId().value) + - "_" + - str(enz.getDataIndex()) + - "_" + - "Complex_formation_")) - enzyme.setId(enzsetId) - - if groupName != moose.element('/'): - if groupName not in groupInfo: - groupInfo[groupName]=[enzsetId] - else: - groupInfo[groupName].append(enzsetId) - enzyme.setName(str(idBeginWith(convertSpecialCharshot(enz.name)))) - #enzyme.setName(cleanEnzname) - enzyme.setFast(False) - enzyme.setReversible(True) - k1 = enz.concK1 - k2 = enz.k2 - k3 = enz.k3 - enzAnno = " " - enzAnno = "<moose:EnzymaticReaction>\n" - + "_" + str(enz.getId().value) + + "_" + str(enz.getDataIndex()) + + "_" + "Complex_formation_")) + #Finding Enzyme parent (E), each enzyme should just have one parent, multiple parent not right! + secplxerror = "" + enzSubt = () enzOut = enz.neighbors["enzOut"] - if not enzOut: - print(" Enzyme parent missing for ", enz.name) + secplxerror = "enzyme parent missing " else: + enzAnno = "<moose:EnzymaticReaction>\n" listofname(enzOut, True) enzSubt = enzOut - for i in range(0, len(nameList_)): - enzAnno = enzAnno + "<moose:enzyme>" + \ - (str(idBeginWith(convertSpecialChar( - nameList_[i])))) + "</moose:enzyme>\n" - #noofSub,sRateLaw = getSubprd(cremodel_,True,"sub",enzSub) - # for i in range(0,len(nameList_)): - # enzAnno=enzAnno+"<moose:enzyme>"+nameList_[i]+"</moose:enzyme>\n" - #rec_order = noofSub - #rate_law = "k1"+"*"+sRateLaw - - enzSub = enz.neighbors["sub"] - if not enzSub: - print("Enzyme \"", enz.name, "\" substrate missing") - else: - listofname(enzSub, True) - enzSubt += enzSub - for i in range(0, len(nameList_)): - enzAnno = enzAnno + "<moose:substrates>" + \ - nameList_[i] + "</moose:substrates>\n" - if enzSubt: - rate_law = "k1" - noofSub, sRateLaw = getSubprd(cremodel_, True, "sub", enzSubt) - #rec_order = rec_order + noofSub - rec_order = noofSub - rate_law = compt + " * ( " + rate_law + " * " + sRateLaw - - enzPrd = enz.neighbors["cplxDest"] - if not enzPrd: - print("Enzyme \"", enz.name, "\"product missing") - else: - noofPrd, sRateLaw = getSubprd(cremodel_, True, "prd", enzPrd) - for i in range(0, len(nameList_)): - enzAnno = enzAnno + "<moose:product>" + \ - nameList_[i] + "</moose:product>\n" - rate_law = rate_law + " - " + " k2 " + ' * ' + sRateLaw +" )" - - prd_order = noofPrd - enzAnno = enzAnno + "<moose:groupName>" + cleanEnzname + "_" + \ + if len(nameList_) != 1: + secplxerror = secplxerror +" multiple enzyme parent present" + else: + for i in range(0, len(nameList_)): + enzAnno = enzAnno + "<moose:enzyme>" + \ + (str(idBeginWith(convertSpecialChar( + nameList_[i])))) + "</moose:enzyme>\n" + + #Finding Substrate, (S) + enzSub = enz.neighbors["sub"] + if not enzSub: + secplxerror = secplxerror + " substrate missing" + else: + listofname(enzSub, True) + enzSubt += enzSub + for i in range(0, len(nameList_)): + enzAnno = enzAnno + "<moose:substrates>" + \ + nameList_[i] + "</moose:substrates>\n" + + #Finding product, which in this case the cplx (SE*) + enzPrd = enz.neighbors["cplxDest"] + noofPrd = len(enzPrd) + if not enzPrd: + secplxerror = secplxerror + " enzymecplx missing which act as product " + else: + listofname(enzPrd, True) + for i in range(0, len(nameList_)): + enzAnno = enzAnno + "<moose:product>" + \ + nameList_[i] + "</moose:product>\n" + foundEnzymeComplex = True + + if foundEnzymeComplex: + # Only if S+E->SE* found, reaction is created + enzyme = cremodel_.createReaction() + if notesE != "": + cleanNotesE = convertNotesSpecialChar(notesE) + notesStringE = "<body xmlns=\"http://www.w3.org/1999/xhtml\">\n \t \t" + \ + cleanNotesE + "\n\t </body>" + enzyme.setNotes(notesStringE) + + enzyme.setId(enzsetId) + enzyme.setName(str(idBeginWith(convertSpecialCharshot(enz.name)))) + enzyme.setFast(False) + enzyme.setReversible(True) + k1 = enz.concK1 + k2 = enz.k2 + k3 = enz.k3 + + enzAnno = enzAnno + "<moose:groupName>" + cleanEnzname + "_" + \ str(enz.getId().value) + "_" + \ str(enz.getDataIndex()) + "_" + "</moose:groupName>\n" - enzAnno = enzAnno + "<moose:stage>1</moose:stage>\n" - if enzannoexist: - enzAnno = enzAnno + enzGpnCorCol - enzAnno = enzAnno + "</moose:EnzymaticReaction>" - enzyme.setAnnotation(enzAnno) - kl = enzyme.createKineticLaw() - kl.setFormula(rate_law) - kl.setNotes( - "<body xmlns=\"http://www.w3.org/1999/xhtml\">\n\t\t" + - rate_law + - "\n \t </body>") - punit = parmUnit(prd_order - 1, cremodel_) - printParameters(kl, "k2", k2, punit) + enzAnno = enzAnno + "<moose:stage>1</moose:stage>\n" + if enzannoexist: + enzAnno = enzAnno + enzGpnCorCol + enzAnno = enzAnno + "</moose:EnzymaticReaction>" + enzyme.setAnnotation(enzAnno) + if enzSubt: + rate_law = "k1" + noofSub, sRateLaw = getSubprd(cremodel_, True, "sub", enzSubt) + rate_law = compt + " * ( " + rate_law + " * " + sRateLaw + if enzPrd: + noofPrd, sRateLaw = getSubprd(cremodel_, True, "prd", enzPrd) + rate_law = rate_law + " - " + " k2 " + ' * ' + sRateLaw +" )" + kl = enzyme.createKineticLaw() + kl.setFormula(rate_law) + kl.setNotes("<body xmlns=\"http://www.w3.org/1999/xhtml\">\n\t\t" + \ + rate_law + "\n \t </body>") + unit = parmUnit(noofSub - 1, cremodel_) + printParameters(kl, "k1", k1, unit) + punit = parmUnit(noofPrd - 1, cremodel_) + printParameters(kl, "k2", k2, punit) - unit = parmUnit(rec_order - 1, cremodel_) - printParameters(kl, "k1", k1, unit) - enzyme = cremodel_.createReaction() + if groupName != moose.element('/'): + if groupName not in groupInfo: + groupInfo[groupName]=[enzsetId] + else: + groupInfo[groupName].append(enzsetId) + else: + if secplxerror: + print ("\'"+enz.name+"\' this enzyme is not written to file because,"+ secplxerror) + + #Here SE* -> E+ P + foundEnzymeEP = False enzsetIdP = str(idBeginWith(cleanEnzname + - "_" + - str(enz.getId().value) + - "_" + - str(enz.getDataIndex()) + - "_" + - "Product_formation_")) - enzyme.setId(enzsetIdP) - enzyme.setName(str(idBeginWith(convertSpecialCharshot(enz.name)))) - #enzyme.setName(cleanEnzname) - if groupName != moose.element('/'): - if groupName not in groupInfo: - groupInfo[groupName]=[enzsetIdP] - else: - groupInfo[groupName].append(enzsetIdP) - - enzyme.setFast(False) - enzyme.setReversible(False) - enzAnno2 = "<moose:EnzymaticReaction>" - - enzSub = enz.neighbors["cplxDest"] - if not enzSub: - print(" complex missing from ", enz.name) + "_" + str(enz.getId().value) + + "_" + str(enz.getDataIndex()) + + "_" + "Product_formation_")) + cplxeperror = "" + #enzSubt = "" + enzOut = enz.neighbors["enzOut"] + if not enzOut: + cplxepeerror = "enzyme parent missing " else: + enzAnno2 = "<moose:EnzymaticReaction>\n" + listofname(enzOut, True) + #enzSubt = enzOut + if len(nameList_) != 1: + cplxeperror = cplxeperror +" multiple enzyme parent present" + else: + # for i in range(0, len(nameList_)): + # enzEnz = "<moose:enzyme>" + \ + # (str(idBeginWith(convertSpecialChar( + # nameList_[i])))) + "</moose:enzyme>\n" + #Finding Substrate, which is (SE*) + enzSub = enz.neighbors["cplxDest"] + noofSub = len(enzSub) + listofname(enzSub, True) + if not enzSub: + cplxeperror = cplxeperror +"complex missing which act as substrate " + else: + for i in range(0, len(nameList_)): + enzAnno2 =enzAnno2 +"<moose:complex>" + \ + nameList_[i] + "</moose:complex>\n" + listofname(enzOut, True) + for i in range(0, len(nameList_)): + enzAnno2 = enzAnno2 +"<moose:enzyme>" + \ + (str(idBeginWith(convertSpecialChar( + nameList_[i])))) + "</moose:enzyme>\n" + + enzPrd = enz.neighbors["prd"] + noofPrd = len(enzPrd) + if not enzPrd: + cplxeperror = cplxeperror + "product missing " + else: + listofname(enzPrd,True) + for i in range(0, len(nameList_)): + enzAnno2 = enzAnno2 + "<moose:product>" + \ + nameList_[i] + "</moose:product>\n" + enzAnno2 += "<moose:groupName>" + cleanEnzname + "_" + \ + str(enz.getId().value) + "_" + \ + str(enz.getDataIndex()) + "_" + "</moose:groupName>\n" + enzAnno2 += "<moose:stage>2</moose:stage> \n" + if enzannoexist: + enzAnno2 = enzAnno2 + enzGpnCorCol + enzAnno2 += "</moose:EnzymaticReaction>" + + foundEnzymeEP = True + + if foundEnzymeEP: + enzyme = cremodel_.createReaction() + enzyme.setId(enzsetIdP) + enzyme.setName(str(idBeginWith(convertSpecialCharshot(enz.name)))) + enzyme.setFast(False) + enzyme.setReversible(False) + enzyme.setAnnotation(enzAnno2) noofSub, sRateLaw = getSubprd(cremodel_, True, "sub", enzSub) - for i in range(0, len(nameList_)): - enzAnno2 = enzAnno2 + "<moose:complex>" + \ - nameList_[i] + "</moose:complex>\n" - - enzEnz = enz.neighbors["enzOut"] - if not enzEnz: - print("Enzyme parent missing for ", enz.name) - else: - noofEnz, sRateLaw1 = getSubprd(cremodel_, True, "prd", enzEnz) - for i in range(0, len(nameList_)): - enzAnno2 = enzAnno2 + "<moose:enzyme>" + \ - nameList_[i] + "</moose:enzyme>\n" - enzPrd = enz.neighbors["prd"] - if enzPrd: - noofprd, sRateLaw2 = getSubprd(cremodel_, True, "prd", enzPrd) + enzprdt = () + enzPrdt = enzPrd+enzOut + noofprd, sRateLaw2 = getSubprd(cremodel_, True, "prd", enzPrdt) + enzrate_law = compt + " * k3" + '*' + sRateLaw + kl = enzyme.createKineticLaw() + kl.setFormula(enzrate_law) + kl.setNotes( + "<body xmlns=\"http://www.w3.org/1999/xhtml\">\n\t\t" + + enzrate_law + + "\n \t </body>") + unit = parmUnit(noofSub - 1, cremodel_) + printParameters(kl, "k3", k3, unit) + if groupName != moose.element('/'): + if groupName not in groupInfo: + groupInfo[groupName]=[enzsetIdP] + else: + groupInfo[groupName].append(enzsetIdP) else: - print("Enzyme \"", enz.name, "\" product missing") - for i in range(0, len(nameList_)): - enzAnno2 = enzAnno2 + "<moose:product>" + \ - nameList_[i] + "</moose:product>\n" - enzAnno2 += "<moose:groupName>" + cleanEnzname + "_" + \ - str(enz.getId().value) + "_" + \ - str(enz.getDataIndex()) + "_" + "</moose:groupName>\n" - enzAnno2 += "<moose:stage>2</moose:stage> \n" - if enzannoexist: - enzAnno2 = enzAnno2 + enzGpnCorCol - enzAnno2 += "</moose:EnzymaticReaction>" - enzyme.setAnnotation(enzAnno2) - - enzrate_law = compt + " * k3" + '*' + sRateLaw - kl = enzyme.createKineticLaw() - kl.setFormula(enzrate_law) - kl.setNotes( - "<body xmlns=\"http://www.w3.org/1999/xhtml\">\n\t\t" + - enzrate_law + - "\n \t </body>") - unit = parmUnit(noofPrd - 1, cremodel_) - printParameters(kl, "k3", k3, unit) - + print (cplxeperror) elif(enz.className == "MMenz" or enz.className == "ZombieMMenz"): enzSub = enz.neighbors["sub"] @@ -520,6 +552,7 @@ def Counter(items): return dict((i, items.count(i)) for i in items) def getSubprd(cremodel_, mobjEnz, type, neighborslist): + if type == "sub": reacSub = neighborslist reacSubCou = Counter(reacSub) @@ -563,6 +596,7 @@ def processRateLaw(objectCount, cremodel, noofObj, type, mobjEnz): clean_name = (str(idBeginWith(convertSpecialChar(nameIndex)))) if mobjEnz == True: nameList_.append(clean_name) + if type == "sub": sbmlRef = cremodel.createReactant() elif type == "prd": @@ -573,7 +607,6 @@ def processRateLaw(objectCount, cremodel, noofObj, type, mobjEnz): if type == "sub" or type == "prd": sbmlRef.setSpecies(clean_name) - sbmlRef.setStoichiometry(count) if clean_name in spe_constTrue: sbmlRef.setConstant(True) @@ -740,22 +773,25 @@ def writeReac(modelpath, cremodel_, sceneitems,reacGroup): def writeFunc(modelpath, cremodel_): funcs = moose.wildcardFind(modelpath + '/##[ISA=Function]') # if func: + foundFunc = False for func in funcs: if func: if func.parent.className == "CubeMesh" or func.parent.className == "CyclMesh": - funcEle = moose.element( - moose.element(func).neighbors["valueOut"][0]) - funcEle1 = moose.element(funcEle) - fName = idBeginWith(convertSpecialChar( + if len(moose.element(func).neighbors["valueOut"]) > 0: + funcEle = moose.element( + moose.element(func).neighbors["valueOut"][0]) + funcEle1 = moose.element(funcEle) + fName = idBeginWith(convertSpecialChar( funcEle.name + "_" + str(funcEle.getId().value) + "_" + str(funcEle.getDataIndex()) + "_")) - expr = moose.element(func).expr - + expr = " " + expr = str(moose.element(func).expr) + if not expr: + foundFunc = True else: + foundFunc = True fName = idBeginWith(convertSpecialChar(func.parent.name + - "_" + - str(func.parent.getId().value) + - "_" + - str(func.parent.getDataIndex()) + + "_" + str(func.parent.getId().value) + + "_" + str(func.parent.getDataIndex()) + "_")) item = func.path + '/x[0]' sumtot = moose.element(item).neighbors["input"] @@ -766,10 +802,10 @@ def writeFunc(modelpath, cremodel_): z = str(idBeginWith(str(convertSpecialChar(sumtot[i].name + "_" + str(moose.element( sumtot[i]).getId().value) + "_" + str(moose.element(sumtot[i]).getDataIndex())) + "_"))) expr = expr.replace(v, z) - - rule = cremodel_.createAssignmentRule() - rule.setVariable(fName) - rule.setFormula(expr) + if foundFunc: + rule = cremodel_.createAssignmentRule() + rule.setVariable(fName) + rule.setFormula(expr) def convertNotesSpecialChar(str1): d = {"&": "_and", "<": "_lessthan_", ">": "_greaterthan_", "BEL": "°"} @@ -1020,10 +1056,11 @@ def xyPosition(objInfo,xory): except ValueError: return (float(0)) -def recalculatecoordinates(mObjlist,xcord,ycord): +def recalculatecoordinates(modelpath, mObjlist,xcord,ycord): positionInfoExist = not(len(np.nonzero(xcord)[0]) == 0 \ and len(np.nonzero(ycord)[0]) == 0) - + defaultsceneWidth = 1000 + defaultsceneHeight = 800 if positionInfoExist: #Here all the object has been taken now recalculate and reassign back x and y co-ordinates xmin = min(xcord) @@ -1033,11 +1070,21 @@ def recalculatecoordinates(mObjlist,xcord,ycord): for merts in mObjlist: objInfo = merts.path+'/info' if moose.exists(objInfo): - Ix = (xyPosition(objInfo,'x')-xmin)/(xmax-xmin) - Iy = (ymin-xyPosition(objInfo,'y'))/(ymax-ymin) + Ix = defaultsceneWidth * ((xyPosition(objInfo,'x')-xmin)/(xmax-xmin)) + Iy = defaultsceneHeight * ((ymin-xyPosition(objInfo,'y'))/(ymax-ymin)) moose.element(objInfo).x = Ix moose.element(objInfo).y = Iy - + + else: + srcdesConnection = {} + setupItem(modelpath,srcdesConnection) + #print srcdesConnection + ''' + #meshEntry,xmin,xmax,ymin,ymax,positionInfoExist,sceneitems = setupMeshObj(modelpath) + #if not positionInfoExist: + #cmin,cmax,sceneitems = autoCoordinates(meshEntry,srcdesConnection) + sceneitems = autoCoordinates(meshEntry,srcdesConnection) + ''' def writeUnits(cremodel_): unitVol = cremodel_.createUnitDefinition() unitVol.setId("volume") diff --git a/moose-core/python/moose/chemUtil/chemConnectUtil.py b/moose-core/python/moose/chemUtil/chemConnectUtil.py index 48e06e9482e16c922f9124746ca189af27bbcfc0..f4cbccbc3e6228e6fd66177282ad52659b24e43d 100644 --- a/moose-core/python/moose/chemUtil/chemConnectUtil.py +++ b/moose-core/python/moose/chemUtil/chemConnectUtil.py @@ -207,4 +207,4 @@ def findCompartment(element): def mooseIsInstance(element, classNames): - return moose.element(element).__class__.__name__ in classNames \ No newline at end of file + return moose.element(element).__class__.__name__ in classNames diff --git a/moose-core/python/moose/moose.py b/moose-core/python/moose/moose.py index 7d045d3793fc3c711c75ad23224fda085f6dece3..416e2e5f44d3552f276ecc772bd1f082ddb46437 100644 --- a/moose-core/python/moose/moose.py +++ b/moose-core/python/moose/moose.py @@ -1,15 +1,17 @@ # -*- coding: utf-8 -*- -from __future__ import print_function, division, absolute_import # Author: Subhasis Ray # Maintainer: Dilawar Singh, Harsha Rani, Upi Bhalla +from __future__ import print_function, division, absolute_import + from contextlib import closing import warnings import pydoc from io import StringIO import moose +import moose.utils as mu sbmlImport_, sbmlError_ = True, '' @@ -20,6 +22,20 @@ except Exception as e: sbmlImport_ = False sbmlError_ = '%s' % e +# NeuroML2 import. +nml2Import_, nml2ImportError_ = True, '' +try: + import moose.neuroml2 as _neuroml2 +except Exception as e: + nml2Import_ = False + nml2ImportError_ = '\n'.join( [ + "NML2 support is disabled because `libneuroml` and " + , "`pyneuroml` modules are not found." + , " pip install pyneuroml libneuroml " + , " should fix it." + , " Actual error: %s " % e ] + ) + chemImport_, chemError_ = True, '' try: import moose.chemUtil as _chemUtil @@ -173,6 +189,24 @@ def mergeChemModel(src, des): else: return False +# NML2 reader and writer function. +def mooseReadNML2( modelpath ): + """Read NeuroML model (version 2). + + """ + global nml2Import_ + if nml2Import_: + reader = _neuroml2.NML2Reader( ) + reader.read( modelpath ) + return reader + else: + mu.info( nml2ImportError_ ) + mu.warn( "Could not load NML2 support. Doing nothing" ) + return False + +def mooseWriteNML2( outfile ): + mu.warn( "Writing to NML2 is not supported yet" ) + ################################################################ # Wrappers for global functions ################################################################ diff --git a/moose-core/python/moose/neuroml/NetworkML.py b/moose-core/python/moose/neuroml/NetworkML.py index f85a6f76eb1ad7961e6f11ced574de5fc4715a6f..b400ce23088f3d56ade2ff155f1490289422ab2a 100644 --- a/moose-core/python/moose/neuroml/NetworkML.py +++ b/moose-core/python/moose/neuroml/NetworkML.py @@ -378,7 +378,7 @@ class NetworkML(): else: if not moose.exists(pre_path+'/'+syn_name+'_spikegen'): ## create new spikegen - spikegen = moose.SpikeGen(pre_path+'/'+syn_name+'_spikegen') + spikegen = moose.element(pre_path+'/'+syn_name+'_spikegen') ## connect the compartment Vm to the spikegen moose.connect(precomp,"VmOut",spikegen,"Vm") ## spikegens for different synapse_types can have different thresholds diff --git a/moose-core/python/moose/neuroml/__init__.py b/moose-core/python/moose/neuroml/__init__.py index 9dd74d554fe8ddd44e289858656cc58ac637667c..88d032f0e48d7816c3dddf1d8b9c3e573db4028c 100644 --- a/moose-core/python/moose/neuroml/__init__.py +++ b/moose-core/python/moose/neuroml/__init__.py @@ -1,31 +1,10 @@ # -*- coding: utf-8 -*- + +from __future__ import absolute_import, division, print_function + +import moose.utils as mu + from .NeuroML import NeuroML, loadNeuroML_L123 from .NetworkML import NetworkML from .MorphML import MorphML from .ChannelML import ChannelML - -import tempfile -import logging - -debug_ = False - -if debug_: - logging.basicConfig(level=logging.DEBUG, - format='%(asctime)s %(name)-12s %(levelname)-8s %(message)s', - datefmt='%m-%d %H:%M', - filename='__moose.nml__.log' - ) -else: - logging.basicConfig(level=logging.WARN, - format='%(asctime)s %(name)-12s %(levelname)-8s %(message)s', - datefmt='%m-%d %H:%M' - ) - -# define a Handler which writes INFO messages or higher to the sys.stderr -console = logging.StreamHandler() -console.setLevel(logging.INFO) -formatter = logging.Formatter('%(name)-12s: %(levelname)-8s %(message)s') -console.setFormatter(formatter) -logging.getLogger('moose.nml').addHandler(console) -_logger = logging.getLogger('moose.nml') -_logger.debug("Loading NML library") diff --git a/moose-core/python/moose/neuroml2/__init__.py b/moose-core/python/moose/neuroml2/__init__.py index b7f2f2943bdac10c5f55e744f49e838c6807712b..92baa3ae349a463500b4ba4caa24f4368cad2026 100644 --- a/moose-core/python/moose/neuroml2/__init__.py +++ b/moose-core/python/moose/neuroml2/__init__.py @@ -57,11 +57,11 @@ available in converter.py. But the complete cell-model writing is not fully implemented. Hence this is not included in __all__. """ -__author__ = 'Subhasis Ray' -from reader import NML2Reader +from __future__ import absolute_import, division, print_function +import moose.utils as mu -__all__ = ['NML2Reader'] +__author__ = 'Subhasis Ray' +from .reader import NML2Reader -# # __init__.py ends here diff --git a/moose-core/python/moose/neuroml2/generated_neuroml.py b/moose-core/python/moose/neuroml2/generated_neuroml.py deleted file mode 100644 index a7f07c270c357d431a5982ccf69127b0dc06b18d..0000000000000000000000000000000000000000 --- a/moose-core/python/moose/neuroml2/generated_neuroml.py +++ /dev/null @@ -1,12732 +0,0 @@ -# -*- coding: utf-8 -*- - -# -*- coding: utf-8 -*- - -# -# Generated Sun Apr 17 15:01:27 2016 by generateDS.py version 2.22a. -# -# Command line options: -# ('-o', 'generated_neuroml.py') -# ('-s', 'generated_neuromlsub.py') -# -# Command line arguments: -# /home/subha/src/neuroml_dev/NeuroML2/Schemas/NeuroML2/NeuroML_v2beta.xsd -# -# Command line: -# /home/subha/.local/bin/generateDS.py -o "generated_neuroml.py" -s "generated_neuromlsub.py" /home/subha/src/neuroml_dev/NeuroML2/Schemas/NeuroML2/NeuroML_v2beta.xsd -# -# Current working directory (os.getcwd()): -# neuroml2 -# - -import sys -import re as re_ -import base64 -import datetime as datetime_ -import warnings as warnings_ -from lxml import etree as etree_ - - -Validate_simpletypes_ = True -if sys.version_info.major == 2: - BaseStrType_ = basestring -else: - BaseStrType_ = str - - -def parsexml_(infile, parser=None, **kwargs): - if parser is None: - # Use the lxml ElementTree compatible parser so that, e.g., - # we ignore comments. - parser = etree_.ETCompatXMLParser() - doc = etree_.parse(infile, parser=parser, **kwargs) - return doc - -# -# User methods -# -# Calls to the methods in these classes are generated by generateDS.py. -# You can replace these methods by re-implementing the following class -# in a module named generatedssuper.py. - -try: - from generatedssuper import GeneratedsSuper -except ImportError as exp: - - class GeneratedsSuper(object): - tzoff_pattern = re_.compile(r'(\+|-)((0\d|1[0-3]):[0-5]\d|14:00)$') - class _FixedOffsetTZ(datetime_.tzinfo): - def __init__(self, offset, name): - self.__offset = datetime_.timedelta(minutes=offset) - self.__name = name - def utcoffset(self, dt): - return self.__offset - def tzname(self, dt): - return self.__name - def dst(self, dt): - return None - def gds_format_string(self, input_data, input_name=''): - return input_data - def gds_validate_string(self, input_data, node=None, input_name=''): - if not input_data: - return '' - else: - return input_data - def gds_format_base64(self, input_data, input_name=''): - return base64.b64encode(input_data) - def gds_validate_base64(self, input_data, node=None, input_name=''): - return input_data - def gds_format_integer(self, input_data, input_name=''): - return '%d' % input_data - def gds_validate_integer(self, input_data, node=None, input_name=''): - return input_data - def gds_format_integer_list(self, input_data, input_name=''): - return '%s' % ' '.join(input_data) - def gds_validate_integer_list( - self, input_data, node=None, input_name=''): - values = input_data.split() - for value in values: - try: - int(value) - except (TypeError, ValueError): - raise_parse_error(node, 'Requires sequence of integers') - return values - def gds_format_float(self, input_data, input_name=''): - return ('%.15f' % input_data).rstrip('0') - def gds_validate_float(self, input_data, node=None, input_name=''): - return input_data - def gds_format_float_list(self, input_data, input_name=''): - return '%s' % ' '.join(input_data) - def gds_validate_float_list( - self, input_data, node=None, input_name=''): - values = input_data.split() - for value in values: - try: - float(value) - except (TypeError, ValueError): - raise_parse_error(node, 'Requires sequence of floats') - return values - def gds_format_double(self, input_data, input_name=''): - return '%e' % input_data - def gds_validate_double(self, input_data, node=None, input_name=''): - return input_data - def gds_format_double_list(self, input_data, input_name=''): - return '%s' % ' '.join(input_data) - def gds_validate_double_list( - self, input_data, node=None, input_name=''): - values = input_data.split() - for value in values: - try: - float(value) - except (TypeError, ValueError): - raise_parse_error(node, 'Requires sequence of doubles') - return values - def gds_format_boolean(self, input_data, input_name=''): - return ('%s' % input_data).lower() - def gds_validate_boolean(self, input_data, node=None, input_name=''): - return input_data - def gds_format_boolean_list(self, input_data, input_name=''): - return '%s' % ' '.join(input_data) - def gds_validate_boolean_list( - self, input_data, node=None, input_name=''): - values = input_data.split() - for value in values: - if value not in ('true', '1', 'false', '0', ): - raise_parse_error( - node, - 'Requires sequence of booleans ' - '("true", "1", "false", "0")') - return values - def gds_validate_datetime(self, input_data, node=None, input_name=''): - return input_data - def gds_format_datetime(self, input_data, input_name=''): - if input_data.microsecond == 0: - _svalue = '%04d-%02d-%02dT%02d:%02d:%02d' % ( - input_data.year, - input_data.month, - input_data.day, - input_data.hour, - input_data.minute, - input_data.second, - ) - else: - _svalue = '%04d-%02d-%02dT%02d:%02d:%02d.%s' % ( - input_data.year, - input_data.month, - input_data.day, - input_data.hour, - input_data.minute, - input_data.second, - ('%f' % (float(input_data.microsecond) / 1000000))[2:], - ) - if input_data.tzinfo is not None: - tzoff = input_data.tzinfo.utcoffset(input_data) - if tzoff is not None: - total_seconds = tzoff.seconds + (86400 * tzoff.days) - if total_seconds == 0: - _svalue += 'Z' - else: - if total_seconds < 0: - _svalue += '-' - total_seconds *= -1 - else: - _svalue += '+' - hours = total_seconds // 3600 - minutes = (total_seconds - (hours * 3600)) // 60 - _svalue += '{0:02d}:{1:02d}'.format(hours, minutes) - return _svalue - @classmethod - def gds_parse_datetime(cls, input_data): - tz = None - if input_data[-1] == 'Z': - tz = GeneratedsSuper._FixedOffsetTZ(0, 'UTC') - input_data = input_data[:-1] - else: - results = GeneratedsSuper.tzoff_pattern.search(input_data) - if results is not None: - tzoff_parts = results.group(2).split(':') - tzoff = int(tzoff_parts[0]) * 60 + int(tzoff_parts[1]) - if results.group(1) == '-': - tzoff *= -1 - tz = GeneratedsSuper._FixedOffsetTZ( - tzoff, results.group(0)) - input_data = input_data[:-6] - time_parts = input_data.split('.') - if len(time_parts) > 1: - micro_seconds = int(float('0.' + time_parts[1]) * 1000000) - input_data = '%s.%s' % (time_parts[0], micro_seconds, ) - dt = datetime_.datetime.strptime( - input_data, '%Y-%m-%dT%H:%M:%S.%f') - else: - dt = datetime_.datetime.strptime( - input_data, '%Y-%m-%dT%H:%M:%S') - dt = dt.replace(tzinfo=tz) - return dt - def gds_validate_date(self, input_data, node=None, input_name=''): - return input_data - def gds_format_date(self, input_data, input_name=''): - _svalue = '%04d-%02d-%02d' % ( - input_data.year, - input_data.month, - input_data.day, - ) - try: - if input_data.tzinfo is not None: - tzoff = input_data.tzinfo.utcoffset(input_data) - if tzoff is not None: - total_seconds = tzoff.seconds + (86400 * tzoff.days) - if total_seconds == 0: - _svalue += 'Z' - else: - if total_seconds < 0: - _svalue += '-' - total_seconds *= -1 - else: - _svalue += '+' - hours = total_seconds // 3600 - minutes = (total_seconds - (hours * 3600)) // 60 - _svalue += '{0:02d}:{1:02d}'.format( - hours, minutes) - except AttributeError: - pass - return _svalue - @classmethod - def gds_parse_date(cls, input_data): - tz = None - if input_data[-1] == 'Z': - tz = GeneratedsSuper._FixedOffsetTZ(0, 'UTC') - input_data = input_data[:-1] - else: - results = GeneratedsSuper.tzoff_pattern.search(input_data) - if results is not None: - tzoff_parts = results.group(2).split(':') - tzoff = int(tzoff_parts[0]) * 60 + int(tzoff_parts[1]) - if results.group(1) == '-': - tzoff *= -1 - tz = GeneratedsSuper._FixedOffsetTZ( - tzoff, results.group(0)) - input_data = input_data[:-6] - dt = datetime_.datetime.strptime(input_data, '%Y-%m-%d') - dt = dt.replace(tzinfo=tz) - return dt.date() - def gds_validate_time(self, input_data, node=None, input_name=''): - return input_data - def gds_format_time(self, input_data, input_name=''): - if input_data.microsecond == 0: - _svalue = '%02d:%02d:%02d' % ( - input_data.hour, - input_data.minute, - input_data.second, - ) - else: - _svalue = '%02d:%02d:%02d.%s' % ( - input_data.hour, - input_data.minute, - input_data.second, - ('%f' % (float(input_data.microsecond) / 1000000))[2:], - ) - if input_data.tzinfo is not None: - tzoff = input_data.tzinfo.utcoffset(input_data) - if tzoff is not None: - total_seconds = tzoff.seconds + (86400 * tzoff.days) - if total_seconds == 0: - _svalue += 'Z' - else: - if total_seconds < 0: - _svalue += '-' - total_seconds *= -1 - else: - _svalue += '+' - hours = total_seconds // 3600 - minutes = (total_seconds - (hours * 3600)) // 60 - _svalue += '{0:02d}:{1:02d}'.format(hours, minutes) - return _svalue - def gds_validate_simple_patterns(self, patterns, target): - # pat is a list of lists of strings/patterns. We should: - # - AND the outer elements - # - OR the inner elements - found1 = True - for patterns1 in patterns: - found2 = False - for patterns2 in patterns1: - if re_.search(patterns2, target) is not None: - found2 = True - break - if not found2: - found1 = False - break - return found1 - @classmethod - def gds_parse_time(cls, input_data): - tz = None - if input_data[-1] == 'Z': - tz = GeneratedsSuper._FixedOffsetTZ(0, 'UTC') - input_data = input_data[:-1] - else: - results = GeneratedsSuper.tzoff_pattern.search(input_data) - if results is not None: - tzoff_parts = results.group(2).split(':') - tzoff = int(tzoff_parts[0]) * 60 + int(tzoff_parts[1]) - if results.group(1) == '-': - tzoff *= -1 - tz = GeneratedsSuper._FixedOffsetTZ( - tzoff, results.group(0)) - input_data = input_data[:-6] - if len(input_data.split('.')) > 1: - dt = datetime_.datetime.strptime(input_data, '%H:%M:%S.%f') - else: - dt = datetime_.datetime.strptime(input_data, '%H:%M:%S') - dt = dt.replace(tzinfo=tz) - return dt.time() - def gds_str_lower(self, instring): - return instring.lower() - def get_path_(self, node): - path_list = [] - self.get_path_list_(node, path_list) - path_list.reverse() - path = '/'.join(path_list) - return path - Tag_strip_pattern_ = re_.compile(r'\{.*\}') - def get_path_list_(self, node, path_list): - if node is None: - return - tag = GeneratedsSuper.Tag_strip_pattern_.sub('', node.tag) - if tag: - path_list.append(tag) - self.get_path_list_(node.getparent(), path_list) - def get_class_obj_(self, node, default_class=None): - class_obj1 = default_class - if 'xsi' in node.nsmap: - classname = node.get('{%s}type' % node.nsmap['xsi']) - if classname is not None: - names = classname.split(':') - if len(names) == 2: - classname = names[1] - class_obj2 = globals().get(classname) - if class_obj2 is not None: - class_obj1 = class_obj2 - return class_obj1 - def gds_build_any(self, node, type_name=None): - return None - @classmethod - def gds_reverse_node_mapping(cls, mapping): - return dict(((v, k) for k, v in mapping.iteritems())) - @staticmethod - def gds_encode(instring): - if sys.version_info.major == 2: - return instring.encode(ExternalEncoding) - else: - return instring - - def getSubclassFromModule_(module, class_): - '''Get the subclass of a class from a specific module.''' - name = class_.__name__ + 'Sub' - if hasattr(module, name): - return getattr(module, name) - else: - return None - - -# -# If you have installed IPython you can uncomment and use the following. -# IPython is available from http://ipython.scipy.org/. -# - -## from IPython.Shell import IPShellEmbed -## args = '' -## ipshell = IPShellEmbed(args, -## banner = 'Dropping into IPython', -## exit_msg = 'Leaving Interpreter, back to program.') - -# Then use the following line where and when you want to drop into the -# IPython shell: -# ipshell('<some message> -- Entering ipshell.\nHit Ctrl-D to exit') - -# -# Globals -# - -ExternalEncoding = 'ascii' -Tag_pattern_ = re_.compile(r'({.*})?(.*)') -String_cleanup_pat_ = re_.compile(r"[\n\r\s]+") -Namespace_extract_pat_ = re_.compile(r'{(.*)}(.*)') -CDATA_pattern_ = re_.compile(r"<!\[CDATA\[.*?\]\]>", re_.DOTALL) - -# Change this to redirect the generated superclass module to use a -# specific subclass module. -CurrentSubclassModule_ = None - -# -# Support/utility functions. -# - - -def showIndent(outfile, level, pretty_print=True): - if pretty_print: - for idx in range(level): - outfile.write(' ') - - -def quote_xml(inStr): - "Escape markup chars, but do not modify CDATA sections." - if not inStr: - return '' - s1 = (isinstance(inStr, BaseStrType_) and inStr or '%s' % inStr) - s2 = '' - pos = 0 - matchobjects = CDATA_pattern_.finditer(s1) - for mo in matchobjects: - s3 = s1[pos:mo.start()] - s2 += quote_xml_aux(s3) - s2 += s1[mo.start():mo.end()] - pos = mo.end() - s3 = s1[pos:] - s2 += quote_xml_aux(s3) - return s2 - - -def quote_xml_aux(inStr): - s1 = inStr.replace('&', '&') - s1 = s1.replace('<', '<') - s1 = s1.replace('>', '>') - return s1 - - -def quote_attrib(inStr): - s1 = (isinstance(inStr, BaseStrType_) and inStr or '%s' % inStr) - s1 = s1.replace('&', '&') - s1 = s1.replace('<', '<') - s1 = s1.replace('>', '>') - if '"' in s1: - if "'" in s1: - s1 = '"%s"' % s1.replace('"', """) - else: - s1 = "'%s'" % s1 - else: - s1 = '"%s"' % s1 - return s1 - - -def quote_python(inStr): - s1 = inStr - if s1.find("'") == -1: - if s1.find('\n') == -1: - return "'%s'" % s1 - else: - return "'''%s'''" % s1 - else: - if s1.find('"') != -1: - s1 = s1.replace('"', '\\"') - if s1.find('\n') == -1: - return '"%s"' % s1 - else: - return '"""%s"""' % s1 - - -def get_all_text_(node): - if node.text is not None: - text = node.text - else: - text = '' - for child in node: - if child.tail is not None: - text += child.tail - return text - - -def find_attr_value_(attr_name, node): - attrs = node.attrib - attr_parts = attr_name.split(':') - value = None - if len(attr_parts) == 1: - value = attrs.get(attr_name) - elif len(attr_parts) == 2: - prefix, name = attr_parts - namespace = node.nsmap.get(prefix) - if namespace is not None: - value = attrs.get('{%s}%s' % (namespace, name, )) - return value - - -class GDSParseError(Exception): - pass - - -def raise_parse_error(node, msg): - msg = '%s (element %s/line %d)' % (msg, node.tag, node.sourceline, ) - raise GDSParseError(msg) - - -class MixedContainer: - # Constants for category: - CategoryNone = 0 - CategoryText = 1 - CategorySimple = 2 - CategoryComplex = 3 - # Constants for content_type: - TypeNone = 0 - TypeText = 1 - TypeString = 2 - TypeInteger = 3 - TypeFloat = 4 - TypeDecimal = 5 - TypeDouble = 6 - TypeBoolean = 7 - TypeBase64 = 8 - def __init__(self, category, content_type, name, value): - self.category = category - self.content_type = content_type - self.name = name - self.value = value - def getCategory(self): - return self.category - def getContenttype(self, content_type): - return self.content_type - def getValue(self): - return self.value - def getName(self): - return self.name - def export(self, outfile, level, name, namespace, pretty_print=True): - if self.category == MixedContainer.CategoryText: - # Prevent exporting empty content as empty lines. - if self.value.strip(): - outfile.write(self.value) - elif self.category == MixedContainer.CategorySimple: - self.exportSimple(outfile, level, name) - else: # category == MixedContainer.CategoryComplex - self.value.export(outfile, level, namespace, name, pretty_print) - def exportSimple(self, outfile, level, name): - if self.content_type == MixedContainer.TypeString: - outfile.write('<%s>%s</%s>' % ( - self.name, self.value, self.name)) - elif self.content_type == MixedContainer.TypeInteger or \ - self.content_type == MixedContainer.TypeBoolean: - outfile.write('<%s>%d</%s>' % ( - self.name, self.value, self.name)) - elif self.content_type == MixedContainer.TypeFloat or \ - self.content_type == MixedContainer.TypeDecimal: - outfile.write('<%s>%f</%s>' % ( - self.name, self.value, self.name)) - elif self.content_type == MixedContainer.TypeDouble: - outfile.write('<%s>%g</%s>' % ( - self.name, self.value, self.name)) - elif self.content_type == MixedContainer.TypeBase64: - outfile.write('<%s>%s</%s>' % ( - self.name, base64.b64encode(self.value), self.name)) - def to_etree(self, element): - if self.category == MixedContainer.CategoryText: - # Prevent exporting empty content as empty lines. - if self.value.strip(): - if len(element) > 0: - if element[-1].tail is None: - element[-1].tail = self.value - else: - element[-1].tail += self.value - else: - if element.text is None: - element.text = self.value - else: - element.text += self.value - elif self.category == MixedContainer.CategorySimple: - subelement = etree_.SubElement(element, '%s' % self.name) - subelement.text = self.to_etree_simple() - else: # category == MixedContainer.CategoryComplex - self.value.to_etree(element) - def to_etree_simple(self): - if self.content_type == MixedContainer.TypeString: - text = self.value - elif (self.content_type == MixedContainer.TypeInteger or - self.content_type == MixedContainer.TypeBoolean): - text = '%d' % self.value - elif (self.content_type == MixedContainer.TypeFloat or - self.content_type == MixedContainer.TypeDecimal): - text = '%f' % self.value - elif self.content_type == MixedContainer.TypeDouble: - text = '%g' % self.value - elif self.content_type == MixedContainer.TypeBase64: - text = '%s' % base64.b64encode(self.value) - return text - def exportLiteral(self, outfile, level, name): - if self.category == MixedContainer.CategoryText: - showIndent(outfile, level) - outfile.write( - 'model_.MixedContainer(%d, %d, "%s", "%s"),\n' % ( - self.category, self.content_type, self.name, self.value)) - elif self.category == MixedContainer.CategorySimple: - showIndent(outfile, level) - outfile.write( - 'model_.MixedContainer(%d, %d, "%s", "%s"),\n' % ( - self.category, self.content_type, self.name, self.value)) - else: # category == MixedContainer.CategoryComplex - showIndent(outfile, level) - outfile.write( - 'model_.MixedContainer(%d, %d, "%s",\n' % ( - self.category, self.content_type, self.name,)) - self.value.exportLiteral(outfile, level + 1) - showIndent(outfile, level) - outfile.write(')\n') - - -class MemberSpec_(object): - def __init__(self, name='', data_type='', container=0): - self.name = name - self.data_type = data_type - self.container = container - def set_name(self, name): self.name = name - def get_name(self): return self.name - def set_data_type(self, data_type): self.data_type = data_type - def get_data_type_chain(self): return self.data_type - def get_data_type(self): - if isinstance(self.data_type, list): - if len(self.data_type) > 0: - return self.data_type[-1] - else: - return 'xs:string' - else: - return self.data_type - def set_container(self, container): self.container = container - def get_container(self): return self.container - - -def _cast(typ, value): - if typ is None or value is None: - return value - return typ(value) - -# -# Data representation classes. -# - - -class Annotation(GeneratedsSuper): - """Placeholder for MIRIAM related metadata, among others.""" - subclass = None - superclass = None - def __init__(self, anytypeobjs_=None): - self.original_tagname_ = None - if anytypeobjs_ is None: - self.anytypeobjs_ = [] - else: - self.anytypeobjs_ = anytypeobjs_ - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, Annotation) - if subclass is not None: - return subclass(*args_, **kwargs_) - if Annotation.subclass: - return Annotation.subclass(*args_, **kwargs_) - else: - return Annotation(*args_, **kwargs_) - factory = staticmethod(factory) - def get_anytypeobjs_(self): return self.anytypeobjs_ - def set_anytypeobjs_(self, anytypeobjs_): self.anytypeobjs_ = anytypeobjs_ - def add_anytypeobjs_(self, value): self.anytypeobjs_.append(value) - def insert_anytypeobjs_(self, index, value): self._anytypeobjs_[index] = value - def hasContent_(self): - if ( - self.anytypeobjs_ - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='Annotation', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='Annotation') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='Annotation', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='Annotation'): - pass - def exportChildren(self, outfile, level, namespace_='', name_='Annotation', fromsubclass_=False, pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - for obj_ in self.anytypeobjs_: - obj_.export(outfile, level, namespace_, pretty_print=pretty_print) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - pass - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - obj_ = self.gds_build_any(child_, 'Annotation') - if obj_ is not None: - self.add_anytypeobjs_(obj_) -# end class Annotation - - -class ComponentType(GeneratedsSuper): - """Contains an extension to NeuroML by creating custom LEMS - ComponentType.""" - subclass = None - superclass = None - def __init__(self, name=None, extends=None, description=None, anytypeobjs_=None): - self.original_tagname_ = None - self.name = _cast(None, name) - self.extends = _cast(None, extends) - self.description = _cast(None, description) - if anytypeobjs_ is None: - self.anytypeobjs_ = [] - else: - self.anytypeobjs_ = anytypeobjs_ - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, ComponentType) - if subclass is not None: - return subclass(*args_, **kwargs_) - if ComponentType.subclass: - return ComponentType.subclass(*args_, **kwargs_) - else: - return ComponentType(*args_, **kwargs_) - factory = staticmethod(factory) - def get_anytypeobjs_(self): return self.anytypeobjs_ - def set_anytypeobjs_(self, anytypeobjs_): self.anytypeobjs_ = anytypeobjs_ - def add_anytypeobjs_(self, value): self.anytypeobjs_.append(value) - def insert_anytypeobjs_(self, index, value): self._anytypeobjs_[index] = value - def get_name(self): return self.name - def set_name(self, name): self.name = name - def get_extends(self): return self.extends - def set_extends(self, extends): self.extends = extends - def get_description(self): return self.description - def set_description(self, description): self.description = description - def hasContent_(self): - if ( - self.anytypeobjs_ - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='ComponentType', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='ComponentType') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='ComponentType', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='ComponentType'): - if self.name is not None and 'name' not in already_processed: - already_processed.add('name') - outfile.write(' name=%s' % (self.gds_encode(self.gds_format_string(quote_attrib(self.name), input_name='name')), )) - if self.extends is not None and 'extends' not in already_processed: - already_processed.add('extends') - outfile.write(' extends=%s' % (self.gds_encode(self.gds_format_string(quote_attrib(self.extends), input_name='extends')), )) - if self.description is not None and 'description' not in already_processed: - already_processed.add('description') - outfile.write(' description=%s' % (self.gds_encode(self.gds_format_string(quote_attrib(self.description), input_name='description')), )) - def exportChildren(self, outfile, level, namespace_='', name_='ComponentType', fromsubclass_=False, pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - for obj_ in self.anytypeobjs_: - obj_.export(outfile, level, namespace_, pretty_print=pretty_print) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - value = find_attr_value_('name', node) - if value is not None and 'name' not in already_processed: - already_processed.add('name') - self.name = value - value = find_attr_value_('extends', node) - if value is not None and 'extends' not in already_processed: - already_processed.add('extends') - self.extends = value - value = find_attr_value_('description', node) - if value is not None and 'description' not in already_processed: - already_processed.add('description') - self.description = value - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - obj_ = self.gds_build_any(child_, 'ComponentType') - if obj_ is not None: - self.add_anytypeobjs_(obj_) -# end class ComponentType - - -class IncludeType(GeneratedsSuper): - subclass = None - superclass = None - def __init__(self, href=None, valueOf_=None, mixedclass_=None, content_=None): - self.original_tagname_ = None - self.href = _cast(None, href) - self.valueOf_ = valueOf_ - if mixedclass_ is None: - self.mixedclass_ = MixedContainer - else: - self.mixedclass_ = mixedclass_ - if content_ is None: - self.content_ = [] - else: - self.content_ = content_ - self.valueOf_ = valueOf_ - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, IncludeType) - if subclass is not None: - return subclass(*args_, **kwargs_) - if IncludeType.subclass: - return IncludeType.subclass(*args_, **kwargs_) - else: - return IncludeType(*args_, **kwargs_) - factory = staticmethod(factory) - def get_href(self): return self.href - def set_href(self, href): self.href = href - def get_valueOf_(self): return self.valueOf_ - def set_valueOf_(self, valueOf_): self.valueOf_ = valueOf_ - def hasContent_(self): - if ( - 1 if type(self.valueOf_) in [int,float] else self.valueOf_ - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='IncludeType', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='IncludeType') - outfile.write('>') - self.exportChildren(outfile, level + 1, namespace_, name_, pretty_print=pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='IncludeType'): - if self.href is not None and 'href' not in already_processed: - already_processed.add('href') - outfile.write(' href=%s' % (self.gds_encode(self.gds_format_string(quote_attrib(self.href), input_name='href')), )) - def exportChildren(self, outfile, level, namespace_='', name_='IncludeType', fromsubclass_=False, pretty_print=True): - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - self.valueOf_ = get_all_text_(node) - if node.text is not None: - obj_ = self.mixedclass_(MixedContainer.CategoryText, - MixedContainer.TypeNone, '', node.text) - self.content_.append(obj_) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - value = find_attr_value_('href', node) - if value is not None and 'href' not in already_processed: - already_processed.add('href') - self.href = value - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if not fromsubclass_ and child_.tail is not None: - obj_ = self.mixedclass_(MixedContainer.CategoryText, - MixedContainer.TypeNone, '', child_.tail) - self.content_.append(obj_) - pass -# end class IncludeType - - -class Q10Settings(GeneratedsSuper): - subclass = None - superclass = None - def __init__(self, type_=None, fixedQ10=None, q10Factor=None, experimentalTemp=None): - self.original_tagname_ = None - self.type_ = _cast(None, type_) - self.fixedQ10 = _cast(None, fixedQ10) - self.q10Factor = _cast(None, q10Factor) - self.experimentalTemp = _cast(None, experimentalTemp) - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, Q10Settings) - if subclass is not None: - return subclass(*args_, **kwargs_) - if Q10Settings.subclass: - return Q10Settings.subclass(*args_, **kwargs_) - else: - return Q10Settings(*args_, **kwargs_) - factory = staticmethod(factory) - def get_type(self): return self.type_ - def set_type(self, type_): self.type_ = type_ - def get_fixedQ10(self): return self.fixedQ10 - def set_fixedQ10(self, fixedQ10): self.fixedQ10 = fixedQ10 - def get_q10Factor(self): return self.q10Factor - def set_q10Factor(self, q10Factor): self.q10Factor = q10Factor - def get_experimentalTemp(self): return self.experimentalTemp - def set_experimentalTemp(self, experimentalTemp): self.experimentalTemp = experimentalTemp - def validate_NmlId(self, value): - # Validate type NmlId, a restriction on xs:string. - if value is not None and Validate_simpletypes_: - if not self.gds_validate_simple_patterns( - self.validate_NmlId_patterns_, value): - warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_NmlId_patterns_, )) - validate_NmlId_patterns_ = [['^[a-zA-Z0-9_]*$']] - def validate_Nml2Quantity_none(self, value): - # Validate type Nml2Quantity_none, a restriction on xs:string. - if value is not None and Validate_simpletypes_: - if not self.gds_validate_simple_patterns( - self.validate_Nml2Quantity_none_patterns_, value): - warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_Nml2Quantity_none_patterns_, )) - validate_Nml2Quantity_none_patterns_ = [['^-?([0-9]*(\\.[0-9]+)?)([eE]-?[0-9]+)?$']] - def validate_Nml2Quantity_temperature(self, value): - # Validate type Nml2Quantity_temperature, a restriction on xs:string. - if value is not None and Validate_simpletypes_: - if not self.gds_validate_simple_patterns( - self.validate_Nml2Quantity_temperature_patterns_, value): - warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_Nml2Quantity_temperature_patterns_, )) - validate_Nml2Quantity_temperature_patterns_ = [['^-?([0-9]*(\\.[0-9]+)?)([eE]-?[0-9]+)?[\\s]*(degC)$']] - def hasContent_(self): - if ( - - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='Q10Settings', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='Q10Settings') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='Q10Settings', pretty_print=pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='Q10Settings'): - if self.type_ is not None and 'type_' not in already_processed: - already_processed.add('type_') - outfile.write(' type=%s' % (quote_attrib(self.type_), )) - if self.fixedQ10 is not None and 'fixedQ10' not in already_processed: - already_processed.add('fixedQ10') - outfile.write(' fixedQ10=%s' % (quote_attrib(self.fixedQ10), )) - if self.q10Factor is not None and 'q10Factor' not in already_processed: - already_processed.add('q10Factor') - outfile.write(' q10Factor=%s' % (quote_attrib(self.q10Factor), )) - if self.experimentalTemp is not None and 'experimentalTemp' not in already_processed: - already_processed.add('experimentalTemp') - outfile.write(' experimentalTemp=%s' % (quote_attrib(self.experimentalTemp), )) - def exportChildren(self, outfile, level, namespace_='', name_='Q10Settings', fromsubclass_=False, pretty_print=True): - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - value = find_attr_value_('type', node) - if value is not None and 'type' not in already_processed: - already_processed.add('type') - self.type_ = value - self.validate_NmlId(self.type_) # validate type NmlId - value = find_attr_value_('fixedQ10', node) - if value is not None and 'fixedQ10' not in already_processed: - already_processed.add('fixedQ10') - self.fixedQ10 = value - self.validate_Nml2Quantity_none(self.fixedQ10) # validate type Nml2Quantity_none - value = find_attr_value_('q10Factor', node) - if value is not None and 'q10Factor' not in already_processed: - already_processed.add('q10Factor') - self.q10Factor = value - self.validate_Nml2Quantity_none(self.q10Factor) # validate type Nml2Quantity_none - value = find_attr_value_('experimentalTemp', node) - if value is not None and 'experimentalTemp' not in already_processed: - already_processed.add('experimentalTemp') - self.experimentalTemp = value - self.validate_Nml2Quantity_temperature(self.experimentalTemp) # validate type Nml2Quantity_temperature - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - pass -# end class Q10Settings - - -class HHRate(GeneratedsSuper): - subclass = None - superclass = None - def __init__(self, type_=None, rate=None, midpoint=None, scale=None): - self.original_tagname_ = None - self.type_ = _cast(None, type_) - self.rate = _cast(None, rate) - self.midpoint = _cast(None, midpoint) - self.scale = _cast(None, scale) - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, HHRate) - if subclass is not None: - return subclass(*args_, **kwargs_) - if HHRate.subclass: - return HHRate.subclass(*args_, **kwargs_) - else: - return HHRate(*args_, **kwargs_) - factory = staticmethod(factory) - def get_type(self): return self.type_ - def set_type(self, type_): self.type_ = type_ - def get_rate(self): return self.rate - def set_rate(self, rate): self.rate = rate - def get_midpoint(self): return self.midpoint - def set_midpoint(self, midpoint): self.midpoint = midpoint - def get_scale(self): return self.scale - def set_scale(self, scale): self.scale = scale - def validate_NmlId(self, value): - # Validate type NmlId, a restriction on xs:string. - if value is not None and Validate_simpletypes_: - if not self.gds_validate_simple_patterns( - self.validate_NmlId_patterns_, value): - warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_NmlId_patterns_, )) - validate_NmlId_patterns_ = [['^[a-zA-Z0-9_]*$']] - def validate_Nml2Quantity_pertime(self, value): - # Validate type Nml2Quantity_pertime, a restriction on xs:string. - if value is not None and Validate_simpletypes_: - if not self.gds_validate_simple_patterns( - self.validate_Nml2Quantity_pertime_patterns_, value): - warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_Nml2Quantity_pertime_patterns_, )) - validate_Nml2Quantity_pertime_patterns_ = [['^-?([0-9]*(\\.[0-9]+)?)([eE]-?[0-9]+)?[\\s]*(per_s|per_ms|Hz)$']] - def validate_Nml2Quantity_voltage(self, value): - # Validate type Nml2Quantity_voltage, a restriction on xs:string. - if value is not None and Validate_simpletypes_: - if not self.gds_validate_simple_patterns( - self.validate_Nml2Quantity_voltage_patterns_, value): - warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_Nml2Quantity_voltage_patterns_, )) - validate_Nml2Quantity_voltage_patterns_ = [['^-?([0-9]*(\\.[0-9]+)?)([eE]-?[0-9]+)?[\\s]*(V|mV)$']] - def hasContent_(self): - if ( - - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='HHRate', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='HHRate') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='HHRate', pretty_print=pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='HHRate'): - if self.type_ is not None and 'type_' not in already_processed: - already_processed.add('type_') - outfile.write(' type=%s' % (quote_attrib(self.type_), )) - if self.rate is not None and 'rate' not in already_processed: - already_processed.add('rate') - outfile.write(' rate=%s' % (quote_attrib(self.rate), )) - if self.midpoint is not None and 'midpoint' not in already_processed: - already_processed.add('midpoint') - outfile.write(' midpoint=%s' % (quote_attrib(self.midpoint), )) - if self.scale is not None and 'scale' not in already_processed: - already_processed.add('scale') - outfile.write(' scale=%s' % (quote_attrib(self.scale), )) - def exportChildren(self, outfile, level, namespace_='', name_='HHRate', fromsubclass_=False, pretty_print=True): - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - value = find_attr_value_('type', node) - if value is not None and 'type' not in already_processed: - already_processed.add('type') - self.type_ = value - self.validate_NmlId(self.type_) # validate type NmlId - value = find_attr_value_('rate', node) - if value is not None and 'rate' not in already_processed: - already_processed.add('rate') - self.rate = value - self.validate_Nml2Quantity_pertime(self.rate) # validate type Nml2Quantity_pertime - value = find_attr_value_('midpoint', node) - if value is not None and 'midpoint' not in already_processed: - already_processed.add('midpoint') - self.midpoint = value - self.validate_Nml2Quantity_voltage(self.midpoint) # validate type Nml2Quantity_voltage - value = find_attr_value_('scale', node) - if value is not None and 'scale' not in already_processed: - already_processed.add('scale') - self.scale = value - self.validate_Nml2Quantity_voltage(self.scale) # validate type Nml2Quantity_voltage - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - pass -# end class HHRate - - -class HHVariable(GeneratedsSuper): - subclass = None - superclass = None - def __init__(self, type_=None, rate=None, midpoint=None, scale=None): - self.original_tagname_ = None - self.type_ = _cast(None, type_) - self.rate = _cast(float, rate) - self.midpoint = _cast(None, midpoint) - self.scale = _cast(None, scale) - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, HHVariable) - if subclass is not None: - return subclass(*args_, **kwargs_) - if HHVariable.subclass: - return HHVariable.subclass(*args_, **kwargs_) - else: - return HHVariable(*args_, **kwargs_) - factory = staticmethod(factory) - def get_type(self): return self.type_ - def set_type(self, type_): self.type_ = type_ - def get_rate(self): return self.rate - def set_rate(self, rate): self.rate = rate - def get_midpoint(self): return self.midpoint - def set_midpoint(self, midpoint): self.midpoint = midpoint - def get_scale(self): return self.scale - def set_scale(self, scale): self.scale = scale - def validate_NmlId(self, value): - # Validate type NmlId, a restriction on xs:string. - if value is not None and Validate_simpletypes_: - if not self.gds_validate_simple_patterns( - self.validate_NmlId_patterns_, value): - warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_NmlId_patterns_, )) - validate_NmlId_patterns_ = [['^[a-zA-Z0-9_]*$']] - def validate_Nml2Quantity_voltage(self, value): - # Validate type Nml2Quantity_voltage, a restriction on xs:string. - if value is not None and Validate_simpletypes_: - if not self.gds_validate_simple_patterns( - self.validate_Nml2Quantity_voltage_patterns_, value): - warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_Nml2Quantity_voltage_patterns_, )) - validate_Nml2Quantity_voltage_patterns_ = [['^-?([0-9]*(\\.[0-9]+)?)([eE]-?[0-9]+)?[\\s]*(V|mV)$']] - def hasContent_(self): - if ( - - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='HHVariable', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='HHVariable') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='HHVariable', pretty_print=pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='HHVariable'): - if self.type_ is not None and 'type_' not in already_processed: - already_processed.add('type_') - outfile.write(' type=%s' % (quote_attrib(self.type_), )) - if self.rate is not None and 'rate' not in already_processed: - already_processed.add('rate') - outfile.write(' rate="%s"' % self.gds_format_float(self.rate, input_name='rate')) - if self.midpoint is not None and 'midpoint' not in already_processed: - already_processed.add('midpoint') - outfile.write(' midpoint=%s' % (quote_attrib(self.midpoint), )) - if self.scale is not None and 'scale' not in already_processed: - already_processed.add('scale') - outfile.write(' scale=%s' % (quote_attrib(self.scale), )) - def exportChildren(self, outfile, level, namespace_='', name_='HHVariable', fromsubclass_=False, pretty_print=True): - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - value = find_attr_value_('type', node) - if value is not None and 'type' not in already_processed: - already_processed.add('type') - self.type_ = value - self.validate_NmlId(self.type_) # validate type NmlId - value = find_attr_value_('rate', node) - if value is not None and 'rate' not in already_processed: - already_processed.add('rate') - try: - self.rate = float(value) - except ValueError as exp: - raise ValueError('Bad float/double attribute (rate): %s' % exp) - value = find_attr_value_('midpoint', node) - if value is not None and 'midpoint' not in already_processed: - already_processed.add('midpoint') - self.midpoint = value - self.validate_Nml2Quantity_voltage(self.midpoint) # validate type Nml2Quantity_voltage - value = find_attr_value_('scale', node) - if value is not None and 'scale' not in already_processed: - already_processed.add('scale') - self.scale = value - self.validate_Nml2Quantity_voltage(self.scale) # validate type Nml2Quantity_voltage - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - pass -# end class HHVariable - - -class HHTime(GeneratedsSuper): - subclass = None - superclass = None - def __init__(self, type_=None, rate=None, midpoint=None, scale=None, tau=None): - self.original_tagname_ = None - self.type_ = _cast(None, type_) - self.rate = _cast(None, rate) - self.midpoint = _cast(None, midpoint) - self.scale = _cast(None, scale) - self.tau = _cast(None, tau) - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, HHTime) - if subclass is not None: - return subclass(*args_, **kwargs_) - if HHTime.subclass: - return HHTime.subclass(*args_, **kwargs_) - else: - return HHTime(*args_, **kwargs_) - factory = staticmethod(factory) - def get_type(self): return self.type_ - def set_type(self, type_): self.type_ = type_ - def get_rate(self): return self.rate - def set_rate(self, rate): self.rate = rate - def get_midpoint(self): return self.midpoint - def set_midpoint(self, midpoint): self.midpoint = midpoint - def get_scale(self): return self.scale - def set_scale(self, scale): self.scale = scale - def get_tau(self): return self.tau - def set_tau(self, tau): self.tau = tau - def validate_NmlId(self, value): - # Validate type NmlId, a restriction on xs:string. - if value is not None and Validate_simpletypes_: - if not self.gds_validate_simple_patterns( - self.validate_NmlId_patterns_, value): - warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_NmlId_patterns_, )) - validate_NmlId_patterns_ = [['^[a-zA-Z0-9_]*$']] - def validate_Nml2Quantity_time(self, value): - # Validate type Nml2Quantity_time, a restriction on xs:string. - if value is not None and Validate_simpletypes_: - if not self.gds_validate_simple_patterns( - self.validate_Nml2Quantity_time_patterns_, value): - warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_Nml2Quantity_time_patterns_, )) - validate_Nml2Quantity_time_patterns_ = [['^-?([0-9]*(\\.[0-9]+)?)([eE]-?[0-9]+)?[\\s]*(s|ms)$']] - def validate_Nml2Quantity_voltage(self, value): - # Validate type Nml2Quantity_voltage, a restriction on xs:string. - if value is not None and Validate_simpletypes_: - if not self.gds_validate_simple_patterns( - self.validate_Nml2Quantity_voltage_patterns_, value): - warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_Nml2Quantity_voltage_patterns_, )) - validate_Nml2Quantity_voltage_patterns_ = [['^-?([0-9]*(\\.[0-9]+)?)([eE]-?[0-9]+)?[\\s]*(V|mV)$']] - def hasContent_(self): - if ( - - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='HHTime', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='HHTime') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='HHTime', pretty_print=pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='HHTime'): - if self.type_ is not None and 'type_' not in already_processed: - already_processed.add('type_') - outfile.write(' type=%s' % (quote_attrib(self.type_), )) - if self.rate is not None and 'rate' not in already_processed: - already_processed.add('rate') - outfile.write(' rate=%s' % (quote_attrib(self.rate), )) - if self.midpoint is not None and 'midpoint' not in already_processed: - already_processed.add('midpoint') - outfile.write(' midpoint=%s' % (quote_attrib(self.midpoint), )) - if self.scale is not None and 'scale' not in already_processed: - already_processed.add('scale') - outfile.write(' scale=%s' % (quote_attrib(self.scale), )) - if self.tau is not None and 'tau' not in already_processed: - already_processed.add('tau') - outfile.write(' tau=%s' % (quote_attrib(self.tau), )) - def exportChildren(self, outfile, level, namespace_='', name_='HHTime', fromsubclass_=False, pretty_print=True): - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - value = find_attr_value_('type', node) - if value is not None and 'type' not in already_processed: - already_processed.add('type') - self.type_ = value - self.validate_NmlId(self.type_) # validate type NmlId - value = find_attr_value_('rate', node) - if value is not None and 'rate' not in already_processed: - already_processed.add('rate') - self.rate = value - self.validate_Nml2Quantity_time(self.rate) # validate type Nml2Quantity_time - value = find_attr_value_('midpoint', node) - if value is not None and 'midpoint' not in already_processed: - already_processed.add('midpoint') - self.midpoint = value - self.validate_Nml2Quantity_voltage(self.midpoint) # validate type Nml2Quantity_voltage - value = find_attr_value_('scale', node) - if value is not None and 'scale' not in already_processed: - already_processed.add('scale') - self.scale = value - self.validate_Nml2Quantity_voltage(self.scale) # validate type Nml2Quantity_voltage - value = find_attr_value_('tau', node) - if value is not None and 'tau' not in already_processed: - already_processed.add('tau') - self.tau = value - self.validate_Nml2Quantity_time(self.tau) # validate type Nml2Quantity_time - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - pass -# end class HHTime - - -class BlockMechanism(GeneratedsSuper): - subclass = None - superclass = None - def __init__(self, type_=None, species=None, blockConcentration=None, scalingConc=None, scalingVolt=None): - self.original_tagname_ = None - self.type_ = _cast(None, type_) - self.species = _cast(None, species) - self.blockConcentration = _cast(None, blockConcentration) - self.scalingConc = _cast(None, scalingConc) - self.scalingVolt = _cast(None, scalingVolt) - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, BlockMechanism) - if subclass is not None: - return subclass(*args_, **kwargs_) - if BlockMechanism.subclass: - return BlockMechanism.subclass(*args_, **kwargs_) - else: - return BlockMechanism(*args_, **kwargs_) - factory = staticmethod(factory) - def get_type(self): return self.type_ - def set_type(self, type_): self.type_ = type_ - def get_species(self): return self.species - def set_species(self, species): self.species = species - def get_blockConcentration(self): return self.blockConcentration - def set_blockConcentration(self, blockConcentration): self.blockConcentration = blockConcentration - def get_scalingConc(self): return self.scalingConc - def set_scalingConc(self, scalingConc): self.scalingConc = scalingConc - def get_scalingVolt(self): return self.scalingVolt - def set_scalingVolt(self, scalingVolt): self.scalingVolt = scalingVolt - def validate_BlockTypes(self, value): - # Validate type BlockTypes, a restriction on xs:string. - if value is not None and Validate_simpletypes_: - value = str(value) - enumerations = ['voltageConcDepBlockMechanism'] - enumeration_respectee = False - for enum in enumerations: - if value == enum: - enumeration_respectee = True - break - if not enumeration_respectee: - warnings_.warn('Value "%(value)s" does not match xsd enumeration restriction on BlockTypes' % {"value" : value.encode("utf-8")} ) - def validate_NmlId(self, value): - # Validate type NmlId, a restriction on xs:string. - if value is not None and Validate_simpletypes_: - if not self.gds_validate_simple_patterns( - self.validate_NmlId_patterns_, value): - warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_NmlId_patterns_, )) - validate_NmlId_patterns_ = [['^[a-zA-Z0-9_]*$']] - def validate_Nml2Quantity_concentration(self, value): - # Validate type Nml2Quantity_concentration, a restriction on xs:string. - if value is not None and Validate_simpletypes_: - if not self.gds_validate_simple_patterns( - self.validate_Nml2Quantity_concentration_patterns_, value): - warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_Nml2Quantity_concentration_patterns_, )) - validate_Nml2Quantity_concentration_patterns_ = [['^-?([0-9]*(\\.[0-9]+)?)([eE]-?[0-9]+)?[\\s]*(mol_per_m3|mol_per_cm3|M|mM)$']] - def validate_Nml2Quantity_voltage(self, value): - # Validate type Nml2Quantity_voltage, a restriction on xs:string. - if value is not None and Validate_simpletypes_: - if not self.gds_validate_simple_patterns( - self.validate_Nml2Quantity_voltage_patterns_, value): - warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_Nml2Quantity_voltage_patterns_, )) - validate_Nml2Quantity_voltage_patterns_ = [['^-?([0-9]*(\\.[0-9]+)?)([eE]-?[0-9]+)?[\\s]*(V|mV)$']] - def hasContent_(self): - if ( - - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='BlockMechanism', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='BlockMechanism') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='BlockMechanism', pretty_print=pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='BlockMechanism'): - if self.type_ is not None and 'type_' not in already_processed: - already_processed.add('type_') - outfile.write(' type=%s' % (quote_attrib(self.type_), )) - if self.species is not None and 'species' not in already_processed: - already_processed.add('species') - outfile.write(' species=%s' % (quote_attrib(self.species), )) - if self.blockConcentration is not None and 'blockConcentration' not in already_processed: - already_processed.add('blockConcentration') - outfile.write(' blockConcentration=%s' % (quote_attrib(self.blockConcentration), )) - if self.scalingConc is not None and 'scalingConc' not in already_processed: - already_processed.add('scalingConc') - outfile.write(' scalingConc=%s' % (quote_attrib(self.scalingConc), )) - if self.scalingVolt is not None and 'scalingVolt' not in already_processed: - already_processed.add('scalingVolt') - outfile.write(' scalingVolt=%s' % (quote_attrib(self.scalingVolt), )) - def exportChildren(self, outfile, level, namespace_='', name_='BlockMechanism', fromsubclass_=False, pretty_print=True): - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - value = find_attr_value_('type', node) - if value is not None and 'type' not in already_processed: - already_processed.add('type') - self.type_ = value - self.validate_BlockTypes(self.type_) # validate type BlockTypes - value = find_attr_value_('species', node) - if value is not None and 'species' not in already_processed: - already_processed.add('species') - self.species = value - self.validate_NmlId(self.species) # validate type NmlId - value = find_attr_value_('blockConcentration', node) - if value is not None and 'blockConcentration' not in already_processed: - already_processed.add('blockConcentration') - self.blockConcentration = value - self.validate_Nml2Quantity_concentration(self.blockConcentration) # validate type Nml2Quantity_concentration - value = find_attr_value_('scalingConc', node) - if value is not None and 'scalingConc' not in already_processed: - already_processed.add('scalingConc') - self.scalingConc = value - self.validate_Nml2Quantity_concentration(self.scalingConc) # validate type Nml2Quantity_concentration - value = find_attr_value_('scalingVolt', node) - if value is not None and 'scalingVolt' not in already_processed: - already_processed.add('scalingVolt') - self.scalingVolt = value - self.validate_Nml2Quantity_voltage(self.scalingVolt) # validate type Nml2Quantity_voltage - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - pass -# end class BlockMechanism - - -class PlasticityMechanism(GeneratedsSuper): - subclass = None - superclass = None - def __init__(self, type_=None, initReleaseProb=None, tauRec=None, tauFac=None): - self.original_tagname_ = None - self.type_ = _cast(None, type_) - self.initReleaseProb = _cast(None, initReleaseProb) - self.tauRec = _cast(None, tauRec) - self.tauFac = _cast(None, tauFac) - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, PlasticityMechanism) - if subclass is not None: - return subclass(*args_, **kwargs_) - if PlasticityMechanism.subclass: - return PlasticityMechanism.subclass(*args_, **kwargs_) - else: - return PlasticityMechanism(*args_, **kwargs_) - factory = staticmethod(factory) - def get_type(self): return self.type_ - def set_type(self, type_): self.type_ = type_ - def get_initReleaseProb(self): return self.initReleaseProb - def set_initReleaseProb(self, initReleaseProb): self.initReleaseProb = initReleaseProb - def get_tauRec(self): return self.tauRec - def set_tauRec(self, tauRec): self.tauRec = tauRec - def get_tauFac(self): return self.tauFac - def set_tauFac(self, tauFac): self.tauFac = tauFac - def validate_PlasticityTypes(self, value): - # Validate type PlasticityTypes, a restriction on xs:string. - if value is not None and Validate_simpletypes_: - value = str(value) - enumerations = ['tsodyksMarkramDepMechanism', 'tsodyksMarkramDepFacMechanism'] - enumeration_respectee = False - for enum in enumerations: - if value == enum: - enumeration_respectee = True - break - if not enumeration_respectee: - warnings_.warn('Value "%(value)s" does not match xsd enumeration restriction on PlasticityTypes' % {"value" : value.encode("utf-8")} ) - def validate_ZeroToOne(self, value): - # Validate type ZeroToOne, a restriction on xs:double. - if value is not None and Validate_simpletypes_: - if value < 0: - warnings_.warn('Value "%(value)s" does not match xsd minInclusive restriction on ZeroToOne' % {"value" : value} ) - if value > 1: - warnings_.warn('Value "%(value)s" does not match xsd maxInclusive restriction on ZeroToOne' % {"value" : value} ) - def validate_Nml2Quantity_time(self, value): - # Validate type Nml2Quantity_time, a restriction on xs:string. - if value is not None and Validate_simpletypes_: - if not self.gds_validate_simple_patterns( - self.validate_Nml2Quantity_time_patterns_, value): - warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_Nml2Quantity_time_patterns_, )) - validate_Nml2Quantity_time_patterns_ = [['^-?([0-9]*(\\.[0-9]+)?)([eE]-?[0-9]+)?[\\s]*(s|ms)$']] - def hasContent_(self): - if ( - - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='PlasticityMechanism', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='PlasticityMechanism') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='PlasticityMechanism', pretty_print=pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='PlasticityMechanism'): - if self.type_ is not None and 'type_' not in already_processed: - already_processed.add('type_') - outfile.write(' type=%s' % (quote_attrib(self.type_), )) - if self.initReleaseProb is not None and 'initReleaseProb' not in already_processed: - already_processed.add('initReleaseProb') - outfile.write(' initReleaseProb=%s' % (quote_attrib(self.initReleaseProb), )) - if self.tauRec is not None and 'tauRec' not in already_processed: - already_processed.add('tauRec') - outfile.write(' tauRec=%s' % (quote_attrib(self.tauRec), )) - if self.tauFac is not None and 'tauFac' not in already_processed: - already_processed.add('tauFac') - outfile.write(' tauFac=%s' % (quote_attrib(self.tauFac), )) - def exportChildren(self, outfile, level, namespace_='', name_='PlasticityMechanism', fromsubclass_=False, pretty_print=True): - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - value = find_attr_value_('type', node) - if value is not None and 'type' not in already_processed: - already_processed.add('type') - self.type_ = value - self.validate_PlasticityTypes(self.type_) # validate type PlasticityTypes - value = find_attr_value_('initReleaseProb', node) - if value is not None and 'initReleaseProb' not in already_processed: - already_processed.add('initReleaseProb') - try: - self.initReleaseProb = float(value) - except ValueError as exp: - raise ValueError('Bad float/double attribute (initReleaseProb): %s' % exp) - self.validate_ZeroToOne(self.initReleaseProb) # validate type ZeroToOne - value = find_attr_value_('tauRec', node) - if value is not None and 'tauRec' not in already_processed: - already_processed.add('tauRec') - self.tauRec = value - self.validate_Nml2Quantity_time(self.tauRec) # validate type Nml2Quantity_time - value = find_attr_value_('tauFac', node) - if value is not None and 'tauFac' not in already_processed: - already_processed.add('tauFac') - self.tauFac = value - self.validate_Nml2Quantity_time(self.tauFac) # validate type Nml2Quantity_time - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - pass -# end class PlasticityMechanism - - -class SegmentParent(GeneratedsSuper): - subclass = None - superclass = None - def __init__(self, segment=None, fractionAlong='1'): - self.original_tagname_ = None - self.segment = _cast(None, segment) - self.fractionAlong = _cast(None, fractionAlong) - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, SegmentParent) - if subclass is not None: - return subclass(*args_, **kwargs_) - if SegmentParent.subclass: - return SegmentParent.subclass(*args_, **kwargs_) - else: - return SegmentParent(*args_, **kwargs_) - factory = staticmethod(factory) - def get_segment(self): return self.segment - def set_segment(self, segment): self.segment = segment - def get_fractionAlong(self): return self.fractionAlong - def set_fractionAlong(self, fractionAlong): self.fractionAlong = fractionAlong - def validate_SegmentId(self, value): - # Validate type SegmentId, a restriction on xs:nonNegativeInteger. - if value is not None and Validate_simpletypes_: - pass - def validate_ZeroToOne(self, value): - # Validate type ZeroToOne, a restriction on xs:double. - if value is not None and Validate_simpletypes_: - if value < 0: - warnings_.warn('Value "%(value)s" does not match xsd minInclusive restriction on ZeroToOne' % {"value" : value} ) - if value > 1: - warnings_.warn('Value "%(value)s" does not match xsd maxInclusive restriction on ZeroToOne' % {"value" : value} ) - def hasContent_(self): - if ( - - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='SegmentParent', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='SegmentParent') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='SegmentParent', pretty_print=pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='SegmentParent'): - if self.segment is not None and 'segment' not in already_processed: - already_processed.add('segment') - outfile.write(' segment=%s' % (quote_attrib(self.segment), )) - if self.fractionAlong != 1 and 'fractionAlong' not in already_processed: - already_processed.add('fractionAlong') - outfile.write(' fractionAlong=%s' % (quote_attrib(self.fractionAlong), )) - def exportChildren(self, outfile, level, namespace_='', name_='SegmentParent', fromsubclass_=False, pretty_print=True): - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - value = find_attr_value_('segment', node) - if value is not None and 'segment' not in already_processed: - already_processed.add('segment') - try: - self.segment = int(value) - except ValueError as exp: - raise_parse_error(node, 'Bad integer attribute: %s' % exp) - if self.segment < 0: - raise_parse_error(node, 'Invalid NonNegativeInteger') - self.validate_SegmentId(self.segment) # validate type SegmentId - value = find_attr_value_('fractionAlong', node) - if value is not None and 'fractionAlong' not in already_processed: - already_processed.add('fractionAlong') - try: - self.fractionAlong = float(value) - except ValueError as exp: - raise ValueError('Bad float/double attribute (fractionAlong): %s' % exp) - self.validate_ZeroToOne(self.fractionAlong) # validate type ZeroToOne - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - pass -# end class SegmentParent - - -class Point3DWithDiam(GeneratedsSuper): - """A 3D point with diameter.""" - subclass = None - superclass = None - def __init__(self, x=None, y=None, z=None, diameter=None): - self.original_tagname_ = None - self.x = _cast(float, x) - self.y = _cast(float, y) - self.z = _cast(float, z) - self.diameter = _cast(float, diameter) - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, Point3DWithDiam) - if subclass is not None: - return subclass(*args_, **kwargs_) - if Point3DWithDiam.subclass: - return Point3DWithDiam.subclass(*args_, **kwargs_) - else: - return Point3DWithDiam(*args_, **kwargs_) - factory = staticmethod(factory) - def get_x(self): return self.x - def set_x(self, x): self.x = x - def get_y(self): return self.y - def set_y(self, y): self.y = y - def get_z(self): return self.z - def set_z(self, z): self.z = z - def get_diameter(self): return self.diameter - def set_diameter(self, diameter): self.diameter = diameter - def hasContent_(self): - if ( - - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='Point3DWithDiam', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='Point3DWithDiam') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='Point3DWithDiam', pretty_print=pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='Point3DWithDiam'): - if self.x is not None and 'x' not in already_processed: - already_processed.add('x') - outfile.write(' x="%s"' % self.gds_format_double(self.x, input_name='x')) - if self.y is not None and 'y' not in already_processed: - already_processed.add('y') - outfile.write(' y="%s"' % self.gds_format_double(self.y, input_name='y')) - if self.z is not None and 'z' not in already_processed: - already_processed.add('z') - outfile.write(' z="%s"' % self.gds_format_double(self.z, input_name='z')) - if self.diameter is not None and 'diameter' not in already_processed: - already_processed.add('diameter') - outfile.write(' diameter="%s"' % self.gds_format_double(self.diameter, input_name='diameter')) - def exportChildren(self, outfile, level, namespace_='', name_='Point3DWithDiam', fromsubclass_=False, pretty_print=True): - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - value = find_attr_value_('x', node) - if value is not None and 'x' not in already_processed: - already_processed.add('x') - try: - self.x = float(value) - except ValueError as exp: - raise ValueError('Bad float/double attribute (x): %s' % exp) - value = find_attr_value_('y', node) - if value is not None and 'y' not in already_processed: - already_processed.add('y') - try: - self.y = float(value) - except ValueError as exp: - raise ValueError('Bad float/double attribute (y): %s' % exp) - value = find_attr_value_('z', node) - if value is not None and 'z' not in already_processed: - already_processed.add('z') - try: - self.z = float(value) - except ValueError as exp: - raise ValueError('Bad float/double attribute (z): %s' % exp) - value = find_attr_value_('diameter', node) - if value is not None and 'diameter' not in already_processed: - already_processed.add('diameter') - try: - self.diameter = float(value) - except ValueError as exp: - raise ValueError('Bad float/double attribute (diameter): %s' % exp) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - pass -# end class Point3DWithDiam - - -class ProximalDetails(GeneratedsSuper): - subclass = None - superclass = None - def __init__(self, translationStart=None): - self.original_tagname_ = None - self.translationStart = _cast(float, translationStart) - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, ProximalDetails) - if subclass is not None: - return subclass(*args_, **kwargs_) - if ProximalDetails.subclass: - return ProximalDetails.subclass(*args_, **kwargs_) - else: - return ProximalDetails(*args_, **kwargs_) - factory = staticmethod(factory) - def get_translationStart(self): return self.translationStart - def set_translationStart(self, translationStart): self.translationStart = translationStart - def hasContent_(self): - if ( - - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='ProximalDetails', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='ProximalDetails') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='ProximalDetails', pretty_print=pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='ProximalDetails'): - if self.translationStart is not None and 'translationStart' not in already_processed: - already_processed.add('translationStart') - outfile.write(' translationStart="%s"' % self.gds_format_double(self.translationStart, input_name='translationStart')) - def exportChildren(self, outfile, level, namespace_='', name_='ProximalDetails', fromsubclass_=False, pretty_print=True): - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - value = find_attr_value_('translationStart', node) - if value is not None and 'translationStart' not in already_processed: - already_processed.add('translationStart') - try: - self.translationStart = float(value) - except ValueError as exp: - raise ValueError('Bad float/double attribute (translationStart): %s' % exp) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - pass -# end class ProximalDetails - - -class DistalDetails(GeneratedsSuper): - subclass = None - superclass = None - def __init__(self, normalizationEnd=None): - self.original_tagname_ = None - self.normalizationEnd = _cast(float, normalizationEnd) - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, DistalDetails) - if subclass is not None: - return subclass(*args_, **kwargs_) - if DistalDetails.subclass: - return DistalDetails.subclass(*args_, **kwargs_) - else: - return DistalDetails(*args_, **kwargs_) - factory = staticmethod(factory) - def get_normalizationEnd(self): return self.normalizationEnd - def set_normalizationEnd(self, normalizationEnd): self.normalizationEnd = normalizationEnd - def hasContent_(self): - if ( - - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='DistalDetails', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='DistalDetails') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='DistalDetails', pretty_print=pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='DistalDetails'): - if self.normalizationEnd is not None and 'normalizationEnd' not in already_processed: - already_processed.add('normalizationEnd') - outfile.write(' normalizationEnd="%s"' % self.gds_format_double(self.normalizationEnd, input_name='normalizationEnd')) - def exportChildren(self, outfile, level, namespace_='', name_='DistalDetails', fromsubclass_=False, pretty_print=True): - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - value = find_attr_value_('normalizationEnd', node) - if value is not None and 'normalizationEnd' not in already_processed: - already_processed.add('normalizationEnd') - try: - self.normalizationEnd = float(value) - except ValueError as exp: - raise ValueError('Bad float/double attribute (normalizationEnd): %s' % exp) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - pass -# end class DistalDetails - - -class Member(GeneratedsSuper): - subclass = None - superclass = None - def __init__(self, segment=None): - self.original_tagname_ = None - self.segment = _cast(None, segment) - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, Member) - if subclass is not None: - return subclass(*args_, **kwargs_) - if Member.subclass: - return Member.subclass(*args_, **kwargs_) - else: - return Member(*args_, **kwargs_) - factory = staticmethod(factory) - def get_segment(self): return self.segment - def set_segment(self, segment): self.segment = segment - def validate_SegmentId(self, value): - # Validate type SegmentId, a restriction on xs:nonNegativeInteger. - if value is not None and Validate_simpletypes_: - pass - def hasContent_(self): - if ( - - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='Member', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='Member') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='Member', pretty_print=pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='Member'): - if self.segment is not None and 'segment' not in already_processed: - already_processed.add('segment') - outfile.write(' segment=%s' % (quote_attrib(self.segment), )) - def exportChildren(self, outfile, level, namespace_='', name_='Member', fromsubclass_=False, pretty_print=True): - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - value = find_attr_value_('segment', node) - if value is not None and 'segment' not in already_processed: - already_processed.add('segment') - try: - self.segment = int(value) - except ValueError as exp: - raise_parse_error(node, 'Bad integer attribute: %s' % exp) - if self.segment < 0: - raise_parse_error(node, 'Invalid NonNegativeInteger') - self.validate_SegmentId(self.segment) # validate type SegmentId - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - pass -# end class Member - - -class Include(GeneratedsSuper): - subclass = None - superclass = None - def __init__(self, segmentGroup=None): - self.original_tagname_ = None - self.segmentGroup = _cast(None, segmentGroup) - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, Include) - if subclass is not None: - return subclass(*args_, **kwargs_) - if Include.subclass: - return Include.subclass(*args_, **kwargs_) - else: - return Include(*args_, **kwargs_) - factory = staticmethod(factory) - def get_segmentGroup(self): return self.segmentGroup - def set_segmentGroup(self, segmentGroup): self.segmentGroup = segmentGroup - def validate_NmlId(self, value): - # Validate type NmlId, a restriction on xs:string. - if value is not None and Validate_simpletypes_: - if not self.gds_validate_simple_patterns( - self.validate_NmlId_patterns_, value): - warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_NmlId_patterns_, )) - validate_NmlId_patterns_ = [['^[a-zA-Z0-9_]*$']] - def hasContent_(self): - if ( - - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='Include', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='Include') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='Include', pretty_print=pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='Include'): - if self.segmentGroup is not None and 'segmentGroup' not in already_processed: - already_processed.add('segmentGroup') - outfile.write(' segmentGroup=%s' % (quote_attrib(self.segmentGroup), )) - def exportChildren(self, outfile, level, namespace_='', name_='Include', fromsubclass_=False, pretty_print=True): - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - value = find_attr_value_('segmentGroup', node) - if value is not None and 'segmentGroup' not in already_processed: - already_processed.add('segmentGroup') - self.segmentGroup = value - self.validate_NmlId(self.segmentGroup) # validate type NmlId - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - pass -# end class Include - - -class Path(GeneratedsSuper): - subclass = None - superclass = None - def __init__(self, from_=None, to=None): - self.original_tagname_ = None - self.from_ = from_ - self.to = to - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, Path) - if subclass is not None: - return subclass(*args_, **kwargs_) - if Path.subclass: - return Path.subclass(*args_, **kwargs_) - else: - return Path(*args_, **kwargs_) - factory = staticmethod(factory) - def get_from(self): return self.from_ - def set_from(self, from_): self.from_ = from_ - def get_to(self): return self.to - def set_to(self, to): self.to = to - def hasContent_(self): - if ( - self.from_ is not None or - self.to is not None - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='Path', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='Path') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='Path', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='Path'): - pass - def exportChildren(self, outfile, level, namespace_='', name_='Path', fromsubclass_=False, pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.from_ is not None: - self.from_.export(outfile, level, namespace_, name_='from', pretty_print=pretty_print) - if self.to is not None: - self.to.export(outfile, level, namespace_, name_='to', pretty_print=pretty_print) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - pass - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'from': - obj_ = SegmentEndPoint.factory() - obj_.build(child_) - self.from_ = obj_ - obj_.original_tagname_ = 'from' - elif nodeName_ == 'to': - obj_ = SegmentEndPoint.factory() - obj_.build(child_) - self.to = obj_ - obj_.original_tagname_ = 'to' -# end class Path - - -class SubTree(GeneratedsSuper): - subclass = None - superclass = None - def __init__(self, from_=None, to=None): - self.original_tagname_ = None - self.from_ = from_ - self.to = to - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, SubTree) - if subclass is not None: - return subclass(*args_, **kwargs_) - if SubTree.subclass: - return SubTree.subclass(*args_, **kwargs_) - else: - return SubTree(*args_, **kwargs_) - factory = staticmethod(factory) - def get_from(self): return self.from_ - def set_from(self, from_): self.from_ = from_ - def get_to(self): return self.to - def set_to(self, to): self.to = to - def hasContent_(self): - if ( - self.from_ is not None or - self.to is not None - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='SubTree', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='SubTree') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='SubTree', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='SubTree'): - pass - def exportChildren(self, outfile, level, namespace_='', name_='SubTree', fromsubclass_=False, pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.from_ is not None: - self.from_.export(outfile, level, namespace_, name_='from', pretty_print=pretty_print) - if self.to is not None: - self.to.export(outfile, level, namespace_, name_='to', pretty_print=pretty_print) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - pass - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'from': - obj_ = SegmentEndPoint.factory() - obj_.build(child_) - self.from_ = obj_ - obj_.original_tagname_ = 'from' - elif nodeName_ == 'to': - obj_ = SegmentEndPoint.factory() - obj_.build(child_) - self.to = obj_ - obj_.original_tagname_ = 'to' -# end class SubTree - - -class SegmentEndPoint(GeneratedsSuper): - subclass = None - superclass = None - def __init__(self, segment=None): - self.original_tagname_ = None - self.segment = _cast(None, segment) - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, SegmentEndPoint) - if subclass is not None: - return subclass(*args_, **kwargs_) - if SegmentEndPoint.subclass: - return SegmentEndPoint.subclass(*args_, **kwargs_) - else: - return SegmentEndPoint(*args_, **kwargs_) - factory = staticmethod(factory) - def get_segment(self): return self.segment - def set_segment(self, segment): self.segment = segment - def validate_SegmentId(self, value): - # Validate type SegmentId, a restriction on xs:nonNegativeInteger. - if value is not None and Validate_simpletypes_: - pass - def hasContent_(self): - if ( - - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='SegmentEndPoint', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='SegmentEndPoint') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='SegmentEndPoint', pretty_print=pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='SegmentEndPoint'): - if self.segment is not None and 'segment' not in already_processed: - already_processed.add('segment') - outfile.write(' segment=%s' % (quote_attrib(self.segment), )) - def exportChildren(self, outfile, level, namespace_='', name_='SegmentEndPoint', fromsubclass_=False, pretty_print=True): - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - value = find_attr_value_('segment', node) - if value is not None and 'segment' not in already_processed: - already_processed.add('segment') - try: - self.segment = int(value) - except ValueError as exp: - raise_parse_error(node, 'Bad integer attribute: %s' % exp) - if self.segment < 0: - raise_parse_error(node, 'Invalid NonNegativeInteger') - self.validate_SegmentId(self.segment) # validate type SegmentId - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - pass -# end class SegmentEndPoint - - -class MembraneProperties(GeneratedsSuper): - subclass = None - superclass = None - def __init__(self, channelPopulation=None, channelDensity=None, spikeThresh=None, specificCapacitance=None, initMembPotential=None, reversalPotential=None): - self.original_tagname_ = None - if channelPopulation is None: - self.channelPopulation = [] - else: - self.channelPopulation = channelPopulation - if channelDensity is None: - self.channelDensity = [] - else: - self.channelDensity = channelDensity - if spikeThresh is None: - self.spikeThresh = [] - else: - self.spikeThresh = spikeThresh - if specificCapacitance is None: - self.specificCapacitance = [] - else: - self.specificCapacitance = specificCapacitance - if initMembPotential is None: - self.initMembPotential = [] - else: - self.initMembPotential = initMembPotential - if reversalPotential is None: - self.reversalPotential = [] - else: - self.reversalPotential = reversalPotential - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, MembraneProperties) - if subclass is not None: - return subclass(*args_, **kwargs_) - if MembraneProperties.subclass: - return MembraneProperties.subclass(*args_, **kwargs_) - else: - return MembraneProperties(*args_, **kwargs_) - factory = staticmethod(factory) - def get_channelPopulation(self): return self.channelPopulation - def set_channelPopulation(self, channelPopulation): self.channelPopulation = channelPopulation - def add_channelPopulation(self, value): self.channelPopulation.append(value) - def insert_channelPopulation_at(self, index, value): self.channelPopulation.insert(index, value) - def replace_channelPopulation_at(self, index, value): self.channelPopulation[index] = value - def get_channelDensity(self): return self.channelDensity - def set_channelDensity(self, channelDensity): self.channelDensity = channelDensity - def add_channelDensity(self, value): self.channelDensity.append(value) - def insert_channelDensity_at(self, index, value): self.channelDensity.insert(index, value) - def replace_channelDensity_at(self, index, value): self.channelDensity[index] = value - def get_spikeThresh(self): return self.spikeThresh - def set_spikeThresh(self, spikeThresh): self.spikeThresh = spikeThresh - def add_spikeThresh(self, value): self.spikeThresh.append(value) - def insert_spikeThresh_at(self, index, value): self.spikeThresh.insert(index, value) - def replace_spikeThresh_at(self, index, value): self.spikeThresh[index] = value - def get_specificCapacitance(self): return self.specificCapacitance - def set_specificCapacitance(self, specificCapacitance): self.specificCapacitance = specificCapacitance - def add_specificCapacitance(self, value): self.specificCapacitance.append(value) - def insert_specificCapacitance_at(self, index, value): self.specificCapacitance.insert(index, value) - def replace_specificCapacitance_at(self, index, value): self.specificCapacitance[index] = value - def get_initMembPotential(self): return self.initMembPotential - def set_initMembPotential(self, initMembPotential): self.initMembPotential = initMembPotential - def add_initMembPotential(self, value): self.initMembPotential.append(value) - def insert_initMembPotential_at(self, index, value): self.initMembPotential.insert(index, value) - def replace_initMembPotential_at(self, index, value): self.initMembPotential[index] = value - def get_reversalPotential(self): return self.reversalPotential - def set_reversalPotential(self, reversalPotential): self.reversalPotential = reversalPotential - def add_reversalPotential(self, value): self.reversalPotential.append(value) - def insert_reversalPotential_at(self, index, value): self.reversalPotential.insert(index, value) - def replace_reversalPotential_at(self, index, value): self.reversalPotential[index] = value - def hasContent_(self): - if ( - self.channelPopulation or - self.channelDensity or - self.spikeThresh or - self.specificCapacitance or - self.initMembPotential or - self.reversalPotential - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='MembraneProperties', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='MembraneProperties') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='MembraneProperties', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='MembraneProperties'): - pass - def exportChildren(self, outfile, level, namespace_='', name_='MembraneProperties', fromsubclass_=False, pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - for channelPopulation_ in self.channelPopulation: - channelPopulation_.export(outfile, level, namespace_, name_='channelPopulation', pretty_print=pretty_print) - for channelDensity_ in self.channelDensity: - channelDensity_.export(outfile, level, namespace_, name_='channelDensity', pretty_print=pretty_print) - for spikeThresh_ in self.spikeThresh: - spikeThresh_.export(outfile, level, namespace_, name_='spikeThresh', pretty_print=pretty_print) - for specificCapacitance_ in self.specificCapacitance: - specificCapacitance_.export(outfile, level, namespace_, name_='specificCapacitance', pretty_print=pretty_print) - for initMembPotential_ in self.initMembPotential: - initMembPotential_.export(outfile, level, namespace_, name_='initMembPotential', pretty_print=pretty_print) - for reversalPotential_ in self.reversalPotential: - reversalPotential_.export(outfile, level, namespace_, name_='reversalPotential', pretty_print=pretty_print) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - pass - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'channelPopulation': - obj_ = ChannelPopulation.factory() - obj_.build(child_) - self.channelPopulation.append(obj_) - obj_.original_tagname_ = 'channelPopulation' - elif nodeName_ == 'channelDensity': - obj_ = ChannelDensity.factory() - obj_.build(child_) - self.channelDensity.append(obj_) - obj_.original_tagname_ = 'channelDensity' - elif nodeName_ == 'spikeThresh': - class_obj_ = self.get_class_obj_(child_, ValueAcrossSegOrSegGroup) - obj_ = class_obj_.factory() - obj_.build(child_) - self.spikeThresh.append(obj_) - obj_.original_tagname_ = 'spikeThresh' - elif nodeName_ == 'specificCapacitance': - class_obj_ = self.get_class_obj_(child_, ValueAcrossSegOrSegGroup) - obj_ = class_obj_.factory() - obj_.build(child_) - self.specificCapacitance.append(obj_) - obj_.original_tagname_ = 'specificCapacitance' - elif nodeName_ == 'initMembPotential': - class_obj_ = self.get_class_obj_(child_, ValueAcrossSegOrSegGroup) - obj_ = class_obj_.factory() - obj_.build(child_) - self.initMembPotential.append(obj_) - obj_.original_tagname_ = 'initMembPotential' - elif nodeName_ == 'reversalPotential': - obj_ = ReversalPotential.factory() - obj_.build(child_) - self.reversalPotential.append(obj_) - obj_.original_tagname_ = 'reversalPotential' -# end class MembraneProperties - - -class ValueAcrossSegOrSegGroup(GeneratedsSuper): - subclass = None - superclass = None - def __init__(self, value=None, segmentGroup='all', segment=None, extensiontype_=None): - self.original_tagname_ = None - self.value = _cast(None, value) - self.segmentGroup = _cast(None, segmentGroup) - self.segment = _cast(None, segment) - self.extensiontype_ = extensiontype_ - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, ValueAcrossSegOrSegGroup) - if subclass is not None: - return subclass(*args_, **kwargs_) - if ValueAcrossSegOrSegGroup.subclass: - return ValueAcrossSegOrSegGroup.subclass(*args_, **kwargs_) - else: - return ValueAcrossSegOrSegGroup(*args_, **kwargs_) - factory = staticmethod(factory) - def get_value(self): return self.value - def set_value(self, value): self.value = value - def get_segmentGroup(self): return self.segmentGroup - def set_segmentGroup(self, segmentGroup): self.segmentGroup = segmentGroup - def get_segment(self): return self.segment - def set_segment(self, segment): self.segment = segment - def get_extensiontype_(self): return self.extensiontype_ - def set_extensiontype_(self, extensiontype_): self.extensiontype_ = extensiontype_ - def validate_Nml2Quantity(self, value): - # Validate type Nml2Quantity, a restriction on xs:string. - if value is not None and Validate_simpletypes_: - if not self.gds_validate_simple_patterns( - self.validate_Nml2Quantity_patterns_, value): - warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_Nml2Quantity_patterns_, )) - validate_Nml2Quantity_patterns_ = [['^-?([0-9]*(\\.[0-9]+)?)([eE]-?[0-9]+)?[\\s]*([_a-zA-Z0-9])*$']] - def validate_NmlId(self, value): - # Validate type NmlId, a restriction on xs:string. - if value is not None and Validate_simpletypes_: - if not self.gds_validate_simple_patterns( - self.validate_NmlId_patterns_, value): - warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_NmlId_patterns_, )) - validate_NmlId_patterns_ = [['^[a-zA-Z0-9_]*$']] - def hasContent_(self): - if ( - - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='ValueAcrossSegOrSegGroup', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='ValueAcrossSegOrSegGroup') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='ValueAcrossSegOrSegGroup', pretty_print=pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='ValueAcrossSegOrSegGroup'): - if self.value is not None and 'value' not in already_processed: - already_processed.add('value') - outfile.write(' value=%s' % (quote_attrib(self.value), )) - if self.segmentGroup != "all" and 'segmentGroup' not in already_processed: - already_processed.add('segmentGroup') - outfile.write(' segmentGroup=%s' % (quote_attrib(self.segmentGroup), )) - if self.segment is not None and 'segment' not in already_processed: - already_processed.add('segment') - outfile.write(' segment=%s' % (quote_attrib(self.segment), )) - if self.extensiontype_ is not None and 'xsi:type' not in already_processed: - already_processed.add('xsi:type') - outfile.write(' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"') - outfile.write(' xsi:type="%s"' % self.extensiontype_) - def exportChildren(self, outfile, level, namespace_='', name_='ValueAcrossSegOrSegGroup', fromsubclass_=False, pretty_print=True): - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - value = find_attr_value_('value', node) - if value is not None and 'value' not in already_processed: - already_processed.add('value') - self.value = value - self.validate_Nml2Quantity(self.value) # validate type Nml2Quantity - value = find_attr_value_('segmentGroup', node) - if value is not None and 'segmentGroup' not in already_processed: - already_processed.add('segmentGroup') - self.segmentGroup = value - self.validate_NmlId(self.segmentGroup) # validate type NmlId - value = find_attr_value_('segment', node) - if value is not None and 'segment' not in already_processed: - already_processed.add('segment') - self.segment = value - self.validate_NmlId(self.segment) # validate type NmlId - value = find_attr_value_('xsi:type', node) - if value is not None and 'xsi:type' not in already_processed: - already_processed.add('xsi:type') - self.extensiontype_ = value - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - pass -# end class ValueAcrossSegOrSegGroup - - -class VariableParameter(GeneratedsSuper): - subclass = None - superclass = None - def __init__(self, parameter=None, segmentGroup=None, inhomogeneousValue=None): - self.original_tagname_ = None - self.parameter = _cast(None, parameter) - self.segmentGroup = _cast(None, segmentGroup) - self.inhomogeneousValue = inhomogeneousValue - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, VariableParameter) - if subclass is not None: - return subclass(*args_, **kwargs_) - if VariableParameter.subclass: - return VariableParameter.subclass(*args_, **kwargs_) - else: - return VariableParameter(*args_, **kwargs_) - factory = staticmethod(factory) - def get_inhomogeneousValue(self): return self.inhomogeneousValue - def set_inhomogeneousValue(self, inhomogeneousValue): self.inhomogeneousValue = inhomogeneousValue - def get_parameter(self): return self.parameter - def set_parameter(self, parameter): self.parameter = parameter - def get_segmentGroup(self): return self.segmentGroup - def set_segmentGroup(self, segmentGroup): self.segmentGroup = segmentGroup - def hasContent_(self): - if ( - self.inhomogeneousValue is not None - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='VariableParameter', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='VariableParameter') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='VariableParameter', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='VariableParameter'): - if self.parameter is not None and 'parameter' not in already_processed: - already_processed.add('parameter') - outfile.write(' parameter=%s' % (self.gds_encode(self.gds_format_string(quote_attrib(self.parameter), input_name='parameter')), )) - if self.segmentGroup is not None and 'segmentGroup' not in already_processed: - already_processed.add('segmentGroup') - outfile.write(' segmentGroup=%s' % (self.gds_encode(self.gds_format_string(quote_attrib(self.segmentGroup), input_name='segmentGroup')), )) - def exportChildren(self, outfile, level, namespace_='', name_='VariableParameter', fromsubclass_=False, pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.inhomogeneousValue is not None: - self.inhomogeneousValue.export(outfile, level, namespace_, name_='inhomogeneousValue', pretty_print=pretty_print) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - value = find_attr_value_('parameter', node) - if value is not None and 'parameter' not in already_processed: - already_processed.add('parameter') - self.parameter = value - value = find_attr_value_('segmentGroup', node) - if value is not None and 'segmentGroup' not in already_processed: - already_processed.add('segmentGroup') - self.segmentGroup = value - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'inhomogeneousValue': - obj_ = InhomogeneousValue.factory() - obj_.build(child_) - self.inhomogeneousValue = obj_ - obj_.original_tagname_ = 'inhomogeneousValue' -# end class VariableParameter - - -class InhomogeneousValue(GeneratedsSuper): - subclass = None - superclass = None - def __init__(self, inhomogeneousParam=None, value=None): - self.original_tagname_ = None - self.inhomogeneousParam = _cast(None, inhomogeneousParam) - self.value = _cast(None, value) - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, InhomogeneousValue) - if subclass is not None: - return subclass(*args_, **kwargs_) - if InhomogeneousValue.subclass: - return InhomogeneousValue.subclass(*args_, **kwargs_) - else: - return InhomogeneousValue(*args_, **kwargs_) - factory = staticmethod(factory) - def get_inhomogeneousParam(self): return self.inhomogeneousParam - def set_inhomogeneousParam(self, inhomogeneousParam): self.inhomogeneousParam = inhomogeneousParam - def get_value(self): return self.value - def set_value(self, value): self.value = value - def hasContent_(self): - if ( - - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='InhomogeneousValue', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='InhomogeneousValue') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='InhomogeneousValue', pretty_print=pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='InhomogeneousValue'): - if self.inhomogeneousParam is not None and 'inhomogeneousParam' not in already_processed: - already_processed.add('inhomogeneousParam') - outfile.write(' inhomogeneousParam=%s' % (self.gds_encode(self.gds_format_string(quote_attrib(self.inhomogeneousParam), input_name='inhomogeneousParam')), )) - if self.value is not None and 'value' not in already_processed: - already_processed.add('value') - outfile.write(' value=%s' % (self.gds_encode(self.gds_format_string(quote_attrib(self.value), input_name='value')), )) - def exportChildren(self, outfile, level, namespace_='', name_='InhomogeneousValue', fromsubclass_=False, pretty_print=True): - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - value = find_attr_value_('inhomogeneousParam', node) - if value is not None and 'inhomogeneousParam' not in already_processed: - already_processed.add('inhomogeneousParam') - self.inhomogeneousParam = value - value = find_attr_value_('value', node) - if value is not None and 'value' not in already_processed: - already_processed.add('value') - self.value = value - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - pass -# end class InhomogeneousValue - - -class ReversalPotential(ValueAcrossSegOrSegGroup): - subclass = None - superclass = ValueAcrossSegOrSegGroup - def __init__(self, value=None, segmentGroup='all', segment=None, species=None): - self.original_tagname_ = None - super(ReversalPotential, self).__init__(value, segmentGroup, segment, ) - self.species = _cast(None, species) - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, ReversalPotential) - if subclass is not None: - return subclass(*args_, **kwargs_) - if ReversalPotential.subclass: - return ReversalPotential.subclass(*args_, **kwargs_) - else: - return ReversalPotential(*args_, **kwargs_) - factory = staticmethod(factory) - def get_species(self): return self.species - def set_species(self, species): self.species = species - def validate_NmlId(self, value): - # Validate type NmlId, a restriction on xs:string. - if value is not None and Validate_simpletypes_: - if not self.gds_validate_simple_patterns( - self.validate_NmlId_patterns_, value): - warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_NmlId_patterns_, )) - validate_NmlId_patterns_ = [['^[a-zA-Z0-9_]*$']] - def hasContent_(self): - if ( - super(ReversalPotential, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='ReversalPotential', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='ReversalPotential') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='ReversalPotential', pretty_print=pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='ReversalPotential'): - super(ReversalPotential, self).exportAttributes(outfile, level, already_processed, namespace_, name_='ReversalPotential') - if self.species is not None and 'species' not in already_processed: - already_processed.add('species') - outfile.write(' species=%s' % (quote_attrib(self.species), )) - def exportChildren(self, outfile, level, namespace_='', name_='ReversalPotential', fromsubclass_=False, pretty_print=True): - super(ReversalPotential, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - value = find_attr_value_('species', node) - if value is not None and 'species' not in already_processed: - already_processed.add('species') - self.species = value - self.validate_NmlId(self.species) # validate type NmlId - super(ReversalPotential, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(ReversalPotential, self).buildChildren(child_, node, nodeName_, True) - pass -# end class ReversalPotential - - -class Species(ValueAcrossSegOrSegGroup): - """Specifying the ion here again is redundant, the ion name should be - the same as id. Kept for now until LEMS implementation can - select by id. TODO: remove.""" - subclass = None - superclass = ValueAcrossSegOrSegGroup - def __init__(self, value=None, segmentGroup='all', segment=None, id=None, concentrationModel=None, ion=None, initialConcentration=None, initialExtConcentration=None): - self.original_tagname_ = None - super(Species, self).__init__(value, segmentGroup, segment, ) - self.id = _cast(None, id) - self.concentrationModel = _cast(None, concentrationModel) - self.ion = _cast(None, ion) - self.initialConcentration = _cast(None, initialConcentration) - self.initialExtConcentration = _cast(None, initialExtConcentration) - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, Species) - if subclass is not None: - return subclass(*args_, **kwargs_) - if Species.subclass: - return Species.subclass(*args_, **kwargs_) - else: - return Species(*args_, **kwargs_) - factory = staticmethod(factory) - def get_id(self): return self.id - def set_id(self, id): self.id = id - def get_concentrationModel(self): return self.concentrationModel - def set_concentrationModel(self, concentrationModel): self.concentrationModel = concentrationModel - def get_ion(self): return self.ion - def set_ion(self, ion): self.ion = ion - def get_initialConcentration(self): return self.initialConcentration - def set_initialConcentration(self, initialConcentration): self.initialConcentration = initialConcentration - def get_initialExtConcentration(self): return self.initialExtConcentration - def set_initialExtConcentration(self, initialExtConcentration): self.initialExtConcentration = initialExtConcentration - def validate_NmlId(self, value): - # Validate type NmlId, a restriction on xs:string. - if value is not None and Validate_simpletypes_: - if not self.gds_validate_simple_patterns( - self.validate_NmlId_patterns_, value): - warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_NmlId_patterns_, )) - validate_NmlId_patterns_ = [['^[a-zA-Z0-9_]*$']] - def validate_Nml2Quantity_concentration(self, value): - # Validate type Nml2Quantity_concentration, a restriction on xs:string. - if value is not None and Validate_simpletypes_: - if not self.gds_validate_simple_patterns( - self.validate_Nml2Quantity_concentration_patterns_, value): - warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_Nml2Quantity_concentration_patterns_, )) - validate_Nml2Quantity_concentration_patterns_ = [['^-?([0-9]*(\\.[0-9]+)?)([eE]-?[0-9]+)?[\\s]*(mol_per_m3|mol_per_cm3|M|mM)$']] - def hasContent_(self): - if ( - super(Species, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='Species', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='Species') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='Species', pretty_print=pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='Species'): - super(Species, self).exportAttributes(outfile, level, already_processed, namespace_, name_='Species') - if self.id is not None and 'id' not in already_processed: - already_processed.add('id') - outfile.write(' id=%s' % (quote_attrib(self.id), )) - if self.concentrationModel is not None and 'concentrationModel' not in already_processed: - already_processed.add('concentrationModel') - outfile.write(' concentrationModel=%s' % (quote_attrib(self.concentrationModel), )) - if self.ion is not None and 'ion' not in already_processed: - already_processed.add('ion') - outfile.write(' ion=%s' % (quote_attrib(self.ion), )) - if self.initialConcentration is not None and 'initialConcentration' not in already_processed: - already_processed.add('initialConcentration') - outfile.write(' initialConcentration=%s' % (quote_attrib(self.initialConcentration), )) - if self.initialExtConcentration is not None and 'initialExtConcentration' not in already_processed: - already_processed.add('initialExtConcentration') - outfile.write(' initialExtConcentration=%s' % (quote_attrib(self.initialExtConcentration), )) - def exportChildren(self, outfile, level, namespace_='', name_='Species', fromsubclass_=False, pretty_print=True): - super(Species, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - value = find_attr_value_('id', node) - if value is not None and 'id' not in already_processed: - already_processed.add('id') - self.id = value - self.validate_NmlId(self.id) # validate type NmlId - value = find_attr_value_('concentrationModel', node) - if value is not None and 'concentrationModel' not in already_processed: - already_processed.add('concentrationModel') - self.concentrationModel = value - self.validate_NmlId(self.concentrationModel) # validate type NmlId - value = find_attr_value_('ion', node) - if value is not None and 'ion' not in already_processed: - already_processed.add('ion') - self.ion = value - self.validate_NmlId(self.ion) # validate type NmlId - value = find_attr_value_('initialConcentration', node) - if value is not None and 'initialConcentration' not in already_processed: - already_processed.add('initialConcentration') - self.initialConcentration = value - self.validate_Nml2Quantity_concentration(self.initialConcentration) # validate type Nml2Quantity_concentration - value = find_attr_value_('initialExtConcentration', node) - if value is not None and 'initialExtConcentration' not in already_processed: - already_processed.add('initialExtConcentration') - self.initialExtConcentration = value - self.validate_Nml2Quantity_concentration(self.initialExtConcentration) # validate type Nml2Quantity_concentration - super(Species, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(Species, self).buildChildren(child_, node, nodeName_, True) - pass -# end class Species - - -class IntracellularProperties(GeneratedsSuper): - subclass = None - superclass = None - def __init__(self, species=None, resistivity=None): - self.original_tagname_ = None - if species is None: - self.species = [] - else: - self.species = species - if resistivity is None: - self.resistivity = [] - else: - self.resistivity = resistivity - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, IntracellularProperties) - if subclass is not None: - return subclass(*args_, **kwargs_) - if IntracellularProperties.subclass: - return IntracellularProperties.subclass(*args_, **kwargs_) - else: - return IntracellularProperties(*args_, **kwargs_) - factory = staticmethod(factory) - def get_species(self): return self.species - def set_species(self, species): self.species = species - def add_species(self, value): self.species.append(value) - def insert_species_at(self, index, value): self.species.insert(index, value) - def replace_species_at(self, index, value): self.species[index] = value - def get_resistivity(self): return self.resistivity - def set_resistivity(self, resistivity): self.resistivity = resistivity - def add_resistivity(self, value): self.resistivity.append(value) - def insert_resistivity_at(self, index, value): self.resistivity.insert(index, value) - def replace_resistivity_at(self, index, value): self.resistivity[index] = value - def hasContent_(self): - if ( - self.species or - self.resistivity - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='IntracellularProperties', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='IntracellularProperties') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='IntracellularProperties', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='IntracellularProperties'): - pass - def exportChildren(self, outfile, level, namespace_='', name_='IntracellularProperties', fromsubclass_=False, pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - for species_ in self.species: - species_.export(outfile, level, namespace_, name_='species', pretty_print=pretty_print) - for resistivity_ in self.resistivity: - resistivity_.export(outfile, level, namespace_, name_='resistivity', pretty_print=pretty_print) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - pass - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'species': - obj_ = Species.factory() - obj_.build(child_) - self.species.append(obj_) - obj_.original_tagname_ = 'species' - elif nodeName_ == 'resistivity': - class_obj_ = self.get_class_obj_(child_, ValueAcrossSegOrSegGroup) - obj_ = class_obj_.factory() - obj_.build(child_) - self.resistivity.append(obj_) - obj_.original_tagname_ = 'resistivity' -# end class IntracellularProperties - - -class ExtracellularPropertiesLocal(GeneratedsSuper): - subclass = None - superclass = None - def __init__(self, temperature=None, species=None): - self.original_tagname_ = None - self.temperature = _cast(None, temperature) - if species is None: - self.species = [] - else: - self.species = species - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, ExtracellularPropertiesLocal) - if subclass is not None: - return subclass(*args_, **kwargs_) - if ExtracellularPropertiesLocal.subclass: - return ExtracellularPropertiesLocal.subclass(*args_, **kwargs_) - else: - return ExtracellularPropertiesLocal(*args_, **kwargs_) - factory = staticmethod(factory) - def get_species(self): return self.species - def set_species(self, species): self.species = species - def add_species(self, value): self.species.append(value) - def insert_species_at(self, index, value): self.species.insert(index, value) - def replace_species_at(self, index, value): self.species[index] = value - def get_temperature(self): return self.temperature - def set_temperature(self, temperature): self.temperature = temperature - def validate_Nml2Quantity_temperature(self, value): - # Validate type Nml2Quantity_temperature, a restriction on xs:string. - if value is not None and Validate_simpletypes_: - if not self.gds_validate_simple_patterns( - self.validate_Nml2Quantity_temperature_patterns_, value): - warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_Nml2Quantity_temperature_patterns_, )) - validate_Nml2Quantity_temperature_patterns_ = [['^-?([0-9]*(\\.[0-9]+)?)([eE]-?[0-9]+)?[\\s]*(degC)$']] - def hasContent_(self): - if ( - self.species - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='ExtracellularPropertiesLocal', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='ExtracellularPropertiesLocal') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='ExtracellularPropertiesLocal', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='ExtracellularPropertiesLocal'): - if self.temperature is not None and 'temperature' not in already_processed: - already_processed.add('temperature') - outfile.write(' temperature=%s' % (quote_attrib(self.temperature), )) - def exportChildren(self, outfile, level, namespace_='', name_='ExtracellularPropertiesLocal', fromsubclass_=False, pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - for species_ in self.species: - species_.export(outfile, level, namespace_, name_='species', pretty_print=pretty_print) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - value = find_attr_value_('temperature', node) - if value is not None and 'temperature' not in already_processed: - already_processed.add('temperature') - self.temperature = value - self.validate_Nml2Quantity_temperature(self.temperature) # validate type Nml2Quantity_temperature - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'species': - obj_ = Species.factory() - obj_.build(child_) - self.species.append(obj_) - obj_.original_tagname_ = 'species' -# end class ExtracellularPropertiesLocal - - -class SpaceStructure(GeneratedsSuper): - subclass = None - superclass = None - def __init__(self, xSpacing=None, ySpacing=None, zSpacing=None, xStart=0, yStart=0, zStart=0): - self.original_tagname_ = None - self.xSpacing = _cast(float, xSpacing) - self.ySpacing = _cast(float, ySpacing) - self.zSpacing = _cast(float, zSpacing) - self.xStart = _cast(float, xStart) - self.yStart = _cast(float, yStart) - self.zStart = _cast(float, zStart) - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, SpaceStructure) - if subclass is not None: - return subclass(*args_, **kwargs_) - if SpaceStructure.subclass: - return SpaceStructure.subclass(*args_, **kwargs_) - else: - return SpaceStructure(*args_, **kwargs_) - factory = staticmethod(factory) - def get_xSpacing(self): return self.xSpacing - def set_xSpacing(self, xSpacing): self.xSpacing = xSpacing - def get_ySpacing(self): return self.ySpacing - def set_ySpacing(self, ySpacing): self.ySpacing = ySpacing - def get_zSpacing(self): return self.zSpacing - def set_zSpacing(self, zSpacing): self.zSpacing = zSpacing - def get_xStart(self): return self.xStart - def set_xStart(self, xStart): self.xStart = xStart - def get_yStart(self): return self.yStart - def set_yStart(self, yStart): self.yStart = yStart - def get_zStart(self): return self.zStart - def set_zStart(self, zStart): self.zStart = zStart - def hasContent_(self): - if ( - - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='SpaceStructure', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='SpaceStructure') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='SpaceStructure', pretty_print=pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='SpaceStructure'): - if self.xSpacing is not None and 'xSpacing' not in already_processed: - already_processed.add('xSpacing') - outfile.write(' xSpacing="%s"' % self.gds_format_float(self.xSpacing, input_name='xSpacing')) - if self.ySpacing is not None and 'ySpacing' not in already_processed: - already_processed.add('ySpacing') - outfile.write(' ySpacing="%s"' % self.gds_format_float(self.ySpacing, input_name='ySpacing')) - if self.zSpacing is not None and 'zSpacing' not in already_processed: - already_processed.add('zSpacing') - outfile.write(' zSpacing="%s"' % self.gds_format_float(self.zSpacing, input_name='zSpacing')) - if self.xStart != 0 and 'xStart' not in already_processed: - already_processed.add('xStart') - outfile.write(' xStart="%s"' % self.gds_format_float(self.xStart, input_name='xStart')) - if self.yStart != 0 and 'yStart' not in already_processed: - already_processed.add('yStart') - outfile.write(' yStart="%s"' % self.gds_format_float(self.yStart, input_name='yStart')) - if self.zStart != 0 and 'zStart' not in already_processed: - already_processed.add('zStart') - outfile.write(' zStart="%s"' % self.gds_format_float(self.zStart, input_name='zStart')) - def exportChildren(self, outfile, level, namespace_='', name_='SpaceStructure', fromsubclass_=False, pretty_print=True): - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - value = find_attr_value_('xSpacing', node) - if value is not None and 'xSpacing' not in already_processed: - already_processed.add('xSpacing') - try: - self.xSpacing = float(value) - except ValueError as exp: - raise ValueError('Bad float/double attribute (xSpacing): %s' % exp) - value = find_attr_value_('ySpacing', node) - if value is not None and 'ySpacing' not in already_processed: - already_processed.add('ySpacing') - try: - self.ySpacing = float(value) - except ValueError as exp: - raise ValueError('Bad float/double attribute (ySpacing): %s' % exp) - value = find_attr_value_('zSpacing', node) - if value is not None and 'zSpacing' not in already_processed: - already_processed.add('zSpacing') - try: - self.zSpacing = float(value) - except ValueError as exp: - raise ValueError('Bad float/double attribute (zSpacing): %s' % exp) - value = find_attr_value_('xStart', node) - if value is not None and 'xStart' not in already_processed: - already_processed.add('xStart') - try: - self.xStart = float(value) - except ValueError as exp: - raise ValueError('Bad float/double attribute (xStart): %s' % exp) - value = find_attr_value_('yStart', node) - if value is not None and 'yStart' not in already_processed: - already_processed.add('yStart') - try: - self.yStart = float(value) - except ValueError as exp: - raise ValueError('Bad float/double attribute (yStart): %s' % exp) - value = find_attr_value_('zStart', node) - if value is not None and 'zStart' not in already_processed: - already_processed.add('zStart') - try: - self.zStart = float(value) - except ValueError as exp: - raise ValueError('Bad float/double attribute (zStart): %s' % exp) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - pass -# end class SpaceStructure - - -class Layout(GeneratedsSuper): - subclass = None - superclass = None - def __init__(self, space=None, random=None, grid=None, unstructured=None): - self.original_tagname_ = None - self.space = _cast(None, space) - self.random = random - self.grid = grid - self.unstructured = unstructured - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, Layout) - if subclass is not None: - return subclass(*args_, **kwargs_) - if Layout.subclass: - return Layout.subclass(*args_, **kwargs_) - else: - return Layout(*args_, **kwargs_) - factory = staticmethod(factory) - def get_random(self): return self.random - def set_random(self, random): self.random = random - def get_grid(self): return self.grid - def set_grid(self, grid): self.grid = grid - def get_unstructured(self): return self.unstructured - def set_unstructured(self, unstructured): self.unstructured = unstructured - def get_space(self): return self.space - def set_space(self, space): self.space = space - def validate_NmlId(self, value): - # Validate type NmlId, a restriction on xs:string. - if value is not None and Validate_simpletypes_: - if not self.gds_validate_simple_patterns( - self.validate_NmlId_patterns_, value): - warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_NmlId_patterns_, )) - validate_NmlId_patterns_ = [['^[a-zA-Z0-9_]*$']] - def hasContent_(self): - if ( - self.random is not None or - self.grid is not None or - self.unstructured is not None - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='Layout', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='Layout') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='Layout', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='Layout'): - if self.space is not None and 'space' not in already_processed: - already_processed.add('space') - outfile.write(' space=%s' % (quote_attrib(self.space), )) - def exportChildren(self, outfile, level, namespace_='', name_='Layout', fromsubclass_=False, pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.random is not None: - self.random.export(outfile, level, namespace_, name_='random', pretty_print=pretty_print) - if self.grid is not None: - self.grid.export(outfile, level, namespace_, name_='grid', pretty_print=pretty_print) - if self.unstructured is not None: - self.unstructured.export(outfile, level, namespace_, name_='unstructured', pretty_print=pretty_print) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - value = find_attr_value_('space', node) - if value is not None and 'space' not in already_processed: - already_processed.add('space') - self.space = value - self.validate_NmlId(self.space) # validate type NmlId - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'random': - obj_ = RandomLayout.factory() - obj_.build(child_) - self.random = obj_ - obj_.original_tagname_ = 'random' - elif nodeName_ == 'grid': - obj_ = GridLayout.factory() - obj_.build(child_) - self.grid = obj_ - obj_.original_tagname_ = 'grid' - elif nodeName_ == 'unstructured': - obj_ = UnstructuredLayout.factory() - obj_.build(child_) - self.unstructured = obj_ - obj_.original_tagname_ = 'unstructured' -# end class Layout - - -class UnstructuredLayout(GeneratedsSuper): - subclass = None - superclass = None - def __init__(self, number=None): - self.original_tagname_ = None - self.number = _cast(int, number) - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, UnstructuredLayout) - if subclass is not None: - return subclass(*args_, **kwargs_) - if UnstructuredLayout.subclass: - return UnstructuredLayout.subclass(*args_, **kwargs_) - else: - return UnstructuredLayout(*args_, **kwargs_) - factory = staticmethod(factory) - def get_number(self): return self.number - def set_number(self, number): self.number = number - def hasContent_(self): - if ( - - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='UnstructuredLayout', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='UnstructuredLayout') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='UnstructuredLayout', pretty_print=pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='UnstructuredLayout'): - if self.number is not None and 'number' not in already_processed: - already_processed.add('number') - outfile.write(' number="%s"' % self.gds_format_integer(self.number, input_name='number')) - def exportChildren(self, outfile, level, namespace_='', name_='UnstructuredLayout', fromsubclass_=False, pretty_print=True): - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - value = find_attr_value_('number', node) - if value is not None and 'number' not in already_processed: - already_processed.add('number') - try: - self.number = int(value) - except ValueError as exp: - raise_parse_error(node, 'Bad integer attribute: %s' % exp) - if self.number < 0: - raise_parse_error(node, 'Invalid NonNegativeInteger') - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - pass -# end class UnstructuredLayout - - -class RandomLayout(GeneratedsSuper): - subclass = None - superclass = None - def __init__(self, number=None, region=None): - self.original_tagname_ = None - self.number = _cast(int, number) - self.region = _cast(None, region) - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, RandomLayout) - if subclass is not None: - return subclass(*args_, **kwargs_) - if RandomLayout.subclass: - return RandomLayout.subclass(*args_, **kwargs_) - else: - return RandomLayout(*args_, **kwargs_) - factory = staticmethod(factory) - def get_number(self): return self.number - def set_number(self, number): self.number = number - def get_region(self): return self.region - def set_region(self, region): self.region = region - def validate_NmlId(self, value): - # Validate type NmlId, a restriction on xs:string. - if value is not None and Validate_simpletypes_: - if not self.gds_validate_simple_patterns( - self.validate_NmlId_patterns_, value): - warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_NmlId_patterns_, )) - validate_NmlId_patterns_ = [['^[a-zA-Z0-9_]*$']] - def hasContent_(self): - if ( - - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='RandomLayout', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='RandomLayout') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='RandomLayout', pretty_print=pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='RandomLayout'): - if self.number is not None and 'number' not in already_processed: - already_processed.add('number') - outfile.write(' number="%s"' % self.gds_format_integer(self.number, input_name='number')) - if self.region is not None and 'region' not in already_processed: - already_processed.add('region') - outfile.write(' region=%s' % (quote_attrib(self.region), )) - def exportChildren(self, outfile, level, namespace_='', name_='RandomLayout', fromsubclass_=False, pretty_print=True): - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - value = find_attr_value_('number', node) - if value is not None and 'number' not in already_processed: - already_processed.add('number') - try: - self.number = int(value) - except ValueError as exp: - raise_parse_error(node, 'Bad integer attribute: %s' % exp) - if self.number < 0: - raise_parse_error(node, 'Invalid NonNegativeInteger') - value = find_attr_value_('region', node) - if value is not None and 'region' not in already_processed: - already_processed.add('region') - self.region = value - self.validate_NmlId(self.region) # validate type NmlId - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - pass -# end class RandomLayout - - -class GridLayout(GeneratedsSuper): - subclass = None - superclass = None - def __init__(self, xSize=None, ySize=None, zSize=None): - self.original_tagname_ = None - self.xSize = _cast(int, xSize) - self.ySize = _cast(int, ySize) - self.zSize = _cast(int, zSize) - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, GridLayout) - if subclass is not None: - return subclass(*args_, **kwargs_) - if GridLayout.subclass: - return GridLayout.subclass(*args_, **kwargs_) - else: - return GridLayout(*args_, **kwargs_) - factory = staticmethod(factory) - def get_xSize(self): return self.xSize - def set_xSize(self, xSize): self.xSize = xSize - def get_ySize(self): return self.ySize - def set_ySize(self, ySize): self.ySize = ySize - def get_zSize(self): return self.zSize - def set_zSize(self, zSize): self.zSize = zSize - def hasContent_(self): - if ( - - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='GridLayout', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='GridLayout') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='GridLayout', pretty_print=pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='GridLayout'): - if self.xSize is not None and 'xSize' not in already_processed: - already_processed.add('xSize') - outfile.write(' xSize="%s"' % self.gds_format_integer(self.xSize, input_name='xSize')) - if self.ySize is not None and 'ySize' not in already_processed: - already_processed.add('ySize') - outfile.write(' ySize="%s"' % self.gds_format_integer(self.ySize, input_name='ySize')) - if self.zSize is not None and 'zSize' not in already_processed: - already_processed.add('zSize') - outfile.write(' zSize="%s"' % self.gds_format_integer(self.zSize, input_name='zSize')) - def exportChildren(self, outfile, level, namespace_='', name_='GridLayout', fromsubclass_=False, pretty_print=True): - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - value = find_attr_value_('xSize', node) - if value is not None and 'xSize' not in already_processed: - already_processed.add('xSize') - try: - self.xSize = int(value) - except ValueError as exp: - raise_parse_error(node, 'Bad integer attribute: %s' % exp) - if self.xSize < 0: - raise_parse_error(node, 'Invalid NonNegativeInteger') - value = find_attr_value_('ySize', node) - if value is not None and 'ySize' not in already_processed: - already_processed.add('ySize') - try: - self.ySize = int(value) - except ValueError as exp: - raise_parse_error(node, 'Bad integer attribute: %s' % exp) - if self.ySize < 0: - raise_parse_error(node, 'Invalid NonNegativeInteger') - value = find_attr_value_('zSize', node) - if value is not None and 'zSize' not in already_processed: - already_processed.add('zSize') - try: - self.zSize = int(value) - except ValueError as exp: - raise_parse_error(node, 'Bad integer attribute: %s' % exp) - if self.zSize < 0: - raise_parse_error(node, 'Invalid NonNegativeInteger') - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - pass -# end class GridLayout - - -class Instance(GeneratedsSuper): - subclass = None - superclass = None - def __init__(self, id=None, i=None, j=None, k=None, location=None): - self.original_tagname_ = None - self.id = _cast(int, id) - self.i = _cast(int, i) - self.j = _cast(int, j) - self.k = _cast(int, k) - self.location = location - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, Instance) - if subclass is not None: - return subclass(*args_, **kwargs_) - if Instance.subclass: - return Instance.subclass(*args_, **kwargs_) - else: - return Instance(*args_, **kwargs_) - factory = staticmethod(factory) - def get_location(self): return self.location - def set_location(self, location): self.location = location - def get_id(self): return self.id - def set_id(self, id): self.id = id - def get_i(self): return self.i - def set_i(self, i): self.i = i - def get_j(self): return self.j - def set_j(self, j): self.j = j - def get_k(self): return self.k - def set_k(self, k): self.k = k - def hasContent_(self): - if ( - self.location is not None - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='Instance', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='Instance') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='Instance', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='Instance'): - if self.id is not None and 'id' not in already_processed: - already_processed.add('id') - outfile.write(' id="%s"' % self.gds_format_integer(self.id, input_name='id')) - if self.i is not None and 'i' not in already_processed: - already_processed.add('i') - outfile.write(' i="%s"' % self.gds_format_integer(self.i, input_name='i')) - if self.j is not None and 'j' not in already_processed: - already_processed.add('j') - outfile.write(' j="%s"' % self.gds_format_integer(self.j, input_name='j')) - if self.k is not None and 'k' not in already_processed: - already_processed.add('k') - outfile.write(' k="%s"' % self.gds_format_integer(self.k, input_name='k')) - def exportChildren(self, outfile, level, namespace_='', name_='Instance', fromsubclass_=False, pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.location is not None: - self.location.export(outfile, level, namespace_, name_='location', pretty_print=pretty_print) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - value = find_attr_value_('id', node) - if value is not None and 'id' not in already_processed: - already_processed.add('id') - try: - self.id = int(value) - except ValueError as exp: - raise_parse_error(node, 'Bad integer attribute: %s' % exp) - if self.id < 0: - raise_parse_error(node, 'Invalid NonNegativeInteger') - value = find_attr_value_('i', node) - if value is not None and 'i' not in already_processed: - already_processed.add('i') - try: - self.i = int(value) - except ValueError as exp: - raise_parse_error(node, 'Bad integer attribute: %s' % exp) - if self.i < 0: - raise_parse_error(node, 'Invalid NonNegativeInteger') - value = find_attr_value_('j', node) - if value is not None and 'j' not in already_processed: - already_processed.add('j') - try: - self.j = int(value) - except ValueError as exp: - raise_parse_error(node, 'Bad integer attribute: %s' % exp) - if self.j < 0: - raise_parse_error(node, 'Invalid NonNegativeInteger') - value = find_attr_value_('k', node) - if value is not None and 'k' not in already_processed: - already_processed.add('k') - try: - self.k = int(value) - except ValueError as exp: - raise_parse_error(node, 'Bad integer attribute: %s' % exp) - if self.k < 0: - raise_parse_error(node, 'Invalid NonNegativeInteger') - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'location': - obj_ = Location.factory() - obj_.build(child_) - self.location = obj_ - obj_.original_tagname_ = 'location' -# end class Instance - - -class Location(GeneratedsSuper): - subclass = None - superclass = None - def __init__(self, x=None, y=None, z=None): - self.original_tagname_ = None - self.x = _cast(float, x) - self.y = _cast(float, y) - self.z = _cast(float, z) - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, Location) - if subclass is not None: - return subclass(*args_, **kwargs_) - if Location.subclass: - return Location.subclass(*args_, **kwargs_) - else: - return Location(*args_, **kwargs_) - factory = staticmethod(factory) - def get_x(self): return self.x - def set_x(self, x): self.x = x - def get_y(self): return self.y - def set_y(self, y): self.y = y - def get_z(self): return self.z - def set_z(self, z): self.z = z - def hasContent_(self): - if ( - - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='Location', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='Location') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='Location', pretty_print=pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='Location'): - if self.x is not None and 'x' not in already_processed: - already_processed.add('x') - outfile.write(' x="%s"' % self.gds_format_float(self.x, input_name='x')) - if self.y is not None and 'y' not in already_processed: - already_processed.add('y') - outfile.write(' y="%s"' % self.gds_format_float(self.y, input_name='y')) - if self.z is not None and 'z' not in already_processed: - already_processed.add('z') - outfile.write(' z="%s"' % self.gds_format_float(self.z, input_name='z')) - def exportChildren(self, outfile, level, namespace_='', name_='Location', fromsubclass_=False, pretty_print=True): - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - value = find_attr_value_('x', node) - if value is not None and 'x' not in already_processed: - already_processed.add('x') - try: - self.x = float(value) - except ValueError as exp: - raise ValueError('Bad float/double attribute (x): %s' % exp) - value = find_attr_value_('y', node) - if value is not None and 'y' not in already_processed: - already_processed.add('y') - try: - self.y = float(value) - except ValueError as exp: - raise ValueError('Bad float/double attribute (y): %s' % exp) - value = find_attr_value_('z', node) - if value is not None and 'z' not in already_processed: - already_processed.add('z') - try: - self.z = float(value) - except ValueError as exp: - raise ValueError('Bad float/double attribute (z): %s' % exp) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - pass -# end class Location - - -class SynapticConnection(GeneratedsSuper): - """Single explicit connection. Introduced to test connections in LEMS. - Will probably be removed in favour of connections wrapped in - projection element""" - subclass = None - superclass = None - def __init__(self, from_=None, to=None, synapse=None): - self.original_tagname_ = None - self.from_ = _cast(None, from_) - self.to = _cast(None, to) - self.synapse = _cast(None, synapse) - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, SynapticConnection) - if subclass is not None: - return subclass(*args_, **kwargs_) - if SynapticConnection.subclass: - return SynapticConnection.subclass(*args_, **kwargs_) - else: - return SynapticConnection(*args_, **kwargs_) - factory = staticmethod(factory) - def get_from(self): return self.from_ - def set_from(self, from_): self.from_ = from_ - def get_to(self): return self.to - def set_to(self, to): self.to = to - def get_synapse(self): return self.synapse - def set_synapse(self, synapse): self.synapse = synapse - def hasContent_(self): - if ( - - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='SynapticConnection', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='SynapticConnection') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='SynapticConnection', pretty_print=pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='SynapticConnection'): - if self.from_ is not None and 'from_' not in already_processed: - already_processed.add('from_') - outfile.write(' from=%s' % (self.gds_encode(self.gds_format_string(quote_attrib(self.from_), input_name='from')), )) - if self.to is not None and 'to' not in already_processed: - already_processed.add('to') - outfile.write(' to=%s' % (self.gds_encode(self.gds_format_string(quote_attrib(self.to), input_name='to')), )) - if self.synapse is not None and 'synapse' not in already_processed: - already_processed.add('synapse') - outfile.write(' synapse=%s' % (self.gds_encode(self.gds_format_string(quote_attrib(self.synapse), input_name='synapse')), )) - def exportChildren(self, outfile, level, namespace_='', name_='SynapticConnection', fromsubclass_=False, pretty_print=True): - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - value = find_attr_value_('from', node) - if value is not None and 'from' not in already_processed: - already_processed.add('from') - self.from_ = value - value = find_attr_value_('to', node) - if value is not None and 'to' not in already_processed: - already_processed.add('to') - self.to = value - value = find_attr_value_('synapse', node) - if value is not None and 'synapse' not in already_processed: - already_processed.add('synapse') - self.synapse = value - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - pass -# end class SynapticConnection - - -class Connection(GeneratedsSuper): - """Subject to change as it gets tested with LEMS""" - subclass = None - superclass = None - def __init__(self, id=None, preCellId=None, postCellId=None): - self.original_tagname_ = None - self.id = _cast(int, id) - self.preCellId = _cast(None, preCellId) - self.postCellId = _cast(None, postCellId) - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, Connection) - if subclass is not None: - return subclass(*args_, **kwargs_) - if Connection.subclass: - return Connection.subclass(*args_, **kwargs_) - else: - return Connection(*args_, **kwargs_) - factory = staticmethod(factory) - def get_id(self): return self.id - def set_id(self, id): self.id = id - def get_preCellId(self): return self.preCellId - def set_preCellId(self, preCellId): self.preCellId = preCellId - def get_postCellId(self): return self.postCellId - def set_postCellId(self, postCellId): self.postCellId = postCellId - def hasContent_(self): - if ( - - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='Connection', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='Connection') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='Connection', pretty_print=pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='Connection'): - if self.id is not None and 'id' not in already_processed: - already_processed.add('id') - outfile.write(' id="%s"' % self.gds_format_integer(self.id, input_name='id')) - if self.preCellId is not None and 'preCellId' not in already_processed: - already_processed.add('preCellId') - outfile.write(' preCellId=%s' % (self.gds_encode(self.gds_format_string(quote_attrib(self.preCellId), input_name='preCellId')), )) - if self.postCellId is not None and 'postCellId' not in already_processed: - already_processed.add('postCellId') - outfile.write(' postCellId=%s' % (self.gds_encode(self.gds_format_string(quote_attrib(self.postCellId), input_name='postCellId')), )) - def exportChildren(self, outfile, level, namespace_='', name_='Connection', fromsubclass_=False, pretty_print=True): - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - value = find_attr_value_('id', node) - if value is not None and 'id' not in already_processed: - already_processed.add('id') - try: - self.id = int(value) - except ValueError as exp: - raise_parse_error(node, 'Bad integer attribute: %s' % exp) - if self.id < 0: - raise_parse_error(node, 'Invalid NonNegativeInteger') - value = find_attr_value_('preCellId', node) - if value is not None and 'preCellId' not in already_processed: - already_processed.add('preCellId') - self.preCellId = value - value = find_attr_value_('postCellId', node) - if value is not None and 'postCellId' not in already_processed: - already_processed.add('postCellId') - self.postCellId = value - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - pass -# end class Connection - - -class ExplicitInput(GeneratedsSuper): - """Single explicit input. Introduced to test inputs in LEMS. Will - probably be removed in favour of inputs wrapped in inputList - element""" - subclass = None - superclass = None - def __init__(self, target=None, input=None, destination=None): - self.original_tagname_ = None - self.target = _cast(None, target) - self.input = _cast(None, input) - self.destination = _cast(None, destination) - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, ExplicitInput) - if subclass is not None: - return subclass(*args_, **kwargs_) - if ExplicitInput.subclass: - return ExplicitInput.subclass(*args_, **kwargs_) - else: - return ExplicitInput(*args_, **kwargs_) - factory = staticmethod(factory) - def get_target(self): return self.target - def set_target(self, target): self.target = target - def get_input(self): return self.input - def set_input(self, input): self.input = input - def get_destination(self): return self.destination - def set_destination(self, destination): self.destination = destination - def hasContent_(self): - if ( - - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='ExplicitInput', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='ExplicitInput') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='ExplicitInput', pretty_print=pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='ExplicitInput'): - if self.target is not None and 'target' not in already_processed: - already_processed.add('target') - outfile.write(' target=%s' % (self.gds_encode(self.gds_format_string(quote_attrib(self.target), input_name='target')), )) - if self.input is not None and 'input' not in already_processed: - already_processed.add('input') - outfile.write(' input=%s' % (self.gds_encode(self.gds_format_string(quote_attrib(self.input), input_name='input')), )) - if self.destination is not None and 'destination' not in already_processed: - already_processed.add('destination') - outfile.write(' destination=%s' % (self.gds_encode(self.gds_format_string(quote_attrib(self.destination), input_name='destination')), )) - def exportChildren(self, outfile, level, namespace_='', name_='ExplicitInput', fromsubclass_=False, pretty_print=True): - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - value = find_attr_value_('target', node) - if value is not None and 'target' not in already_processed: - already_processed.add('target') - self.target = value - value = find_attr_value_('input', node) - if value is not None and 'input' not in already_processed: - already_processed.add('input') - self.input = value - value = find_attr_value_('destination', node) - if value is not None and 'destination' not in already_processed: - already_processed.add('destination') - self.destination = value - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - pass -# end class ExplicitInput - - -class Input(GeneratedsSuper): - """Subject to change as it gets tested with LEMS""" - subclass = None - superclass = None - def __init__(self, id=None, target=None, destination=None): - self.original_tagname_ = None - self.id = _cast(int, id) - self.target = _cast(None, target) - self.destination = _cast(None, destination) - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, Input) - if subclass is not None: - return subclass(*args_, **kwargs_) - if Input.subclass: - return Input.subclass(*args_, **kwargs_) - else: - return Input(*args_, **kwargs_) - factory = staticmethod(factory) - def get_id(self): return self.id - def set_id(self, id): self.id = id - def get_target(self): return self.target - def set_target(self, target): self.target = target - def get_destination(self): return self.destination - def set_destination(self, destination): self.destination = destination - def validate_NmlId(self, value): - # Validate type NmlId, a restriction on xs:string. - if value is not None and Validate_simpletypes_: - if not self.gds_validate_simple_patterns( - self.validate_NmlId_patterns_, value): - warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_NmlId_patterns_, )) - validate_NmlId_patterns_ = [['^[a-zA-Z0-9_]*$']] - def hasContent_(self): - if ( - - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='Input', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='Input') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='Input', pretty_print=pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='Input'): - if self.id is not None and 'id' not in already_processed: - already_processed.add('id') - outfile.write(' id="%s"' % self.gds_format_integer(self.id, input_name='id')) - if self.target is not None and 'target' not in already_processed: - already_processed.add('target') - outfile.write(' target=%s' % (self.gds_encode(self.gds_format_string(quote_attrib(self.target), input_name='target')), )) - if self.destination is not None and 'destination' not in already_processed: - already_processed.add('destination') - outfile.write(' destination=%s' % (quote_attrib(self.destination), )) - def exportChildren(self, outfile, level, namespace_='', name_='Input', fromsubclass_=False, pretty_print=True): - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - value = find_attr_value_('id', node) - if value is not None and 'id' not in already_processed: - already_processed.add('id') - try: - self.id = int(value) - except ValueError as exp: - raise_parse_error(node, 'Bad integer attribute: %s' % exp) - if self.id < 0: - raise_parse_error(node, 'Invalid NonNegativeInteger') - value = find_attr_value_('target', node) - if value is not None and 'target' not in already_processed: - already_processed.add('target') - self.target = value - value = find_attr_value_('destination', node) - if value is not None and 'destination' not in already_processed: - already_processed.add('destination') - self.destination = value - self.validate_NmlId(self.destination) # validate type NmlId - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - pass -# end class Input - - -class Base(GeneratedsSuper): - """Anything which can have a unique id (within its parent) i.e. most - elements.""" - subclass = None - superclass = None - def __init__(self, id=None, neuroLexId=None, extensiontype_=None): - self.original_tagname_ = None - self.id = _cast(None, id) - self.neuroLexId = _cast(None, neuroLexId) - self.extensiontype_ = extensiontype_ - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, Base) - if subclass is not None: - return subclass(*args_, **kwargs_) - if Base.subclass: - return Base.subclass(*args_, **kwargs_) - else: - return Base(*args_, **kwargs_) - factory = staticmethod(factory) - def get_id(self): return self.id - def set_id(self, id): self.id = id - def get_neuroLexId(self): return self.neuroLexId - def set_neuroLexId(self, neuroLexId): self.neuroLexId = neuroLexId - def get_extensiontype_(self): return self.extensiontype_ - def set_extensiontype_(self, extensiontype_): self.extensiontype_ = extensiontype_ - def validate_NmlId(self, value): - # Validate type NmlId, a restriction on xs:string. - if value is not None and Validate_simpletypes_: - if not self.gds_validate_simple_patterns( - self.validate_NmlId_patterns_, value): - warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_NmlId_patterns_, )) - validate_NmlId_patterns_ = [['^[a-zA-Z0-9_]*$']] - def validate_NeuroLexId(self, value): - # Validate type NeuroLexId, a restriction on xs:string. - if value is not None and Validate_simpletypes_: - if not self.gds_validate_simple_patterns( - self.validate_NeuroLexId_patterns_, value): - warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_NeuroLexId_patterns_, )) - validate_NeuroLexId_patterns_ = [['^[a-zA-Z0-9_]*$']] - def hasContent_(self): - if ( - - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='Base', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='Base') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='Base', pretty_print=pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='Base'): - if self.id is not None and 'id' not in already_processed: - already_processed.add('id') - outfile.write(' id=%s' % (quote_attrib(self.id), )) - if self.neuroLexId is not None and 'neuroLexId' not in already_processed: - already_processed.add('neuroLexId') - outfile.write(' neuroLexId=%s' % (quote_attrib(self.neuroLexId), )) - if self.extensiontype_ is not None and 'xsi:type' not in already_processed: - already_processed.add('xsi:type') - outfile.write(' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"') - outfile.write(' xsi:type="%s"' % self.extensiontype_) - def exportChildren(self, outfile, level, namespace_='', name_='Base', fromsubclass_=False, pretty_print=True): - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - value = find_attr_value_('id', node) - if value is not None and 'id' not in already_processed: - already_processed.add('id') - self.id = value - self.validate_NmlId(self.id) # validate type NmlId - value = find_attr_value_('neuroLexId', node) - if value is not None and 'neuroLexId' not in already_processed: - already_processed.add('neuroLexId') - self.neuroLexId = value - self.validate_NeuroLexId(self.neuroLexId) # validate type NeuroLexId - value = find_attr_value_('xsi:type', node) - if value is not None and 'xsi:type' not in already_processed: - already_processed.add('xsi:type') - self.extensiontype_ = value - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - pass -# end class Base - - -class Standalone(Base): - """Elements which can stand alone and be referenced by id, e.g. cell, - morphology.Optional human readable name of the element. Not - necessarily unique; should not be used for referencing/indexing.""" - subclass = None - superclass = Base - def __init__(self, id=None, neuroLexId=None, name=None, metaid=None, notes=None, annotation=None, extensiontype_=None): - self.original_tagname_ = None - super(Standalone, self).__init__(id, neuroLexId, extensiontype_, ) - self.name = _cast(None, name) - self.metaid = _cast(None, metaid) - self.notes = notes - self.validate_Notes(self.notes) - self.annotation = annotation - self.extensiontype_ = extensiontype_ - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, Standalone) - if subclass is not None: - return subclass(*args_, **kwargs_) - if Standalone.subclass: - return Standalone.subclass(*args_, **kwargs_) - else: - return Standalone(*args_, **kwargs_) - factory = staticmethod(factory) - def get_notes(self): return self.notes - def set_notes(self, notes): self.notes = notes - def get_annotation(self): return self.annotation - def set_annotation(self, annotation): self.annotation = annotation - def get_name(self): return self.name - def set_name(self, name): self.name = name - def get_metaid(self): return self.metaid - def set_metaid(self, metaid): self.metaid = metaid - def get_extensiontype_(self): return self.extensiontype_ - def set_extensiontype_(self, extensiontype_): self.extensiontype_ = extensiontype_ - def validate_Notes(self, value): - # Validate type Notes, a restriction on xs:string. - if value is not None and Validate_simpletypes_: - pass - def validate_MetaId(self, value): - # Validate type MetaId, a restriction on xs:string. - if value is not None and Validate_simpletypes_: - if not self.gds_validate_simple_patterns( - self.validate_MetaId_patterns_, value): - warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_MetaId_patterns_, )) - validate_MetaId_patterns_ = [['^[a-zA-Z0-9_]*$']] - def hasContent_(self): - if ( - self.notes is not None or - self.annotation is not None or - super(Standalone, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='Standalone', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='Standalone') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='Standalone', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='Standalone'): - super(Standalone, self).exportAttributes(outfile, level, already_processed, namespace_, name_='Standalone') - if self.name is not None and 'name' not in already_processed: - already_processed.add('name') - outfile.write(' name=%s' % (self.gds_encode(self.gds_format_string(quote_attrib(self.name), input_name='name')), )) - if self.metaid is not None and 'metaid' not in already_processed: - already_processed.add('metaid') - outfile.write(' metaid=%s' % (quote_attrib(self.metaid), )) - if self.extensiontype_ is not None and 'xsi:type' not in already_processed: - already_processed.add('xsi:type') - outfile.write(' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"') - outfile.write(' xsi:type="%s"' % self.extensiontype_) - def exportChildren(self, outfile, level, namespace_='', name_='Standalone', fromsubclass_=False, pretty_print=True): - super(Standalone, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.notes is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%snotes>%s</%snotes>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.notes), input_name='notes')), namespace_, eol_)) - if self.annotation is not None: - self.annotation.export(outfile, level, namespace_, name_='annotation', pretty_print=pretty_print) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - value = find_attr_value_('name', node) - if value is not None and 'name' not in already_processed: - already_processed.add('name') - self.name = value - value = find_attr_value_('metaid', node) - if value is not None and 'metaid' not in already_processed: - already_processed.add('metaid') - self.metaid = value - self.validate_MetaId(self.metaid) # validate type MetaId - value = find_attr_value_('xsi:type', node) - if value is not None and 'xsi:type' not in already_processed: - already_processed.add('xsi:type') - self.extensiontype_ = value - super(Standalone, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'notes': - notes_ = child_.text - notes_ = self.gds_validate_string(notes_, node, 'notes') - self.notes = notes_ - # validate type Notes - self.validate_Notes(self.notes) - elif nodeName_ == 'annotation': - obj_ = Annotation.factory() - obj_.build(child_) - self.annotation = obj_ - obj_.original_tagname_ = 'annotation' - super(Standalone, self).buildChildren(child_, node, nodeName_, True) -# end class Standalone - - -class SpikeSourcePoisson(Standalone): - subclass = None - superclass = Standalone - def __init__(self, id=None, neuroLexId=None, name=None, metaid=None, notes=None, annotation=None, start=None, duration=None, rate=None): - self.original_tagname_ = None - super(SpikeSourcePoisson, self).__init__(id, neuroLexId, name, metaid, notes, annotation, ) - self.start = _cast(None, start) - self.duration = _cast(None, duration) - self.rate = _cast(None, rate) - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, SpikeSourcePoisson) - if subclass is not None: - return subclass(*args_, **kwargs_) - if SpikeSourcePoisson.subclass: - return SpikeSourcePoisson.subclass(*args_, **kwargs_) - else: - return SpikeSourcePoisson(*args_, **kwargs_) - factory = staticmethod(factory) - def get_start(self): return self.start - def set_start(self, start): self.start = start - def get_duration(self): return self.duration - def set_duration(self, duration): self.duration = duration - def get_rate(self): return self.rate - def set_rate(self, rate): self.rate = rate - def validate_Nml2Quantity_time(self, value): - # Validate type Nml2Quantity_time, a restriction on xs:string. - if value is not None and Validate_simpletypes_: - if not self.gds_validate_simple_patterns( - self.validate_Nml2Quantity_time_patterns_, value): - warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_Nml2Quantity_time_patterns_, )) - validate_Nml2Quantity_time_patterns_ = [['^-?([0-9]*(\\.[0-9]+)?)([eE]-?[0-9]+)?[\\s]*(s|ms)$']] - def validate_Nml2Quantity_pertime(self, value): - # Validate type Nml2Quantity_pertime, a restriction on xs:string. - if value is not None and Validate_simpletypes_: - if not self.gds_validate_simple_patterns( - self.validate_Nml2Quantity_pertime_patterns_, value): - warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_Nml2Quantity_pertime_patterns_, )) - validate_Nml2Quantity_pertime_patterns_ = [['^-?([0-9]*(\\.[0-9]+)?)([eE]-?[0-9]+)?[\\s]*(per_s|per_ms|Hz)$']] - def hasContent_(self): - if ( - super(SpikeSourcePoisson, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='SpikeSourcePoisson', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='SpikeSourcePoisson') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='SpikeSourcePoisson', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='SpikeSourcePoisson'): - super(SpikeSourcePoisson, self).exportAttributes(outfile, level, already_processed, namespace_, name_='SpikeSourcePoisson') - if self.start is not None and 'start' not in already_processed: - already_processed.add('start') - outfile.write(' start=%s' % (quote_attrib(self.start), )) - if self.duration is not None and 'duration' not in already_processed: - already_processed.add('duration') - outfile.write(' duration=%s' % (quote_attrib(self.duration), )) - if self.rate is not None and 'rate' not in already_processed: - already_processed.add('rate') - outfile.write(' rate=%s' % (quote_attrib(self.rate), )) - def exportChildren(self, outfile, level, namespace_='', name_='SpikeSourcePoisson', fromsubclass_=False, pretty_print=True): - super(SpikeSourcePoisson, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - value = find_attr_value_('start', node) - if value is not None and 'start' not in already_processed: - already_processed.add('start') - self.start = value - self.validate_Nml2Quantity_time(self.start) # validate type Nml2Quantity_time - value = find_attr_value_('duration', node) - if value is not None and 'duration' not in already_processed: - already_processed.add('duration') - self.duration = value - self.validate_Nml2Quantity_time(self.duration) # validate type Nml2Quantity_time - value = find_attr_value_('rate', node) - if value is not None and 'rate' not in already_processed: - already_processed.add('rate') - self.rate = value - self.validate_Nml2Quantity_pertime(self.rate) # validate type Nml2Quantity_pertime - super(SpikeSourcePoisson, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(SpikeSourcePoisson, self).buildChildren(child_, node, nodeName_, True) - pass -# end class SpikeSourcePoisson - - -class InputList(Base): - """Subject to change as it gets tested with LEMS""" - subclass = None - superclass = Base - def __init__(self, id=None, neuroLexId=None, population=None, component=None, input=None): - self.original_tagname_ = None - super(InputList, self).__init__(id, neuroLexId, ) - self.population = _cast(None, population) - self.component = _cast(None, component) - if input is None: - self.input = [] - else: - self.input = input - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, InputList) - if subclass is not None: - return subclass(*args_, **kwargs_) - if InputList.subclass: - return InputList.subclass(*args_, **kwargs_) - else: - return InputList(*args_, **kwargs_) - factory = staticmethod(factory) - def get_input(self): return self.input - def set_input(self, input): self.input = input - def add_input(self, value): self.input.append(value) - def insert_input_at(self, index, value): self.input.insert(index, value) - def replace_input_at(self, index, value): self.input[index] = value - def get_population(self): return self.population - def set_population(self, population): self.population = population - def get_component(self): return self.component - def set_component(self, component): self.component = component - def validate_NmlId(self, value): - # Validate type NmlId, a restriction on xs:string. - if value is not None and Validate_simpletypes_: - if not self.gds_validate_simple_patterns( - self.validate_NmlId_patterns_, value): - warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_NmlId_patterns_, )) - validate_NmlId_patterns_ = [['^[a-zA-Z0-9_]*$']] - def hasContent_(self): - if ( - self.input or - super(InputList, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='InputList', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='InputList') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='InputList', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='InputList'): - super(InputList, self).exportAttributes(outfile, level, already_processed, namespace_, name_='InputList') - if self.population is not None and 'population' not in already_processed: - already_processed.add('population') - outfile.write(' population=%s' % (quote_attrib(self.population), )) - if self.component is not None and 'component' not in already_processed: - already_processed.add('component') - outfile.write(' component=%s' % (quote_attrib(self.component), )) - def exportChildren(self, outfile, level, namespace_='', name_='InputList', fromsubclass_=False, pretty_print=True): - super(InputList, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - for input_ in self.input: - input_.export(outfile, level, namespace_, name_='input', pretty_print=pretty_print) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - value = find_attr_value_('population', node) - if value is not None and 'population' not in already_processed: - already_processed.add('population') - self.population = value - self.validate_NmlId(self.population) # validate type NmlId - value = find_attr_value_('component', node) - if value is not None and 'component' not in already_processed: - already_processed.add('component') - self.component = value - self.validate_NmlId(self.component) # validate type NmlId - super(InputList, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'input': - obj_ = Input.factory() - obj_.build(child_) - self.input.append(obj_) - obj_.original_tagname_ = 'input' - super(InputList, self).buildChildren(child_, node, nodeName_, True) -# end class InputList - - -class Projection(Base): - """Subject to change as it gets tested with LEMS""" - subclass = None - superclass = Base - def __init__(self, id=None, neuroLexId=None, presynapticPopulation=None, postsynapticPopulation=None, synapse=None, connection=None): - self.original_tagname_ = None - super(Projection, self).__init__(id, neuroLexId, ) - self.presynapticPopulation = _cast(None, presynapticPopulation) - self.postsynapticPopulation = _cast(None, postsynapticPopulation) - self.synapse = _cast(None, synapse) - if connection is None: - self.connection = [] - else: - self.connection = connection - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, Projection) - if subclass is not None: - return subclass(*args_, **kwargs_) - if Projection.subclass: - return Projection.subclass(*args_, **kwargs_) - else: - return Projection(*args_, **kwargs_) - factory = staticmethod(factory) - def get_connection(self): return self.connection - def set_connection(self, connection): self.connection = connection - def add_connection(self, value): self.connection.append(value) - def insert_connection_at(self, index, value): self.connection.insert(index, value) - def replace_connection_at(self, index, value): self.connection[index] = value - def get_presynapticPopulation(self): return self.presynapticPopulation - def set_presynapticPopulation(self, presynapticPopulation): self.presynapticPopulation = presynapticPopulation - def get_postsynapticPopulation(self): return self.postsynapticPopulation - def set_postsynapticPopulation(self, postsynapticPopulation): self.postsynapticPopulation = postsynapticPopulation - def get_synapse(self): return self.synapse - def set_synapse(self, synapse): self.synapse = synapse - def validate_NmlId(self, value): - # Validate type NmlId, a restriction on xs:string. - if value is not None and Validate_simpletypes_: - if not self.gds_validate_simple_patterns( - self.validate_NmlId_patterns_, value): - warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_NmlId_patterns_, )) - validate_NmlId_patterns_ = [['^[a-zA-Z0-9_]*$']] - def hasContent_(self): - if ( - self.connection or - super(Projection, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='Projection', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='Projection') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='Projection', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='Projection'): - super(Projection, self).exportAttributes(outfile, level, already_processed, namespace_, name_='Projection') - if self.presynapticPopulation is not None and 'presynapticPopulation' not in already_processed: - already_processed.add('presynapticPopulation') - outfile.write(' presynapticPopulation=%s' % (quote_attrib(self.presynapticPopulation), )) - if self.postsynapticPopulation is not None and 'postsynapticPopulation' not in already_processed: - already_processed.add('postsynapticPopulation') - outfile.write(' postsynapticPopulation=%s' % (quote_attrib(self.postsynapticPopulation), )) - if self.synapse is not None and 'synapse' not in already_processed: - already_processed.add('synapse') - outfile.write(' synapse=%s' % (quote_attrib(self.synapse), )) - def exportChildren(self, outfile, level, namespace_='', name_='Projection', fromsubclass_=False, pretty_print=True): - super(Projection, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - for connection_ in self.connection: - connection_.export(outfile, level, namespace_, name_='connection', pretty_print=pretty_print) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - value = find_attr_value_('presynapticPopulation', node) - if value is not None and 'presynapticPopulation' not in already_processed: - already_processed.add('presynapticPopulation') - self.presynapticPopulation = value - self.validate_NmlId(self.presynapticPopulation) # validate type NmlId - value = find_attr_value_('postsynapticPopulation', node) - if value is not None and 'postsynapticPopulation' not in already_processed: - already_processed.add('postsynapticPopulation') - self.postsynapticPopulation = value - self.validate_NmlId(self.postsynapticPopulation) # validate type NmlId - value = find_attr_value_('synapse', node) - if value is not None and 'synapse' not in already_processed: - already_processed.add('synapse') - self.synapse = value - self.validate_NmlId(self.synapse) # validate type NmlId - super(Projection, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'connection': - obj_ = Connection.factory() - obj_.build(child_) - self.connection.append(obj_) - obj_.original_tagname_ = 'connection' - super(Projection, self).buildChildren(child_, node, nodeName_, True) -# end class Projection - - -class CellSet(Base): - subclass = None - superclass = Base - def __init__(self, id=None, neuroLexId=None, select=None, anytypeobjs_=None): - self.original_tagname_ = None - super(CellSet, self).__init__(id, neuroLexId, ) - self.select = _cast(None, select) - if anytypeobjs_ is None: - self.anytypeobjs_ = [] - else: - self.anytypeobjs_ = anytypeobjs_ - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, CellSet) - if subclass is not None: - return subclass(*args_, **kwargs_) - if CellSet.subclass: - return CellSet.subclass(*args_, **kwargs_) - else: - return CellSet(*args_, **kwargs_) - factory = staticmethod(factory) - def get_anytypeobjs_(self): return self.anytypeobjs_ - def set_anytypeobjs_(self, anytypeobjs_): self.anytypeobjs_ = anytypeobjs_ - def add_anytypeobjs_(self, value): self.anytypeobjs_.append(value) - def insert_anytypeobjs_(self, index, value): self._anytypeobjs_[index] = value - def get_select(self): return self.select - def set_select(self, select): self.select = select - def hasContent_(self): - if ( - self.anytypeobjs_ or - super(CellSet, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='CellSet', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='CellSet') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='CellSet', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='CellSet'): - super(CellSet, self).exportAttributes(outfile, level, already_processed, namespace_, name_='CellSet') - if self.select is not None and 'select' not in already_processed: - already_processed.add('select') - outfile.write(' select=%s' % (self.gds_encode(self.gds_format_string(quote_attrib(self.select), input_name='select')), )) - def exportChildren(self, outfile, level, namespace_='', name_='CellSet', fromsubclass_=False, pretty_print=True): - super(CellSet, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - for obj_ in self.anytypeobjs_: - obj_.export(outfile, level, namespace_, pretty_print=pretty_print) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - value = find_attr_value_('select', node) - if value is not None and 'select' not in already_processed: - already_processed.add('select') - self.select = value - super(CellSet, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - obj_ = self.gds_build_any(child_, 'CellSet') - if obj_ is not None: - self.add_anytypeobjs_(obj_) - super(CellSet, self).buildChildren(child_, node, nodeName_, True) -# end class CellSet - - -class Population(Standalone): - subclass = None - superclass = Standalone - def __init__(self, id=None, neuroLexId=None, name=None, metaid=None, notes=None, annotation=None, cell=None, network=None, component=None, size=None, type_=None, extracellularProperties=None, layout=None, instance=None): - self.original_tagname_ = None - super(Population, self).__init__(id, neuroLexId, name, metaid, notes, annotation, ) - self.cell = _cast(None, cell) - self.network = _cast(None, network) - self.component = _cast(None, component) - self.size = _cast(int, size) - self.type_ = _cast(None, type_) - self.extracellularProperties = _cast(None, extracellularProperties) - self.layout = layout - if instance is None: - self.instance = [] - else: - self.instance = instance - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, Population) - if subclass is not None: - return subclass(*args_, **kwargs_) - if Population.subclass: - return Population.subclass(*args_, **kwargs_) - else: - return Population(*args_, **kwargs_) - factory = staticmethod(factory) - def get_layout(self): return self.layout - def set_layout(self, layout): self.layout = layout - def get_instance(self): return self.instance - def set_instance(self, instance): self.instance = instance - def add_instance(self, value): self.instance.append(value) - def insert_instance_at(self, index, value): self.instance.insert(index, value) - def replace_instance_at(self, index, value): self.instance[index] = value - def get_cell(self): return self.cell - def set_cell(self, cell): self.cell = cell - def get_network(self): return self.network - def set_network(self, network): self.network = network - def get_component(self): return self.component - def set_component(self, component): self.component = component - def get_size(self): return self.size - def set_size(self, size): self.size = size - def get_type(self): return self.type_ - def set_type(self, type_): self.type_ = type_ - def get_extracellularProperties(self): return self.extracellularProperties - def set_extracellularProperties(self, extracellularProperties): self.extracellularProperties = extracellularProperties - def validate_NmlId(self, value): - # Validate type NmlId, a restriction on xs:string. - if value is not None and Validate_simpletypes_: - if not self.gds_validate_simple_patterns( - self.validate_NmlId_patterns_, value): - warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_NmlId_patterns_, )) - validate_NmlId_patterns_ = [['^[a-zA-Z0-9_]*$']] - def validate_populationTypes(self, value): - # Validate type populationTypes, a restriction on xs:string. - if value is not None and Validate_simpletypes_: - value = str(value) - enumerations = ['population', 'populationList'] - enumeration_respectee = False - for enum in enumerations: - if value == enum: - enumeration_respectee = True - break - if not enumeration_respectee: - warnings_.warn('Value "%(value)s" does not match xsd enumeration restriction on populationTypes' % {"value" : value.encode("utf-8")} ) - def hasContent_(self): - if ( - self.layout is not None or - self.instance or - super(Population, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='Population', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='Population') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='Population', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='Population'): - super(Population, self).exportAttributes(outfile, level, already_processed, namespace_, name_='Population') - if self.cell is not None and 'cell' not in already_processed: - already_processed.add('cell') - outfile.write(' cell=%s' % (quote_attrib(self.cell), )) - if self.network is not None and 'network' not in already_processed: - already_processed.add('network') - outfile.write(' network=%s' % (quote_attrib(self.network), )) - if self.component is not None and 'component' not in already_processed: - already_processed.add('component') - outfile.write(' component=%s' % (quote_attrib(self.component), )) - if self.size is not None and 'size' not in already_processed: - already_processed.add('size') - outfile.write(' size="%s"' % self.gds_format_integer(self.size, input_name='size')) - if self.type_ is not None and 'type_' not in already_processed: - already_processed.add('type_') - outfile.write(' type=%s' % (quote_attrib(self.type_), )) - if self.extracellularProperties is not None and 'extracellularProperties' not in already_processed: - already_processed.add('extracellularProperties') - outfile.write(' extracellularProperties=%s' % (quote_attrib(self.extracellularProperties), )) - def exportChildren(self, outfile, level, namespace_='', name_='Population', fromsubclass_=False, pretty_print=True): - super(Population, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.layout is not None: - self.layout.export(outfile, level, namespace_, name_='layout', pretty_print=pretty_print) - for instance_ in self.instance: - instance_.export(outfile, level, namespace_, name_='instance', pretty_print=pretty_print) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - value = find_attr_value_('cell', node) - if value is not None and 'cell' not in already_processed: - already_processed.add('cell') - self.cell = value - self.validate_NmlId(self.cell) # validate type NmlId - value = find_attr_value_('network', node) - if value is not None and 'network' not in already_processed: - already_processed.add('network') - self.network = value - self.validate_NmlId(self.network) # validate type NmlId - value = find_attr_value_('component', node) - if value is not None and 'component' not in already_processed: - already_processed.add('component') - self.component = value - self.validate_NmlId(self.component) # validate type NmlId - value = find_attr_value_('size', node) - if value is not None and 'size' not in already_processed: - already_processed.add('size') - try: - self.size = int(value) - except ValueError as exp: - raise_parse_error(node, 'Bad integer attribute: %s' % exp) - value = find_attr_value_('type', node) - if value is not None and 'type' not in already_processed: - already_processed.add('type') - self.type_ = value - self.validate_populationTypes(self.type_) # validate type populationTypes - value = find_attr_value_('extracellularProperties', node) - if value is not None and 'extracellularProperties' not in already_processed: - already_processed.add('extracellularProperties') - self.extracellularProperties = value - self.validate_NmlId(self.extracellularProperties) # validate type NmlId - super(Population, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'layout': - obj_ = Layout.factory() - obj_.build(child_) - self.layout = obj_ - obj_.original_tagname_ = 'layout' - elif nodeName_ == 'instance': - obj_ = Instance.factory() - obj_.build(child_) - self.instance.append(obj_) - obj_.original_tagname_ = 'instance' - super(Population, self).buildChildren(child_, node, nodeName_, True) -# end class Population - - -class Region(Base): - subclass = None - superclass = Base - def __init__(self, id=None, neuroLexId=None, space=None, anytypeobjs_=None): - self.original_tagname_ = None - super(Region, self).__init__(id, neuroLexId, ) - self.space = _cast(None, space) - if anytypeobjs_ is None: - self.anytypeobjs_ = [] - else: - self.anytypeobjs_ = anytypeobjs_ - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, Region) - if subclass is not None: - return subclass(*args_, **kwargs_) - if Region.subclass: - return Region.subclass(*args_, **kwargs_) - else: - return Region(*args_, **kwargs_) - factory = staticmethod(factory) - def get_anytypeobjs_(self): return self.anytypeobjs_ - def set_anytypeobjs_(self, anytypeobjs_): self.anytypeobjs_ = anytypeobjs_ - def add_anytypeobjs_(self, value): self.anytypeobjs_.append(value) - def insert_anytypeobjs_(self, index, value): self._anytypeobjs_[index] = value - def get_space(self): return self.space - def set_space(self, space): self.space = space - def validate_NmlId(self, value): - # Validate type NmlId, a restriction on xs:string. - if value is not None and Validate_simpletypes_: - if not self.gds_validate_simple_patterns( - self.validate_NmlId_patterns_, value): - warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_NmlId_patterns_, )) - validate_NmlId_patterns_ = [['^[a-zA-Z0-9_]*$']] - def hasContent_(self): - if ( - self.anytypeobjs_ or - super(Region, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='Region', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='Region') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='Region', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='Region'): - super(Region, self).exportAttributes(outfile, level, already_processed, namespace_, name_='Region') - if self.space is not None and 'space' not in already_processed: - already_processed.add('space') - outfile.write(' space=%s' % (quote_attrib(self.space), )) - def exportChildren(self, outfile, level, namespace_='', name_='Region', fromsubclass_=False, pretty_print=True): - super(Region, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - for obj_ in self.anytypeobjs_: - obj_.export(outfile, level, namespace_, pretty_print=pretty_print) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - value = find_attr_value_('space', node) - if value is not None and 'space' not in already_processed: - already_processed.add('space') - self.space = value - self.validate_NmlId(self.space) # validate type NmlId - super(Region, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - obj_ = self.gds_build_any(child_, 'Region') - if obj_ is not None: - self.add_anytypeobjs_(obj_) - super(Region, self).buildChildren(child_, node, nodeName_, True) -# end class Region - - -class Space(Base): - subclass = None - superclass = Base - def __init__(self, id=None, neuroLexId=None, basedOn=None, structure=None): - self.original_tagname_ = None - super(Space, self).__init__(id, neuroLexId, ) - self.basedOn = _cast(None, basedOn) - self.structure = structure - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, Space) - if subclass is not None: - return subclass(*args_, **kwargs_) - if Space.subclass: - return Space.subclass(*args_, **kwargs_) - else: - return Space(*args_, **kwargs_) - factory = staticmethod(factory) - def get_structure(self): return self.structure - def set_structure(self, structure): self.structure = structure - def get_basedOn(self): return self.basedOn - def set_basedOn(self, basedOn): self.basedOn = basedOn - def validate_allowedSpaces(self, value): - # Validate type allowedSpaces, a restriction on xs:string. - if value is not None and Validate_simpletypes_: - value = str(value) - enumerations = ['Euclidean_1D', 'Euclidean_2D', 'Euclidean_3D', 'Grid_1D', 'Grid_2D', 'Grid_3D'] - enumeration_respectee = False - for enum in enumerations: - if value == enum: - enumeration_respectee = True - break - if not enumeration_respectee: - warnings_.warn('Value "%(value)s" does not match xsd enumeration restriction on allowedSpaces' % {"value" : value.encode("utf-8")} ) - def hasContent_(self): - if ( - self.structure is not None or - super(Space, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='Space', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='Space') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='Space', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='Space'): - super(Space, self).exportAttributes(outfile, level, already_processed, namespace_, name_='Space') - if self.basedOn is not None and 'basedOn' not in already_processed: - already_processed.add('basedOn') - outfile.write(' basedOn=%s' % (quote_attrib(self.basedOn), )) - def exportChildren(self, outfile, level, namespace_='', name_='Space', fromsubclass_=False, pretty_print=True): - super(Space, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.structure is not None: - self.structure.export(outfile, level, namespace_, name_='structure', pretty_print=pretty_print) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - value = find_attr_value_('basedOn', node) - if value is not None and 'basedOn' not in already_processed: - already_processed.add('basedOn') - self.basedOn = value - self.validate_allowedSpaces(self.basedOn) # validate type allowedSpaces - super(Space, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'structure': - obj_ = SpaceStructure.factory() - obj_.build(child_) - self.structure = obj_ - obj_.original_tagname_ = 'structure' - super(Space, self).buildChildren(child_, node, nodeName_, True) -# end class Space - - -class Network(Standalone): - subclass = None - superclass = Standalone - def __init__(self, id=None, neuroLexId=None, name=None, metaid=None, notes=None, annotation=None, space=None, region=None, extracellularProperties=None, population=None, cellSet=None, synapticConnection=None, projection=None, explicitInput=None, inputList=None): - self.original_tagname_ = None - super(Network, self).__init__(id, neuroLexId, name, metaid, notes, annotation, ) - if space is None: - self.space = [] - else: - self.space = space - if region is None: - self.region = [] - else: - self.region = region - if extracellularProperties is None: - self.extracellularProperties = [] - else: - self.extracellularProperties = extracellularProperties - if population is None: - self.population = [] - else: - self.population = population - if cellSet is None: - self.cellSet = [] - else: - self.cellSet = cellSet - if synapticConnection is None: - self.synapticConnection = [] - else: - self.synapticConnection = synapticConnection - if projection is None: - self.projection = [] - else: - self.projection = projection - if explicitInput is None: - self.explicitInput = [] - else: - self.explicitInput = explicitInput - if inputList is None: - self.inputList = [] - else: - self.inputList = inputList - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, Network) - if subclass is not None: - return subclass(*args_, **kwargs_) - if Network.subclass: - return Network.subclass(*args_, **kwargs_) - else: - return Network(*args_, **kwargs_) - factory = staticmethod(factory) - def get_space(self): return self.space - def set_space(self, space): self.space = space - def add_space(self, value): self.space.append(value) - def insert_space_at(self, index, value): self.space.insert(index, value) - def replace_space_at(self, index, value): self.space[index] = value - def get_region(self): return self.region - def set_region(self, region): self.region = region - def add_region(self, value): self.region.append(value) - def insert_region_at(self, index, value): self.region.insert(index, value) - def replace_region_at(self, index, value): self.region[index] = value - def get_extracellularProperties(self): return self.extracellularProperties - def set_extracellularProperties(self, extracellularProperties): self.extracellularProperties = extracellularProperties - def add_extracellularProperties(self, value): self.extracellularProperties.append(value) - def insert_extracellularProperties_at(self, index, value): self.extracellularProperties.insert(index, value) - def replace_extracellularProperties_at(self, index, value): self.extracellularProperties[index] = value - def get_population(self): return self.population - def set_population(self, population): self.population = population - def add_population(self, value): self.population.append(value) - def insert_population_at(self, index, value): self.population.insert(index, value) - def replace_population_at(self, index, value): self.population[index] = value - def get_cellSet(self): return self.cellSet - def set_cellSet(self, cellSet): self.cellSet = cellSet - def add_cellSet(self, value): self.cellSet.append(value) - def insert_cellSet_at(self, index, value): self.cellSet.insert(index, value) - def replace_cellSet_at(self, index, value): self.cellSet[index] = value - def get_synapticConnection(self): return self.synapticConnection - def set_synapticConnection(self, synapticConnection): self.synapticConnection = synapticConnection - def add_synapticConnection(self, value): self.synapticConnection.append(value) - def insert_synapticConnection_at(self, index, value): self.synapticConnection.insert(index, value) - def replace_synapticConnection_at(self, index, value): self.synapticConnection[index] = value - def get_projection(self): return self.projection - def set_projection(self, projection): self.projection = projection - def add_projection(self, value): self.projection.append(value) - def insert_projection_at(self, index, value): self.projection.insert(index, value) - def replace_projection_at(self, index, value): self.projection[index] = value - def get_explicitInput(self): return self.explicitInput - def set_explicitInput(self, explicitInput): self.explicitInput = explicitInput - def add_explicitInput(self, value): self.explicitInput.append(value) - def insert_explicitInput_at(self, index, value): self.explicitInput.insert(index, value) - def replace_explicitInput_at(self, index, value): self.explicitInput[index] = value - def get_inputList(self): return self.inputList - def set_inputList(self, inputList): self.inputList = inputList - def add_inputList(self, value): self.inputList.append(value) - def insert_inputList_at(self, index, value): self.inputList.insert(index, value) - def replace_inputList_at(self, index, value): self.inputList[index] = value - def hasContent_(self): - if ( - self.space or - self.region or - self.extracellularProperties or - self.population or - self.cellSet or - self.synapticConnection or - self.projection or - self.explicitInput or - self.inputList or - super(Network, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='Network', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='Network') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='Network', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='Network'): - super(Network, self).exportAttributes(outfile, level, already_processed, namespace_, name_='Network') - def exportChildren(self, outfile, level, namespace_='', name_='Network', fromsubclass_=False, pretty_print=True): - super(Network, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - for space_ in self.space: - space_.export(outfile, level, namespace_, name_='space', pretty_print=pretty_print) - for region_ in self.region: - region_.export(outfile, level, namespace_, name_='region', pretty_print=pretty_print) - for extracellularProperties_ in self.extracellularProperties: - extracellularProperties_.export(outfile, level, namespace_, name_='extracellularProperties', pretty_print=pretty_print) - for population_ in self.population: - population_.export(outfile, level, namespace_, name_='population', pretty_print=pretty_print) - for cellSet_ in self.cellSet: - cellSet_.export(outfile, level, namespace_, name_='cellSet', pretty_print=pretty_print) - for synapticConnection_ in self.synapticConnection: - synapticConnection_.export(outfile, level, namespace_, name_='synapticConnection', pretty_print=pretty_print) - for projection_ in self.projection: - projection_.export(outfile, level, namespace_, name_='projection', pretty_print=pretty_print) - for explicitInput_ in self.explicitInput: - explicitInput_.export(outfile, level, namespace_, name_='explicitInput', pretty_print=pretty_print) - for inputList_ in self.inputList: - inputList_.export(outfile, level, namespace_, name_='inputList', pretty_print=pretty_print) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(Network, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'space': - obj_ = Space.factory() - obj_.build(child_) - self.space.append(obj_) - obj_.original_tagname_ = 'space' - elif nodeName_ == 'region': - obj_ = Region.factory() - obj_.build(child_) - self.region.append(obj_) - obj_.original_tagname_ = 'region' - elif nodeName_ == 'extracellularProperties': - obj_ = ExtracellularPropertiesLocal.factory() - obj_.build(child_) - self.extracellularProperties.append(obj_) - obj_.original_tagname_ = 'extracellularProperties' - elif nodeName_ == 'population': - obj_ = Population.factory() - obj_.build(child_) - self.population.append(obj_) - obj_.original_tagname_ = 'population' - elif nodeName_ == 'cellSet': - obj_ = CellSet.factory() - obj_.build(child_) - self.cellSet.append(obj_) - obj_.original_tagname_ = 'cellSet' - elif nodeName_ == 'synapticConnection': - obj_ = SynapticConnection.factory() - obj_.build(child_) - self.synapticConnection.append(obj_) - obj_.original_tagname_ = 'synapticConnection' - elif nodeName_ == 'projection': - obj_ = Projection.factory() - obj_.build(child_) - self.projection.append(obj_) - obj_.original_tagname_ = 'projection' - elif nodeName_ == 'explicitInput': - obj_ = ExplicitInput.factory() - obj_.build(child_) - self.explicitInput.append(obj_) - obj_.original_tagname_ = 'explicitInput' - elif nodeName_ == 'inputList': - obj_ = InputList.factory() - obj_.build(child_) - self.inputList.append(obj_) - obj_.original_tagname_ = 'inputList' - super(Network, self).buildChildren(child_, node, nodeName_, True) -# end class Network - - -class SpikeGeneratorPoisson(Standalone): - subclass = None - superclass = Standalone - def __init__(self, id=None, neuroLexId=None, name=None, metaid=None, notes=None, annotation=None, averageRate=None): - self.original_tagname_ = None - super(SpikeGeneratorPoisson, self).__init__(id, neuroLexId, name, metaid, notes, annotation, ) - self.averageRate = _cast(None, averageRate) - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, SpikeGeneratorPoisson) - if subclass is not None: - return subclass(*args_, **kwargs_) - if SpikeGeneratorPoisson.subclass: - return SpikeGeneratorPoisson.subclass(*args_, **kwargs_) - else: - return SpikeGeneratorPoisson(*args_, **kwargs_) - factory = staticmethod(factory) - def get_averageRate(self): return self.averageRate - def set_averageRate(self, averageRate): self.averageRate = averageRate - def validate_Nml2Quantity_pertime(self, value): - # Validate type Nml2Quantity_pertime, a restriction on xs:string. - if value is not None and Validate_simpletypes_: - if not self.gds_validate_simple_patterns( - self.validate_Nml2Quantity_pertime_patterns_, value): - warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_Nml2Quantity_pertime_patterns_, )) - validate_Nml2Quantity_pertime_patterns_ = [['^-?([0-9]*(\\.[0-9]+)?)([eE]-?[0-9]+)?[\\s]*(per_s|per_ms|Hz)$']] - def hasContent_(self): - if ( - super(SpikeGeneratorPoisson, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='SpikeGeneratorPoisson', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='SpikeGeneratorPoisson') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='SpikeGeneratorPoisson', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='SpikeGeneratorPoisson'): - super(SpikeGeneratorPoisson, self).exportAttributes(outfile, level, already_processed, namespace_, name_='SpikeGeneratorPoisson') - if self.averageRate is not None and 'averageRate' not in already_processed: - already_processed.add('averageRate') - outfile.write(' averageRate=%s' % (quote_attrib(self.averageRate), )) - def exportChildren(self, outfile, level, namespace_='', name_='SpikeGeneratorPoisson', fromsubclass_=False, pretty_print=True): - super(SpikeGeneratorPoisson, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - value = find_attr_value_('averageRate', node) - if value is not None and 'averageRate' not in already_processed: - already_processed.add('averageRate') - self.averageRate = value - self.validate_Nml2Quantity_pertime(self.averageRate) # validate type Nml2Quantity_pertime - super(SpikeGeneratorPoisson, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(SpikeGeneratorPoisson, self).buildChildren(child_, node, nodeName_, True) - pass -# end class SpikeGeneratorPoisson - - -class SpikeGeneratorRandom(Standalone): - subclass = None - superclass = Standalone - def __init__(self, id=None, neuroLexId=None, name=None, metaid=None, notes=None, annotation=None, maxISI=None, minISI=None): - self.original_tagname_ = None - super(SpikeGeneratorRandom, self).__init__(id, neuroLexId, name, metaid, notes, annotation, ) - self.maxISI = _cast(None, maxISI) - self.minISI = _cast(None, minISI) - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, SpikeGeneratorRandom) - if subclass is not None: - return subclass(*args_, **kwargs_) - if SpikeGeneratorRandom.subclass: - return SpikeGeneratorRandom.subclass(*args_, **kwargs_) - else: - return SpikeGeneratorRandom(*args_, **kwargs_) - factory = staticmethod(factory) - def get_maxISI(self): return self.maxISI - def set_maxISI(self, maxISI): self.maxISI = maxISI - def get_minISI(self): return self.minISI - def set_minISI(self, minISI): self.minISI = minISI - def validate_Nml2Quantity_time(self, value): - # Validate type Nml2Quantity_time, a restriction on xs:string. - if value is not None and Validate_simpletypes_: - if not self.gds_validate_simple_patterns( - self.validate_Nml2Quantity_time_patterns_, value): - warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_Nml2Quantity_time_patterns_, )) - validate_Nml2Quantity_time_patterns_ = [['^-?([0-9]*(\\.[0-9]+)?)([eE]-?[0-9]+)?[\\s]*(s|ms)$']] - def hasContent_(self): - if ( - super(SpikeGeneratorRandom, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='SpikeGeneratorRandom', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='SpikeGeneratorRandom') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='SpikeGeneratorRandom', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='SpikeGeneratorRandom'): - super(SpikeGeneratorRandom, self).exportAttributes(outfile, level, already_processed, namespace_, name_='SpikeGeneratorRandom') - if self.maxISI is not None and 'maxISI' not in already_processed: - already_processed.add('maxISI') - outfile.write(' maxISI=%s' % (quote_attrib(self.maxISI), )) - if self.minISI is not None and 'minISI' not in already_processed: - already_processed.add('minISI') - outfile.write(' minISI=%s' % (quote_attrib(self.minISI), )) - def exportChildren(self, outfile, level, namespace_='', name_='SpikeGeneratorRandom', fromsubclass_=False, pretty_print=True): - super(SpikeGeneratorRandom, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - value = find_attr_value_('maxISI', node) - if value is not None and 'maxISI' not in already_processed: - already_processed.add('maxISI') - self.maxISI = value - self.validate_Nml2Quantity_time(self.maxISI) # validate type Nml2Quantity_time - value = find_attr_value_('minISI', node) - if value is not None and 'minISI' not in already_processed: - already_processed.add('minISI') - self.minISI = value - self.validate_Nml2Quantity_time(self.minISI) # validate type Nml2Quantity_time - super(SpikeGeneratorRandom, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(SpikeGeneratorRandom, self).buildChildren(child_, node, nodeName_, True) - pass -# end class SpikeGeneratorRandom - - -class SpikeGenerator(Standalone): - subclass = None - superclass = Standalone - def __init__(self, id=None, neuroLexId=None, name=None, metaid=None, notes=None, annotation=None, period=None): - self.original_tagname_ = None - super(SpikeGenerator, self).__init__(id, neuroLexId, name, metaid, notes, annotation, ) - self.period = _cast(None, period) - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, SpikeGenerator) - if subclass is not None: - return subclass(*args_, **kwargs_) - if SpikeGenerator.subclass: - return SpikeGenerator.subclass(*args_, **kwargs_) - else: - return SpikeGenerator(*args_, **kwargs_) - factory = staticmethod(factory) - def get_period(self): return self.period - def set_period(self, period): self.period = period - def validate_Nml2Quantity_time(self, value): - # Validate type Nml2Quantity_time, a restriction on xs:string. - if value is not None and Validate_simpletypes_: - if not self.gds_validate_simple_patterns( - self.validate_Nml2Quantity_time_patterns_, value): - warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_Nml2Quantity_time_patterns_, )) - validate_Nml2Quantity_time_patterns_ = [['^-?([0-9]*(\\.[0-9]+)?)([eE]-?[0-9]+)?[\\s]*(s|ms)$']] - def hasContent_(self): - if ( - super(SpikeGenerator, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='SpikeGenerator', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='SpikeGenerator') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='SpikeGenerator', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='SpikeGenerator'): - super(SpikeGenerator, self).exportAttributes(outfile, level, already_processed, namespace_, name_='SpikeGenerator') - if self.period is not None and 'period' not in already_processed: - already_processed.add('period') - outfile.write(' period=%s' % (quote_attrib(self.period), )) - def exportChildren(self, outfile, level, namespace_='', name_='SpikeGenerator', fromsubclass_=False, pretty_print=True): - super(SpikeGenerator, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - value = find_attr_value_('period', node) - if value is not None and 'period' not in already_processed: - already_processed.add('period') - self.period = value - self.validate_Nml2Quantity_time(self.period) # validate type Nml2Quantity_time - super(SpikeGenerator, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(SpikeGenerator, self).buildChildren(child_, node, nodeName_, True) - pass -# end class SpikeGenerator - - -class SpikeArray(Standalone): - subclass = None - superclass = Standalone - def __init__(self, id=None, neuroLexId=None, name=None, metaid=None, notes=None, annotation=None, spike=None): - self.original_tagname_ = None - super(SpikeArray, self).__init__(id, neuroLexId, name, metaid, notes, annotation, ) - if spike is None: - self.spike = [] - else: - self.spike = spike - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, SpikeArray) - if subclass is not None: - return subclass(*args_, **kwargs_) - if SpikeArray.subclass: - return SpikeArray.subclass(*args_, **kwargs_) - else: - return SpikeArray(*args_, **kwargs_) - factory = staticmethod(factory) - def get_spike(self): return self.spike - def set_spike(self, spike): self.spike = spike - def add_spike(self, value): self.spike.append(value) - def insert_spike_at(self, index, value): self.spike.insert(index, value) - def replace_spike_at(self, index, value): self.spike[index] = value - def hasContent_(self): - if ( - self.spike or - super(SpikeArray, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='SpikeArray', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='SpikeArray') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='SpikeArray', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='SpikeArray'): - super(SpikeArray, self).exportAttributes(outfile, level, already_processed, namespace_, name_='SpikeArray') - def exportChildren(self, outfile, level, namespace_='', name_='SpikeArray', fromsubclass_=False, pretty_print=True): - super(SpikeArray, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - for spike_ in self.spike: - spike_.export(outfile, level, namespace_, name_='spike', pretty_print=pretty_print) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(SpikeArray, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'spike': - obj_ = Spike.factory() - obj_.build(child_) - self.spike.append(obj_) - obj_.original_tagname_ = 'spike' - super(SpikeArray, self).buildChildren(child_, node, nodeName_, True) -# end class SpikeArray - - -class Spike(Standalone): - subclass = None - superclass = Standalone - def __init__(self, id=None, neuroLexId=None, name=None, metaid=None, notes=None, annotation=None, time=None): - self.original_tagname_ = None - super(Spike, self).__init__(id, neuroLexId, name, metaid, notes, annotation, ) - self.time = _cast(None, time) - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, Spike) - if subclass is not None: - return subclass(*args_, **kwargs_) - if Spike.subclass: - return Spike.subclass(*args_, **kwargs_) - else: - return Spike(*args_, **kwargs_) - factory = staticmethod(factory) - def get_time(self): return self.time - def set_time(self, time): self.time = time - def validate_Nml2Quantity_time(self, value): - # Validate type Nml2Quantity_time, a restriction on xs:string. - if value is not None and Validate_simpletypes_: - if not self.gds_validate_simple_patterns( - self.validate_Nml2Quantity_time_patterns_, value): - warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_Nml2Quantity_time_patterns_, )) - validate_Nml2Quantity_time_patterns_ = [['^-?([0-9]*(\\.[0-9]+)?)([eE]-?[0-9]+)?[\\s]*(s|ms)$']] - def hasContent_(self): - if ( - super(Spike, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='Spike', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='Spike') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='Spike', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='Spike'): - super(Spike, self).exportAttributes(outfile, level, already_processed, namespace_, name_='Spike') - if self.time is not None and 'time' not in already_processed: - already_processed.add('time') - outfile.write(' time=%s' % (quote_attrib(self.time), )) - def exportChildren(self, outfile, level, namespace_='', name_='Spike', fromsubclass_=False, pretty_print=True): - super(Spike, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - value = find_attr_value_('time', node) - if value is not None and 'time' not in already_processed: - already_processed.add('time') - self.time = value - self.validate_Nml2Quantity_time(self.time) # validate type Nml2Quantity_time - super(Spike, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(Spike, self).buildChildren(child_, node, nodeName_, True) - pass -# end class Spike - - -class VoltageClamp(Standalone): - subclass = None - superclass = Standalone - def __init__(self, id=None, neuroLexId=None, name=None, metaid=None, notes=None, annotation=None, delay=None, duration=None, targetVoltage=None, seriesResistance=None): - self.original_tagname_ = None - super(VoltageClamp, self).__init__(id, neuroLexId, name, metaid, notes, annotation, ) - self.delay = _cast(None, delay) - self.duration = _cast(None, duration) - self.targetVoltage = _cast(None, targetVoltage) - self.seriesResistance = _cast(None, seriesResistance) - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, VoltageClamp) - if subclass is not None: - return subclass(*args_, **kwargs_) - if VoltageClamp.subclass: - return VoltageClamp.subclass(*args_, **kwargs_) - else: - return VoltageClamp(*args_, **kwargs_) - factory = staticmethod(factory) - def get_delay(self): return self.delay - def set_delay(self, delay): self.delay = delay - def get_duration(self): return self.duration - def set_duration(self, duration): self.duration = duration - def get_targetVoltage(self): return self.targetVoltage - def set_targetVoltage(self, targetVoltage): self.targetVoltage = targetVoltage - def get_seriesResistance(self): return self.seriesResistance - def set_seriesResistance(self, seriesResistance): self.seriesResistance = seriesResistance - def validate_Nml2Quantity_time(self, value): - # Validate type Nml2Quantity_time, a restriction on xs:string. - if value is not None and Validate_simpletypes_: - if not self.gds_validate_simple_patterns( - self.validate_Nml2Quantity_time_patterns_, value): - warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_Nml2Quantity_time_patterns_, )) - validate_Nml2Quantity_time_patterns_ = [['^-?([0-9]*(\\.[0-9]+)?)([eE]-?[0-9]+)?[\\s]*(s|ms)$']] - def validate_Nml2Quantity_voltage(self, value): - # Validate type Nml2Quantity_voltage, a restriction on xs:string. - if value is not None and Validate_simpletypes_: - if not self.gds_validate_simple_patterns( - self.validate_Nml2Quantity_voltage_patterns_, value): - warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_Nml2Quantity_voltage_patterns_, )) - validate_Nml2Quantity_voltage_patterns_ = [['^-?([0-9]*(\\.[0-9]+)?)([eE]-?[0-9]+)?[\\s]*(V|mV)$']] - def validate_Nml2Quantity_resistance(self, value): - # Validate type Nml2Quantity_resistance, a restriction on xs:string. - if value is not None and Validate_simpletypes_: - if not self.gds_validate_simple_patterns( - self.validate_Nml2Quantity_resistance_patterns_, value): - warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_Nml2Quantity_resistance_patterns_, )) - validate_Nml2Quantity_resistance_patterns_ = [['^-?([0-9]*(\\.[0-9]+)?)([eE]-?[0-9]+)?[\\s]*(ohm|Kohm|Mohm)$']] - def hasContent_(self): - if ( - super(VoltageClamp, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='VoltageClamp', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='VoltageClamp') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='VoltageClamp', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='VoltageClamp'): - super(VoltageClamp, self).exportAttributes(outfile, level, already_processed, namespace_, name_='VoltageClamp') - if self.delay is not None and 'delay' not in already_processed: - already_processed.add('delay') - outfile.write(' delay=%s' % (quote_attrib(self.delay), )) - if self.duration is not None and 'duration' not in already_processed: - already_processed.add('duration') - outfile.write(' duration=%s' % (quote_attrib(self.duration), )) - if self.targetVoltage is not None and 'targetVoltage' not in already_processed: - already_processed.add('targetVoltage') - outfile.write(' targetVoltage=%s' % (quote_attrib(self.targetVoltage), )) - if self.seriesResistance is not None and 'seriesResistance' not in already_processed: - already_processed.add('seriesResistance') - outfile.write(' seriesResistance=%s' % (quote_attrib(self.seriesResistance), )) - def exportChildren(self, outfile, level, namespace_='', name_='VoltageClamp', fromsubclass_=False, pretty_print=True): - super(VoltageClamp, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - value = find_attr_value_('delay', node) - if value is not None and 'delay' not in already_processed: - already_processed.add('delay') - self.delay = value - self.validate_Nml2Quantity_time(self.delay) # validate type Nml2Quantity_time - value = find_attr_value_('duration', node) - if value is not None and 'duration' not in already_processed: - already_processed.add('duration') - self.duration = value - self.validate_Nml2Quantity_time(self.duration) # validate type Nml2Quantity_time - value = find_attr_value_('targetVoltage', node) - if value is not None and 'targetVoltage' not in already_processed: - already_processed.add('targetVoltage') - self.targetVoltage = value - self.validate_Nml2Quantity_voltage(self.targetVoltage) # validate type Nml2Quantity_voltage - value = find_attr_value_('seriesResistance', node) - if value is not None and 'seriesResistance' not in already_processed: - already_processed.add('seriesResistance') - self.seriesResistance = value - self.validate_Nml2Quantity_resistance(self.seriesResistance) # validate type Nml2Quantity_resistance - super(VoltageClamp, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(VoltageClamp, self).buildChildren(child_, node, nodeName_, True) - pass -# end class VoltageClamp - - -class RampGenerator(Standalone): - subclass = None - superclass = Standalone - def __init__(self, id=None, neuroLexId=None, name=None, metaid=None, notes=None, annotation=None, delay=None, duration=None, startAmplitude=None, finishAmplitude=None, baselineAmplitude=None): - self.original_tagname_ = None - super(RampGenerator, self).__init__(id, neuroLexId, name, metaid, notes, annotation, ) - self.delay = _cast(None, delay) - self.duration = _cast(None, duration) - self.startAmplitude = _cast(None, startAmplitude) - self.finishAmplitude = _cast(None, finishAmplitude) - self.baselineAmplitude = _cast(None, baselineAmplitude) - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, RampGenerator) - if subclass is not None: - return subclass(*args_, **kwargs_) - if RampGenerator.subclass: - return RampGenerator.subclass(*args_, **kwargs_) - else: - return RampGenerator(*args_, **kwargs_) - factory = staticmethod(factory) - def get_delay(self): return self.delay - def set_delay(self, delay): self.delay = delay - def get_duration(self): return self.duration - def set_duration(self, duration): self.duration = duration - def get_startAmplitude(self): return self.startAmplitude - def set_startAmplitude(self, startAmplitude): self.startAmplitude = startAmplitude - def get_finishAmplitude(self): return self.finishAmplitude - def set_finishAmplitude(self, finishAmplitude): self.finishAmplitude = finishAmplitude - def get_baselineAmplitude(self): return self.baselineAmplitude - def set_baselineAmplitude(self, baselineAmplitude): self.baselineAmplitude = baselineAmplitude - def validate_Nml2Quantity_time(self, value): - # Validate type Nml2Quantity_time, a restriction on xs:string. - if value is not None and Validate_simpletypes_: - if not self.gds_validate_simple_patterns( - self.validate_Nml2Quantity_time_patterns_, value): - warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_Nml2Quantity_time_patterns_, )) - validate_Nml2Quantity_time_patterns_ = [['^-?([0-9]*(\\.[0-9]+)?)([eE]-?[0-9]+)?[\\s]*(s|ms)$']] - def validate_Nml2Quantity_current(self, value): - # Validate type Nml2Quantity_current, a restriction on xs:string. - if value is not None and Validate_simpletypes_: - if not self.gds_validate_simple_patterns( - self.validate_Nml2Quantity_current_patterns_, value): - warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_Nml2Quantity_current_patterns_, )) - validate_Nml2Quantity_current_patterns_ = [['^-?([0-9]*(\\.[0-9]+)?)([eE]-?[0-9]+)?[\\s]*(A|uA|nA|pA)$']] - def hasContent_(self): - if ( - super(RampGenerator, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='RampGenerator', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='RampGenerator') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='RampGenerator', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='RampGenerator'): - super(RampGenerator, self).exportAttributes(outfile, level, already_processed, namespace_, name_='RampGenerator') - if self.delay is not None and 'delay' not in already_processed: - already_processed.add('delay') - outfile.write(' delay=%s' % (quote_attrib(self.delay), )) - if self.duration is not None and 'duration' not in already_processed: - already_processed.add('duration') - outfile.write(' duration=%s' % (quote_attrib(self.duration), )) - if self.startAmplitude is not None and 'startAmplitude' not in already_processed: - already_processed.add('startAmplitude') - outfile.write(' startAmplitude=%s' % (quote_attrib(self.startAmplitude), )) - if self.finishAmplitude is not None and 'finishAmplitude' not in already_processed: - already_processed.add('finishAmplitude') - outfile.write(' finishAmplitude=%s' % (quote_attrib(self.finishAmplitude), )) - if self.baselineAmplitude is not None and 'baselineAmplitude' not in already_processed: - already_processed.add('baselineAmplitude') - outfile.write(' baselineAmplitude=%s' % (quote_attrib(self.baselineAmplitude), )) - def exportChildren(self, outfile, level, namespace_='', name_='RampGenerator', fromsubclass_=False, pretty_print=True): - super(RampGenerator, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - value = find_attr_value_('delay', node) - if value is not None and 'delay' not in already_processed: - already_processed.add('delay') - self.delay = value - self.validate_Nml2Quantity_time(self.delay) # validate type Nml2Quantity_time - value = find_attr_value_('duration', node) - if value is not None and 'duration' not in already_processed: - already_processed.add('duration') - self.duration = value - self.validate_Nml2Quantity_time(self.duration) # validate type Nml2Quantity_time - value = find_attr_value_('startAmplitude', node) - if value is not None and 'startAmplitude' not in already_processed: - already_processed.add('startAmplitude') - self.startAmplitude = value - self.validate_Nml2Quantity_current(self.startAmplitude) # validate type Nml2Quantity_current - value = find_attr_value_('finishAmplitude', node) - if value is not None and 'finishAmplitude' not in already_processed: - already_processed.add('finishAmplitude') - self.finishAmplitude = value - self.validate_Nml2Quantity_current(self.finishAmplitude) # validate type Nml2Quantity_current - value = find_attr_value_('baselineAmplitude', node) - if value is not None and 'baselineAmplitude' not in already_processed: - already_processed.add('baselineAmplitude') - self.baselineAmplitude = value - self.validate_Nml2Quantity_current(self.baselineAmplitude) # validate type Nml2Quantity_current - super(RampGenerator, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(RampGenerator, self).buildChildren(child_, node, nodeName_, True) - pass -# end class RampGenerator - - -class SineGenerator(Standalone): - subclass = None - superclass = Standalone - def __init__(self, id=None, neuroLexId=None, name=None, metaid=None, notes=None, annotation=None, delay=None, phase=None, duration=None, amplitude=None, period=None): - self.original_tagname_ = None - super(SineGenerator, self).__init__(id, neuroLexId, name, metaid, notes, annotation, ) - self.delay = _cast(None, delay) - self.phase = _cast(None, phase) - self.duration = _cast(None, duration) - self.amplitude = _cast(None, amplitude) - self.period = _cast(None, period) - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, SineGenerator) - if subclass is not None: - return subclass(*args_, **kwargs_) - if SineGenerator.subclass: - return SineGenerator.subclass(*args_, **kwargs_) - else: - return SineGenerator(*args_, **kwargs_) - factory = staticmethod(factory) - def get_delay(self): return self.delay - def set_delay(self, delay): self.delay = delay - def get_phase(self): return self.phase - def set_phase(self, phase): self.phase = phase - def get_duration(self): return self.duration - def set_duration(self, duration): self.duration = duration - def get_amplitude(self): return self.amplitude - def set_amplitude(self, amplitude): self.amplitude = amplitude - def get_period(self): return self.period - def set_period(self, period): self.period = period - def validate_Nml2Quantity_time(self, value): - # Validate type Nml2Quantity_time, a restriction on xs:string. - if value is not None and Validate_simpletypes_: - if not self.gds_validate_simple_patterns( - self.validate_Nml2Quantity_time_patterns_, value): - warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_Nml2Quantity_time_patterns_, )) - validate_Nml2Quantity_time_patterns_ = [['^-?([0-9]*(\\.[0-9]+)?)([eE]-?[0-9]+)?[\\s]*(s|ms)$']] - def validate_Nml2Quantity_none(self, value): - # Validate type Nml2Quantity_none, a restriction on xs:string. - if value is not None and Validate_simpletypes_: - if not self.gds_validate_simple_patterns( - self.validate_Nml2Quantity_none_patterns_, value): - warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_Nml2Quantity_none_patterns_, )) - validate_Nml2Quantity_none_patterns_ = [['^-?([0-9]*(\\.[0-9]+)?)([eE]-?[0-9]+)?$']] - def validate_Nml2Quantity_current(self, value): - # Validate type Nml2Quantity_current, a restriction on xs:string. - if value is not None and Validate_simpletypes_: - if not self.gds_validate_simple_patterns( - self.validate_Nml2Quantity_current_patterns_, value): - warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_Nml2Quantity_current_patterns_, )) - validate_Nml2Quantity_current_patterns_ = [['^-?([0-9]*(\\.[0-9]+)?)([eE]-?[0-9]+)?[\\s]*(A|uA|nA|pA)$']] - def hasContent_(self): - if ( - super(SineGenerator, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='SineGenerator', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='SineGenerator') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='SineGenerator', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='SineGenerator'): - super(SineGenerator, self).exportAttributes(outfile, level, already_processed, namespace_, name_='SineGenerator') - if self.delay is not None and 'delay' not in already_processed: - already_processed.add('delay') - outfile.write(' delay=%s' % (quote_attrib(self.delay), )) - if self.phase is not None and 'phase' not in already_processed: - already_processed.add('phase') - outfile.write(' phase=%s' % (quote_attrib(self.phase), )) - if self.duration is not None and 'duration' not in already_processed: - already_processed.add('duration') - outfile.write(' duration=%s' % (quote_attrib(self.duration), )) - if self.amplitude is not None and 'amplitude' not in already_processed: - already_processed.add('amplitude') - outfile.write(' amplitude=%s' % (quote_attrib(self.amplitude), )) - if self.period is not None and 'period' not in already_processed: - already_processed.add('period') - outfile.write(' period=%s' % (quote_attrib(self.period), )) - def exportChildren(self, outfile, level, namespace_='', name_='SineGenerator', fromsubclass_=False, pretty_print=True): - super(SineGenerator, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - value = find_attr_value_('delay', node) - if value is not None and 'delay' not in already_processed: - already_processed.add('delay') - self.delay = value - self.validate_Nml2Quantity_time(self.delay) # validate type Nml2Quantity_time - value = find_attr_value_('phase', node) - if value is not None and 'phase' not in already_processed: - already_processed.add('phase') - self.phase = value - self.validate_Nml2Quantity_none(self.phase) # validate type Nml2Quantity_none - value = find_attr_value_('duration', node) - if value is not None and 'duration' not in already_processed: - already_processed.add('duration') - self.duration = value - self.validate_Nml2Quantity_time(self.duration) # validate type Nml2Quantity_time - value = find_attr_value_('amplitude', node) - if value is not None and 'amplitude' not in already_processed: - already_processed.add('amplitude') - self.amplitude = value - self.validate_Nml2Quantity_current(self.amplitude) # validate type Nml2Quantity_current - value = find_attr_value_('period', node) - if value is not None and 'period' not in already_processed: - already_processed.add('period') - self.period = value - self.validate_Nml2Quantity_time(self.period) # validate type Nml2Quantity_time - super(SineGenerator, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(SineGenerator, self).buildChildren(child_, node, nodeName_, True) - pass -# end class SineGenerator - - -class PulseGenerator(Standalone): - subclass = None - superclass = Standalone - def __init__(self, id=None, neuroLexId=None, name=None, metaid=None, notes=None, annotation=None, delay=None, duration=None, amplitude=None): - self.original_tagname_ = None - super(PulseGenerator, self).__init__(id, neuroLexId, name, metaid, notes, annotation, ) - self.delay = _cast(None, delay) - self.duration = _cast(None, duration) - self.amplitude = _cast(None, amplitude) - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, PulseGenerator) - if subclass is not None: - return subclass(*args_, **kwargs_) - if PulseGenerator.subclass: - return PulseGenerator.subclass(*args_, **kwargs_) - else: - return PulseGenerator(*args_, **kwargs_) - factory = staticmethod(factory) - def get_delay(self): return self.delay - def set_delay(self, delay): self.delay = delay - def get_duration(self): return self.duration - def set_duration(self, duration): self.duration = duration - def get_amplitude(self): return self.amplitude - def set_amplitude(self, amplitude): self.amplitude = amplitude - def validate_Nml2Quantity_time(self, value): - # Validate type Nml2Quantity_time, a restriction on xs:string. - if value is not None and Validate_simpletypes_: - if not self.gds_validate_simple_patterns( - self.validate_Nml2Quantity_time_patterns_, value): - warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_Nml2Quantity_time_patterns_, )) - validate_Nml2Quantity_time_patterns_ = [['^-?([0-9]*(\\.[0-9]+)?)([eE]-?[0-9]+)?[\\s]*(s|ms)$']] - def validate_Nml2Quantity_current(self, value): - # Validate type Nml2Quantity_current, a restriction on xs:string. - if value is not None and Validate_simpletypes_: - if not self.gds_validate_simple_patterns( - self.validate_Nml2Quantity_current_patterns_, value): - warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_Nml2Quantity_current_patterns_, )) - validate_Nml2Quantity_current_patterns_ = [['^-?([0-9]*(\\.[0-9]+)?)([eE]-?[0-9]+)?[\\s]*(A|uA|nA|pA)$']] - def hasContent_(self): - if ( - super(PulseGenerator, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='PulseGenerator', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='PulseGenerator') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='PulseGenerator', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='PulseGenerator'): - super(PulseGenerator, self).exportAttributes(outfile, level, already_processed, namespace_, name_='PulseGenerator') - if self.delay is not None and 'delay' not in already_processed: - already_processed.add('delay') - outfile.write(' delay=%s' % (quote_attrib(self.delay), )) - if self.duration is not None and 'duration' not in already_processed: - already_processed.add('duration') - outfile.write(' duration=%s' % (quote_attrib(self.duration), )) - if self.amplitude is not None and 'amplitude' not in already_processed: - already_processed.add('amplitude') - outfile.write(' amplitude=%s' % (quote_attrib(self.amplitude), )) - def exportChildren(self, outfile, level, namespace_='', name_='PulseGenerator', fromsubclass_=False, pretty_print=True): - super(PulseGenerator, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - value = find_attr_value_('delay', node) - if value is not None and 'delay' not in already_processed: - already_processed.add('delay') - self.delay = value - self.validate_Nml2Quantity_time(self.delay) # validate type Nml2Quantity_time - value = find_attr_value_('duration', node) - if value is not None and 'duration' not in already_processed: - already_processed.add('duration') - self.duration = value - self.validate_Nml2Quantity_time(self.duration) # validate type Nml2Quantity_time - value = find_attr_value_('amplitude', node) - if value is not None and 'amplitude' not in already_processed: - already_processed.add('amplitude') - self.amplitude = value - self.validate_Nml2Quantity_current(self.amplitude) # validate type Nml2Quantity_current - super(PulseGenerator, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(PulseGenerator, self).buildChildren(child_, node, nodeName_, True) - pass -# end class PulseGenerator - - -class ReactionScheme(Base): - subclass = None - superclass = Base - def __init__(self, id=None, neuroLexId=None, source=None, type_=None, anytypeobjs_=None): - self.original_tagname_ = None - super(ReactionScheme, self).__init__(id, neuroLexId, ) - self.source = _cast(None, source) - self.type_ = _cast(None, type_) - if anytypeobjs_ is None: - self.anytypeobjs_ = [] - else: - self.anytypeobjs_ = anytypeobjs_ - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, ReactionScheme) - if subclass is not None: - return subclass(*args_, **kwargs_) - if ReactionScheme.subclass: - return ReactionScheme.subclass(*args_, **kwargs_) - else: - return ReactionScheme(*args_, **kwargs_) - factory = staticmethod(factory) - def get_anytypeobjs_(self): return self.anytypeobjs_ - def set_anytypeobjs_(self, anytypeobjs_): self.anytypeobjs_ = anytypeobjs_ - def add_anytypeobjs_(self, value): self.anytypeobjs_.append(value) - def insert_anytypeobjs_(self, index, value): self._anytypeobjs_[index] = value - def get_source(self): return self.source - def set_source(self, source): self.source = source - def get_type(self): return self.type_ - def set_type(self, type_): self.type_ = type_ - def hasContent_(self): - if ( - self.anytypeobjs_ or - super(ReactionScheme, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='ReactionScheme', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='ReactionScheme') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='ReactionScheme', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='ReactionScheme'): - super(ReactionScheme, self).exportAttributes(outfile, level, already_processed, namespace_, name_='ReactionScheme') - if self.source is not None and 'source' not in already_processed: - already_processed.add('source') - outfile.write(' source=%s' % (self.gds_encode(self.gds_format_string(quote_attrib(self.source), input_name='source')), )) - if self.type_ is not None and 'type_' not in already_processed: - already_processed.add('type_') - outfile.write(' type=%s' % (self.gds_encode(self.gds_format_string(quote_attrib(self.type_), input_name='type')), )) - def exportChildren(self, outfile, level, namespace_='', name_='ReactionScheme', fromsubclass_=False, pretty_print=True): - super(ReactionScheme, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - for obj_ in self.anytypeobjs_: - obj_.export(outfile, level, namespace_, pretty_print=pretty_print) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - value = find_attr_value_('source', node) - if value is not None and 'source' not in already_processed: - already_processed.add('source') - self.source = value - value = find_attr_value_('type', node) - if value is not None and 'type' not in already_processed: - already_processed.add('type') - self.type_ = value - super(ReactionScheme, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - obj_ = self.gds_build_any(child_, 'ReactionScheme') - if obj_ is not None: - self.add_anytypeobjs_(obj_) - super(ReactionScheme, self).buildChildren(child_, node, nodeName_, True) -# end class ReactionScheme - - -class ExtracellularProperties(Base): - subclass = None - superclass = Base - def __init__(self, id=None, neuroLexId=None, temperature=None, species=None): - self.original_tagname_ = None - super(ExtracellularProperties, self).__init__(id, neuroLexId, ) - self.temperature = _cast(None, temperature) - if species is None: - self.species = [] - else: - self.species = species - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, ExtracellularProperties) - if subclass is not None: - return subclass(*args_, **kwargs_) - if ExtracellularProperties.subclass: - return ExtracellularProperties.subclass(*args_, **kwargs_) - else: - return ExtracellularProperties(*args_, **kwargs_) - factory = staticmethod(factory) - def get_species(self): return self.species - def set_species(self, species): self.species = species - def add_species(self, value): self.species.append(value) - def insert_species_at(self, index, value): self.species.insert(index, value) - def replace_species_at(self, index, value): self.species[index] = value - def get_temperature(self): return self.temperature - def set_temperature(self, temperature): self.temperature = temperature - def validate_Nml2Quantity_temperature(self, value): - # Validate type Nml2Quantity_temperature, a restriction on xs:string. - if value is not None and Validate_simpletypes_: - if not self.gds_validate_simple_patterns( - self.validate_Nml2Quantity_temperature_patterns_, value): - warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_Nml2Quantity_temperature_patterns_, )) - validate_Nml2Quantity_temperature_patterns_ = [['^-?([0-9]*(\\.[0-9]+)?)([eE]-?[0-9]+)?[\\s]*(degC)$']] - def hasContent_(self): - if ( - self.species or - super(ExtracellularProperties, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='ExtracellularProperties', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='ExtracellularProperties') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='ExtracellularProperties', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='ExtracellularProperties'): - super(ExtracellularProperties, self).exportAttributes(outfile, level, already_processed, namespace_, name_='ExtracellularProperties') - if self.temperature is not None and 'temperature' not in already_processed: - already_processed.add('temperature') - outfile.write(' temperature=%s' % (quote_attrib(self.temperature), )) - def exportChildren(self, outfile, level, namespace_='', name_='ExtracellularProperties', fromsubclass_=False, pretty_print=True): - super(ExtracellularProperties, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - for species_ in self.species: - species_.export(outfile, level, namespace_, name_='species', pretty_print=pretty_print) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - value = find_attr_value_('temperature', node) - if value is not None and 'temperature' not in already_processed: - already_processed.add('temperature') - self.temperature = value - self.validate_Nml2Quantity_temperature(self.temperature) # validate type Nml2Quantity_temperature - super(ExtracellularProperties, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'species': - obj_ = Species.factory() - obj_.build(child_) - self.species.append(obj_) - obj_.original_tagname_ = 'species' - super(ExtracellularProperties, self).buildChildren(child_, node, nodeName_, True) -# end class ExtracellularProperties - - -class ChannelDensity(Base): - """Specifying the ion here again is redundant, this will be set in - ionChannel. It is added here TEMPORARILY as selecting all ca or - na conducting channel populations/densities in a cell would be - difficult otherwise. It should be removed in the longer term, - due to possible inconsistencies in this value and that in the - ionChannel element. TODO: remove.""" - subclass = None - superclass = Base - def __init__(self, id=None, neuroLexId=None, ionChannel=None, condDensity=None, erev=None, segmentGroup='all', segment=None, ion=None, variableParameter=None): - self.original_tagname_ = None - super(ChannelDensity, self).__init__(id, neuroLexId, ) - self.ionChannel = _cast(None, ionChannel) - self.condDensity = _cast(None, condDensity) - self.erev = _cast(None, erev) - self.segmentGroup = _cast(None, segmentGroup) - self.segment = _cast(None, segment) - self.ion = _cast(None, ion) - if variableParameter is None: - self.variableParameter = [] - else: - self.variableParameter = variableParameter - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, ChannelDensity) - if subclass is not None: - return subclass(*args_, **kwargs_) - if ChannelDensity.subclass: - return ChannelDensity.subclass(*args_, **kwargs_) - else: - return ChannelDensity(*args_, **kwargs_) - factory = staticmethod(factory) - def get_variableParameter(self): return self.variableParameter - def set_variableParameter(self, variableParameter): self.variableParameter = variableParameter - def add_variableParameter(self, value): self.variableParameter.append(value) - def insert_variableParameter_at(self, index, value): self.variableParameter.insert(index, value) - def replace_variableParameter_at(self, index, value): self.variableParameter[index] = value - def get_ionChannel(self): return self.ionChannel - def set_ionChannel(self, ionChannel): self.ionChannel = ionChannel - def get_condDensity(self): return self.condDensity - def set_condDensity(self, condDensity): self.condDensity = condDensity - def get_erev(self): return self.erev - def set_erev(self, erev): self.erev = erev - def get_segmentGroup(self): return self.segmentGroup - def set_segmentGroup(self, segmentGroup): self.segmentGroup = segmentGroup - def get_segment(self): return self.segment - def set_segment(self, segment): self.segment = segment - def get_ion(self): return self.ion - def set_ion(self, ion): self.ion = ion - def validate_NmlId(self, value): - # Validate type NmlId, a restriction on xs:string. - if value is not None and Validate_simpletypes_: - if not self.gds_validate_simple_patterns( - self.validate_NmlId_patterns_, value): - warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_NmlId_patterns_, )) - validate_NmlId_patterns_ = [['^[a-zA-Z0-9_]*$']] - def validate_Nml2Quantity_conductanceDensity(self, value): - # Validate type Nml2Quantity_conductanceDensity, a restriction on xs:string. - if value is not None and Validate_simpletypes_: - if not self.gds_validate_simple_patterns( - self.validate_Nml2Quantity_conductanceDensity_patterns_, value): - warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_Nml2Quantity_conductanceDensity_patterns_, )) - validate_Nml2Quantity_conductanceDensity_patterns_ = [['^-?([0-9]*(\\.[0-9]+)?)([eE]-?[0-9]+)?[\\s]*(S_per_m2|mS_per_cm2|S_per_cm2)$']] - def validate_Nml2Quantity_voltage(self, value): - # Validate type Nml2Quantity_voltage, a restriction on xs:string. - if value is not None and Validate_simpletypes_: - if not self.gds_validate_simple_patterns( - self.validate_Nml2Quantity_voltage_patterns_, value): - warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_Nml2Quantity_voltage_patterns_, )) - validate_Nml2Quantity_voltage_patterns_ = [['^-?([0-9]*(\\.[0-9]+)?)([eE]-?[0-9]+)?[\\s]*(V|mV)$']] - def hasContent_(self): - if ( - self.variableParameter or - super(ChannelDensity, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='ChannelDensity', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='ChannelDensity') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='ChannelDensity', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='ChannelDensity'): - super(ChannelDensity, self).exportAttributes(outfile, level, already_processed, namespace_, name_='ChannelDensity') - if self.ionChannel is not None and 'ionChannel' not in already_processed: - already_processed.add('ionChannel') - outfile.write(' ionChannel=%s' % (quote_attrib(self.ionChannel), )) - if self.condDensity is not None and 'condDensity' not in already_processed: - already_processed.add('condDensity') - outfile.write(' condDensity=%s' % (quote_attrib(self.condDensity), )) - if self.erev is not None and 'erev' not in already_processed: - already_processed.add('erev') - outfile.write(' erev=%s' % (quote_attrib(self.erev), )) - if self.segmentGroup != "all" and 'segmentGroup' not in already_processed: - already_processed.add('segmentGroup') - outfile.write(' segmentGroup=%s' % (quote_attrib(self.segmentGroup), )) - if self.segment is not None and 'segment' not in already_processed: - already_processed.add('segment') - outfile.write(' segment=%s' % (quote_attrib(self.segment), )) - if self.ion is not None and 'ion' not in already_processed: - already_processed.add('ion') - outfile.write(' ion=%s' % (quote_attrib(self.ion), )) - def exportChildren(self, outfile, level, namespace_='', name_='ChannelDensity', fromsubclass_=False, pretty_print=True): - super(ChannelDensity, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - for variableParameter_ in self.variableParameter: - variableParameter_.export(outfile, level, namespace_, name_='variableParameter', pretty_print=pretty_print) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - value = find_attr_value_('ionChannel', node) - if value is not None and 'ionChannel' not in already_processed: - already_processed.add('ionChannel') - self.ionChannel = value - self.validate_NmlId(self.ionChannel) # validate type NmlId - value = find_attr_value_('condDensity', node) - if value is not None and 'condDensity' not in already_processed: - already_processed.add('condDensity') - self.condDensity = value - self.validate_Nml2Quantity_conductanceDensity(self.condDensity) # validate type Nml2Quantity_conductanceDensity - value = find_attr_value_('erev', node) - if value is not None and 'erev' not in already_processed: - already_processed.add('erev') - self.erev = value - self.validate_Nml2Quantity_voltage(self.erev) # validate type Nml2Quantity_voltage - value = find_attr_value_('segmentGroup', node) - if value is not None and 'segmentGroup' not in already_processed: - already_processed.add('segmentGroup') - self.segmentGroup = value - self.validate_NmlId(self.segmentGroup) # validate type NmlId - value = find_attr_value_('segment', node) - if value is not None and 'segment' not in already_processed: - already_processed.add('segment') - self.segment = value - self.validate_NmlId(self.segment) # validate type NmlId - value = find_attr_value_('ion', node) - if value is not None and 'ion' not in already_processed: - already_processed.add('ion') - self.ion = value - self.validate_NmlId(self.ion) # validate type NmlId - super(ChannelDensity, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'variableParameter': - obj_ = VariableParameter.factory() - obj_.build(child_) - self.variableParameter.append(obj_) - obj_.original_tagname_ = 'variableParameter' - super(ChannelDensity, self).buildChildren(child_, node, nodeName_, True) -# end class ChannelDensity - - -class ChannelPopulation(Base): - """Specifying the ion here again is redundant, this will be set in - ionChannel. It is added here TEMPORARILY as selecting all ca or - na conducting channel populations/densities in a cell would be - difficult otherwise. It should be removed in the longer term, - due to possible inconsistencies in this value and that in the - ionChannel element. TODO: remove.""" - subclass = None - superclass = Base - def __init__(self, id=None, neuroLexId=None, ionChannel=None, number=None, erev=None, segmentGroup='all', segment=None, ion=None, variableParameter=None): - self.original_tagname_ = None - super(ChannelPopulation, self).__init__(id, neuroLexId, ) - self.ionChannel = _cast(None, ionChannel) - self.number = _cast(int, number) - self.erev = _cast(None, erev) - self.segmentGroup = _cast(None, segmentGroup) - self.segment = _cast(None, segment) - self.ion = _cast(None, ion) - if variableParameter is None: - self.variableParameter = [] - else: - self.variableParameter = variableParameter - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, ChannelPopulation) - if subclass is not None: - return subclass(*args_, **kwargs_) - if ChannelPopulation.subclass: - return ChannelPopulation.subclass(*args_, **kwargs_) - else: - return ChannelPopulation(*args_, **kwargs_) - factory = staticmethod(factory) - def get_variableParameter(self): return self.variableParameter - def set_variableParameter(self, variableParameter): self.variableParameter = variableParameter - def add_variableParameter(self, value): self.variableParameter.append(value) - def insert_variableParameter_at(self, index, value): self.variableParameter.insert(index, value) - def replace_variableParameter_at(self, index, value): self.variableParameter[index] = value - def get_ionChannel(self): return self.ionChannel - def set_ionChannel(self, ionChannel): self.ionChannel = ionChannel - def get_number(self): return self.number - def set_number(self, number): self.number = number - def get_erev(self): return self.erev - def set_erev(self, erev): self.erev = erev - def get_segmentGroup(self): return self.segmentGroup - def set_segmentGroup(self, segmentGroup): self.segmentGroup = segmentGroup - def get_segment(self): return self.segment - def set_segment(self, segment): self.segment = segment - def get_ion(self): return self.ion - def set_ion(self, ion): self.ion = ion - def validate_NmlId(self, value): - # Validate type NmlId, a restriction on xs:string. - if value is not None and Validate_simpletypes_: - if not self.gds_validate_simple_patterns( - self.validate_NmlId_patterns_, value): - warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_NmlId_patterns_, )) - validate_NmlId_patterns_ = [['^[a-zA-Z0-9_]*$']] - def validate_Nml2Quantity_voltage(self, value): - # Validate type Nml2Quantity_voltage, a restriction on xs:string. - if value is not None and Validate_simpletypes_: - if not self.gds_validate_simple_patterns( - self.validate_Nml2Quantity_voltage_patterns_, value): - warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_Nml2Quantity_voltage_patterns_, )) - validate_Nml2Quantity_voltage_patterns_ = [['^-?([0-9]*(\\.[0-9]+)?)([eE]-?[0-9]+)?[\\s]*(V|mV)$']] - def hasContent_(self): - if ( - self.variableParameter or - super(ChannelPopulation, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='ChannelPopulation', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='ChannelPopulation') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='ChannelPopulation', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='ChannelPopulation'): - super(ChannelPopulation, self).exportAttributes(outfile, level, already_processed, namespace_, name_='ChannelPopulation') - if self.ionChannel is not None and 'ionChannel' not in already_processed: - already_processed.add('ionChannel') - outfile.write(' ionChannel=%s' % (quote_attrib(self.ionChannel), )) - if self.number is not None and 'number' not in already_processed: - already_processed.add('number') - outfile.write(' number="%s"' % self.gds_format_integer(self.number, input_name='number')) - if self.erev is not None and 'erev' not in already_processed: - already_processed.add('erev') - outfile.write(' erev=%s' % (quote_attrib(self.erev), )) - if self.segmentGroup != "all" and 'segmentGroup' not in already_processed: - already_processed.add('segmentGroup') - outfile.write(' segmentGroup=%s' % (quote_attrib(self.segmentGroup), )) - if self.segment is not None and 'segment' not in already_processed: - already_processed.add('segment') - outfile.write(' segment=%s' % (quote_attrib(self.segment), )) - if self.ion is not None and 'ion' not in already_processed: - already_processed.add('ion') - outfile.write(' ion=%s' % (quote_attrib(self.ion), )) - def exportChildren(self, outfile, level, namespace_='', name_='ChannelPopulation', fromsubclass_=False, pretty_print=True): - super(ChannelPopulation, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - for variableParameter_ in self.variableParameter: - variableParameter_.export(outfile, level, namespace_, name_='variableParameter', pretty_print=pretty_print) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - value = find_attr_value_('ionChannel', node) - if value is not None and 'ionChannel' not in already_processed: - already_processed.add('ionChannel') - self.ionChannel = value - self.validate_NmlId(self.ionChannel) # validate type NmlId - value = find_attr_value_('number', node) - if value is not None and 'number' not in already_processed: - already_processed.add('number') - try: - self.number = int(value) - except ValueError as exp: - raise_parse_error(node, 'Bad integer attribute: %s' % exp) - if self.number < 0: - raise_parse_error(node, 'Invalid NonNegativeInteger') - value = find_attr_value_('erev', node) - if value is not None and 'erev' not in already_processed: - already_processed.add('erev') - self.erev = value - self.validate_Nml2Quantity_voltage(self.erev) # validate type Nml2Quantity_voltage - value = find_attr_value_('segmentGroup', node) - if value is not None and 'segmentGroup' not in already_processed: - already_processed.add('segmentGroup') - self.segmentGroup = value - self.validate_NmlId(self.segmentGroup) # validate type NmlId - value = find_attr_value_('segment', node) - if value is not None and 'segment' not in already_processed: - already_processed.add('segment') - self.segment = value - self.validate_NmlId(self.segment) # validate type NmlId - value = find_attr_value_('ion', node) - if value is not None and 'ion' not in already_processed: - already_processed.add('ion') - self.ion = value - self.validate_NmlId(self.ion) # validate type NmlId - super(ChannelPopulation, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'variableParameter': - obj_ = VariableParameter.factory() - obj_.build(child_) - self.variableParameter.append(obj_) - obj_.original_tagname_ = 'variableParameter' - super(ChannelPopulation, self).buildChildren(child_, node, nodeName_, True) -# end class ChannelPopulation - - -class BiophysicalProperties(Standalone): - """Standalone element which is usually inside a single cell, but could - be outside and referenced by id.""" - subclass = None - superclass = Standalone - def __init__(self, id=None, neuroLexId=None, name=None, metaid=None, notes=None, annotation=None, membraneProperties=None, intracellularProperties=None, extracellularProperties=None): - self.original_tagname_ = None - super(BiophysicalProperties, self).__init__(id, neuroLexId, name, metaid, notes, annotation, ) - self.membraneProperties = membraneProperties - self.intracellularProperties = intracellularProperties - self.extracellularProperties = extracellularProperties - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, BiophysicalProperties) - if subclass is not None: - return subclass(*args_, **kwargs_) - if BiophysicalProperties.subclass: - return BiophysicalProperties.subclass(*args_, **kwargs_) - else: - return BiophysicalProperties(*args_, **kwargs_) - factory = staticmethod(factory) - def get_membraneProperties(self): return self.membraneProperties - def set_membraneProperties(self, membraneProperties): self.membraneProperties = membraneProperties - def get_intracellularProperties(self): return self.intracellularProperties - def set_intracellularProperties(self, intracellularProperties): self.intracellularProperties = intracellularProperties - def get_extracellularProperties(self): return self.extracellularProperties - def set_extracellularProperties(self, extracellularProperties): self.extracellularProperties = extracellularProperties - def hasContent_(self): - if ( - self.membraneProperties is not None or - self.intracellularProperties is not None or - self.extracellularProperties is not None or - super(BiophysicalProperties, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='BiophysicalProperties', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='BiophysicalProperties') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='BiophysicalProperties', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='BiophysicalProperties'): - super(BiophysicalProperties, self).exportAttributes(outfile, level, already_processed, namespace_, name_='BiophysicalProperties') - def exportChildren(self, outfile, level, namespace_='', name_='BiophysicalProperties', fromsubclass_=False, pretty_print=True): - super(BiophysicalProperties, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.membraneProperties is not None: - self.membraneProperties.export(outfile, level, namespace_, name_='membraneProperties', pretty_print=pretty_print) - if self.intracellularProperties is not None: - self.intracellularProperties.export(outfile, level, namespace_, name_='intracellularProperties', pretty_print=pretty_print) - if self.extracellularProperties is not None: - self.extracellularProperties.export(outfile, level, namespace_, name_='extracellularProperties', pretty_print=pretty_print) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(BiophysicalProperties, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'membraneProperties': - obj_ = MembraneProperties.factory() - obj_.build(child_) - self.membraneProperties = obj_ - obj_.original_tagname_ = 'membraneProperties' - elif nodeName_ == 'intracellularProperties': - obj_ = IntracellularProperties.factory() - obj_.build(child_) - self.intracellularProperties = obj_ - obj_.original_tagname_ = 'intracellularProperties' - elif nodeName_ == 'extracellularProperties': - obj_ = ExtracellularProperties.factory() - obj_.build(child_) - self.extracellularProperties = obj_ - obj_.original_tagname_ = 'extracellularProperties' - super(BiophysicalProperties, self).buildChildren(child_, node, nodeName_, True) -# end class BiophysicalProperties - - -class InhomogeneousParam(Base): - subclass = None - superclass = Base - def __init__(self, id=None, neuroLexId=None, variable=None, metric=None, proximal=None, distal=None): - self.original_tagname_ = None - super(InhomogeneousParam, self).__init__(id, neuroLexId, ) - self.variable = _cast(None, variable) - self.metric = _cast(None, metric) - self.proximal = proximal - self.distal = distal - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, InhomogeneousParam) - if subclass is not None: - return subclass(*args_, **kwargs_) - if InhomogeneousParam.subclass: - return InhomogeneousParam.subclass(*args_, **kwargs_) - else: - return InhomogeneousParam(*args_, **kwargs_) - factory = staticmethod(factory) - def get_proximal(self): return self.proximal - def set_proximal(self, proximal): self.proximal = proximal - def get_distal(self): return self.distal - def set_distal(self, distal): self.distal = distal - def get_variable(self): return self.variable - def set_variable(self, variable): self.variable = variable - def get_metric(self): return self.metric - def set_metric(self, metric): self.metric = metric - def validate_Metric(self, value): - # Validate type Metric, a restriction on xs:string. - if value is not None and Validate_simpletypes_: - value = str(value) - enumerations = ['Path Length from root'] - enumeration_respectee = False - for enum in enumerations: - if value == enum: - enumeration_respectee = True - break - if not enumeration_respectee: - warnings_.warn('Value "%(value)s" does not match xsd enumeration restriction on Metric' % {"value" : value.encode("utf-8")} ) - def hasContent_(self): - if ( - self.proximal is not None or - self.distal is not None or - super(InhomogeneousParam, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='InhomogeneousParam', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='InhomogeneousParam') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='InhomogeneousParam', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='InhomogeneousParam'): - super(InhomogeneousParam, self).exportAttributes(outfile, level, already_processed, namespace_, name_='InhomogeneousParam') - if self.variable is not None and 'variable' not in already_processed: - already_processed.add('variable') - outfile.write(' variable=%s' % (self.gds_encode(self.gds_format_string(quote_attrib(self.variable), input_name='variable')), )) - if self.metric is not None and 'metric' not in already_processed: - already_processed.add('metric') - outfile.write(' metric=%s' % (quote_attrib(self.metric), )) - def exportChildren(self, outfile, level, namespace_='', name_='InhomogeneousParam', fromsubclass_=False, pretty_print=True): - super(InhomogeneousParam, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.proximal is not None: - self.proximal.export(outfile, level, namespace_, name_='proximal', pretty_print=pretty_print) - if self.distal is not None: - self.distal.export(outfile, level, namespace_, name_='distal', pretty_print=pretty_print) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - value = find_attr_value_('variable', node) - if value is not None and 'variable' not in already_processed: - already_processed.add('variable') - self.variable = value - value = find_attr_value_('metric', node) - if value is not None and 'metric' not in already_processed: - already_processed.add('metric') - self.metric = value - self.validate_Metric(self.metric) # validate type Metric - super(InhomogeneousParam, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'proximal': - obj_ = ProximalDetails.factory() - obj_.build(child_) - self.proximal = obj_ - obj_.original_tagname_ = 'proximal' - elif nodeName_ == 'distal': - obj_ = DistalDetails.factory() - obj_.build(child_) - self.distal = obj_ - obj_.original_tagname_ = 'distal' - super(InhomogeneousParam, self).buildChildren(child_, node, nodeName_, True) -# end class InhomogeneousParam - - -class SegmentGroup(Base): - subclass = None - superclass = Base - def __init__(self, id=None, neuroLexId=None, member=None, include=None, path=None, subTree=None, inhomogeneousParam=None): - self.original_tagname_ = None - super(SegmentGroup, self).__init__(id, neuroLexId, ) - if member is None: - self.member = [] - else: - self.member = member - if include is None: - self.include = [] - else: - self.include = include - if path is None: - self.path = [] - else: - self.path = path - if subTree is None: - self.subTree = [] - else: - self.subTree = subTree - if inhomogeneousParam is None: - self.inhomogeneousParam = [] - else: - self.inhomogeneousParam = inhomogeneousParam - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, SegmentGroup) - if subclass is not None: - return subclass(*args_, **kwargs_) - if SegmentGroup.subclass: - return SegmentGroup.subclass(*args_, **kwargs_) - else: - return SegmentGroup(*args_, **kwargs_) - factory = staticmethod(factory) - def get_member(self): return self.member - def set_member(self, member): self.member = member - def add_member(self, value): self.member.append(value) - def insert_member_at(self, index, value): self.member.insert(index, value) - def replace_member_at(self, index, value): self.member[index] = value - def get_include(self): return self.include - def set_include(self, include): self.include = include - def add_include(self, value): self.include.append(value) - def insert_include_at(self, index, value): self.include.insert(index, value) - def replace_include_at(self, index, value): self.include[index] = value - def get_path(self): return self.path - def set_path(self, path): self.path = path - def add_path(self, value): self.path.append(value) - def insert_path_at(self, index, value): self.path.insert(index, value) - def replace_path_at(self, index, value): self.path[index] = value - def get_subTree(self): return self.subTree - def set_subTree(self, subTree): self.subTree = subTree - def add_subTree(self, value): self.subTree.append(value) - def insert_subTree_at(self, index, value): self.subTree.insert(index, value) - def replace_subTree_at(self, index, value): self.subTree[index] = value - def get_inhomogeneousParam(self): return self.inhomogeneousParam - def set_inhomogeneousParam(self, inhomogeneousParam): self.inhomogeneousParam = inhomogeneousParam - def add_inhomogeneousParam(self, value): self.inhomogeneousParam.append(value) - def insert_inhomogeneousParam_at(self, index, value): self.inhomogeneousParam.insert(index, value) - def replace_inhomogeneousParam_at(self, index, value): self.inhomogeneousParam[index] = value - def hasContent_(self): - if ( - self.member or - self.include or - self.path or - self.subTree or - self.inhomogeneousParam or - super(SegmentGroup, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='SegmentGroup', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='SegmentGroup') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='SegmentGroup', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='SegmentGroup'): - super(SegmentGroup, self).exportAttributes(outfile, level, already_processed, namespace_, name_='SegmentGroup') - def exportChildren(self, outfile, level, namespace_='', name_='SegmentGroup', fromsubclass_=False, pretty_print=True): - super(SegmentGroup, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - for member_ in self.member: - member_.export(outfile, level, namespace_, name_='member', pretty_print=pretty_print) - for include_ in self.include: - include_.export(outfile, level, namespace_, name_='include', pretty_print=pretty_print) - for path_ in self.path: - path_.export(outfile, level, namespace_, name_='path', pretty_print=pretty_print) - for subTree_ in self.subTree: - subTree_.export(outfile, level, namespace_, name_='subTree', pretty_print=pretty_print) - for inhomogeneousParam_ in self.inhomogeneousParam: - inhomogeneousParam_.export(outfile, level, namespace_, name_='inhomogeneousParam', pretty_print=pretty_print) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(SegmentGroup, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'member': - obj_ = Member.factory() - obj_.build(child_) - self.member.append(obj_) - obj_.original_tagname_ = 'member' - elif nodeName_ == 'include': - obj_ = Include.factory() - obj_.build(child_) - self.include.append(obj_) - obj_.original_tagname_ = 'include' - elif nodeName_ == 'path': - obj_ = Path.factory() - obj_.build(child_) - self.path.append(obj_) - obj_.original_tagname_ = 'path' - elif nodeName_ == 'subTree': - obj_ = SubTree.factory() - obj_.build(child_) - self.subTree.append(obj_) - obj_.original_tagname_ = 'subTree' - elif nodeName_ == 'inhomogeneousParam': - obj_ = InhomogeneousParam.factory() - obj_.build(child_) - self.inhomogeneousParam.append(obj_) - obj_.original_tagname_ = 'inhomogeneousParam' - super(SegmentGroup, self).buildChildren(child_, node, nodeName_, True) -# end class SegmentGroup - - -class Segment(Base): - subclass = None - superclass = Base - def __init__(self, id=None, neuroLexId=None, name=None, parent=None, proximal=None, distal=None): - self.original_tagname_ = None - super(Segment, self).__init__(id, neuroLexId, ) - self.name = _cast(None, name) - self.parent = parent - self.proximal = proximal - self.distal = distal - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, Segment) - if subclass is not None: - return subclass(*args_, **kwargs_) - if Segment.subclass: - return Segment.subclass(*args_, **kwargs_) - else: - return Segment(*args_, **kwargs_) - factory = staticmethod(factory) - def get_parent(self): return self.parent - def set_parent(self, parent): self.parent = parent - def get_proximal(self): return self.proximal - def set_proximal(self, proximal): self.proximal = proximal - def get_distal(self): return self.distal - def set_distal(self, distal): self.distal = distal - def get_name(self): return self.name - def set_name(self, name): self.name = name - def hasContent_(self): - if ( - self.parent is not None or - self.proximal is not None or - self.distal is not None or - super(Segment, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='Segment', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='Segment') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='Segment', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='Segment'): - super(Segment, self).exportAttributes(outfile, level, already_processed, namespace_, name_='Segment') - if self.name is not None and 'name' not in already_processed: - already_processed.add('name') - outfile.write(' name=%s' % (self.gds_encode(self.gds_format_string(quote_attrib(self.name), input_name='name')), )) - def exportChildren(self, outfile, level, namespace_='', name_='Segment', fromsubclass_=False, pretty_print=True): - super(Segment, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.parent is not None: - self.parent.export(outfile, level, namespace_, name_='parent', pretty_print=pretty_print) - if self.proximal is not None: - self.proximal.export(outfile, level, namespace_, name_='proximal', pretty_print=pretty_print) - if self.distal is not None: - self.distal.export(outfile, level, namespace_, name_='distal', pretty_print=pretty_print) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - value = find_attr_value_('name', node) - if value is not None and 'name' not in already_processed: - already_processed.add('name') - self.name = value - super(Segment, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'parent': - obj_ = SegmentParent.factory() - obj_.build(child_) - self.parent = obj_ - obj_.original_tagname_ = 'parent' - elif nodeName_ == 'proximal': - obj_ = Point3DWithDiam.factory() - obj_.build(child_) - self.proximal = obj_ - obj_.original_tagname_ = 'proximal' - elif nodeName_ == 'distal': - obj_ = Point3DWithDiam.factory() - obj_.build(child_) - self.distal = obj_ - obj_.original_tagname_ = 'distal' - super(Segment, self).buildChildren(child_, node, nodeName_, True) -# end class Segment - - -class Morphology(Standalone): - """Standalone element which is usually inside a single cell, but could - be outside and referenced by id.""" - subclass = None - superclass = Standalone - def __init__(self, id=None, neuroLexId=None, name=None, metaid=None, notes=None, annotation=None, segment=None, segmentGroup=None): - self.original_tagname_ = None - super(Morphology, self).__init__(id, neuroLexId, name, metaid, notes, annotation, ) - if segment is None: - self.segment = [] - else: - self.segment = segment - if segmentGroup is None: - self.segmentGroup = [] - else: - self.segmentGroup = segmentGroup - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, Morphology) - if subclass is not None: - return subclass(*args_, **kwargs_) - if Morphology.subclass: - return Morphology.subclass(*args_, **kwargs_) - else: - return Morphology(*args_, **kwargs_) - factory = staticmethod(factory) - def get_segment(self): return self.segment - def set_segment(self, segment): self.segment = segment - def add_segment(self, value): self.segment.append(value) - def insert_segment_at(self, index, value): self.segment.insert(index, value) - def replace_segment_at(self, index, value): self.segment[index] = value - def get_segmentGroup(self): return self.segmentGroup - def set_segmentGroup(self, segmentGroup): self.segmentGroup = segmentGroup - def add_segmentGroup(self, value): self.segmentGroup.append(value) - def insert_segmentGroup_at(self, index, value): self.segmentGroup.insert(index, value) - def replace_segmentGroup_at(self, index, value): self.segmentGroup[index] = value - def hasContent_(self): - if ( - self.segment or - self.segmentGroup or - super(Morphology, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='Morphology', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='Morphology') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='Morphology', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='Morphology'): - super(Morphology, self).exportAttributes(outfile, level, already_processed, namespace_, name_='Morphology') - def exportChildren(self, outfile, level, namespace_='', name_='Morphology', fromsubclass_=False, pretty_print=True): - super(Morphology, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - for segment_ in self.segment: - segment_.export(outfile, level, namespace_, name_='segment', pretty_print=pretty_print) - for segmentGroup_ in self.segmentGroup: - segmentGroup_.export(outfile, level, namespace_, name_='segmentGroup', pretty_print=pretty_print) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(Morphology, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'segment': - obj_ = Segment.factory() - obj_.build(child_) - self.segment.append(obj_) - obj_.original_tagname_ = 'segment' - elif nodeName_ == 'segmentGroup': - obj_ = SegmentGroup.factory() - obj_.build(child_) - self.segmentGroup.append(obj_) - obj_.original_tagname_ = 'segmentGroup' - super(Morphology, self).buildChildren(child_, node, nodeName_, True) -# end class Morphology - - -class BaseCell(Standalone): - subclass = None - superclass = Standalone - def __init__(self, id=None, neuroLexId=None, name=None, metaid=None, notes=None, annotation=None, extensiontype_=None): - self.original_tagname_ = None - super(BaseCell, self).__init__(id, neuroLexId, name, metaid, notes, annotation, extensiontype_, ) - self.extensiontype_ = extensiontype_ - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, BaseCell) - if subclass is not None: - return subclass(*args_, **kwargs_) - if BaseCell.subclass: - return BaseCell.subclass(*args_, **kwargs_) - else: - return BaseCell(*args_, **kwargs_) - factory = staticmethod(factory) - def get_extensiontype_(self): return self.extensiontype_ - def set_extensiontype_(self, extensiontype_): self.extensiontype_ = extensiontype_ - def hasContent_(self): - if ( - super(BaseCell, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='BaseCell', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='BaseCell') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='BaseCell', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='BaseCell'): - super(BaseCell, self).exportAttributes(outfile, level, already_processed, namespace_, name_='BaseCell') - if self.extensiontype_ is not None and 'xsi:type' not in already_processed: - already_processed.add('xsi:type') - outfile.write(' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"') - outfile.write(' xsi:type="%s"' % self.extensiontype_) - def exportChildren(self, outfile, level, namespace_='', name_='BaseCell', fromsubclass_=False, pretty_print=True): - super(BaseCell, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - value = find_attr_value_('xsi:type', node) - if value is not None and 'xsi:type' not in already_processed: - already_processed.add('xsi:type') - self.extensiontype_ = value - super(BaseCell, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(BaseCell, self).buildChildren(child_, node, nodeName_, True) - pass -# end class BaseCell - - -class BaseSynapse(Standalone): - subclass = None - superclass = Standalone - def __init__(self, id=None, neuroLexId=None, name=None, metaid=None, notes=None, annotation=None, extensiontype_=None): - self.original_tagname_ = None - super(BaseSynapse, self).__init__(id, neuroLexId, name, metaid, notes, annotation, extensiontype_, ) - self.extensiontype_ = extensiontype_ - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, BaseSynapse) - if subclass is not None: - return subclass(*args_, **kwargs_) - if BaseSynapse.subclass: - return BaseSynapse.subclass(*args_, **kwargs_) - else: - return BaseSynapse(*args_, **kwargs_) - factory = staticmethod(factory) - def get_extensiontype_(self): return self.extensiontype_ - def set_extensiontype_(self, extensiontype_): self.extensiontype_ = extensiontype_ - def hasContent_(self): - if ( - super(BaseSynapse, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='BaseSynapse', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='BaseSynapse') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='BaseSynapse', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='BaseSynapse'): - super(BaseSynapse, self).exportAttributes(outfile, level, already_processed, namespace_, name_='BaseSynapse') - if self.extensiontype_ is not None and 'xsi:type' not in already_processed: - already_processed.add('xsi:type') - outfile.write(' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"') - outfile.write(' xsi:type="%s"' % self.extensiontype_) - def exportChildren(self, outfile, level, namespace_='', name_='BaseSynapse', fromsubclass_=False, pretty_print=True): - super(BaseSynapse, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - value = find_attr_value_('xsi:type', node) - if value is not None and 'xsi:type' not in already_processed: - already_processed.add('xsi:type') - self.extensiontype_ = value - super(BaseSynapse, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(BaseSynapse, self).buildChildren(child_, node, nodeName_, True) - pass -# end class BaseSynapse - - -class DecayingPoolConcentrationModel(Standalone): - """Should not be required, as it's present on the species element!""" - subclass = None - superclass = Standalone - def __init__(self, id=None, neuroLexId=None, name=None, metaid=None, notes=None, annotation=None, ion=None, restingConc=None, decayConstant=None, shellThickness=None, extensiontype_=None): - self.original_tagname_ = None - super(DecayingPoolConcentrationModel, self).__init__(id, neuroLexId, name, metaid, notes, annotation, extensiontype_, ) - self.ion = _cast(None, ion) - self.restingConc = _cast(None, restingConc) - self.decayConstant = _cast(None, decayConstant) - self.shellThickness = _cast(None, shellThickness) - self.extensiontype_ = extensiontype_ - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, DecayingPoolConcentrationModel) - if subclass is not None: - return subclass(*args_, **kwargs_) - if DecayingPoolConcentrationModel.subclass: - return DecayingPoolConcentrationModel.subclass(*args_, **kwargs_) - else: - return DecayingPoolConcentrationModel(*args_, **kwargs_) - factory = staticmethod(factory) - def get_ion(self): return self.ion - def set_ion(self, ion): self.ion = ion - def get_restingConc(self): return self.restingConc - def set_restingConc(self, restingConc): self.restingConc = restingConc - def get_decayConstant(self): return self.decayConstant - def set_decayConstant(self, decayConstant): self.decayConstant = decayConstant - def get_shellThickness(self): return self.shellThickness - def set_shellThickness(self, shellThickness): self.shellThickness = shellThickness - def get_extensiontype_(self): return self.extensiontype_ - def set_extensiontype_(self, extensiontype_): self.extensiontype_ = extensiontype_ - def validate_NmlId(self, value): - # Validate type NmlId, a restriction on xs:string. - if value is not None and Validate_simpletypes_: - if not self.gds_validate_simple_patterns( - self.validate_NmlId_patterns_, value): - warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_NmlId_patterns_, )) - validate_NmlId_patterns_ = [['^[a-zA-Z0-9_]*$']] - def validate_Nml2Quantity_concentration(self, value): - # Validate type Nml2Quantity_concentration, a restriction on xs:string. - if value is not None and Validate_simpletypes_: - if not self.gds_validate_simple_patterns( - self.validate_Nml2Quantity_concentration_patterns_, value): - warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_Nml2Quantity_concentration_patterns_, )) - validate_Nml2Quantity_concentration_patterns_ = [['^-?([0-9]*(\\.[0-9]+)?)([eE]-?[0-9]+)?[\\s]*(mol_per_m3|mol_per_cm3|M|mM)$']] - def validate_Nml2Quantity_time(self, value): - # Validate type Nml2Quantity_time, a restriction on xs:string. - if value is not None and Validate_simpletypes_: - if not self.gds_validate_simple_patterns( - self.validate_Nml2Quantity_time_patterns_, value): - warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_Nml2Quantity_time_patterns_, )) - validate_Nml2Quantity_time_patterns_ = [['^-?([0-9]*(\\.[0-9]+)?)([eE]-?[0-9]+)?[\\s]*(s|ms)$']] - def validate_Nml2Quantity_length(self, value): - # Validate type Nml2Quantity_length, a restriction on xs:string. - if value is not None and Validate_simpletypes_: - if not self.gds_validate_simple_patterns( - self.validate_Nml2Quantity_length_patterns_, value): - warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_Nml2Quantity_length_patterns_, )) - validate_Nml2Quantity_length_patterns_ = [['^-?([0-9]*(\\.[0-9]+)?)([eE]-?[0-9]+)?[\\s]*(m|cm|um)$']] - def hasContent_(self): - if ( - super(DecayingPoolConcentrationModel, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='DecayingPoolConcentrationModel', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='DecayingPoolConcentrationModel') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='DecayingPoolConcentrationModel', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='DecayingPoolConcentrationModel'): - super(DecayingPoolConcentrationModel, self).exportAttributes(outfile, level, already_processed, namespace_, name_='DecayingPoolConcentrationModel') - if self.ion is not None and 'ion' not in already_processed: - already_processed.add('ion') - outfile.write(' ion=%s' % (quote_attrib(self.ion), )) - if self.restingConc is not None and 'restingConc' not in already_processed: - already_processed.add('restingConc') - outfile.write(' restingConc=%s' % (quote_attrib(self.restingConc), )) - if self.decayConstant is not None and 'decayConstant' not in already_processed: - already_processed.add('decayConstant') - outfile.write(' decayConstant=%s' % (quote_attrib(self.decayConstant), )) - if self.shellThickness is not None and 'shellThickness' not in already_processed: - already_processed.add('shellThickness') - outfile.write(' shellThickness=%s' % (quote_attrib(self.shellThickness), )) - if self.extensiontype_ is not None and 'xsi:type' not in already_processed: - already_processed.add('xsi:type') - outfile.write(' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"') - outfile.write(' xsi:type="%s"' % self.extensiontype_) - def exportChildren(self, outfile, level, namespace_='', name_='DecayingPoolConcentrationModel', fromsubclass_=False, pretty_print=True): - super(DecayingPoolConcentrationModel, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - value = find_attr_value_('ion', node) - if value is not None and 'ion' not in already_processed: - already_processed.add('ion') - self.ion = value - self.validate_NmlId(self.ion) # validate type NmlId - value = find_attr_value_('restingConc', node) - if value is not None and 'restingConc' not in already_processed: - already_processed.add('restingConc') - self.restingConc = value - self.validate_Nml2Quantity_concentration(self.restingConc) # validate type Nml2Quantity_concentration - value = find_attr_value_('decayConstant', node) - if value is not None and 'decayConstant' not in already_processed: - already_processed.add('decayConstant') - self.decayConstant = value - self.validate_Nml2Quantity_time(self.decayConstant) # validate type Nml2Quantity_time - value = find_attr_value_('shellThickness', node) - if value is not None and 'shellThickness' not in already_processed: - already_processed.add('shellThickness') - self.shellThickness = value - self.validate_Nml2Quantity_length(self.shellThickness) # validate type Nml2Quantity_length - value = find_attr_value_('xsi:type', node) - if value is not None and 'xsi:type' not in already_processed: - already_processed.add('xsi:type') - self.extensiontype_ = value - super(DecayingPoolConcentrationModel, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(DecayingPoolConcentrationModel, self).buildChildren(child_, node, nodeName_, True) - pass -# end class DecayingPoolConcentrationModel - - -class GateHHRatesInf(Base): - subclass = None - superclass = Base - def __init__(self, id=None, neuroLexId=None, instances=1, type_=None, notes=None, q10Settings=None, forwardRate=None, reverseRate=None, steadyState=None): - self.original_tagname_ = None - super(GateHHRatesInf, self).__init__(id, neuroLexId, ) - self.instances = _cast(int, instances) - self.type_ = _cast(None, type_) - self.notes = notes - self.validate_Notes(self.notes) - self.q10Settings = q10Settings - self.forwardRate = forwardRate - self.reverseRate = reverseRate - self.steadyState = steadyState - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, GateHHRatesInf) - if subclass is not None: - return subclass(*args_, **kwargs_) - if GateHHRatesInf.subclass: - return GateHHRatesInf.subclass(*args_, **kwargs_) - else: - return GateHHRatesInf(*args_, **kwargs_) - factory = staticmethod(factory) - def get_notes(self): return self.notes - def set_notes(self, notes): self.notes = notes - def get_q10Settings(self): return self.q10Settings - def set_q10Settings(self, q10Settings): self.q10Settings = q10Settings - def get_forwardRate(self): return self.forwardRate - def set_forwardRate(self, forwardRate): self.forwardRate = forwardRate - def get_reverseRate(self): return self.reverseRate - def set_reverseRate(self, reverseRate): self.reverseRate = reverseRate - def get_steadyState(self): return self.steadyState - def set_steadyState(self, steadyState): self.steadyState = steadyState - def get_instances(self): return self.instances - def set_instances(self, instances): self.instances = instances - def get_type(self): return self.type_ - def set_type(self, type_): self.type_ = type_ - def validate_Notes(self, value): - # Validate type Notes, a restriction on xs:string. - if value is not None and Validate_simpletypes_: - pass - def validate_gateTypes(self, value): - # Validate type gateTypes, a restriction on xs:string. - if value is not None and Validate_simpletypes_: - value = str(value) - enumerations = ['gateHHrates', 'gateHHratesTau', 'gateHHtauInf', 'gateHHratesInf', 'gateKS'] - enumeration_respectee = False - for enum in enumerations: - if value == enum: - enumeration_respectee = True - break - if not enumeration_respectee: - warnings_.warn('Value "%(value)s" does not match xsd enumeration restriction on gateTypes' % {"value" : value.encode("utf-8")} ) - def hasContent_(self): - if ( - self.notes is not None or - self.q10Settings is not None or - self.forwardRate is not None or - self.reverseRate is not None or - self.steadyState is not None or - super(GateHHRatesInf, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='GateHHRatesInf', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='GateHHRatesInf') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='GateHHRatesInf', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='GateHHRatesInf'): - super(GateHHRatesInf, self).exportAttributes(outfile, level, already_processed, namespace_, name_='GateHHRatesInf') - if self.instances != 1 and 'instances' not in already_processed: - already_processed.add('instances') - outfile.write(' instances="%s"' % self.gds_format_integer(self.instances, input_name='instances')) - if self.type_ is not None and 'type_' not in already_processed: - already_processed.add('type_') - outfile.write(' type=%s' % (quote_attrib(self.type_), )) - def exportChildren(self, outfile, level, namespace_='', name_='GateHHRatesInf', fromsubclass_=False, pretty_print=True): - super(GateHHRatesInf, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.notes is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%snotes>%s</%snotes>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.notes), input_name='notes')), namespace_, eol_)) - if self.q10Settings is not None: - self.q10Settings.export(outfile, level, namespace_, name_='q10Settings', pretty_print=pretty_print) - if self.forwardRate is not None: - self.forwardRate.export(outfile, level, namespace_, name_='forwardRate', pretty_print=pretty_print) - if self.reverseRate is not None: - self.reverseRate.export(outfile, level, namespace_, name_='reverseRate', pretty_print=pretty_print) - if self.steadyState is not None: - self.steadyState.export(outfile, level, namespace_, name_='steadyState', pretty_print=pretty_print) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - value = find_attr_value_('instances', node) - if value is not None and 'instances' not in already_processed: - already_processed.add('instances') - try: - self.instances = int(value) - except ValueError as exp: - raise_parse_error(node, 'Bad integer attribute: %s' % exp) - value = find_attr_value_('type', node) - if value is not None and 'type' not in already_processed: - already_processed.add('type') - self.type_ = value - self.validate_gateTypes(self.type_) # validate type gateTypes - super(GateHHRatesInf, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'notes': - notes_ = child_.text - notes_ = self.gds_validate_string(notes_, node, 'notes') - self.notes = notes_ - # validate type Notes - self.validate_Notes(self.notes) - elif nodeName_ == 'q10Settings': - obj_ = Q10Settings.factory() - obj_.build(child_) - self.q10Settings = obj_ - obj_.original_tagname_ = 'q10Settings' - elif nodeName_ == 'forwardRate': - obj_ = HHRate.factory() - obj_.build(child_) - self.forwardRate = obj_ - obj_.original_tagname_ = 'forwardRate' - elif nodeName_ == 'reverseRate': - obj_ = HHRate.factory() - obj_.build(child_) - self.reverseRate = obj_ - obj_.original_tagname_ = 'reverseRate' - elif nodeName_ == 'steadyState': - obj_ = HHVariable.factory() - obj_.build(child_) - self.steadyState = obj_ - obj_.original_tagname_ = 'steadyState' - super(GateHHRatesInf, self).buildChildren(child_, node, nodeName_, True) -# end class GateHHRatesInf - - -class GateHHRatesTau(Base): - subclass = None - superclass = Base - def __init__(self, id=None, neuroLexId=None, instances=1, type_=None, notes=None, q10Settings=None, forwardRate=None, reverseRate=None, timeCourse=None): - self.original_tagname_ = None - super(GateHHRatesTau, self).__init__(id, neuroLexId, ) - self.instances = _cast(int, instances) - self.type_ = _cast(None, type_) - self.notes = notes - self.validate_Notes(self.notes) - self.q10Settings = q10Settings - self.forwardRate = forwardRate - self.reverseRate = reverseRate - self.timeCourse = timeCourse - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, GateHHRatesTau) - if subclass is not None: - return subclass(*args_, **kwargs_) - if GateHHRatesTau.subclass: - return GateHHRatesTau.subclass(*args_, **kwargs_) - else: - return GateHHRatesTau(*args_, **kwargs_) - factory = staticmethod(factory) - def get_notes(self): return self.notes - def set_notes(self, notes): self.notes = notes - def get_q10Settings(self): return self.q10Settings - def set_q10Settings(self, q10Settings): self.q10Settings = q10Settings - def get_forwardRate(self): return self.forwardRate - def set_forwardRate(self, forwardRate): self.forwardRate = forwardRate - def get_reverseRate(self): return self.reverseRate - def set_reverseRate(self, reverseRate): self.reverseRate = reverseRate - def get_timeCourse(self): return self.timeCourse - def set_timeCourse(self, timeCourse): self.timeCourse = timeCourse - def get_instances(self): return self.instances - def set_instances(self, instances): self.instances = instances - def get_type(self): return self.type_ - def set_type(self, type_): self.type_ = type_ - def validate_Notes(self, value): - # Validate type Notes, a restriction on xs:string. - if value is not None and Validate_simpletypes_: - pass - def validate_gateTypes(self, value): - # Validate type gateTypes, a restriction on xs:string. - if value is not None and Validate_simpletypes_: - value = str(value) - enumerations = ['gateHHrates', 'gateHHratesTau', 'gateHHtauInf', 'gateHHratesInf', 'gateKS'] - enumeration_respectee = False - for enum in enumerations: - if value == enum: - enumeration_respectee = True - break - if not enumeration_respectee: - warnings_.warn('Value "%(value)s" does not match xsd enumeration restriction on gateTypes' % {"value" : value.encode("utf-8")} ) - def hasContent_(self): - if ( - self.notes is not None or - self.q10Settings is not None or - self.forwardRate is not None or - self.reverseRate is not None or - self.timeCourse is not None or - super(GateHHRatesTau, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='GateHHRatesTau', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='GateHHRatesTau') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='GateHHRatesTau', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='GateHHRatesTau'): - super(GateHHRatesTau, self).exportAttributes(outfile, level, already_processed, namespace_, name_='GateHHRatesTau') - if self.instances != 1 and 'instances' not in already_processed: - already_processed.add('instances') - outfile.write(' instances="%s"' % self.gds_format_integer(self.instances, input_name='instances')) - if self.type_ is not None and 'type_' not in already_processed: - already_processed.add('type_') - outfile.write(' type=%s' % (quote_attrib(self.type_), )) - def exportChildren(self, outfile, level, namespace_='', name_='GateHHRatesTau', fromsubclass_=False, pretty_print=True): - super(GateHHRatesTau, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.notes is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%snotes>%s</%snotes>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.notes), input_name='notes')), namespace_, eol_)) - if self.q10Settings is not None: - self.q10Settings.export(outfile, level, namespace_, name_='q10Settings', pretty_print=pretty_print) - if self.forwardRate is not None: - self.forwardRate.export(outfile, level, namespace_, name_='forwardRate', pretty_print=pretty_print) - if self.reverseRate is not None: - self.reverseRate.export(outfile, level, namespace_, name_='reverseRate', pretty_print=pretty_print) - if self.timeCourse is not None: - self.timeCourse.export(outfile, level, namespace_, name_='timeCourse', pretty_print=pretty_print) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - value = find_attr_value_('instances', node) - if value is not None and 'instances' not in already_processed: - already_processed.add('instances') - try: - self.instances = int(value) - except ValueError as exp: - raise_parse_error(node, 'Bad integer attribute: %s' % exp) - value = find_attr_value_('type', node) - if value is not None and 'type' not in already_processed: - already_processed.add('type') - self.type_ = value - self.validate_gateTypes(self.type_) # validate type gateTypes - super(GateHHRatesTau, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'notes': - notes_ = child_.text - notes_ = self.gds_validate_string(notes_, node, 'notes') - self.notes = notes_ - # validate type Notes - self.validate_Notes(self.notes) - elif nodeName_ == 'q10Settings': - obj_ = Q10Settings.factory() - obj_.build(child_) - self.q10Settings = obj_ - obj_.original_tagname_ = 'q10Settings' - elif nodeName_ == 'forwardRate': - obj_ = HHRate.factory() - obj_.build(child_) - self.forwardRate = obj_ - obj_.original_tagname_ = 'forwardRate' - elif nodeName_ == 'reverseRate': - obj_ = HHRate.factory() - obj_.build(child_) - self.reverseRate = obj_ - obj_.original_tagname_ = 'reverseRate' - elif nodeName_ == 'timeCourse': - obj_ = HHTime.factory() - obj_.build(child_) - self.timeCourse = obj_ - obj_.original_tagname_ = 'timeCourse' - super(GateHHRatesTau, self).buildChildren(child_, node, nodeName_, True) -# end class GateHHRatesTau - - -class GateHHTauInf(Base): - subclass = None - superclass = Base - def __init__(self, id=None, neuroLexId=None, instances=1, type_=None, notes=None, q10Settings=None, timeCourse=None, steadyState=None): - self.original_tagname_ = None - super(GateHHTauInf, self).__init__(id, neuroLexId, ) - self.instances = _cast(int, instances) - self.type_ = _cast(None, type_) - self.notes = notes - self.validate_Notes(self.notes) - self.q10Settings = q10Settings - self.timeCourse = timeCourse - self.steadyState = steadyState - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, GateHHTauInf) - if subclass is not None: - return subclass(*args_, **kwargs_) - if GateHHTauInf.subclass: - return GateHHTauInf.subclass(*args_, **kwargs_) - else: - return GateHHTauInf(*args_, **kwargs_) - factory = staticmethod(factory) - def get_notes(self): return self.notes - def set_notes(self, notes): self.notes = notes - def get_q10Settings(self): return self.q10Settings - def set_q10Settings(self, q10Settings): self.q10Settings = q10Settings - def get_timeCourse(self): return self.timeCourse - def set_timeCourse(self, timeCourse): self.timeCourse = timeCourse - def get_steadyState(self): return self.steadyState - def set_steadyState(self, steadyState): self.steadyState = steadyState - def get_instances(self): return self.instances - def set_instances(self, instances): self.instances = instances - def get_type(self): return self.type_ - def set_type(self, type_): self.type_ = type_ - def validate_Notes(self, value): - # Validate type Notes, a restriction on xs:string. - if value is not None and Validate_simpletypes_: - pass - def validate_gateTypes(self, value): - # Validate type gateTypes, a restriction on xs:string. - if value is not None and Validate_simpletypes_: - value = str(value) - enumerations = ['gateHHrates', 'gateHHratesTau', 'gateHHtauInf', 'gateHHratesInf', 'gateKS'] - enumeration_respectee = False - for enum in enumerations: - if value == enum: - enumeration_respectee = True - break - if not enumeration_respectee: - warnings_.warn('Value "%(value)s" does not match xsd enumeration restriction on gateTypes' % {"value" : value.encode("utf-8")} ) - def hasContent_(self): - if ( - self.notes is not None or - self.q10Settings is not None or - self.timeCourse is not None or - self.steadyState is not None or - super(GateHHTauInf, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='GateHHTauInf', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='GateHHTauInf') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='GateHHTauInf', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='GateHHTauInf'): - super(GateHHTauInf, self).exportAttributes(outfile, level, already_processed, namespace_, name_='GateHHTauInf') - if self.instances != 1 and 'instances' not in already_processed: - already_processed.add('instances') - outfile.write(' instances="%s"' % self.gds_format_integer(self.instances, input_name='instances')) - if self.type_ is not None and 'type_' not in already_processed: - already_processed.add('type_') - outfile.write(' type=%s' % (quote_attrib(self.type_), )) - def exportChildren(self, outfile, level, namespace_='', name_='GateHHTauInf', fromsubclass_=False, pretty_print=True): - super(GateHHTauInf, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.notes is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%snotes>%s</%snotes>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.notes), input_name='notes')), namespace_, eol_)) - if self.q10Settings is not None: - self.q10Settings.export(outfile, level, namespace_, name_='q10Settings', pretty_print=pretty_print) - if self.timeCourse is not None: - self.timeCourse.export(outfile, level, namespace_, name_='timeCourse', pretty_print=pretty_print) - if self.steadyState is not None: - self.steadyState.export(outfile, level, namespace_, name_='steadyState', pretty_print=pretty_print) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - value = find_attr_value_('instances', node) - if value is not None and 'instances' not in already_processed: - already_processed.add('instances') - try: - self.instances = int(value) - except ValueError as exp: - raise_parse_error(node, 'Bad integer attribute: %s' % exp) - value = find_attr_value_('type', node) - if value is not None and 'type' not in already_processed: - already_processed.add('type') - self.type_ = value - self.validate_gateTypes(self.type_) # validate type gateTypes - super(GateHHTauInf, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'notes': - notes_ = child_.text - notes_ = self.gds_validate_string(notes_, node, 'notes') - self.notes = notes_ - # validate type Notes - self.validate_Notes(self.notes) - elif nodeName_ == 'q10Settings': - obj_ = Q10Settings.factory() - obj_.build(child_) - self.q10Settings = obj_ - obj_.original_tagname_ = 'q10Settings' - elif nodeName_ == 'timeCourse': - obj_ = HHTime.factory() - obj_.build(child_) - self.timeCourse = obj_ - obj_.original_tagname_ = 'timeCourse' - elif nodeName_ == 'steadyState': - obj_ = HHVariable.factory() - obj_.build(child_) - self.steadyState = obj_ - obj_.original_tagname_ = 'steadyState' - super(GateHHTauInf, self).buildChildren(child_, node, nodeName_, True) -# end class GateHHTauInf - - -class GateHHRates(Base): - subclass = None - superclass = Base - def __init__(self, id=None, neuroLexId=None, instances=1, type_=None, notes=None, q10Settings=None, forwardRate=None, reverseRate=None): - self.original_tagname_ = None - super(GateHHRates, self).__init__(id, neuroLexId, ) - self.instances = _cast(int, instances) - self.type_ = _cast(None, type_) - self.notes = notes - self.validate_Notes(self.notes) - self.q10Settings = q10Settings - self.forwardRate = forwardRate - self.reverseRate = reverseRate - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, GateHHRates) - if subclass is not None: - return subclass(*args_, **kwargs_) - if GateHHRates.subclass: - return GateHHRates.subclass(*args_, **kwargs_) - else: - return GateHHRates(*args_, **kwargs_) - factory = staticmethod(factory) - def get_notes(self): return self.notes - def set_notes(self, notes): self.notes = notes - def get_q10Settings(self): return self.q10Settings - def set_q10Settings(self, q10Settings): self.q10Settings = q10Settings - def get_forwardRate(self): return self.forwardRate - def set_forwardRate(self, forwardRate): self.forwardRate = forwardRate - def get_reverseRate(self): return self.reverseRate - def set_reverseRate(self, reverseRate): self.reverseRate = reverseRate - def get_instances(self): return self.instances - def set_instances(self, instances): self.instances = instances - def get_type(self): return self.type_ - def set_type(self, type_): self.type_ = type_ - def validate_Notes(self, value): - # Validate type Notes, a restriction on xs:string. - if value is not None and Validate_simpletypes_: - pass - def validate_gateTypes(self, value): - # Validate type gateTypes, a restriction on xs:string. - if value is not None and Validate_simpletypes_: - value = str(value) - enumerations = ['gateHHrates', 'gateHHratesTau', 'gateHHtauInf', 'gateHHratesInf', 'gateKS'] - enumeration_respectee = False - for enum in enumerations: - if value == enum: - enumeration_respectee = True - break - if not enumeration_respectee: - warnings_.warn('Value "%(value)s" does not match xsd enumeration restriction on gateTypes' % {"value" : value.encode("utf-8")} ) - def hasContent_(self): - if ( - self.notes is not None or - self.q10Settings is not None or - self.forwardRate is not None or - self.reverseRate is not None or - super(GateHHRates, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='GateHHRates', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='GateHHRates') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='GateHHRates', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='GateHHRates'): - super(GateHHRates, self).exportAttributes(outfile, level, already_processed, namespace_, name_='GateHHRates') - if self.instances != 1 and 'instances' not in already_processed: - already_processed.add('instances') - outfile.write(' instances="%s"' % self.gds_format_integer(self.instances, input_name='instances')) - if self.type_ is not None and 'type_' not in already_processed: - already_processed.add('type_') - outfile.write(' type=%s' % (quote_attrib(self.type_), )) - def exportChildren(self, outfile, level, namespace_='', name_='GateHHRates', fromsubclass_=False, pretty_print=True): - super(GateHHRates, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.notes is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%snotes>%s</%snotes>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.notes), input_name='notes')), namespace_, eol_)) - if self.q10Settings is not None: - self.q10Settings.export(outfile, level, namespace_, name_='q10Settings', pretty_print=pretty_print) - if self.forwardRate is not None: - self.forwardRate.export(outfile, level, namespace_, name_='forwardRate', pretty_print=pretty_print) - if self.reverseRate is not None: - self.reverseRate.export(outfile, level, namespace_, name_='reverseRate', pretty_print=pretty_print) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - value = find_attr_value_('instances', node) - if value is not None and 'instances' not in already_processed: - already_processed.add('instances') - try: - self.instances = int(value) - except ValueError as exp: - raise_parse_error(node, 'Bad integer attribute: %s' % exp) - value = find_attr_value_('type', node) - if value is not None and 'type' not in already_processed: - already_processed.add('type') - self.type_ = value - self.validate_gateTypes(self.type_) # validate type gateTypes - super(GateHHRates, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'notes': - notes_ = child_.text - notes_ = self.gds_validate_string(notes_, node, 'notes') - self.notes = notes_ - # validate type Notes - self.validate_Notes(self.notes) - elif nodeName_ == 'q10Settings': - obj_ = Q10Settings.factory() - obj_.build(child_) - self.q10Settings = obj_ - obj_.original_tagname_ = 'q10Settings' - elif nodeName_ == 'forwardRate': - obj_ = HHRate.factory() - obj_.build(child_) - self.forwardRate = obj_ - obj_.original_tagname_ = 'forwardRate' - elif nodeName_ == 'reverseRate': - obj_ = HHRate.factory() - obj_.build(child_) - self.reverseRate = obj_ - obj_.original_tagname_ = 'reverseRate' - super(GateHHRates, self).buildChildren(child_, node, nodeName_, True) -# end class GateHHRates - - -class GateHHUndetermined(Base): - subclass = None - superclass = Base - def __init__(self, id=None, neuroLexId=None, instances=1, type_=None, notes=None, q10Settings=None, forwardRate=None, reverseRate=None, timeCourse=None, steadyState=None): - self.original_tagname_ = None - super(GateHHUndetermined, self).__init__(id, neuroLexId, ) - self.instances = _cast(int, instances) - self.type_ = _cast(None, type_) - self.notes = notes - self.validate_Notes(self.notes) - self.q10Settings = q10Settings - self.forwardRate = forwardRate - self.reverseRate = reverseRate - self.timeCourse = timeCourse - self.steadyState = steadyState - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, GateHHUndetermined) - if subclass is not None: - return subclass(*args_, **kwargs_) - if GateHHUndetermined.subclass: - return GateHHUndetermined.subclass(*args_, **kwargs_) - else: - return GateHHUndetermined(*args_, **kwargs_) - factory = staticmethod(factory) - def get_notes(self): return self.notes - def set_notes(self, notes): self.notes = notes - def get_q10Settings(self): return self.q10Settings - def set_q10Settings(self, q10Settings): self.q10Settings = q10Settings - def get_forwardRate(self): return self.forwardRate - def set_forwardRate(self, forwardRate): self.forwardRate = forwardRate - def get_reverseRate(self): return self.reverseRate - def set_reverseRate(self, reverseRate): self.reverseRate = reverseRate - def get_timeCourse(self): return self.timeCourse - def set_timeCourse(self, timeCourse): self.timeCourse = timeCourse - def get_steadyState(self): return self.steadyState - def set_steadyState(self, steadyState): self.steadyState = steadyState - def get_instances(self): return self.instances - def set_instances(self, instances): self.instances = instances - def get_type(self): return self.type_ - def set_type(self, type_): self.type_ = type_ - def validate_Notes(self, value): - # Validate type Notes, a restriction on xs:string. - if value is not None and Validate_simpletypes_: - pass - def validate_gateTypes(self, value): - # Validate type gateTypes, a restriction on xs:string. - if value is not None and Validate_simpletypes_: - value = str(value) - enumerations = ['gateHHrates', 'gateHHratesTau', 'gateHHtauInf', 'gateHHratesInf', 'gateKS'] - enumeration_respectee = False - for enum in enumerations: - if value == enum: - enumeration_respectee = True - break - if not enumeration_respectee: - warnings_.warn('Value "%(value)s" does not match xsd enumeration restriction on gateTypes' % {"value" : value.encode("utf-8")} ) - def hasContent_(self): - if ( - self.notes is not None or - self.q10Settings is not None or - self.forwardRate is not None or - self.reverseRate is not None or - self.timeCourse is not None or - self.steadyState is not None or - super(GateHHUndetermined, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='GateHHUndetermined', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='GateHHUndetermined') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='GateHHUndetermined', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='GateHHUndetermined'): - super(GateHHUndetermined, self).exportAttributes(outfile, level, already_processed, namespace_, name_='GateHHUndetermined') - if self.instances != 1 and 'instances' not in already_processed: - already_processed.add('instances') - outfile.write(' instances="%s"' % self.gds_format_integer(self.instances, input_name='instances')) - if self.type_ is not None and 'type_' not in already_processed: - already_processed.add('type_') - outfile.write(' type=%s' % (quote_attrib(self.type_), )) - def exportChildren(self, outfile, level, namespace_='', name_='GateHHUndetermined', fromsubclass_=False, pretty_print=True): - super(GateHHUndetermined, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.notes is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%snotes>%s</%snotes>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.notes), input_name='notes')), namespace_, eol_)) - if self.q10Settings is not None: - self.q10Settings.export(outfile, level, namespace_, name_='q10Settings', pretty_print=pretty_print) - if self.forwardRate is not None: - self.forwardRate.export(outfile, level, namespace_, name_='forwardRate', pretty_print=pretty_print) - if self.reverseRate is not None: - self.reverseRate.export(outfile, level, namespace_, name_='reverseRate', pretty_print=pretty_print) - if self.timeCourse is not None: - self.timeCourse.export(outfile, level, namespace_, name_='timeCourse', pretty_print=pretty_print) - if self.steadyState is not None: - self.steadyState.export(outfile, level, namespace_, name_='steadyState', pretty_print=pretty_print) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - value = find_attr_value_('instances', node) - if value is not None and 'instances' not in already_processed: - already_processed.add('instances') - try: - self.instances = int(value) - except ValueError as exp: - raise_parse_error(node, 'Bad integer attribute: %s' % exp) - value = find_attr_value_('type', node) - if value is not None and 'type' not in already_processed: - already_processed.add('type') - self.type_ = value - self.validate_gateTypes(self.type_) # validate type gateTypes - super(GateHHUndetermined, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'notes': - notes_ = child_.text - notes_ = self.gds_validate_string(notes_, node, 'notes') - self.notes = notes_ - # validate type Notes - self.validate_Notes(self.notes) - elif nodeName_ == 'q10Settings': - obj_ = Q10Settings.factory() - obj_.build(child_) - self.q10Settings = obj_ - obj_.original_tagname_ = 'q10Settings' - elif nodeName_ == 'forwardRate': - obj_ = HHRate.factory() - obj_.build(child_) - self.forwardRate = obj_ - obj_.original_tagname_ = 'forwardRate' - elif nodeName_ == 'reverseRate': - obj_ = HHRate.factory() - obj_.build(child_) - self.reverseRate = obj_ - obj_.original_tagname_ = 'reverseRate' - elif nodeName_ == 'timeCourse': - obj_ = HHTime.factory() - obj_.build(child_) - self.timeCourse = obj_ - obj_.original_tagname_ = 'timeCourse' - elif nodeName_ == 'steadyState': - obj_ = HHVariable.factory() - obj_.build(child_) - self.steadyState = obj_ - obj_.original_tagname_ = 'steadyState' - super(GateHHUndetermined, self).buildChildren(child_, node, nodeName_, True) -# end class GateHHUndetermined - - -class IonChannel(Standalone): - subclass = None - superclass = Standalone - def __init__(self, id=None, neuroLexId=None, name=None, metaid=None, notes=None, annotation=None, species=None, type_=None, conductance=None, gate=None, gateHHrates=None, gateHHratesTau=None, gateHHtauInf=None, gateHHratesInf=None): - self.original_tagname_ = None - super(IonChannel, self).__init__(id, neuroLexId, name, metaid, notes, annotation, ) - self.species = _cast(None, species) - self.type_ = _cast(None, type_) - self.conductance = _cast(None, conductance) - if gate is None: - self.gate = [] - else: - self.gate = gate - if gateHHrates is None: - self.gateHHrates = [] - else: - self.gateHHrates = gateHHrates - if gateHHratesTau is None: - self.gateHHratesTau = [] - else: - self.gateHHratesTau = gateHHratesTau - if gateHHtauInf is None: - self.gateHHtauInf = [] - else: - self.gateHHtauInf = gateHHtauInf - if gateHHratesInf is None: - self.gateHHratesInf = [] - else: - self.gateHHratesInf = gateHHratesInf - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, IonChannel) - if subclass is not None: - return subclass(*args_, **kwargs_) - if IonChannel.subclass: - return IonChannel.subclass(*args_, **kwargs_) - else: - return IonChannel(*args_, **kwargs_) - factory = staticmethod(factory) - def get_gate(self): return self.gate - def set_gate(self, gate): self.gate = gate - def add_gate(self, value): self.gate.append(value) - def insert_gate_at(self, index, value): self.gate.insert(index, value) - def replace_gate_at(self, index, value): self.gate[index] = value - def get_gateHHrates(self): return self.gateHHrates - def set_gateHHrates(self, gateHHrates): self.gateHHrates = gateHHrates - def add_gateHHrates(self, value): self.gateHHrates.append(value) - def insert_gateHHrates_at(self, index, value): self.gateHHrates.insert(index, value) - def replace_gateHHrates_at(self, index, value): self.gateHHrates[index] = value - def get_gateHHratesTau(self): return self.gateHHratesTau - def set_gateHHratesTau(self, gateHHratesTau): self.gateHHratesTau = gateHHratesTau - def add_gateHHratesTau(self, value): self.gateHHratesTau.append(value) - def insert_gateHHratesTau_at(self, index, value): self.gateHHratesTau.insert(index, value) - def replace_gateHHratesTau_at(self, index, value): self.gateHHratesTau[index] = value - def get_gateHHtauInf(self): return self.gateHHtauInf - def set_gateHHtauInf(self, gateHHtauInf): self.gateHHtauInf = gateHHtauInf - def add_gateHHtauInf(self, value): self.gateHHtauInf.append(value) - def insert_gateHHtauInf_at(self, index, value): self.gateHHtauInf.insert(index, value) - def replace_gateHHtauInf_at(self, index, value): self.gateHHtauInf[index] = value - def get_gateHHratesInf(self): return self.gateHHratesInf - def set_gateHHratesInf(self, gateHHratesInf): self.gateHHratesInf = gateHHratesInf - def add_gateHHratesInf(self, value): self.gateHHratesInf.append(value) - def insert_gateHHratesInf_at(self, index, value): self.gateHHratesInf.insert(index, value) - def replace_gateHHratesInf_at(self, index, value): self.gateHHratesInf[index] = value - def get_species(self): return self.species - def set_species(self, species): self.species = species - def get_type(self): return self.type_ - def set_type(self, type_): self.type_ = type_ - def get_conductance(self): return self.conductance - def set_conductance(self, conductance): self.conductance = conductance - def validate_NmlId(self, value): - # Validate type NmlId, a restriction on xs:string. - if value is not None and Validate_simpletypes_: - if not self.gds_validate_simple_patterns( - self.validate_NmlId_patterns_, value): - warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_NmlId_patterns_, )) - validate_NmlId_patterns_ = [['^[a-zA-Z0-9_]*$']] - def validate_channelTypes(self, value): - # Validate type channelTypes, a restriction on xs:string. - if value is not None and Validate_simpletypes_: - value = str(value) - enumerations = ['ionChannelPassive', 'ionChannelHH', 'ionChannelKS'] - enumeration_respectee = False - for enum in enumerations: - if value == enum: - enumeration_respectee = True - break - if not enumeration_respectee: - warnings_.warn('Value "%(value)s" does not match xsd enumeration restriction on channelTypes' % {"value" : value.encode("utf-8")} ) - def validate_Nml2Quantity_conductance(self, value): - # Validate type Nml2Quantity_conductance, a restriction on xs:string. - if value is not None and Validate_simpletypes_: - if not self.gds_validate_simple_patterns( - self.validate_Nml2Quantity_conductance_patterns_, value): - warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_Nml2Quantity_conductance_patterns_, )) - validate_Nml2Quantity_conductance_patterns_ = [['^-?([0-9]*(\\.[0-9]+)?)([eE]-?[0-9]+)?[\\s]*(S|mS|uS|nS|pS)$']] - def hasContent_(self): - if ( - self.gate or - self.gateHHrates or - self.gateHHratesTau or - self.gateHHtauInf or - self.gateHHratesInf or - super(IonChannel, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='IonChannel', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='IonChannel') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='IonChannel', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='IonChannel'): - super(IonChannel, self).exportAttributes(outfile, level, already_processed, namespace_, name_='IonChannel') - if self.species is not None and 'species' not in already_processed: - already_processed.add('species') - outfile.write(' species=%s' % (quote_attrib(self.species), )) - if self.type_ is not None and 'type_' not in already_processed: - already_processed.add('type_') - outfile.write(' type=%s' % (quote_attrib(self.type_), )) - if self.conductance is not None and 'conductance' not in already_processed: - already_processed.add('conductance') - outfile.write(' conductance=%s' % (quote_attrib(self.conductance), )) - def exportChildren(self, outfile, level, namespace_='', name_='IonChannel', fromsubclass_=False, pretty_print=True): - super(IonChannel, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - for gate_ in self.gate: - gate_.export(outfile, level, namespace_, name_='gate', pretty_print=pretty_print) - for gateHHrates_ in self.gateHHrates: - gateHHrates_.export(outfile, level, namespace_, name_='gateHHrates', pretty_print=pretty_print) - for gateHHratesTau_ in self.gateHHratesTau: - gateHHratesTau_.export(outfile, level, namespace_, name_='gateHHratesTau', pretty_print=pretty_print) - for gateHHtauInf_ in self.gateHHtauInf: - gateHHtauInf_.export(outfile, level, namespace_, name_='gateHHtauInf', pretty_print=pretty_print) - for gateHHratesInf_ in self.gateHHratesInf: - gateHHratesInf_.export(outfile, level, namespace_, name_='gateHHratesInf', pretty_print=pretty_print) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - value = find_attr_value_('species', node) - if value is not None and 'species' not in already_processed: - already_processed.add('species') - self.species = value - self.validate_NmlId(self.species) # validate type NmlId - value = find_attr_value_('type', node) - if value is not None and 'type' not in already_processed: - already_processed.add('type') - self.type_ = value - self.validate_channelTypes(self.type_) # validate type channelTypes - value = find_attr_value_('conductance', node) - if value is not None and 'conductance' not in already_processed: - already_processed.add('conductance') - self.conductance = value - self.validate_Nml2Quantity_conductance(self.conductance) # validate type Nml2Quantity_conductance - super(IonChannel, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'gate': - obj_ = GateHHUndetermined.factory() - obj_.build(child_) - self.gate.append(obj_) - obj_.original_tagname_ = 'gate' - elif nodeName_ == 'gateHHrates': - obj_ = GateHHRates.factory() - obj_.build(child_) - self.gateHHrates.append(obj_) - obj_.original_tagname_ = 'gateHHrates' - elif nodeName_ == 'gateHHratesTau': - obj_ = GateHHRatesTau.factory() - obj_.build(child_) - self.gateHHratesTau.append(obj_) - obj_.original_tagname_ = 'gateHHratesTau' - elif nodeName_ == 'gateHHtauInf': - obj_ = GateHHTauInf.factory() - obj_.build(child_) - self.gateHHtauInf.append(obj_) - obj_.original_tagname_ = 'gateHHtauInf' - elif nodeName_ == 'gateHHratesInf': - obj_ = GateHHRatesInf.factory() - obj_.build(child_) - self.gateHHratesInf.append(obj_) - obj_.original_tagname_ = 'gateHHratesInf' - super(IonChannel, self).buildChildren(child_, node, nodeName_, True) -# end class IonChannel - - -class NeuroMLDocument(Standalone): - subclass = None - superclass = Standalone - def __init__(self, id=None, neuroLexId=None, name=None, metaid=None, notes=None, annotation=None, include=None, extracellularProperties=None, intracellularProperties=None, morphology=None, ionChannel=None, decayingPoolConcentrationModel=None, expOneSynapse=None, expTwoSynapse=None, blockingPlasticSynapse=None, biophysicalProperties=None, cell=None, baseCell=None, iafTauCell=None, iafTauRefCell=None, iafCell=None, iafRefCell=None, izhikevichCell=None, adExIaFCell=None, pulseGenerator=None, sineGenerator=None, rampGenerator=None, voltageClamp=None, spikeArray=None, spikeGenerator=None, spikeGeneratorRandom=None, spikeGeneratorPoisson=None, IF_curr_alpha=None, IF_curr_exp=None, IF_cond_alpha=None, IF_cond_exp=None, EIF_cond_exp_isfa_ista=None, EIF_cond_alpha_isfa_ista=None, HH_cond_exp=None, expCondSynapse=None, alphaCondSynapse=None, expCurrSynapse=None, alphaCurrSynapse=None, SpikeSourcePoisson=None, network=None, ComponentType=None): - self.original_tagname_ = None - super(NeuroMLDocument, self).__init__(id, neuroLexId, name, metaid, notes, annotation, ) - if include is None: - self.include = [] - else: - self.include = include - if extracellularProperties is None: - self.extracellularProperties = [] - else: - self.extracellularProperties = extracellularProperties - if intracellularProperties is None: - self.intracellularProperties = [] - else: - self.intracellularProperties = intracellularProperties - if morphology is None: - self.morphology = [] - else: - self.morphology = morphology - if ionChannel is None: - self.ionChannel = [] - else: - self.ionChannel = ionChannel - if decayingPoolConcentrationModel is None: - self.decayingPoolConcentrationModel = [] - else: - self.decayingPoolConcentrationModel = decayingPoolConcentrationModel - if expOneSynapse is None: - self.expOneSynapse = [] - else: - self.expOneSynapse = expOneSynapse - if expTwoSynapse is None: - self.expTwoSynapse = [] - else: - self.expTwoSynapse = expTwoSynapse - if blockingPlasticSynapse is None: - self.blockingPlasticSynapse = [] - else: - self.blockingPlasticSynapse = blockingPlasticSynapse - if biophysicalProperties is None: - self.biophysicalProperties = [] - else: - self.biophysicalProperties = biophysicalProperties - if cell is None: - self.cell = [] - else: - self.cell = cell - if baseCell is None: - self.baseCell = [] - else: - self.baseCell = baseCell - if iafTauCell is None: - self.iafTauCell = [] - else: - self.iafTauCell = iafTauCell - if iafTauRefCell is None: - self.iafTauRefCell = [] - else: - self.iafTauRefCell = iafTauRefCell - if iafCell is None: - self.iafCell = [] - else: - self.iafCell = iafCell - if iafRefCell is None: - self.iafRefCell = [] - else: - self.iafRefCell = iafRefCell - if izhikevichCell is None: - self.izhikevichCell = [] - else: - self.izhikevichCell = izhikevichCell - if adExIaFCell is None: - self.adExIaFCell = [] - else: - self.adExIaFCell = adExIaFCell - if pulseGenerator is None: - self.pulseGenerator = [] - else: - self.pulseGenerator = pulseGenerator - if sineGenerator is None: - self.sineGenerator = [] - else: - self.sineGenerator = sineGenerator - if rampGenerator is None: - self.rampGenerator = [] - else: - self.rampGenerator = rampGenerator - if voltageClamp is None: - self.voltageClamp = [] - else: - self.voltageClamp = voltageClamp - if spikeArray is None: - self.spikeArray = [] - else: - self.spikeArray = spikeArray - if spikeGenerator is None: - self.spikeGenerator = [] - else: - self.spikeGenerator = spikeGenerator - if spikeGeneratorRandom is None: - self.spikeGeneratorRandom = [] - else: - self.spikeGeneratorRandom = spikeGeneratorRandom - if spikeGeneratorPoisson is None: - self.spikeGeneratorPoisson = [] - else: - self.spikeGeneratorPoisson = spikeGeneratorPoisson - if IF_curr_alpha is None: - self.IF_curr_alpha = [] - else: - self.IF_curr_alpha = IF_curr_alpha - if IF_curr_exp is None: - self.IF_curr_exp = [] - else: - self.IF_curr_exp = IF_curr_exp - if IF_cond_alpha is None: - self.IF_cond_alpha = [] - else: - self.IF_cond_alpha = IF_cond_alpha - if IF_cond_exp is None: - self.IF_cond_exp = [] - else: - self.IF_cond_exp = IF_cond_exp - if EIF_cond_exp_isfa_ista is None: - self.EIF_cond_exp_isfa_ista = [] - else: - self.EIF_cond_exp_isfa_ista = EIF_cond_exp_isfa_ista - if EIF_cond_alpha_isfa_ista is None: - self.EIF_cond_alpha_isfa_ista = [] - else: - self.EIF_cond_alpha_isfa_ista = EIF_cond_alpha_isfa_ista - if HH_cond_exp is None: - self.HH_cond_exp = [] - else: - self.HH_cond_exp = HH_cond_exp - if expCondSynapse is None: - self.expCondSynapse = [] - else: - self.expCondSynapse = expCondSynapse - if alphaCondSynapse is None: - self.alphaCondSynapse = [] - else: - self.alphaCondSynapse = alphaCondSynapse - if expCurrSynapse is None: - self.expCurrSynapse = [] - else: - self.expCurrSynapse = expCurrSynapse - if alphaCurrSynapse is None: - self.alphaCurrSynapse = [] - else: - self.alphaCurrSynapse = alphaCurrSynapse - if SpikeSourcePoisson is None: - self.SpikeSourcePoisson = [] - else: - self.SpikeSourcePoisson = SpikeSourcePoisson - if network is None: - self.network = [] - else: - self.network = network - if ComponentType is None: - self.ComponentType = [] - else: - self.ComponentType = ComponentType - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, NeuroMLDocument) - if subclass is not None: - return subclass(*args_, **kwargs_) - if NeuroMLDocument.subclass: - return NeuroMLDocument.subclass(*args_, **kwargs_) - else: - return NeuroMLDocument(*args_, **kwargs_) - factory = staticmethod(factory) - def get_include(self): return self.include - def set_include(self, include): self.include = include - def add_include(self, value): self.include.append(value) - def insert_include_at(self, index, value): self.include.insert(index, value) - def replace_include_at(self, index, value): self.include[index] = value - def get_extracellularProperties(self): return self.extracellularProperties - def set_extracellularProperties(self, extracellularProperties): self.extracellularProperties = extracellularProperties - def add_extracellularProperties(self, value): self.extracellularProperties.append(value) - def insert_extracellularProperties_at(self, index, value): self.extracellularProperties.insert(index, value) - def replace_extracellularProperties_at(self, index, value): self.extracellularProperties[index] = value - def get_intracellularProperties(self): return self.intracellularProperties - def set_intracellularProperties(self, intracellularProperties): self.intracellularProperties = intracellularProperties - def add_intracellularProperties(self, value): self.intracellularProperties.append(value) - def insert_intracellularProperties_at(self, index, value): self.intracellularProperties.insert(index, value) - def replace_intracellularProperties_at(self, index, value): self.intracellularProperties[index] = value - def get_morphology(self): return self.morphology - def set_morphology(self, morphology): self.morphology = morphology - def add_morphology(self, value): self.morphology.append(value) - def insert_morphology_at(self, index, value): self.morphology.insert(index, value) - def replace_morphology_at(self, index, value): self.morphology[index] = value - def get_ionChannel(self): return self.ionChannel - def set_ionChannel(self, ionChannel): self.ionChannel = ionChannel - def add_ionChannel(self, value): self.ionChannel.append(value) - def insert_ionChannel_at(self, index, value): self.ionChannel.insert(index, value) - def replace_ionChannel_at(self, index, value): self.ionChannel[index] = value - def get_decayingPoolConcentrationModel(self): return self.decayingPoolConcentrationModel - def set_decayingPoolConcentrationModel(self, decayingPoolConcentrationModel): self.decayingPoolConcentrationModel = decayingPoolConcentrationModel - def add_decayingPoolConcentrationModel(self, value): self.decayingPoolConcentrationModel.append(value) - def insert_decayingPoolConcentrationModel_at(self, index, value): self.decayingPoolConcentrationModel.insert(index, value) - def replace_decayingPoolConcentrationModel_at(self, index, value): self.decayingPoolConcentrationModel[index] = value - def get_expOneSynapse(self): return self.expOneSynapse - def set_expOneSynapse(self, expOneSynapse): self.expOneSynapse = expOneSynapse - def add_expOneSynapse(self, value): self.expOneSynapse.append(value) - def insert_expOneSynapse_at(self, index, value): self.expOneSynapse.insert(index, value) - def replace_expOneSynapse_at(self, index, value): self.expOneSynapse[index] = value - def get_expTwoSynapse(self): return self.expTwoSynapse - def set_expTwoSynapse(self, expTwoSynapse): self.expTwoSynapse = expTwoSynapse - def add_expTwoSynapse(self, value): self.expTwoSynapse.append(value) - def insert_expTwoSynapse_at(self, index, value): self.expTwoSynapse.insert(index, value) - def replace_expTwoSynapse_at(self, index, value): self.expTwoSynapse[index] = value - def get_blockingPlasticSynapse(self): return self.blockingPlasticSynapse - def set_blockingPlasticSynapse(self, blockingPlasticSynapse): self.blockingPlasticSynapse = blockingPlasticSynapse - def add_blockingPlasticSynapse(self, value): self.blockingPlasticSynapse.append(value) - def insert_blockingPlasticSynapse_at(self, index, value): self.blockingPlasticSynapse.insert(index, value) - def replace_blockingPlasticSynapse_at(self, index, value): self.blockingPlasticSynapse[index] = value - def get_biophysicalProperties(self): return self.biophysicalProperties - def set_biophysicalProperties(self, biophysicalProperties): self.biophysicalProperties = biophysicalProperties - def add_biophysicalProperties(self, value): self.biophysicalProperties.append(value) - def insert_biophysicalProperties_at(self, index, value): self.biophysicalProperties.insert(index, value) - def replace_biophysicalProperties_at(self, index, value): self.biophysicalProperties[index] = value - def get_cell(self): return self.cell - def set_cell(self, cell): self.cell = cell - def add_cell(self, value): self.cell.append(value) - def insert_cell_at(self, index, value): self.cell.insert(index, value) - def replace_cell_at(self, index, value): self.cell[index] = value - def get_baseCell(self): return self.baseCell - def set_baseCell(self, baseCell): self.baseCell = baseCell - def add_baseCell(self, value): self.baseCell.append(value) - def insert_baseCell_at(self, index, value): self.baseCell.insert(index, value) - def replace_baseCell_at(self, index, value): self.baseCell[index] = value - def get_iafTauCell(self): return self.iafTauCell - def set_iafTauCell(self, iafTauCell): self.iafTauCell = iafTauCell - def add_iafTauCell(self, value): self.iafTauCell.append(value) - def insert_iafTauCell_at(self, index, value): self.iafTauCell.insert(index, value) - def replace_iafTauCell_at(self, index, value): self.iafTauCell[index] = value - def get_iafTauRefCell(self): return self.iafTauRefCell - def set_iafTauRefCell(self, iafTauRefCell): self.iafTauRefCell = iafTauRefCell - def add_iafTauRefCell(self, value): self.iafTauRefCell.append(value) - def insert_iafTauRefCell_at(self, index, value): self.iafTauRefCell.insert(index, value) - def replace_iafTauRefCell_at(self, index, value): self.iafTauRefCell[index] = value - def get_iafCell(self): return self.iafCell - def set_iafCell(self, iafCell): self.iafCell = iafCell - def add_iafCell(self, value): self.iafCell.append(value) - def insert_iafCell_at(self, index, value): self.iafCell.insert(index, value) - def replace_iafCell_at(self, index, value): self.iafCell[index] = value - def get_iafRefCell(self): return self.iafRefCell - def set_iafRefCell(self, iafRefCell): self.iafRefCell = iafRefCell - def add_iafRefCell(self, value): self.iafRefCell.append(value) - def insert_iafRefCell_at(self, index, value): self.iafRefCell.insert(index, value) - def replace_iafRefCell_at(self, index, value): self.iafRefCell[index] = value - def get_izhikevichCell(self): return self.izhikevichCell - def set_izhikevichCell(self, izhikevichCell): self.izhikevichCell = izhikevichCell - def add_izhikevichCell(self, value): self.izhikevichCell.append(value) - def insert_izhikevichCell_at(self, index, value): self.izhikevichCell.insert(index, value) - def replace_izhikevichCell_at(self, index, value): self.izhikevichCell[index] = value - def get_adExIaFCell(self): return self.adExIaFCell - def set_adExIaFCell(self, adExIaFCell): self.adExIaFCell = adExIaFCell - def add_adExIaFCell(self, value): self.adExIaFCell.append(value) - def insert_adExIaFCell_at(self, index, value): self.adExIaFCell.insert(index, value) - def replace_adExIaFCell_at(self, index, value): self.adExIaFCell[index] = value - def get_pulseGenerator(self): return self.pulseGenerator - def set_pulseGenerator(self, pulseGenerator): self.pulseGenerator = pulseGenerator - def add_pulseGenerator(self, value): self.pulseGenerator.append(value) - def insert_pulseGenerator_at(self, index, value): self.pulseGenerator.insert(index, value) - def replace_pulseGenerator_at(self, index, value): self.pulseGenerator[index] = value - def get_sineGenerator(self): return self.sineGenerator - def set_sineGenerator(self, sineGenerator): self.sineGenerator = sineGenerator - def add_sineGenerator(self, value): self.sineGenerator.append(value) - def insert_sineGenerator_at(self, index, value): self.sineGenerator.insert(index, value) - def replace_sineGenerator_at(self, index, value): self.sineGenerator[index] = value - def get_rampGenerator(self): return self.rampGenerator - def set_rampGenerator(self, rampGenerator): self.rampGenerator = rampGenerator - def add_rampGenerator(self, value): self.rampGenerator.append(value) - def insert_rampGenerator_at(self, index, value): self.rampGenerator.insert(index, value) - def replace_rampGenerator_at(self, index, value): self.rampGenerator[index] = value - def get_voltageClamp(self): return self.voltageClamp - def set_voltageClamp(self, voltageClamp): self.voltageClamp = voltageClamp - def add_voltageClamp(self, value): self.voltageClamp.append(value) - def insert_voltageClamp_at(self, index, value): self.voltageClamp.insert(index, value) - def replace_voltageClamp_at(self, index, value): self.voltageClamp[index] = value - def get_spikeArray(self): return self.spikeArray - def set_spikeArray(self, spikeArray): self.spikeArray = spikeArray - def add_spikeArray(self, value): self.spikeArray.append(value) - def insert_spikeArray_at(self, index, value): self.spikeArray.insert(index, value) - def replace_spikeArray_at(self, index, value): self.spikeArray[index] = value - def get_spikeGenerator(self): return self.spikeGenerator - def set_spikeGenerator(self, spikeGenerator): self.spikeGenerator = spikeGenerator - def add_spikeGenerator(self, value): self.spikeGenerator.append(value) - def insert_spikeGenerator_at(self, index, value): self.spikeGenerator.insert(index, value) - def replace_spikeGenerator_at(self, index, value): self.spikeGenerator[index] = value - def get_spikeGeneratorRandom(self): return self.spikeGeneratorRandom - def set_spikeGeneratorRandom(self, spikeGeneratorRandom): self.spikeGeneratorRandom = spikeGeneratorRandom - def add_spikeGeneratorRandom(self, value): self.spikeGeneratorRandom.append(value) - def insert_spikeGeneratorRandom_at(self, index, value): self.spikeGeneratorRandom.insert(index, value) - def replace_spikeGeneratorRandom_at(self, index, value): self.spikeGeneratorRandom[index] = value - def get_spikeGeneratorPoisson(self): return self.spikeGeneratorPoisson - def set_spikeGeneratorPoisson(self, spikeGeneratorPoisson): self.spikeGeneratorPoisson = spikeGeneratorPoisson - def add_spikeGeneratorPoisson(self, value): self.spikeGeneratorPoisson.append(value) - def insert_spikeGeneratorPoisson_at(self, index, value): self.spikeGeneratorPoisson.insert(index, value) - def replace_spikeGeneratorPoisson_at(self, index, value): self.spikeGeneratorPoisson[index] = value - def get_IF_curr_alpha(self): return self.IF_curr_alpha - def set_IF_curr_alpha(self, IF_curr_alpha): self.IF_curr_alpha = IF_curr_alpha - def add_IF_curr_alpha(self, value): self.IF_curr_alpha.append(value) - def insert_IF_curr_alpha_at(self, index, value): self.IF_curr_alpha.insert(index, value) - def replace_IF_curr_alpha_at(self, index, value): self.IF_curr_alpha[index] = value - def get_IF_curr_exp(self): return self.IF_curr_exp - def set_IF_curr_exp(self, IF_curr_exp): self.IF_curr_exp = IF_curr_exp - def add_IF_curr_exp(self, value): self.IF_curr_exp.append(value) - def insert_IF_curr_exp_at(self, index, value): self.IF_curr_exp.insert(index, value) - def replace_IF_curr_exp_at(self, index, value): self.IF_curr_exp[index] = value - def get_IF_cond_alpha(self): return self.IF_cond_alpha - def set_IF_cond_alpha(self, IF_cond_alpha): self.IF_cond_alpha = IF_cond_alpha - def add_IF_cond_alpha(self, value): self.IF_cond_alpha.append(value) - def insert_IF_cond_alpha_at(self, index, value): self.IF_cond_alpha.insert(index, value) - def replace_IF_cond_alpha_at(self, index, value): self.IF_cond_alpha[index] = value - def get_IF_cond_exp(self): return self.IF_cond_exp - def set_IF_cond_exp(self, IF_cond_exp): self.IF_cond_exp = IF_cond_exp - def add_IF_cond_exp(self, value): self.IF_cond_exp.append(value) - def insert_IF_cond_exp_at(self, index, value): self.IF_cond_exp.insert(index, value) - def replace_IF_cond_exp_at(self, index, value): self.IF_cond_exp[index] = value - def get_EIF_cond_exp_isfa_ista(self): return self.EIF_cond_exp_isfa_ista - def set_EIF_cond_exp_isfa_ista(self, EIF_cond_exp_isfa_ista): self.EIF_cond_exp_isfa_ista = EIF_cond_exp_isfa_ista - def add_EIF_cond_exp_isfa_ista(self, value): self.EIF_cond_exp_isfa_ista.append(value) - def insert_EIF_cond_exp_isfa_ista_at(self, index, value): self.EIF_cond_exp_isfa_ista.insert(index, value) - def replace_EIF_cond_exp_isfa_ista_at(self, index, value): self.EIF_cond_exp_isfa_ista[index] = value - def get_EIF_cond_alpha_isfa_ista(self): return self.EIF_cond_alpha_isfa_ista - def set_EIF_cond_alpha_isfa_ista(self, EIF_cond_alpha_isfa_ista): self.EIF_cond_alpha_isfa_ista = EIF_cond_alpha_isfa_ista - def add_EIF_cond_alpha_isfa_ista(self, value): self.EIF_cond_alpha_isfa_ista.append(value) - def insert_EIF_cond_alpha_isfa_ista_at(self, index, value): self.EIF_cond_alpha_isfa_ista.insert(index, value) - def replace_EIF_cond_alpha_isfa_ista_at(self, index, value): self.EIF_cond_alpha_isfa_ista[index] = value - def get_HH_cond_exp(self): return self.HH_cond_exp - def set_HH_cond_exp(self, HH_cond_exp): self.HH_cond_exp = HH_cond_exp - def add_HH_cond_exp(self, value): self.HH_cond_exp.append(value) - def insert_HH_cond_exp_at(self, index, value): self.HH_cond_exp.insert(index, value) - def replace_HH_cond_exp_at(self, index, value): self.HH_cond_exp[index] = value - def get_expCondSynapse(self): return self.expCondSynapse - def set_expCondSynapse(self, expCondSynapse): self.expCondSynapse = expCondSynapse - def add_expCondSynapse(self, value): self.expCondSynapse.append(value) - def insert_expCondSynapse_at(self, index, value): self.expCondSynapse.insert(index, value) - def replace_expCondSynapse_at(self, index, value): self.expCondSynapse[index] = value - def get_alphaCondSynapse(self): return self.alphaCondSynapse - def set_alphaCondSynapse(self, alphaCondSynapse): self.alphaCondSynapse = alphaCondSynapse - def add_alphaCondSynapse(self, value): self.alphaCondSynapse.append(value) - def insert_alphaCondSynapse_at(self, index, value): self.alphaCondSynapse.insert(index, value) - def replace_alphaCondSynapse_at(self, index, value): self.alphaCondSynapse[index] = value - def get_expCurrSynapse(self): return self.expCurrSynapse - def set_expCurrSynapse(self, expCurrSynapse): self.expCurrSynapse = expCurrSynapse - def add_expCurrSynapse(self, value): self.expCurrSynapse.append(value) - def insert_expCurrSynapse_at(self, index, value): self.expCurrSynapse.insert(index, value) - def replace_expCurrSynapse_at(self, index, value): self.expCurrSynapse[index] = value - def get_alphaCurrSynapse(self): return self.alphaCurrSynapse - def set_alphaCurrSynapse(self, alphaCurrSynapse): self.alphaCurrSynapse = alphaCurrSynapse - def add_alphaCurrSynapse(self, value): self.alphaCurrSynapse.append(value) - def insert_alphaCurrSynapse_at(self, index, value): self.alphaCurrSynapse.insert(index, value) - def replace_alphaCurrSynapse_at(self, index, value): self.alphaCurrSynapse[index] = value - def get_SpikeSourcePoisson(self): return self.SpikeSourcePoisson - def set_SpikeSourcePoisson(self, SpikeSourcePoisson): self.SpikeSourcePoisson = SpikeSourcePoisson - def add_SpikeSourcePoisson(self, value): self.SpikeSourcePoisson.append(value) - def insert_SpikeSourcePoisson_at(self, index, value): self.SpikeSourcePoisson.insert(index, value) - def replace_SpikeSourcePoisson_at(self, index, value): self.SpikeSourcePoisson[index] = value - def get_network(self): return self.network - def set_network(self, network): self.network = network - def add_network(self, value): self.network.append(value) - def insert_network_at(self, index, value): self.network.insert(index, value) - def replace_network_at(self, index, value): self.network[index] = value - def get_ComponentType(self): return self.ComponentType - def set_ComponentType(self, ComponentType): self.ComponentType = ComponentType - def add_ComponentType(self, value): self.ComponentType.append(value) - def insert_ComponentType_at(self, index, value): self.ComponentType.insert(index, value) - def replace_ComponentType_at(self, index, value): self.ComponentType[index] = value - def hasContent_(self): - if ( - self.include or - self.extracellularProperties or - self.intracellularProperties or - self.morphology or - self.ionChannel or - self.decayingPoolConcentrationModel or - self.expOneSynapse or - self.expTwoSynapse or - self.blockingPlasticSynapse or - self.biophysicalProperties or - self.cell or - self.baseCell or - self.iafTauCell or - self.iafTauRefCell or - self.iafCell or - self.iafRefCell or - self.izhikevichCell or - self.adExIaFCell or - self.pulseGenerator or - self.sineGenerator or - self.rampGenerator or - self.voltageClamp or - self.spikeArray or - self.spikeGenerator or - self.spikeGeneratorRandom or - self.spikeGeneratorPoisson or - self.IF_curr_alpha or - self.IF_curr_exp or - self.IF_cond_alpha or - self.IF_cond_exp or - self.EIF_cond_exp_isfa_ista or - self.EIF_cond_alpha_isfa_ista or - self.HH_cond_exp or - self.expCondSynapse or - self.alphaCondSynapse or - self.expCurrSynapse or - self.alphaCurrSynapse or - self.SpikeSourcePoisson or - self.network or - self.ComponentType or - super(NeuroMLDocument, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='NeuroMLDocument', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='NeuroMLDocument') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='NeuroMLDocument', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='NeuroMLDocument'): - super(NeuroMLDocument, self).exportAttributes(outfile, level, already_processed, namespace_, name_='NeuroMLDocument') - def exportChildren(self, outfile, level, namespace_='', name_='NeuroMLDocument', fromsubclass_=False, pretty_print=True): - super(NeuroMLDocument, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - for include_ in self.include: - include_.export(outfile, level, namespace_, name_='include', pretty_print=pretty_print) - for extracellularProperties_ in self.extracellularProperties: - extracellularProperties_.export(outfile, level, namespace_, name_='extracellularProperties', pretty_print=pretty_print) - for intracellularProperties_ in self.intracellularProperties: - intracellularProperties_.export(outfile, level, namespace_, name_='intracellularProperties', pretty_print=pretty_print) - for morphology_ in self.morphology: - morphology_.export(outfile, level, namespace_, name_='morphology', pretty_print=pretty_print) - for ionChannel_ in self.ionChannel: - ionChannel_.export(outfile, level, namespace_, name_='ionChannel', pretty_print=pretty_print) - for decayingPoolConcentrationModel_ in self.decayingPoolConcentrationModel: - decayingPoolConcentrationModel_.export(outfile, level, namespace_, name_='decayingPoolConcentrationModel', pretty_print=pretty_print) - for expOneSynapse_ in self.expOneSynapse: - expOneSynapse_.export(outfile, level, namespace_, name_='expOneSynapse', pretty_print=pretty_print) - for expTwoSynapse_ in self.expTwoSynapse: - expTwoSynapse_.export(outfile, level, namespace_, name_='expTwoSynapse', pretty_print=pretty_print) - for blockingPlasticSynapse_ in self.blockingPlasticSynapse: - blockingPlasticSynapse_.export(outfile, level, namespace_, name_='blockingPlasticSynapse', pretty_print=pretty_print) - for biophysicalProperties_ in self.biophysicalProperties: - biophysicalProperties_.export(outfile, level, namespace_, name_='biophysicalProperties', pretty_print=pretty_print) - for cell_ in self.cell: - cell_.export(outfile, level, namespace_, name_='cell', pretty_print=pretty_print) - for baseCell_ in self.baseCell: - baseCell_.export(outfile, level, namespace_, name_='baseCell', pretty_print=pretty_print) - for iafTauCell_ in self.iafTauCell: - iafTauCell_.export(outfile, level, namespace_, name_='iafTauCell', pretty_print=pretty_print) - for iafTauRefCell_ in self.iafTauRefCell: - iafTauRefCell_.export(outfile, level, namespace_, name_='iafTauRefCell', pretty_print=pretty_print) - for iafCell_ in self.iafCell: - iafCell_.export(outfile, level, namespace_, name_='iafCell', pretty_print=pretty_print) - for iafRefCell_ in self.iafRefCell: - iafRefCell_.export(outfile, level, namespace_, name_='iafRefCell', pretty_print=pretty_print) - for izhikevichCell_ in self.izhikevichCell: - izhikevichCell_.export(outfile, level, namespace_, name_='izhikevichCell', pretty_print=pretty_print) - for adExIaFCell_ in self.adExIaFCell: - adExIaFCell_.export(outfile, level, namespace_, name_='adExIaFCell', pretty_print=pretty_print) - for pulseGenerator_ in self.pulseGenerator: - pulseGenerator_.export(outfile, level, namespace_, name_='pulseGenerator', pretty_print=pretty_print) - for sineGenerator_ in self.sineGenerator: - sineGenerator_.export(outfile, level, namespace_, name_='sineGenerator', pretty_print=pretty_print) - for rampGenerator_ in self.rampGenerator: - rampGenerator_.export(outfile, level, namespace_, name_='rampGenerator', pretty_print=pretty_print) - for voltageClamp_ in self.voltageClamp: - voltageClamp_.export(outfile, level, namespace_, name_='voltageClamp', pretty_print=pretty_print) - for spikeArray_ in self.spikeArray: - spikeArray_.export(outfile, level, namespace_, name_='spikeArray', pretty_print=pretty_print) - for spikeGenerator_ in self.spikeGenerator: - spikeGenerator_.export(outfile, level, namespace_, name_='spikeGenerator', pretty_print=pretty_print) - for spikeGeneratorRandom_ in self.spikeGeneratorRandom: - spikeGeneratorRandom_.export(outfile, level, namespace_, name_='spikeGeneratorRandom', pretty_print=pretty_print) - for spikeGeneratorPoisson_ in self.spikeGeneratorPoisson: - spikeGeneratorPoisson_.export(outfile, level, namespace_, name_='spikeGeneratorPoisson', pretty_print=pretty_print) - for IF_curr_alpha_ in self.IF_curr_alpha: - IF_curr_alpha_.export(outfile, level, namespace_, name_='IF_curr_alpha', pretty_print=pretty_print) - for IF_curr_exp_ in self.IF_curr_exp: - IF_curr_exp_.export(outfile, level, namespace_, name_='IF_curr_exp', pretty_print=pretty_print) - for IF_cond_alpha_ in self.IF_cond_alpha: - IF_cond_alpha_.export(outfile, level, namespace_, name_='IF_cond_alpha', pretty_print=pretty_print) - for IF_cond_exp_ in self.IF_cond_exp: - IF_cond_exp_.export(outfile, level, namespace_, name_='IF_cond_exp', pretty_print=pretty_print) - for EIF_cond_exp_isfa_ista_ in self.EIF_cond_exp_isfa_ista: - EIF_cond_exp_isfa_ista_.export(outfile, level, namespace_, name_='EIF_cond_exp_isfa_ista', pretty_print=pretty_print) - for EIF_cond_alpha_isfa_ista_ in self.EIF_cond_alpha_isfa_ista: - EIF_cond_alpha_isfa_ista_.export(outfile, level, namespace_, name_='EIF_cond_alpha_isfa_ista', pretty_print=pretty_print) - for HH_cond_exp_ in self.HH_cond_exp: - HH_cond_exp_.export(outfile, level, namespace_, name_='HH_cond_exp', pretty_print=pretty_print) - for expCondSynapse_ in self.expCondSynapse: - expCondSynapse_.export(outfile, level, namespace_, name_='expCondSynapse', pretty_print=pretty_print) - for alphaCondSynapse_ in self.alphaCondSynapse: - alphaCondSynapse_.export(outfile, level, namespace_, name_='alphaCondSynapse', pretty_print=pretty_print) - for expCurrSynapse_ in self.expCurrSynapse: - expCurrSynapse_.export(outfile, level, namespace_, name_='expCurrSynapse', pretty_print=pretty_print) - for alphaCurrSynapse_ in self.alphaCurrSynapse: - alphaCurrSynapse_.export(outfile, level, namespace_, name_='alphaCurrSynapse', pretty_print=pretty_print) - for SpikeSourcePoisson_ in self.SpikeSourcePoisson: - SpikeSourcePoisson_.export(outfile, level, namespace_, name_='SpikeSourcePoisson', pretty_print=pretty_print) - for network_ in self.network: - network_.export(outfile, level, namespace_, name_='network', pretty_print=pretty_print) - for ComponentType_ in self.ComponentType: - ComponentType_.export(outfile, level, namespace_, name_='ComponentType', pretty_print=pretty_print) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(NeuroMLDocument, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'include': - obj_ = IncludeType.factory() - obj_.build(child_) - self.include.append(obj_) - obj_.original_tagname_ = 'include' - elif nodeName_ == 'extracellularProperties': - obj_ = ExtracellularProperties.factory() - obj_.build(child_) - self.extracellularProperties.append(obj_) - obj_.original_tagname_ = 'extracellularProperties' - elif nodeName_ == 'intracellularProperties': - obj_ = IntracellularProperties.factory() - obj_.build(child_) - self.intracellularProperties.append(obj_) - obj_.original_tagname_ = 'intracellularProperties' - elif nodeName_ == 'morphology': - obj_ = Morphology.factory() - obj_.build(child_) - self.morphology.append(obj_) - obj_.original_tagname_ = 'morphology' - elif nodeName_ == 'ionChannel': - obj_ = IonChannel.factory() - obj_.build(child_) - self.ionChannel.append(obj_) - obj_.original_tagname_ = 'ionChannel' - elif nodeName_ == 'decayingPoolConcentrationModel': - class_obj_ = self.get_class_obj_(child_, DecayingPoolConcentrationModel) - obj_ = class_obj_.factory() - obj_.build(child_) - self.decayingPoolConcentrationModel.append(obj_) - obj_.original_tagname_ = 'decayingPoolConcentrationModel' - elif nodeName_ == 'expOneSynapse': - obj_ = ExpOneSynapse.factory() - obj_.build(child_) - self.expOneSynapse.append(obj_) - obj_.original_tagname_ = 'expOneSynapse' - elif nodeName_ == 'expTwoSynapse': - class_obj_ = self.get_class_obj_(child_, ExpTwoSynapse) - obj_ = class_obj_.factory() - obj_.build(child_) - self.expTwoSynapse.append(obj_) - obj_.original_tagname_ = 'expTwoSynapse' - elif nodeName_ == 'blockingPlasticSynapse': - obj_ = BlockingPlasticSynapse.factory() - obj_.build(child_) - self.blockingPlasticSynapse.append(obj_) - obj_.original_tagname_ = 'blockingPlasticSynapse' - elif nodeName_ == 'biophysicalProperties': - obj_ = BiophysicalProperties.factory() - obj_.build(child_) - self.biophysicalProperties.append(obj_) - obj_.original_tagname_ = 'biophysicalProperties' - elif nodeName_ == 'cell': - obj_ = Cell.factory() - obj_.build(child_) - self.cell.append(obj_) - obj_.original_tagname_ = 'cell' - elif nodeName_ == 'baseCell': - class_obj_ = self.get_class_obj_(child_, BaseCell) - obj_ = class_obj_.factory() - obj_.build(child_) - self.baseCell.append(obj_) - obj_.original_tagname_ = 'baseCell' - elif nodeName_ == 'iafTauCell': - class_obj_ = self.get_class_obj_(child_, IaFTauCell) - obj_ = class_obj_.factory() - obj_.build(child_) - self.iafTauCell.append(obj_) - obj_.original_tagname_ = 'iafTauCell' - elif nodeName_ == 'iafTauRefCell': - obj_ = IaFTauRefCell.factory() - obj_.build(child_) - self.iafTauRefCell.append(obj_) - obj_.original_tagname_ = 'iafTauRefCell' - elif nodeName_ == 'iafCell': - class_obj_ = self.get_class_obj_(child_, IaFCell) - obj_ = class_obj_.factory() - obj_.build(child_) - self.iafCell.append(obj_) - obj_.original_tagname_ = 'iafCell' - elif nodeName_ == 'iafRefCell': - obj_ = IaFRefCell.factory() - obj_.build(child_) - self.iafRefCell.append(obj_) - obj_.original_tagname_ = 'iafRefCell' - elif nodeName_ == 'izhikevichCell': - obj_ = IzhikevichCell.factory() - obj_.build(child_) - self.izhikevichCell.append(obj_) - obj_.original_tagname_ = 'izhikevichCell' - elif nodeName_ == 'adExIaFCell': - obj_ = AdExIaFCell.factory() - obj_.build(child_) - self.adExIaFCell.append(obj_) - obj_.original_tagname_ = 'adExIaFCell' - elif nodeName_ == 'pulseGenerator': - obj_ = PulseGenerator.factory() - obj_.build(child_) - self.pulseGenerator.append(obj_) - obj_.original_tagname_ = 'pulseGenerator' - elif nodeName_ == 'sineGenerator': - obj_ = SineGenerator.factory() - obj_.build(child_) - self.sineGenerator.append(obj_) - obj_.original_tagname_ = 'sineGenerator' - elif nodeName_ == 'rampGenerator': - obj_ = RampGenerator.factory() - obj_.build(child_) - self.rampGenerator.append(obj_) - obj_.original_tagname_ = 'rampGenerator' - elif nodeName_ == 'voltageClamp': - obj_ = VoltageClamp.factory() - obj_.build(child_) - self.voltageClamp.append(obj_) - obj_.original_tagname_ = 'voltageClamp' - elif nodeName_ == 'spikeArray': - obj_ = SpikeArray.factory() - obj_.build(child_) - self.spikeArray.append(obj_) - obj_.original_tagname_ = 'spikeArray' - elif nodeName_ == 'spikeGenerator': - obj_ = SpikeGenerator.factory() - obj_.build(child_) - self.spikeGenerator.append(obj_) - obj_.original_tagname_ = 'spikeGenerator' - elif nodeName_ == 'spikeGeneratorRandom': - obj_ = SpikeGeneratorRandom.factory() - obj_.build(child_) - self.spikeGeneratorRandom.append(obj_) - obj_.original_tagname_ = 'spikeGeneratorRandom' - elif nodeName_ == 'spikeGeneratorPoisson': - obj_ = SpikeGeneratorPoisson.factory() - obj_.build(child_) - self.spikeGeneratorPoisson.append(obj_) - obj_.original_tagname_ = 'spikeGeneratorPoisson' - elif nodeName_ == 'IF_curr_alpha': - obj_ = IF_curr_alpha.factory() - obj_.build(child_) - self.IF_curr_alpha.append(obj_) - obj_.original_tagname_ = 'IF_curr_alpha' - elif nodeName_ == 'IF_curr_exp': - obj_ = IF_curr_exp.factory() - obj_.build(child_) - self.IF_curr_exp.append(obj_) - obj_.original_tagname_ = 'IF_curr_exp' - elif nodeName_ == 'IF_cond_alpha': - obj_ = IF_cond_alpha.factory() - obj_.build(child_) - self.IF_cond_alpha.append(obj_) - obj_.original_tagname_ = 'IF_cond_alpha' - elif nodeName_ == 'IF_cond_exp': - obj_ = IF_cond_exp.factory() - obj_.build(child_) - self.IF_cond_exp.append(obj_) - obj_.original_tagname_ = 'IF_cond_exp' - elif nodeName_ == 'EIF_cond_exp_isfa_ista': - obj_ = EIF_cond_exp_isfa_ista.factory() - obj_.build(child_) - self.EIF_cond_exp_isfa_ista.append(obj_) - obj_.original_tagname_ = 'EIF_cond_exp_isfa_ista' - elif nodeName_ == 'EIF_cond_alpha_isfa_ista': - obj_ = EIF_cond_alpha_isfa_ista.factory() - obj_.build(child_) - self.EIF_cond_alpha_isfa_ista.append(obj_) - obj_.original_tagname_ = 'EIF_cond_alpha_isfa_ista' - elif nodeName_ == 'HH_cond_exp': - obj_ = HH_cond_exp.factory() - obj_.build(child_) - self.HH_cond_exp.append(obj_) - obj_.original_tagname_ = 'HH_cond_exp' - elif nodeName_ == 'expCondSynapse': - obj_ = ExpCondSynapse.factory() - obj_.build(child_) - self.expCondSynapse.append(obj_) - obj_.original_tagname_ = 'expCondSynapse' - elif nodeName_ == 'alphaCondSynapse': - obj_ = AlphaCondSynapse.factory() - obj_.build(child_) - self.alphaCondSynapse.append(obj_) - obj_.original_tagname_ = 'alphaCondSynapse' - elif nodeName_ == 'expCurrSynapse': - obj_ = ExpCurrSynapse.factory() - obj_.build(child_) - self.expCurrSynapse.append(obj_) - obj_.original_tagname_ = 'expCurrSynapse' - elif nodeName_ == 'alphaCurrSynapse': - obj_ = AlphaCurrSynapse.factory() - obj_.build(child_) - self.alphaCurrSynapse.append(obj_) - obj_.original_tagname_ = 'alphaCurrSynapse' - elif nodeName_ == 'SpikeSourcePoisson': - obj_ = SpikeSourcePoisson.factory() - obj_.build(child_) - self.SpikeSourcePoisson.append(obj_) - obj_.original_tagname_ = 'SpikeSourcePoisson' - elif nodeName_ == 'network': - obj_ = Network.factory() - obj_.build(child_) - self.network.append(obj_) - obj_.original_tagname_ = 'network' - elif nodeName_ == 'ComponentType': - obj_ = ComponentType.factory() - obj_.build(child_) - self.ComponentType.append(obj_) - obj_.original_tagname_ = 'ComponentType' - super(NeuroMLDocument, self).buildChildren(child_, node, nodeName_, True) -# end class NeuroMLDocument - - -class BasePynnSynapse(BaseSynapse): - subclass = None - superclass = BaseSynapse - def __init__(self, id=None, neuroLexId=None, name=None, metaid=None, notes=None, annotation=None, tau_syn=None, extensiontype_=None): - self.original_tagname_ = None - super(BasePynnSynapse, self).__init__(id, neuroLexId, name, metaid, notes, annotation, extensiontype_, ) - self.tau_syn = _cast(float, tau_syn) - self.extensiontype_ = extensiontype_ - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, BasePynnSynapse) - if subclass is not None: - return subclass(*args_, **kwargs_) - if BasePynnSynapse.subclass: - return BasePynnSynapse.subclass(*args_, **kwargs_) - else: - return BasePynnSynapse(*args_, **kwargs_) - factory = staticmethod(factory) - def get_tau_syn(self): return self.tau_syn - def set_tau_syn(self, tau_syn): self.tau_syn = tau_syn - def get_extensiontype_(self): return self.extensiontype_ - def set_extensiontype_(self, extensiontype_): self.extensiontype_ = extensiontype_ - def hasContent_(self): - if ( - super(BasePynnSynapse, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='BasePynnSynapse', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='BasePynnSynapse') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='BasePynnSynapse', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='BasePynnSynapse'): - super(BasePynnSynapse, self).exportAttributes(outfile, level, already_processed, namespace_, name_='BasePynnSynapse') - if self.tau_syn is not None and 'tau_syn' not in already_processed: - already_processed.add('tau_syn') - outfile.write(' tau_syn="%s"' % self.gds_format_double(self.tau_syn, input_name='tau_syn')) - if self.extensiontype_ is not None and 'xsi:type' not in already_processed: - already_processed.add('xsi:type') - outfile.write(' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"') - outfile.write(' xsi:type="%s"' % self.extensiontype_) - def exportChildren(self, outfile, level, namespace_='', name_='BasePynnSynapse', fromsubclass_=False, pretty_print=True): - super(BasePynnSynapse, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - value = find_attr_value_('tau_syn', node) - if value is not None and 'tau_syn' not in already_processed: - already_processed.add('tau_syn') - try: - self.tau_syn = float(value) - except ValueError as exp: - raise ValueError('Bad float/double attribute (tau_syn): %s' % exp) - value = find_attr_value_('xsi:type', node) - if value is not None and 'xsi:type' not in already_processed: - already_processed.add('xsi:type') - self.extensiontype_ = value - super(BasePynnSynapse, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(BasePynnSynapse, self).buildChildren(child_, node, nodeName_, True) - pass -# end class BasePynnSynapse - - -class basePyNNCell(BaseCell): - subclass = None - superclass = BaseCell - def __init__(self, id=None, neuroLexId=None, name=None, metaid=None, notes=None, annotation=None, cm=None, i_offset=None, tau_syn_E=None, tau_syn_I=None, v_init=None, extensiontype_=None): - self.original_tagname_ = None - super(basePyNNCell, self).__init__(id, neuroLexId, name, metaid, notes, annotation, extensiontype_, ) - self.cm = _cast(float, cm) - self.i_offset = _cast(float, i_offset) - self.tau_syn_E = _cast(float, tau_syn_E) - self.tau_syn_I = _cast(float, tau_syn_I) - self.v_init = _cast(float, v_init) - self.extensiontype_ = extensiontype_ - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, basePyNNCell) - if subclass is not None: - return subclass(*args_, **kwargs_) - if basePyNNCell.subclass: - return basePyNNCell.subclass(*args_, **kwargs_) - else: - return basePyNNCell(*args_, **kwargs_) - factory = staticmethod(factory) - def get_cm(self): return self.cm - def set_cm(self, cm): self.cm = cm - def get_i_offset(self): return self.i_offset - def set_i_offset(self, i_offset): self.i_offset = i_offset - def get_tau_syn_E(self): return self.tau_syn_E - def set_tau_syn_E(self, tau_syn_E): self.tau_syn_E = tau_syn_E - def get_tau_syn_I(self): return self.tau_syn_I - def set_tau_syn_I(self, tau_syn_I): self.tau_syn_I = tau_syn_I - def get_v_init(self): return self.v_init - def set_v_init(self, v_init): self.v_init = v_init - def get_extensiontype_(self): return self.extensiontype_ - def set_extensiontype_(self, extensiontype_): self.extensiontype_ = extensiontype_ - def hasContent_(self): - if ( - super(basePyNNCell, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='basePyNNCell', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='basePyNNCell') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='basePyNNCell', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='basePyNNCell'): - super(basePyNNCell, self).exportAttributes(outfile, level, already_processed, namespace_, name_='basePyNNCell') - if self.cm is not None and 'cm' not in already_processed: - already_processed.add('cm') - outfile.write(' cm="%s"' % self.gds_format_double(self.cm, input_name='cm')) - if self.i_offset is not None and 'i_offset' not in already_processed: - already_processed.add('i_offset') - outfile.write(' i_offset="%s"' % self.gds_format_double(self.i_offset, input_name='i_offset')) - if self.tau_syn_E is not None and 'tau_syn_E' not in already_processed: - already_processed.add('tau_syn_E') - outfile.write(' tau_syn_E="%s"' % self.gds_format_double(self.tau_syn_E, input_name='tau_syn_E')) - if self.tau_syn_I is not None and 'tau_syn_I' not in already_processed: - already_processed.add('tau_syn_I') - outfile.write(' tau_syn_I="%s"' % self.gds_format_double(self.tau_syn_I, input_name='tau_syn_I')) - if self.v_init is not None and 'v_init' not in already_processed: - already_processed.add('v_init') - outfile.write(' v_init="%s"' % self.gds_format_double(self.v_init, input_name='v_init')) - if self.extensiontype_ is not None and 'xsi:type' not in already_processed: - already_processed.add('xsi:type') - outfile.write(' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"') - outfile.write(' xsi:type="%s"' % self.extensiontype_) - def exportChildren(self, outfile, level, namespace_='', name_='basePyNNCell', fromsubclass_=False, pretty_print=True): - super(basePyNNCell, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - value = find_attr_value_('cm', node) - if value is not None and 'cm' not in already_processed: - already_processed.add('cm') - try: - self.cm = float(value) - except ValueError as exp: - raise ValueError('Bad float/double attribute (cm): %s' % exp) - value = find_attr_value_('i_offset', node) - if value is not None and 'i_offset' not in already_processed: - already_processed.add('i_offset') - try: - self.i_offset = float(value) - except ValueError as exp: - raise ValueError('Bad float/double attribute (i_offset): %s' % exp) - value = find_attr_value_('tau_syn_E', node) - if value is not None and 'tau_syn_E' not in already_processed: - already_processed.add('tau_syn_E') - try: - self.tau_syn_E = float(value) - except ValueError as exp: - raise ValueError('Bad float/double attribute (tau_syn_E): %s' % exp) - value = find_attr_value_('tau_syn_I', node) - if value is not None and 'tau_syn_I' not in already_processed: - already_processed.add('tau_syn_I') - try: - self.tau_syn_I = float(value) - except ValueError as exp: - raise ValueError('Bad float/double attribute (tau_syn_I): %s' % exp) - value = find_attr_value_('v_init', node) - if value is not None and 'v_init' not in already_processed: - already_processed.add('v_init') - try: - self.v_init = float(value) - except ValueError as exp: - raise ValueError('Bad float/double attribute (v_init): %s' % exp) - value = find_attr_value_('xsi:type', node) - if value is not None and 'xsi:type' not in already_processed: - already_processed.add('xsi:type') - self.extensiontype_ = value - super(basePyNNCell, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(basePyNNCell, self).buildChildren(child_, node, nodeName_, True) - pass -# end class basePyNNCell - - -class ConcentrationModel_D(DecayingPoolConcentrationModel): - subclass = None - superclass = DecayingPoolConcentrationModel - def __init__(self, id=None, neuroLexId=None, name=None, metaid=None, notes=None, annotation=None, ion=None, restingConc=None, decayConstant=None, shellThickness=None, type_=None): - self.original_tagname_ = None - super(ConcentrationModel_D, self).__init__(id, neuroLexId, name, metaid, notes, annotation, ion, restingConc, decayConstant, shellThickness, ) - self.type_ = _cast(None, type_) - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, ConcentrationModel_D) - if subclass is not None: - return subclass(*args_, **kwargs_) - if ConcentrationModel_D.subclass: - return ConcentrationModel_D.subclass(*args_, **kwargs_) - else: - return ConcentrationModel_D(*args_, **kwargs_) - factory = staticmethod(factory) - def get_type(self): return self.type_ - def set_type(self, type_): self.type_ = type_ - def hasContent_(self): - if ( - super(ConcentrationModel_D, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='ConcentrationModel_D', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='ConcentrationModel_D') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='ConcentrationModel_D', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='ConcentrationModel_D'): - super(ConcentrationModel_D, self).exportAttributes(outfile, level, already_processed, namespace_, name_='ConcentrationModel_D') - if self.type_ is not None and 'type_' not in already_processed: - already_processed.add('type_') - outfile.write(' type=%s' % (self.gds_encode(self.gds_format_string(quote_attrib(self.type_), input_name='type')), )) - def exportChildren(self, outfile, level, namespace_='', name_='ConcentrationModel_D', fromsubclass_=False, pretty_print=True): - super(ConcentrationModel_D, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - value = find_attr_value_('type', node) - if value is not None and 'type' not in already_processed: - already_processed.add('type') - self.type_ = value - super(ConcentrationModel_D, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(ConcentrationModel_D, self).buildChildren(child_, node, nodeName_, True) - pass -# end class ConcentrationModel_D - - -class Cell(BaseCell): - """Should only be used if morphology element is outside the cell. This - points to the id of the morphology Should only be used if - biophysicalProperties element is outside the cell. This points - to the id of the biophysicalProperties""" - subclass = None - superclass = BaseCell - def __init__(self, id=None, neuroLexId=None, name=None, metaid=None, notes=None, annotation=None, morphology_attr=None, biophysicalProperties_attr=None, morphology=None, biophysicalProperties=None): - self.original_tagname_ = None - super(Cell, self).__init__(id, neuroLexId, name, metaid, notes, annotation, ) - self.morphology_attr = _cast(None, morphology_attr) - self.biophysicalProperties_attr = _cast(None, biophysicalProperties_attr) - self.morphology = morphology - self.biophysicalProperties = biophysicalProperties - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, Cell) - if subclass is not None: - return subclass(*args_, **kwargs_) - if Cell.subclass: - return Cell.subclass(*args_, **kwargs_) - else: - return Cell(*args_, **kwargs_) - factory = staticmethod(factory) - def get_morphology(self): return self.morphology - def set_morphology(self, morphology): self.morphology = morphology - def get_biophysicalProperties(self): return self.biophysicalProperties - def set_biophysicalProperties(self, biophysicalProperties): self.biophysicalProperties = biophysicalProperties - def get_morphology_attr(self): return self.morphology_attr - def set_morphology_attr(self, morphology_attr): self.morphology_attr = morphology_attr - def get_biophysicalProperties_attr(self): return self.biophysicalProperties_attr - def set_biophysicalProperties_attr(self, biophysicalProperties_attr): self.biophysicalProperties_attr = biophysicalProperties_attr - def hasContent_(self): - if ( - self.morphology is not None or - self.biophysicalProperties is not None or - super(Cell, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='Cell', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='Cell') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='Cell', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='Cell'): - super(Cell, self).exportAttributes(outfile, level, already_processed, namespace_, name_='Cell') - if self.morphology_attr is not None and 'morphology_attr' not in already_processed: - already_processed.add('morphology_attr') - outfile.write(' morphology=%s' % (self.gds_encode(self.gds_format_string(quote_attrib(self.morphology_attr), input_name='morphology_attr')), )) - if self.biophysicalProperties_attr is not None and 'biophysicalProperties_attr' not in already_processed: - already_processed.add('biophysicalProperties_attr') - outfile.write(' biophysicalProperties=%s' % (self.gds_encode(self.gds_format_string(quote_attrib(self.biophysicalProperties_attr), input_name='biophysicalProperties_attr')), )) - def exportChildren(self, outfile, level, namespace_='', name_='Cell', fromsubclass_=False, pretty_print=True): - super(Cell, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.morphology is not None: - self.morphology.export(outfile, level, namespace_, name_='morphology', pretty_print=pretty_print) - if self.biophysicalProperties is not None: - self.biophysicalProperties.export(outfile, level, namespace_, name_='biophysicalProperties', pretty_print=pretty_print) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - value = find_attr_value_('morphology', node) - if value is not None and 'morphology_attr' not in already_processed: - already_processed.add('morphology_attr') - self.morphology_attr = value - value = find_attr_value_('biophysicalProperties', node) - if value is not None and 'biophysicalProperties_attr' not in already_processed: - already_processed.add('biophysicalProperties_attr') - self.biophysicalProperties_attr = value - super(Cell, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'morphology': - obj_ = Morphology.factory() - obj_.build(child_) - self.morphology = obj_ - obj_.original_tagname_ = 'morphology' - elif nodeName_ == 'biophysicalProperties': - obj_ = BiophysicalProperties.factory() - obj_.build(child_) - self.biophysicalProperties = obj_ - obj_.original_tagname_ = 'biophysicalProperties' - super(Cell, self).buildChildren(child_, node, nodeName_, True) -# end class Cell - - -class AdExIaFCell(BaseCell): - subclass = None - superclass = BaseCell - def __init__(self, id=None, neuroLexId=None, name=None, metaid=None, notes=None, annotation=None, C=None, gL=None, EL=None, reset=None, VT=None, thresh=None, delT=None, tauw=None, refract=None, a=None, b=None): - self.original_tagname_ = None - super(AdExIaFCell, self).__init__(id, neuroLexId, name, metaid, notes, annotation, ) - self.C = _cast(None, C) - self.gL = _cast(None, gL) - self.EL = _cast(None, EL) - self.reset = _cast(None, reset) - self.VT = _cast(None, VT) - self.thresh = _cast(None, thresh) - self.delT = _cast(None, delT) - self.tauw = _cast(None, tauw) - self.refract = _cast(None, refract) - self.a = _cast(None, a) - self.b = _cast(None, b) - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, AdExIaFCell) - if subclass is not None: - return subclass(*args_, **kwargs_) - if AdExIaFCell.subclass: - return AdExIaFCell.subclass(*args_, **kwargs_) - else: - return AdExIaFCell(*args_, **kwargs_) - factory = staticmethod(factory) - def get_C(self): return self.C - def set_C(self, C): self.C = C - def get_gL(self): return self.gL - def set_gL(self, gL): self.gL = gL - def get_EL(self): return self.EL - def set_EL(self, EL): self.EL = EL - def get_reset(self): return self.reset - def set_reset(self, reset): self.reset = reset - def get_VT(self): return self.VT - def set_VT(self, VT): self.VT = VT - def get_thresh(self): return self.thresh - def set_thresh(self, thresh): self.thresh = thresh - def get_delT(self): return self.delT - def set_delT(self, delT): self.delT = delT - def get_tauw(self): return self.tauw - def set_tauw(self, tauw): self.tauw = tauw - def get_refract(self): return self.refract - def set_refract(self, refract): self.refract = refract - def get_a(self): return self.a - def set_a(self, a): self.a = a - def get_b(self): return self.b - def set_b(self, b): self.b = b - def validate_Nml2Quantity_capacitance(self, value): - # Validate type Nml2Quantity_capacitance, a restriction on xs:string. - if value is not None and Validate_simpletypes_: - if not self.gds_validate_simple_patterns( - self.validate_Nml2Quantity_capacitance_patterns_, value): - warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_Nml2Quantity_capacitance_patterns_, )) - validate_Nml2Quantity_capacitance_patterns_ = [['^-?([0-9]*(\\.[0-9]+)?)([eE]-?[0-9]+)?[\\s]*(F|uF|nF|pF)$']] - def validate_Nml2Quantity_conductance(self, value): - # Validate type Nml2Quantity_conductance, a restriction on xs:string. - if value is not None and Validate_simpletypes_: - if not self.gds_validate_simple_patterns( - self.validate_Nml2Quantity_conductance_patterns_, value): - warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_Nml2Quantity_conductance_patterns_, )) - validate_Nml2Quantity_conductance_patterns_ = [['^-?([0-9]*(\\.[0-9]+)?)([eE]-?[0-9]+)?[\\s]*(S|mS|uS|nS|pS)$']] - def validate_Nml2Quantity_voltage(self, value): - # Validate type Nml2Quantity_voltage, a restriction on xs:string. - if value is not None and Validate_simpletypes_: - if not self.gds_validate_simple_patterns( - self.validate_Nml2Quantity_voltage_patterns_, value): - warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_Nml2Quantity_voltage_patterns_, )) - validate_Nml2Quantity_voltage_patterns_ = [['^-?([0-9]*(\\.[0-9]+)?)([eE]-?[0-9]+)?[\\s]*(V|mV)$']] - def validate_Nml2Quantity_time(self, value): - # Validate type Nml2Quantity_time, a restriction on xs:string. - if value is not None and Validate_simpletypes_: - if not self.gds_validate_simple_patterns( - self.validate_Nml2Quantity_time_patterns_, value): - warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_Nml2Quantity_time_patterns_, )) - validate_Nml2Quantity_time_patterns_ = [['^-?([0-9]*(\\.[0-9]+)?)([eE]-?[0-9]+)?[\\s]*(s|ms)$']] - def validate_Nml2Quantity_current(self, value): - # Validate type Nml2Quantity_current, a restriction on xs:string. - if value is not None and Validate_simpletypes_: - if not self.gds_validate_simple_patterns( - self.validate_Nml2Quantity_current_patterns_, value): - warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_Nml2Quantity_current_patterns_, )) - validate_Nml2Quantity_current_patterns_ = [['^-?([0-9]*(\\.[0-9]+)?)([eE]-?[0-9]+)?[\\s]*(A|uA|nA|pA)$']] - def hasContent_(self): - if ( - super(AdExIaFCell, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='AdExIaFCell', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='AdExIaFCell') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='AdExIaFCell', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='AdExIaFCell'): - super(AdExIaFCell, self).exportAttributes(outfile, level, already_processed, namespace_, name_='AdExIaFCell') - if self.C is not None and 'C' not in already_processed: - already_processed.add('C') - outfile.write(' C=%s' % (quote_attrib(self.C), )) - if self.gL is not None and 'gL' not in already_processed: - already_processed.add('gL') - outfile.write(' gL=%s' % (quote_attrib(self.gL), )) - if self.EL is not None and 'EL' not in already_processed: - already_processed.add('EL') - outfile.write(' EL=%s' % (quote_attrib(self.EL), )) - if self.reset is not None and 'reset' not in already_processed: - already_processed.add('reset') - outfile.write(' reset=%s' % (quote_attrib(self.reset), )) - if self.VT is not None and 'VT' not in already_processed: - already_processed.add('VT') - outfile.write(' VT=%s' % (quote_attrib(self.VT), )) - if self.thresh is not None and 'thresh' not in already_processed: - already_processed.add('thresh') - outfile.write(' thresh=%s' % (quote_attrib(self.thresh), )) - if self.delT is not None and 'delT' not in already_processed: - already_processed.add('delT') - outfile.write(' delT=%s' % (quote_attrib(self.delT), )) - if self.tauw is not None and 'tauw' not in already_processed: - already_processed.add('tauw') - outfile.write(' tauw=%s' % (quote_attrib(self.tauw), )) - if self.refract is not None and 'refract' not in already_processed: - already_processed.add('refract') - outfile.write(' refract=%s' % (quote_attrib(self.refract), )) - if self.a is not None and 'a' not in already_processed: - already_processed.add('a') - outfile.write(' a=%s' % (quote_attrib(self.a), )) - if self.b is not None and 'b' not in already_processed: - already_processed.add('b') - outfile.write(' b=%s' % (quote_attrib(self.b), )) - def exportChildren(self, outfile, level, namespace_='', name_='AdExIaFCell', fromsubclass_=False, pretty_print=True): - super(AdExIaFCell, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - value = find_attr_value_('C', node) - if value is not None and 'C' not in already_processed: - already_processed.add('C') - self.C = value - self.validate_Nml2Quantity_capacitance(self.C) # validate type Nml2Quantity_capacitance - value = find_attr_value_('gL', node) - if value is not None and 'gL' not in already_processed: - already_processed.add('gL') - self.gL = value - self.validate_Nml2Quantity_conductance(self.gL) # validate type Nml2Quantity_conductance - value = find_attr_value_('EL', node) - if value is not None and 'EL' not in already_processed: - already_processed.add('EL') - self.EL = value - self.validate_Nml2Quantity_voltage(self.EL) # validate type Nml2Quantity_voltage - value = find_attr_value_('reset', node) - if value is not None and 'reset' not in already_processed: - already_processed.add('reset') - self.reset = value - self.validate_Nml2Quantity_voltage(self.reset) # validate type Nml2Quantity_voltage - value = find_attr_value_('VT', node) - if value is not None and 'VT' not in already_processed: - already_processed.add('VT') - self.VT = value - self.validate_Nml2Quantity_voltage(self.VT) # validate type Nml2Quantity_voltage - value = find_attr_value_('thresh', node) - if value is not None and 'thresh' not in already_processed: - already_processed.add('thresh') - self.thresh = value - self.validate_Nml2Quantity_voltage(self.thresh) # validate type Nml2Quantity_voltage - value = find_attr_value_('delT', node) - if value is not None and 'delT' not in already_processed: - already_processed.add('delT') - self.delT = value - self.validate_Nml2Quantity_voltage(self.delT) # validate type Nml2Quantity_voltage - value = find_attr_value_('tauw', node) - if value is not None and 'tauw' not in already_processed: - already_processed.add('tauw') - self.tauw = value - self.validate_Nml2Quantity_time(self.tauw) # validate type Nml2Quantity_time - value = find_attr_value_('refract', node) - if value is not None and 'refract' not in already_processed: - already_processed.add('refract') - self.refract = value - self.validate_Nml2Quantity_time(self.refract) # validate type Nml2Quantity_time - value = find_attr_value_('a', node) - if value is not None and 'a' not in already_processed: - already_processed.add('a') - self.a = value - self.validate_Nml2Quantity_conductance(self.a) # validate type Nml2Quantity_conductance - value = find_attr_value_('b', node) - if value is not None and 'b' not in already_processed: - already_processed.add('b') - self.b = value - self.validate_Nml2Quantity_current(self.b) # validate type Nml2Quantity_current - super(AdExIaFCell, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(AdExIaFCell, self).buildChildren(child_, node, nodeName_, True) - pass -# end class AdExIaFCell - - -class IzhikevichCell(BaseCell): - subclass = None - superclass = BaseCell - def __init__(self, id=None, neuroLexId=None, name=None, metaid=None, notes=None, annotation=None, v0=None, thresh=None, a=None, b=None, c=None, d=None): - self.original_tagname_ = None - super(IzhikevichCell, self).__init__(id, neuroLexId, name, metaid, notes, annotation, ) - self.v0 = _cast(None, v0) - self.thresh = _cast(None, thresh) - self.a = _cast(None, a) - self.b = _cast(None, b) - self.c = _cast(None, c) - self.d = _cast(None, d) - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, IzhikevichCell) - if subclass is not None: - return subclass(*args_, **kwargs_) - if IzhikevichCell.subclass: - return IzhikevichCell.subclass(*args_, **kwargs_) - else: - return IzhikevichCell(*args_, **kwargs_) - factory = staticmethod(factory) - def get_v0(self): return self.v0 - def set_v0(self, v0): self.v0 = v0 - def get_thresh(self): return self.thresh - def set_thresh(self, thresh): self.thresh = thresh - def get_a(self): return self.a - def set_a(self, a): self.a = a - def get_b(self): return self.b - def set_b(self, b): self.b = b - def get_c(self): return self.c - def set_c(self, c): self.c = c - def get_d(self): return self.d - def set_d(self, d): self.d = d - def validate_Nml2Quantity_voltage(self, value): - # Validate type Nml2Quantity_voltage, a restriction on xs:string. - if value is not None and Validate_simpletypes_: - if not self.gds_validate_simple_patterns( - self.validate_Nml2Quantity_voltage_patterns_, value): - warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_Nml2Quantity_voltage_patterns_, )) - validate_Nml2Quantity_voltage_patterns_ = [['^-?([0-9]*(\\.[0-9]+)?)([eE]-?[0-9]+)?[\\s]*(V|mV)$']] - def validate_Nml2Quantity_none(self, value): - # Validate type Nml2Quantity_none, a restriction on xs:string. - if value is not None and Validate_simpletypes_: - if not self.gds_validate_simple_patterns( - self.validate_Nml2Quantity_none_patterns_, value): - warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_Nml2Quantity_none_patterns_, )) - validate_Nml2Quantity_none_patterns_ = [['^-?([0-9]*(\\.[0-9]+)?)([eE]-?[0-9]+)?$']] - def hasContent_(self): - if ( - super(IzhikevichCell, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='IzhikevichCell', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='IzhikevichCell') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='IzhikevichCell', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='IzhikevichCell'): - super(IzhikevichCell, self).exportAttributes(outfile, level, already_processed, namespace_, name_='IzhikevichCell') - if self.v0 is not None and 'v0' not in already_processed: - already_processed.add('v0') - outfile.write(' v0=%s' % (quote_attrib(self.v0), )) - if self.thresh is not None and 'thresh' not in already_processed: - already_processed.add('thresh') - outfile.write(' thresh=%s' % (quote_attrib(self.thresh), )) - if self.a is not None and 'a' not in already_processed: - already_processed.add('a') - outfile.write(' a=%s' % (quote_attrib(self.a), )) - if self.b is not None and 'b' not in already_processed: - already_processed.add('b') - outfile.write(' b=%s' % (quote_attrib(self.b), )) - if self.c is not None and 'c' not in already_processed: - already_processed.add('c') - outfile.write(' c=%s' % (quote_attrib(self.c), )) - if self.d is not None and 'd' not in already_processed: - already_processed.add('d') - outfile.write(' d=%s' % (quote_attrib(self.d), )) - def exportChildren(self, outfile, level, namespace_='', name_='IzhikevichCell', fromsubclass_=False, pretty_print=True): - super(IzhikevichCell, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - value = find_attr_value_('v0', node) - if value is not None and 'v0' not in already_processed: - already_processed.add('v0') - self.v0 = value - self.validate_Nml2Quantity_voltage(self.v0) # validate type Nml2Quantity_voltage - value = find_attr_value_('thresh', node) - if value is not None and 'thresh' not in already_processed: - already_processed.add('thresh') - self.thresh = value - self.validate_Nml2Quantity_voltage(self.thresh) # validate type Nml2Quantity_voltage - value = find_attr_value_('a', node) - if value is not None and 'a' not in already_processed: - already_processed.add('a') - self.a = value - self.validate_Nml2Quantity_none(self.a) # validate type Nml2Quantity_none - value = find_attr_value_('b', node) - if value is not None and 'b' not in already_processed: - already_processed.add('b') - self.b = value - self.validate_Nml2Quantity_none(self.b) # validate type Nml2Quantity_none - value = find_attr_value_('c', node) - if value is not None and 'c' not in already_processed: - already_processed.add('c') - self.c = value - self.validate_Nml2Quantity_none(self.c) # validate type Nml2Quantity_none - value = find_attr_value_('d', node) - if value is not None and 'd' not in already_processed: - already_processed.add('d') - self.d = value - self.validate_Nml2Quantity_none(self.d) # validate type Nml2Quantity_none - super(IzhikevichCell, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(IzhikevichCell, self).buildChildren(child_, node, nodeName_, True) - pass -# end class IzhikevichCell - - -class IaFCell(BaseCell): - subclass = None - superclass = BaseCell - def __init__(self, id=None, neuroLexId=None, name=None, metaid=None, notes=None, annotation=None, leakReversal=None, thresh=None, reset=None, C=None, leakConductance=None, extensiontype_=None): - self.original_tagname_ = None - super(IaFCell, self).__init__(id, neuroLexId, name, metaid, notes, annotation, extensiontype_, ) - self.leakReversal = _cast(None, leakReversal) - self.thresh = _cast(None, thresh) - self.reset = _cast(None, reset) - self.C = _cast(None, C) - self.leakConductance = _cast(None, leakConductance) - self.extensiontype_ = extensiontype_ - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, IaFCell) - if subclass is not None: - return subclass(*args_, **kwargs_) - if IaFCell.subclass: - return IaFCell.subclass(*args_, **kwargs_) - else: - return IaFCell(*args_, **kwargs_) - factory = staticmethod(factory) - def get_leakReversal(self): return self.leakReversal - def set_leakReversal(self, leakReversal): self.leakReversal = leakReversal - def get_thresh(self): return self.thresh - def set_thresh(self, thresh): self.thresh = thresh - def get_reset(self): return self.reset - def set_reset(self, reset): self.reset = reset - def get_C(self): return self.C - def set_C(self, C): self.C = C - def get_leakConductance(self): return self.leakConductance - def set_leakConductance(self, leakConductance): self.leakConductance = leakConductance - def get_extensiontype_(self): return self.extensiontype_ - def set_extensiontype_(self, extensiontype_): self.extensiontype_ = extensiontype_ - def validate_Nml2Quantity_voltage(self, value): - # Validate type Nml2Quantity_voltage, a restriction on xs:string. - if value is not None and Validate_simpletypes_: - if not self.gds_validate_simple_patterns( - self.validate_Nml2Quantity_voltage_patterns_, value): - warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_Nml2Quantity_voltage_patterns_, )) - validate_Nml2Quantity_voltage_patterns_ = [['^-?([0-9]*(\\.[0-9]+)?)([eE]-?[0-9]+)?[\\s]*(V|mV)$']] - def validate_Nml2Quantity_capacitance(self, value): - # Validate type Nml2Quantity_capacitance, a restriction on xs:string. - if value is not None and Validate_simpletypes_: - if not self.gds_validate_simple_patterns( - self.validate_Nml2Quantity_capacitance_patterns_, value): - warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_Nml2Quantity_capacitance_patterns_, )) - validate_Nml2Quantity_capacitance_patterns_ = [['^-?([0-9]*(\\.[0-9]+)?)([eE]-?[0-9]+)?[\\s]*(F|uF|nF|pF)$']] - def validate_Nml2Quantity_conductance(self, value): - # Validate type Nml2Quantity_conductance, a restriction on xs:string. - if value is not None and Validate_simpletypes_: - if not self.gds_validate_simple_patterns( - self.validate_Nml2Quantity_conductance_patterns_, value): - warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_Nml2Quantity_conductance_patterns_, )) - validate_Nml2Quantity_conductance_patterns_ = [['^-?([0-9]*(\\.[0-9]+)?)([eE]-?[0-9]+)?[\\s]*(S|mS|uS|nS|pS)$']] - def hasContent_(self): - if ( - super(IaFCell, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='IaFCell', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='IaFCell') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='IaFCell', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='IaFCell'): - super(IaFCell, self).exportAttributes(outfile, level, already_processed, namespace_, name_='IaFCell') - if self.leakReversal is not None and 'leakReversal' not in already_processed: - already_processed.add('leakReversal') - outfile.write(' leakReversal=%s' % (quote_attrib(self.leakReversal), )) - if self.thresh is not None and 'thresh' not in already_processed: - already_processed.add('thresh') - outfile.write(' thresh=%s' % (quote_attrib(self.thresh), )) - if self.reset is not None and 'reset' not in already_processed: - already_processed.add('reset') - outfile.write(' reset=%s' % (quote_attrib(self.reset), )) - if self.C is not None and 'C' not in already_processed: - already_processed.add('C') - outfile.write(' C=%s' % (quote_attrib(self.C), )) - if self.leakConductance is not None and 'leakConductance' not in already_processed: - already_processed.add('leakConductance') - outfile.write(' leakConductance=%s' % (quote_attrib(self.leakConductance), )) - if self.extensiontype_ is not None and 'xsi:type' not in already_processed: - already_processed.add('xsi:type') - outfile.write(' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"') - outfile.write(' xsi:type="%s"' % self.extensiontype_) - def exportChildren(self, outfile, level, namespace_='', name_='IaFCell', fromsubclass_=False, pretty_print=True): - super(IaFCell, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - value = find_attr_value_('leakReversal', node) - if value is not None and 'leakReversal' not in already_processed: - already_processed.add('leakReversal') - self.leakReversal = value - self.validate_Nml2Quantity_voltage(self.leakReversal) # validate type Nml2Quantity_voltage - value = find_attr_value_('thresh', node) - if value is not None and 'thresh' not in already_processed: - already_processed.add('thresh') - self.thresh = value - self.validate_Nml2Quantity_voltage(self.thresh) # validate type Nml2Quantity_voltage - value = find_attr_value_('reset', node) - if value is not None and 'reset' not in already_processed: - already_processed.add('reset') - self.reset = value - self.validate_Nml2Quantity_voltage(self.reset) # validate type Nml2Quantity_voltage - value = find_attr_value_('C', node) - if value is not None and 'C' not in already_processed: - already_processed.add('C') - self.C = value - self.validate_Nml2Quantity_capacitance(self.C) # validate type Nml2Quantity_capacitance - value = find_attr_value_('leakConductance', node) - if value is not None and 'leakConductance' not in already_processed: - already_processed.add('leakConductance') - self.leakConductance = value - self.validate_Nml2Quantity_conductance(self.leakConductance) # validate type Nml2Quantity_conductance - value = find_attr_value_('xsi:type', node) - if value is not None and 'xsi:type' not in already_processed: - already_processed.add('xsi:type') - self.extensiontype_ = value - super(IaFCell, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(IaFCell, self).buildChildren(child_, node, nodeName_, True) - pass -# end class IaFCell - - -class IaFTauCell(BaseCell): - subclass = None - superclass = BaseCell - def __init__(self, id=None, neuroLexId=None, name=None, metaid=None, notes=None, annotation=None, leakReversal=None, thresh=None, reset=None, tau=None, extensiontype_=None): - self.original_tagname_ = None - super(IaFTauCell, self).__init__(id, neuroLexId, name, metaid, notes, annotation, extensiontype_, ) - self.leakReversal = _cast(None, leakReversal) - self.thresh = _cast(None, thresh) - self.reset = _cast(None, reset) - self.tau = _cast(None, tau) - self.extensiontype_ = extensiontype_ - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, IaFTauCell) - if subclass is not None: - return subclass(*args_, **kwargs_) - if IaFTauCell.subclass: - return IaFTauCell.subclass(*args_, **kwargs_) - else: - return IaFTauCell(*args_, **kwargs_) - factory = staticmethod(factory) - def get_leakReversal(self): return self.leakReversal - def set_leakReversal(self, leakReversal): self.leakReversal = leakReversal - def get_thresh(self): return self.thresh - def set_thresh(self, thresh): self.thresh = thresh - def get_reset(self): return self.reset - def set_reset(self, reset): self.reset = reset - def get_tau(self): return self.tau - def set_tau(self, tau): self.tau = tau - def get_extensiontype_(self): return self.extensiontype_ - def set_extensiontype_(self, extensiontype_): self.extensiontype_ = extensiontype_ - def validate_Nml2Quantity_voltage(self, value): - # Validate type Nml2Quantity_voltage, a restriction on xs:string. - if value is not None and Validate_simpletypes_: - if not self.gds_validate_simple_patterns( - self.validate_Nml2Quantity_voltage_patterns_, value): - warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_Nml2Quantity_voltage_patterns_, )) - validate_Nml2Quantity_voltage_patterns_ = [['^-?([0-9]*(\\.[0-9]+)?)([eE]-?[0-9]+)?[\\s]*(V|mV)$']] - def validate_Nml2Quantity_time(self, value): - # Validate type Nml2Quantity_time, a restriction on xs:string. - if value is not None and Validate_simpletypes_: - if not self.gds_validate_simple_patterns( - self.validate_Nml2Quantity_time_patterns_, value): - warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_Nml2Quantity_time_patterns_, )) - validate_Nml2Quantity_time_patterns_ = [['^-?([0-9]*(\\.[0-9]+)?)([eE]-?[0-9]+)?[\\s]*(s|ms)$']] - def hasContent_(self): - if ( - super(IaFTauCell, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='IaFTauCell', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='IaFTauCell') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='IaFTauCell', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='IaFTauCell'): - super(IaFTauCell, self).exportAttributes(outfile, level, already_processed, namespace_, name_='IaFTauCell') - if self.leakReversal is not None and 'leakReversal' not in already_processed: - already_processed.add('leakReversal') - outfile.write(' leakReversal=%s' % (quote_attrib(self.leakReversal), )) - if self.thresh is not None and 'thresh' not in already_processed: - already_processed.add('thresh') - outfile.write(' thresh=%s' % (quote_attrib(self.thresh), )) - if self.reset is not None and 'reset' not in already_processed: - already_processed.add('reset') - outfile.write(' reset=%s' % (quote_attrib(self.reset), )) - if self.tau is not None and 'tau' not in already_processed: - already_processed.add('tau') - outfile.write(' tau=%s' % (quote_attrib(self.tau), )) - if self.extensiontype_ is not None and 'xsi:type' not in already_processed: - already_processed.add('xsi:type') - outfile.write(' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"') - outfile.write(' xsi:type="%s"' % self.extensiontype_) - def exportChildren(self, outfile, level, namespace_='', name_='IaFTauCell', fromsubclass_=False, pretty_print=True): - super(IaFTauCell, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - value = find_attr_value_('leakReversal', node) - if value is not None and 'leakReversal' not in already_processed: - already_processed.add('leakReversal') - self.leakReversal = value - self.validate_Nml2Quantity_voltage(self.leakReversal) # validate type Nml2Quantity_voltage - value = find_attr_value_('thresh', node) - if value is not None and 'thresh' not in already_processed: - already_processed.add('thresh') - self.thresh = value - self.validate_Nml2Quantity_voltage(self.thresh) # validate type Nml2Quantity_voltage - value = find_attr_value_('reset', node) - if value is not None and 'reset' not in already_processed: - already_processed.add('reset') - self.reset = value - self.validate_Nml2Quantity_voltage(self.reset) # validate type Nml2Quantity_voltage - value = find_attr_value_('tau', node) - if value is not None and 'tau' not in already_processed: - already_processed.add('tau') - self.tau = value - self.validate_Nml2Quantity_time(self.tau) # validate type Nml2Quantity_time - value = find_attr_value_('xsi:type', node) - if value is not None and 'xsi:type' not in already_processed: - already_processed.add('xsi:type') - self.extensiontype_ = value - super(IaFTauCell, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(IaFTauCell, self).buildChildren(child_, node, nodeName_, True) - pass -# end class IaFTauCell - - -class BaseConductanceBasedSynapse(BaseSynapse): - subclass = None - superclass = BaseSynapse - def __init__(self, id=None, neuroLexId=None, name=None, metaid=None, notes=None, annotation=None, gbase=None, erev=None, extensiontype_=None): - self.original_tagname_ = None - super(BaseConductanceBasedSynapse, self).__init__(id, neuroLexId, name, metaid, notes, annotation, extensiontype_, ) - self.gbase = _cast(None, gbase) - self.erev = _cast(None, erev) - self.extensiontype_ = extensiontype_ - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, BaseConductanceBasedSynapse) - if subclass is not None: - return subclass(*args_, **kwargs_) - if BaseConductanceBasedSynapse.subclass: - return BaseConductanceBasedSynapse.subclass(*args_, **kwargs_) - else: - return BaseConductanceBasedSynapse(*args_, **kwargs_) - factory = staticmethod(factory) - def get_gbase(self): return self.gbase - def set_gbase(self, gbase): self.gbase = gbase - def get_erev(self): return self.erev - def set_erev(self, erev): self.erev = erev - def get_extensiontype_(self): return self.extensiontype_ - def set_extensiontype_(self, extensiontype_): self.extensiontype_ = extensiontype_ - def validate_Nml2Quantity_conductance(self, value): - # Validate type Nml2Quantity_conductance, a restriction on xs:string. - if value is not None and Validate_simpletypes_: - if not self.gds_validate_simple_patterns( - self.validate_Nml2Quantity_conductance_patterns_, value): - warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_Nml2Quantity_conductance_patterns_, )) - validate_Nml2Quantity_conductance_patterns_ = [['^-?([0-9]*(\\.[0-9]+)?)([eE]-?[0-9]+)?[\\s]*(S|mS|uS|nS|pS)$']] - def validate_Nml2Quantity_voltage(self, value): - # Validate type Nml2Quantity_voltage, a restriction on xs:string. - if value is not None and Validate_simpletypes_: - if not self.gds_validate_simple_patterns( - self.validate_Nml2Quantity_voltage_patterns_, value): - warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_Nml2Quantity_voltage_patterns_, )) - validate_Nml2Quantity_voltage_patterns_ = [['^-?([0-9]*(\\.[0-9]+)?)([eE]-?[0-9]+)?[\\s]*(V|mV)$']] - def hasContent_(self): - if ( - super(BaseConductanceBasedSynapse, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='BaseConductanceBasedSynapse', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='BaseConductanceBasedSynapse') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='BaseConductanceBasedSynapse', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='BaseConductanceBasedSynapse'): - super(BaseConductanceBasedSynapse, self).exportAttributes(outfile, level, already_processed, namespace_, name_='BaseConductanceBasedSynapse') - if self.gbase is not None and 'gbase' not in already_processed: - already_processed.add('gbase') - outfile.write(' gbase=%s' % (quote_attrib(self.gbase), )) - if self.erev is not None and 'erev' not in already_processed: - already_processed.add('erev') - outfile.write(' erev=%s' % (quote_attrib(self.erev), )) - if self.extensiontype_ is not None and 'xsi:type' not in already_processed: - already_processed.add('xsi:type') - outfile.write(' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"') - outfile.write(' xsi:type="%s"' % self.extensiontype_) - def exportChildren(self, outfile, level, namespace_='', name_='BaseConductanceBasedSynapse', fromsubclass_=False, pretty_print=True): - super(BaseConductanceBasedSynapse, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - value = find_attr_value_('gbase', node) - if value is not None and 'gbase' not in already_processed: - already_processed.add('gbase') - self.gbase = value - self.validate_Nml2Quantity_conductance(self.gbase) # validate type Nml2Quantity_conductance - value = find_attr_value_('erev', node) - if value is not None and 'erev' not in already_processed: - already_processed.add('erev') - self.erev = value - self.validate_Nml2Quantity_voltage(self.erev) # validate type Nml2Quantity_voltage - value = find_attr_value_('xsi:type', node) - if value is not None and 'xsi:type' not in already_processed: - already_processed.add('xsi:type') - self.extensiontype_ = value - super(BaseConductanceBasedSynapse, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(BaseConductanceBasedSynapse, self).buildChildren(child_, node, nodeName_, True) - pass -# end class BaseConductanceBasedSynapse - - -class AlphaCurrSynapse(BasePynnSynapse): - subclass = None - superclass = BasePynnSynapse - def __init__(self, id=None, neuroLexId=None, name=None, metaid=None, notes=None, annotation=None, tau_syn=None): - self.original_tagname_ = None - super(AlphaCurrSynapse, self).__init__(id, neuroLexId, name, metaid, notes, annotation, tau_syn, ) - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, AlphaCurrSynapse) - if subclass is not None: - return subclass(*args_, **kwargs_) - if AlphaCurrSynapse.subclass: - return AlphaCurrSynapse.subclass(*args_, **kwargs_) - else: - return AlphaCurrSynapse(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(AlphaCurrSynapse, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='AlphaCurrSynapse', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='AlphaCurrSynapse') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='AlphaCurrSynapse', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='AlphaCurrSynapse'): - super(AlphaCurrSynapse, self).exportAttributes(outfile, level, already_processed, namespace_, name_='AlphaCurrSynapse') - def exportChildren(self, outfile, level, namespace_='', name_='AlphaCurrSynapse', fromsubclass_=False, pretty_print=True): - super(AlphaCurrSynapse, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(AlphaCurrSynapse, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(AlphaCurrSynapse, self).buildChildren(child_, node, nodeName_, True) - pass -# end class AlphaCurrSynapse - - -class ExpCurrSynapse(BasePynnSynapse): - subclass = None - superclass = BasePynnSynapse - def __init__(self, id=None, neuroLexId=None, name=None, metaid=None, notes=None, annotation=None, tau_syn=None): - self.original_tagname_ = None - super(ExpCurrSynapse, self).__init__(id, neuroLexId, name, metaid, notes, annotation, tau_syn, ) - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, ExpCurrSynapse) - if subclass is not None: - return subclass(*args_, **kwargs_) - if ExpCurrSynapse.subclass: - return ExpCurrSynapse.subclass(*args_, **kwargs_) - else: - return ExpCurrSynapse(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(ExpCurrSynapse, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='ExpCurrSynapse', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='ExpCurrSynapse') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='ExpCurrSynapse', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='ExpCurrSynapse'): - super(ExpCurrSynapse, self).exportAttributes(outfile, level, already_processed, namespace_, name_='ExpCurrSynapse') - def exportChildren(self, outfile, level, namespace_='', name_='ExpCurrSynapse', fromsubclass_=False, pretty_print=True): - super(ExpCurrSynapse, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(ExpCurrSynapse, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(ExpCurrSynapse, self).buildChildren(child_, node, nodeName_, True) - pass -# end class ExpCurrSynapse - - -class AlphaCondSynapse(BasePynnSynapse): - subclass = None - superclass = BasePynnSynapse - def __init__(self, id=None, neuroLexId=None, name=None, metaid=None, notes=None, annotation=None, tau_syn=None, e_rev=None): - self.original_tagname_ = None - super(AlphaCondSynapse, self).__init__(id, neuroLexId, name, metaid, notes, annotation, tau_syn, ) - self.e_rev = _cast(float, e_rev) - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, AlphaCondSynapse) - if subclass is not None: - return subclass(*args_, **kwargs_) - if AlphaCondSynapse.subclass: - return AlphaCondSynapse.subclass(*args_, **kwargs_) - else: - return AlphaCondSynapse(*args_, **kwargs_) - factory = staticmethod(factory) - def get_e_rev(self): return self.e_rev - def set_e_rev(self, e_rev): self.e_rev = e_rev - def hasContent_(self): - if ( - super(AlphaCondSynapse, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='AlphaCondSynapse', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='AlphaCondSynapse') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='AlphaCondSynapse', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='AlphaCondSynapse'): - super(AlphaCondSynapse, self).exportAttributes(outfile, level, already_processed, namespace_, name_='AlphaCondSynapse') - if self.e_rev is not None and 'e_rev' not in already_processed: - already_processed.add('e_rev') - outfile.write(' e_rev="%s"' % self.gds_format_double(self.e_rev, input_name='e_rev')) - def exportChildren(self, outfile, level, namespace_='', name_='AlphaCondSynapse', fromsubclass_=False, pretty_print=True): - super(AlphaCondSynapse, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - value = find_attr_value_('e_rev', node) - if value is not None and 'e_rev' not in already_processed: - already_processed.add('e_rev') - try: - self.e_rev = float(value) - except ValueError as exp: - raise ValueError('Bad float/double attribute (e_rev): %s' % exp) - super(AlphaCondSynapse, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(AlphaCondSynapse, self).buildChildren(child_, node, nodeName_, True) - pass -# end class AlphaCondSynapse - - -class ExpCondSynapse(BasePynnSynapse): - subclass = None - superclass = BasePynnSynapse - def __init__(self, id=None, neuroLexId=None, name=None, metaid=None, notes=None, annotation=None, tau_syn=None, e_rev=None): - self.original_tagname_ = None - super(ExpCondSynapse, self).__init__(id, neuroLexId, name, metaid, notes, annotation, tau_syn, ) - self.e_rev = _cast(float, e_rev) - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, ExpCondSynapse) - if subclass is not None: - return subclass(*args_, **kwargs_) - if ExpCondSynapse.subclass: - return ExpCondSynapse.subclass(*args_, **kwargs_) - else: - return ExpCondSynapse(*args_, **kwargs_) - factory = staticmethod(factory) - def get_e_rev(self): return self.e_rev - def set_e_rev(self, e_rev): self.e_rev = e_rev - def hasContent_(self): - if ( - super(ExpCondSynapse, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='ExpCondSynapse', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='ExpCondSynapse') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='ExpCondSynapse', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='ExpCondSynapse'): - super(ExpCondSynapse, self).exportAttributes(outfile, level, already_processed, namespace_, name_='ExpCondSynapse') - if self.e_rev is not None and 'e_rev' not in already_processed: - already_processed.add('e_rev') - outfile.write(' e_rev="%s"' % self.gds_format_double(self.e_rev, input_name='e_rev')) - def exportChildren(self, outfile, level, namespace_='', name_='ExpCondSynapse', fromsubclass_=False, pretty_print=True): - super(ExpCondSynapse, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - value = find_attr_value_('e_rev', node) - if value is not None and 'e_rev' not in already_processed: - already_processed.add('e_rev') - try: - self.e_rev = float(value) - except ValueError as exp: - raise ValueError('Bad float/double attribute (e_rev): %s' % exp) - super(ExpCondSynapse, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(ExpCondSynapse, self).buildChildren(child_, node, nodeName_, True) - pass -# end class ExpCondSynapse - - -class HH_cond_exp(basePyNNCell): - subclass = None - superclass = basePyNNCell - def __init__(self, id=None, neuroLexId=None, name=None, metaid=None, notes=None, annotation=None, cm=None, i_offset=None, tau_syn_E=None, tau_syn_I=None, v_init=None, v_offset=None, e_rev_E=None, e_rev_I=None, e_rev_K=None, e_rev_Na=None, e_rev_leak=None, g_leak=None, gbar_K=None, gbar_Na=None): - self.original_tagname_ = None - super(HH_cond_exp, self).__init__(id, neuroLexId, name, metaid, notes, annotation, cm, i_offset, tau_syn_E, tau_syn_I, v_init, ) - self.v_offset = _cast(float, v_offset) - self.e_rev_E = _cast(float, e_rev_E) - self.e_rev_I = _cast(float, e_rev_I) - self.e_rev_K = _cast(float, e_rev_K) - self.e_rev_Na = _cast(float, e_rev_Na) - self.e_rev_leak = _cast(float, e_rev_leak) - self.g_leak = _cast(float, g_leak) - self.gbar_K = _cast(float, gbar_K) - self.gbar_Na = _cast(float, gbar_Na) - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, HH_cond_exp) - if subclass is not None: - return subclass(*args_, **kwargs_) - if HH_cond_exp.subclass: - return HH_cond_exp.subclass(*args_, **kwargs_) - else: - return HH_cond_exp(*args_, **kwargs_) - factory = staticmethod(factory) - def get_v_offset(self): return self.v_offset - def set_v_offset(self, v_offset): self.v_offset = v_offset - def get_e_rev_E(self): return self.e_rev_E - def set_e_rev_E(self, e_rev_E): self.e_rev_E = e_rev_E - def get_e_rev_I(self): return self.e_rev_I - def set_e_rev_I(self, e_rev_I): self.e_rev_I = e_rev_I - def get_e_rev_K(self): return self.e_rev_K - def set_e_rev_K(self, e_rev_K): self.e_rev_K = e_rev_K - def get_e_rev_Na(self): return self.e_rev_Na - def set_e_rev_Na(self, e_rev_Na): self.e_rev_Na = e_rev_Na - def get_e_rev_leak(self): return self.e_rev_leak - def set_e_rev_leak(self, e_rev_leak): self.e_rev_leak = e_rev_leak - def get_g_leak(self): return self.g_leak - def set_g_leak(self, g_leak): self.g_leak = g_leak - def get_gbar_K(self): return self.gbar_K - def set_gbar_K(self, gbar_K): self.gbar_K = gbar_K - def get_gbar_Na(self): return self.gbar_Na - def set_gbar_Na(self, gbar_Na): self.gbar_Na = gbar_Na - def hasContent_(self): - if ( - super(HH_cond_exp, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='HH_cond_exp', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='HH_cond_exp') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='HH_cond_exp', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='HH_cond_exp'): - super(HH_cond_exp, self).exportAttributes(outfile, level, already_processed, namespace_, name_='HH_cond_exp') - if self.v_offset is not None and 'v_offset' not in already_processed: - already_processed.add('v_offset') - outfile.write(' v_offset="%s"' % self.gds_format_double(self.v_offset, input_name='v_offset')) - if self.e_rev_E is not None and 'e_rev_E' not in already_processed: - already_processed.add('e_rev_E') - outfile.write(' e_rev_E="%s"' % self.gds_format_double(self.e_rev_E, input_name='e_rev_E')) - if self.e_rev_I is not None and 'e_rev_I' not in already_processed: - already_processed.add('e_rev_I') - outfile.write(' e_rev_I="%s"' % self.gds_format_double(self.e_rev_I, input_name='e_rev_I')) - if self.e_rev_K is not None and 'e_rev_K' not in already_processed: - already_processed.add('e_rev_K') - outfile.write(' e_rev_K="%s"' % self.gds_format_double(self.e_rev_K, input_name='e_rev_K')) - if self.e_rev_Na is not None and 'e_rev_Na' not in already_processed: - already_processed.add('e_rev_Na') - outfile.write(' e_rev_Na="%s"' % self.gds_format_double(self.e_rev_Na, input_name='e_rev_Na')) - if self.e_rev_leak is not None and 'e_rev_leak' not in already_processed: - already_processed.add('e_rev_leak') - outfile.write(' e_rev_leak="%s"' % self.gds_format_double(self.e_rev_leak, input_name='e_rev_leak')) - if self.g_leak is not None and 'g_leak' not in already_processed: - already_processed.add('g_leak') - outfile.write(' g_leak="%s"' % self.gds_format_double(self.g_leak, input_name='g_leak')) - if self.gbar_K is not None and 'gbar_K' not in already_processed: - already_processed.add('gbar_K') - outfile.write(' gbar_K="%s"' % self.gds_format_double(self.gbar_K, input_name='gbar_K')) - if self.gbar_Na is not None and 'gbar_Na' not in already_processed: - already_processed.add('gbar_Na') - outfile.write(' gbar_Na="%s"' % self.gds_format_double(self.gbar_Na, input_name='gbar_Na')) - def exportChildren(self, outfile, level, namespace_='', name_='HH_cond_exp', fromsubclass_=False, pretty_print=True): - super(HH_cond_exp, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - value = find_attr_value_('v_offset', node) - if value is not None and 'v_offset' not in already_processed: - already_processed.add('v_offset') - try: - self.v_offset = float(value) - except ValueError as exp: - raise ValueError('Bad float/double attribute (v_offset): %s' % exp) - value = find_attr_value_('e_rev_E', node) - if value is not None and 'e_rev_E' not in already_processed: - already_processed.add('e_rev_E') - try: - self.e_rev_E = float(value) - except ValueError as exp: - raise ValueError('Bad float/double attribute (e_rev_E): %s' % exp) - value = find_attr_value_('e_rev_I', node) - if value is not None and 'e_rev_I' not in already_processed: - already_processed.add('e_rev_I') - try: - self.e_rev_I = float(value) - except ValueError as exp: - raise ValueError('Bad float/double attribute (e_rev_I): %s' % exp) - value = find_attr_value_('e_rev_K', node) - if value is not None and 'e_rev_K' not in already_processed: - already_processed.add('e_rev_K') - try: - self.e_rev_K = float(value) - except ValueError as exp: - raise ValueError('Bad float/double attribute (e_rev_K): %s' % exp) - value = find_attr_value_('e_rev_Na', node) - if value is not None and 'e_rev_Na' not in already_processed: - already_processed.add('e_rev_Na') - try: - self.e_rev_Na = float(value) - except ValueError as exp: - raise ValueError('Bad float/double attribute (e_rev_Na): %s' % exp) - value = find_attr_value_('e_rev_leak', node) - if value is not None and 'e_rev_leak' not in already_processed: - already_processed.add('e_rev_leak') - try: - self.e_rev_leak = float(value) - except ValueError as exp: - raise ValueError('Bad float/double attribute (e_rev_leak): %s' % exp) - value = find_attr_value_('g_leak', node) - if value is not None and 'g_leak' not in already_processed: - already_processed.add('g_leak') - try: - self.g_leak = float(value) - except ValueError as exp: - raise ValueError('Bad float/double attribute (g_leak): %s' % exp) - value = find_attr_value_('gbar_K', node) - if value is not None and 'gbar_K' not in already_processed: - already_processed.add('gbar_K') - try: - self.gbar_K = float(value) - except ValueError as exp: - raise ValueError('Bad float/double attribute (gbar_K): %s' % exp) - value = find_attr_value_('gbar_Na', node) - if value is not None and 'gbar_Na' not in already_processed: - already_processed.add('gbar_Na') - try: - self.gbar_Na = float(value) - except ValueError as exp: - raise ValueError('Bad float/double attribute (gbar_Na): %s' % exp) - super(HH_cond_exp, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(HH_cond_exp, self).buildChildren(child_, node, nodeName_, True) - pass -# end class HH_cond_exp - - -class basePyNNIaFCell(basePyNNCell): - subclass = None - superclass = basePyNNCell - def __init__(self, id=None, neuroLexId=None, name=None, metaid=None, notes=None, annotation=None, cm=None, i_offset=None, tau_syn_E=None, tau_syn_I=None, v_init=None, tau_m=None, tau_refrac=None, v_reset=None, v_rest=None, v_thresh=None, extensiontype_=None): - self.original_tagname_ = None - super(basePyNNIaFCell, self).__init__(id, neuroLexId, name, metaid, notes, annotation, cm, i_offset, tau_syn_E, tau_syn_I, v_init, extensiontype_, ) - self.tau_m = _cast(float, tau_m) - self.tau_refrac = _cast(float, tau_refrac) - self.v_reset = _cast(float, v_reset) - self.v_rest = _cast(float, v_rest) - self.v_thresh = _cast(float, v_thresh) - self.extensiontype_ = extensiontype_ - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, basePyNNIaFCell) - if subclass is not None: - return subclass(*args_, **kwargs_) - if basePyNNIaFCell.subclass: - return basePyNNIaFCell.subclass(*args_, **kwargs_) - else: - return basePyNNIaFCell(*args_, **kwargs_) - factory = staticmethod(factory) - def get_tau_m(self): return self.tau_m - def set_tau_m(self, tau_m): self.tau_m = tau_m - def get_tau_refrac(self): return self.tau_refrac - def set_tau_refrac(self, tau_refrac): self.tau_refrac = tau_refrac - def get_v_reset(self): return self.v_reset - def set_v_reset(self, v_reset): self.v_reset = v_reset - def get_v_rest(self): return self.v_rest - def set_v_rest(self, v_rest): self.v_rest = v_rest - def get_v_thresh(self): return self.v_thresh - def set_v_thresh(self, v_thresh): self.v_thresh = v_thresh - def get_extensiontype_(self): return self.extensiontype_ - def set_extensiontype_(self, extensiontype_): self.extensiontype_ = extensiontype_ - def hasContent_(self): - if ( - super(basePyNNIaFCell, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='basePyNNIaFCell', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='basePyNNIaFCell') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='basePyNNIaFCell', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='basePyNNIaFCell'): - super(basePyNNIaFCell, self).exportAttributes(outfile, level, already_processed, namespace_, name_='basePyNNIaFCell') - if self.tau_m is not None and 'tau_m' not in already_processed: - already_processed.add('tau_m') - outfile.write(' tau_m="%s"' % self.gds_format_double(self.tau_m, input_name='tau_m')) - if self.tau_refrac is not None and 'tau_refrac' not in already_processed: - already_processed.add('tau_refrac') - outfile.write(' tau_refrac="%s"' % self.gds_format_double(self.tau_refrac, input_name='tau_refrac')) - if self.v_reset is not None and 'v_reset' not in already_processed: - already_processed.add('v_reset') - outfile.write(' v_reset="%s"' % self.gds_format_double(self.v_reset, input_name='v_reset')) - if self.v_rest is not None and 'v_rest' not in already_processed: - already_processed.add('v_rest') - outfile.write(' v_rest="%s"' % self.gds_format_double(self.v_rest, input_name='v_rest')) - if self.v_thresh is not None and 'v_thresh' not in already_processed: - already_processed.add('v_thresh') - outfile.write(' v_thresh="%s"' % self.gds_format_double(self.v_thresh, input_name='v_thresh')) - if self.extensiontype_ is not None and 'xsi:type' not in already_processed: - already_processed.add('xsi:type') - outfile.write(' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"') - outfile.write(' xsi:type="%s"' % self.extensiontype_) - def exportChildren(self, outfile, level, namespace_='', name_='basePyNNIaFCell', fromsubclass_=False, pretty_print=True): - super(basePyNNIaFCell, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - value = find_attr_value_('tau_m', node) - if value is not None and 'tau_m' not in already_processed: - already_processed.add('tau_m') - try: - self.tau_m = float(value) - except ValueError as exp: - raise ValueError('Bad float/double attribute (tau_m): %s' % exp) - value = find_attr_value_('tau_refrac', node) - if value is not None and 'tau_refrac' not in already_processed: - already_processed.add('tau_refrac') - try: - self.tau_refrac = float(value) - except ValueError as exp: - raise ValueError('Bad float/double attribute (tau_refrac): %s' % exp) - value = find_attr_value_('v_reset', node) - if value is not None and 'v_reset' not in already_processed: - already_processed.add('v_reset') - try: - self.v_reset = float(value) - except ValueError as exp: - raise ValueError('Bad float/double attribute (v_reset): %s' % exp) - value = find_attr_value_('v_rest', node) - if value is not None and 'v_rest' not in already_processed: - already_processed.add('v_rest') - try: - self.v_rest = float(value) - except ValueError as exp: - raise ValueError('Bad float/double attribute (v_rest): %s' % exp) - value = find_attr_value_('v_thresh', node) - if value is not None and 'v_thresh' not in already_processed: - already_processed.add('v_thresh') - try: - self.v_thresh = float(value) - except ValueError as exp: - raise ValueError('Bad float/double attribute (v_thresh): %s' % exp) - value = find_attr_value_('xsi:type', node) - if value is not None and 'xsi:type' not in already_processed: - already_processed.add('xsi:type') - self.extensiontype_ = value - super(basePyNNIaFCell, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(basePyNNIaFCell, self).buildChildren(child_, node, nodeName_, True) - pass -# end class basePyNNIaFCell - - -class IaFRefCell(IaFCell): - subclass = None - superclass = IaFCell - def __init__(self, id=None, neuroLexId=None, name=None, metaid=None, notes=None, annotation=None, leakReversal=None, thresh=None, reset=None, C=None, leakConductance=None, refract=None): - self.original_tagname_ = None - super(IaFRefCell, self).__init__(id, neuroLexId, name, metaid, notes, annotation, leakReversal, thresh, reset, C, leakConductance, ) - self.refract = _cast(None, refract) - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, IaFRefCell) - if subclass is not None: - return subclass(*args_, **kwargs_) - if IaFRefCell.subclass: - return IaFRefCell.subclass(*args_, **kwargs_) - else: - return IaFRefCell(*args_, **kwargs_) - factory = staticmethod(factory) - def get_refract(self): return self.refract - def set_refract(self, refract): self.refract = refract - def validate_Nml2Quantity_time(self, value): - # Validate type Nml2Quantity_time, a restriction on xs:string. - if value is not None and Validate_simpletypes_: - if not self.gds_validate_simple_patterns( - self.validate_Nml2Quantity_time_patterns_, value): - warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_Nml2Quantity_time_patterns_, )) - validate_Nml2Quantity_time_patterns_ = [['^-?([0-9]*(\\.[0-9]+)?)([eE]-?[0-9]+)?[\\s]*(s|ms)$']] - def hasContent_(self): - if ( - super(IaFRefCell, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='IaFRefCell', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='IaFRefCell') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='IaFRefCell', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='IaFRefCell'): - super(IaFRefCell, self).exportAttributes(outfile, level, already_processed, namespace_, name_='IaFRefCell') - if self.refract is not None and 'refract' not in already_processed: - already_processed.add('refract') - outfile.write(' refract=%s' % (quote_attrib(self.refract), )) - def exportChildren(self, outfile, level, namespace_='', name_='IaFRefCell', fromsubclass_=False, pretty_print=True): - super(IaFRefCell, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - value = find_attr_value_('refract', node) - if value is not None and 'refract' not in already_processed: - already_processed.add('refract') - self.refract = value - self.validate_Nml2Quantity_time(self.refract) # validate type Nml2Quantity_time - super(IaFRefCell, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(IaFRefCell, self).buildChildren(child_, node, nodeName_, True) - pass -# end class IaFRefCell - - -class IaFTauRefCell(IaFTauCell): - subclass = None - superclass = IaFTauCell - def __init__(self, id=None, neuroLexId=None, name=None, metaid=None, notes=None, annotation=None, leakReversal=None, thresh=None, reset=None, tau=None, refract=None): - self.original_tagname_ = None - super(IaFTauRefCell, self).__init__(id, neuroLexId, name, metaid, notes, annotation, leakReversal, thresh, reset, tau, ) - self.refract = _cast(None, refract) - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, IaFTauRefCell) - if subclass is not None: - return subclass(*args_, **kwargs_) - if IaFTauRefCell.subclass: - return IaFTauRefCell.subclass(*args_, **kwargs_) - else: - return IaFTauRefCell(*args_, **kwargs_) - factory = staticmethod(factory) - def get_refract(self): return self.refract - def set_refract(self, refract): self.refract = refract - def validate_Nml2Quantity_time(self, value): - # Validate type Nml2Quantity_time, a restriction on xs:string. - if value is not None and Validate_simpletypes_: - if not self.gds_validate_simple_patterns( - self.validate_Nml2Quantity_time_patterns_, value): - warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_Nml2Quantity_time_patterns_, )) - validate_Nml2Quantity_time_patterns_ = [['^-?([0-9]*(\\.[0-9]+)?)([eE]-?[0-9]+)?[\\s]*(s|ms)$']] - def hasContent_(self): - if ( - super(IaFTauRefCell, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='IaFTauRefCell', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='IaFTauRefCell') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='IaFTauRefCell', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='IaFTauRefCell'): - super(IaFTauRefCell, self).exportAttributes(outfile, level, already_processed, namespace_, name_='IaFTauRefCell') - if self.refract is not None and 'refract' not in already_processed: - already_processed.add('refract') - outfile.write(' refract=%s' % (quote_attrib(self.refract), )) - def exportChildren(self, outfile, level, namespace_='', name_='IaFTauRefCell', fromsubclass_=False, pretty_print=True): - super(IaFTauRefCell, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - value = find_attr_value_('refract', node) - if value is not None and 'refract' not in already_processed: - already_processed.add('refract') - self.refract = value - self.validate_Nml2Quantity_time(self.refract) # validate type Nml2Quantity_time - super(IaFTauRefCell, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(IaFTauRefCell, self).buildChildren(child_, node, nodeName_, True) - pass -# end class IaFTauRefCell - - -class ExpTwoSynapse(BaseConductanceBasedSynapse): - subclass = None - superclass = BaseConductanceBasedSynapse - def __init__(self, id=None, neuroLexId=None, name=None, metaid=None, notes=None, annotation=None, gbase=None, erev=None, tauDecay=None, tauRise=None, extensiontype_=None): - self.original_tagname_ = None - super(ExpTwoSynapse, self).__init__(id, neuroLexId, name, metaid, notes, annotation, gbase, erev, extensiontype_, ) - self.tauDecay = _cast(None, tauDecay) - self.tauRise = _cast(None, tauRise) - self.extensiontype_ = extensiontype_ - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, ExpTwoSynapse) - if subclass is not None: - return subclass(*args_, **kwargs_) - if ExpTwoSynapse.subclass: - return ExpTwoSynapse.subclass(*args_, **kwargs_) - else: - return ExpTwoSynapse(*args_, **kwargs_) - factory = staticmethod(factory) - def get_tauDecay(self): return self.tauDecay - def set_tauDecay(self, tauDecay): self.tauDecay = tauDecay - def get_tauRise(self): return self.tauRise - def set_tauRise(self, tauRise): self.tauRise = tauRise - def get_extensiontype_(self): return self.extensiontype_ - def set_extensiontype_(self, extensiontype_): self.extensiontype_ = extensiontype_ - def validate_Nml2Quantity_time(self, value): - # Validate type Nml2Quantity_time, a restriction on xs:string. - if value is not None and Validate_simpletypes_: - if not self.gds_validate_simple_patterns( - self.validate_Nml2Quantity_time_patterns_, value): - warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_Nml2Quantity_time_patterns_, )) - validate_Nml2Quantity_time_patterns_ = [['^-?([0-9]*(\\.[0-9]+)?)([eE]-?[0-9]+)?[\\s]*(s|ms)$']] - def hasContent_(self): - if ( - super(ExpTwoSynapse, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='ExpTwoSynapse', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='ExpTwoSynapse') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='ExpTwoSynapse', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='ExpTwoSynapse'): - super(ExpTwoSynapse, self).exportAttributes(outfile, level, already_processed, namespace_, name_='ExpTwoSynapse') - if self.tauDecay is not None and 'tauDecay' not in already_processed: - already_processed.add('tauDecay') - outfile.write(' tauDecay=%s' % (quote_attrib(self.tauDecay), )) - if self.tauRise is not None and 'tauRise' not in already_processed: - already_processed.add('tauRise') - outfile.write(' tauRise=%s' % (quote_attrib(self.tauRise), )) - if self.extensiontype_ is not None and 'xsi:type' not in already_processed: - already_processed.add('xsi:type') - outfile.write(' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"') - outfile.write(' xsi:type="%s"' % self.extensiontype_) - def exportChildren(self, outfile, level, namespace_='', name_='ExpTwoSynapse', fromsubclass_=False, pretty_print=True): - super(ExpTwoSynapse, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - value = find_attr_value_('tauDecay', node) - if value is not None and 'tauDecay' not in already_processed: - already_processed.add('tauDecay') - self.tauDecay = value - self.validate_Nml2Quantity_time(self.tauDecay) # validate type Nml2Quantity_time - value = find_attr_value_('tauRise', node) - if value is not None and 'tauRise' not in already_processed: - already_processed.add('tauRise') - self.tauRise = value - self.validate_Nml2Quantity_time(self.tauRise) # validate type Nml2Quantity_time - value = find_attr_value_('xsi:type', node) - if value is not None and 'xsi:type' not in already_processed: - already_processed.add('xsi:type') - self.extensiontype_ = value - super(ExpTwoSynapse, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(ExpTwoSynapse, self).buildChildren(child_, node, nodeName_, True) - pass -# end class ExpTwoSynapse - - -class ExpOneSynapse(BaseConductanceBasedSynapse): - subclass = None - superclass = BaseConductanceBasedSynapse - def __init__(self, id=None, neuroLexId=None, name=None, metaid=None, notes=None, annotation=None, gbase=None, erev=None, tauDecay=None): - self.original_tagname_ = None - super(ExpOneSynapse, self).__init__(id, neuroLexId, name, metaid, notes, annotation, gbase, erev, ) - self.tauDecay = _cast(None, tauDecay) - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, ExpOneSynapse) - if subclass is not None: - return subclass(*args_, **kwargs_) - if ExpOneSynapse.subclass: - return ExpOneSynapse.subclass(*args_, **kwargs_) - else: - return ExpOneSynapse(*args_, **kwargs_) - factory = staticmethod(factory) - def get_tauDecay(self): return self.tauDecay - def set_tauDecay(self, tauDecay): self.tauDecay = tauDecay - def validate_Nml2Quantity_time(self, value): - # Validate type Nml2Quantity_time, a restriction on xs:string. - if value is not None and Validate_simpletypes_: - if not self.gds_validate_simple_patterns( - self.validate_Nml2Quantity_time_patterns_, value): - warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_Nml2Quantity_time_patterns_, )) - validate_Nml2Quantity_time_patterns_ = [['^-?([0-9]*(\\.[0-9]+)?)([eE]-?[0-9]+)?[\\s]*(s|ms)$']] - def hasContent_(self): - if ( - super(ExpOneSynapse, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='ExpOneSynapse', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='ExpOneSynapse') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='ExpOneSynapse', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='ExpOneSynapse'): - super(ExpOneSynapse, self).exportAttributes(outfile, level, already_processed, namespace_, name_='ExpOneSynapse') - if self.tauDecay is not None and 'tauDecay' not in already_processed: - already_processed.add('tauDecay') - outfile.write(' tauDecay=%s' % (quote_attrib(self.tauDecay), )) - def exportChildren(self, outfile, level, namespace_='', name_='ExpOneSynapse', fromsubclass_=False, pretty_print=True): - super(ExpOneSynapse, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - value = find_attr_value_('tauDecay', node) - if value is not None and 'tauDecay' not in already_processed: - already_processed.add('tauDecay') - self.tauDecay = value - self.validate_Nml2Quantity_time(self.tauDecay) # validate type Nml2Quantity_time - super(ExpOneSynapse, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(ExpOneSynapse, self).buildChildren(child_, node, nodeName_, True) - pass -# end class ExpOneSynapse - - -class IF_curr_exp(basePyNNIaFCell): - subclass = None - superclass = basePyNNIaFCell - def __init__(self, id=None, neuroLexId=None, name=None, metaid=None, notes=None, annotation=None, cm=None, i_offset=None, tau_syn_E=None, tau_syn_I=None, v_init=None, tau_m=None, tau_refrac=None, v_reset=None, v_rest=None, v_thresh=None): - self.original_tagname_ = None - super(IF_curr_exp, self).__init__(id, neuroLexId, name, metaid, notes, annotation, cm, i_offset, tau_syn_E, tau_syn_I, v_init, tau_m, tau_refrac, v_reset, v_rest, v_thresh, ) - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, IF_curr_exp) - if subclass is not None: - return subclass(*args_, **kwargs_) - if IF_curr_exp.subclass: - return IF_curr_exp.subclass(*args_, **kwargs_) - else: - return IF_curr_exp(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(IF_curr_exp, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='IF_curr_exp', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='IF_curr_exp') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='IF_curr_exp', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='IF_curr_exp'): - super(IF_curr_exp, self).exportAttributes(outfile, level, already_processed, namespace_, name_='IF_curr_exp') - def exportChildren(self, outfile, level, namespace_='', name_='IF_curr_exp', fromsubclass_=False, pretty_print=True): - super(IF_curr_exp, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(IF_curr_exp, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(IF_curr_exp, self).buildChildren(child_, node, nodeName_, True) - pass -# end class IF_curr_exp - - -class IF_curr_alpha(basePyNNIaFCell): - subclass = None - superclass = basePyNNIaFCell - def __init__(self, id=None, neuroLexId=None, name=None, metaid=None, notes=None, annotation=None, cm=None, i_offset=None, tau_syn_E=None, tau_syn_I=None, v_init=None, tau_m=None, tau_refrac=None, v_reset=None, v_rest=None, v_thresh=None): - self.original_tagname_ = None - super(IF_curr_alpha, self).__init__(id, neuroLexId, name, metaid, notes, annotation, cm, i_offset, tau_syn_E, tau_syn_I, v_init, tau_m, tau_refrac, v_reset, v_rest, v_thresh, ) - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, IF_curr_alpha) - if subclass is not None: - return subclass(*args_, **kwargs_) - if IF_curr_alpha.subclass: - return IF_curr_alpha.subclass(*args_, **kwargs_) - else: - return IF_curr_alpha(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(IF_curr_alpha, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='IF_curr_alpha', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='IF_curr_alpha') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='IF_curr_alpha', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='IF_curr_alpha'): - super(IF_curr_alpha, self).exportAttributes(outfile, level, already_processed, namespace_, name_='IF_curr_alpha') - def exportChildren(self, outfile, level, namespace_='', name_='IF_curr_alpha', fromsubclass_=False, pretty_print=True): - super(IF_curr_alpha, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(IF_curr_alpha, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(IF_curr_alpha, self).buildChildren(child_, node, nodeName_, True) - pass -# end class IF_curr_alpha - - -class basePyNNIaFCondCell(basePyNNIaFCell): - subclass = None - superclass = basePyNNIaFCell - def __init__(self, id=None, neuroLexId=None, name=None, metaid=None, notes=None, annotation=None, cm=None, i_offset=None, tau_syn_E=None, tau_syn_I=None, v_init=None, tau_m=None, tau_refrac=None, v_reset=None, v_rest=None, v_thresh=None, e_rev_E=None, e_rev_I=None, extensiontype_=None): - self.original_tagname_ = None - super(basePyNNIaFCondCell, self).__init__(id, neuroLexId, name, metaid, notes, annotation, cm, i_offset, tau_syn_E, tau_syn_I, v_init, tau_m, tau_refrac, v_reset, v_rest, v_thresh, extensiontype_, ) - self.e_rev_E = _cast(float, e_rev_E) - self.e_rev_I = _cast(float, e_rev_I) - self.extensiontype_ = extensiontype_ - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, basePyNNIaFCondCell) - if subclass is not None: - return subclass(*args_, **kwargs_) - if basePyNNIaFCondCell.subclass: - return basePyNNIaFCondCell.subclass(*args_, **kwargs_) - else: - return basePyNNIaFCondCell(*args_, **kwargs_) - factory = staticmethod(factory) - def get_e_rev_E(self): return self.e_rev_E - def set_e_rev_E(self, e_rev_E): self.e_rev_E = e_rev_E - def get_e_rev_I(self): return self.e_rev_I - def set_e_rev_I(self, e_rev_I): self.e_rev_I = e_rev_I - def get_extensiontype_(self): return self.extensiontype_ - def set_extensiontype_(self, extensiontype_): self.extensiontype_ = extensiontype_ - def hasContent_(self): - if ( - super(basePyNNIaFCondCell, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='basePyNNIaFCondCell', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='basePyNNIaFCondCell') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='basePyNNIaFCondCell', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='basePyNNIaFCondCell'): - super(basePyNNIaFCondCell, self).exportAttributes(outfile, level, already_processed, namespace_, name_='basePyNNIaFCondCell') - if self.e_rev_E is not None and 'e_rev_E' not in already_processed: - already_processed.add('e_rev_E') - outfile.write(' e_rev_E="%s"' % self.gds_format_double(self.e_rev_E, input_name='e_rev_E')) - if self.e_rev_I is not None and 'e_rev_I' not in already_processed: - already_processed.add('e_rev_I') - outfile.write(' e_rev_I="%s"' % self.gds_format_double(self.e_rev_I, input_name='e_rev_I')) - if self.extensiontype_ is not None and 'xsi:type' not in already_processed: - already_processed.add('xsi:type') - outfile.write(' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"') - outfile.write(' xsi:type="%s"' % self.extensiontype_) - def exportChildren(self, outfile, level, namespace_='', name_='basePyNNIaFCondCell', fromsubclass_=False, pretty_print=True): - super(basePyNNIaFCondCell, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - value = find_attr_value_('e_rev_E', node) - if value is not None and 'e_rev_E' not in already_processed: - already_processed.add('e_rev_E') - try: - self.e_rev_E = float(value) - except ValueError as exp: - raise ValueError('Bad float/double attribute (e_rev_E): %s' % exp) - value = find_attr_value_('e_rev_I', node) - if value is not None and 'e_rev_I' not in already_processed: - already_processed.add('e_rev_I') - try: - self.e_rev_I = float(value) - except ValueError as exp: - raise ValueError('Bad float/double attribute (e_rev_I): %s' % exp) - value = find_attr_value_('xsi:type', node) - if value is not None and 'xsi:type' not in already_processed: - already_processed.add('xsi:type') - self.extensiontype_ = value - super(basePyNNIaFCondCell, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(basePyNNIaFCondCell, self).buildChildren(child_, node, nodeName_, True) - pass -# end class basePyNNIaFCondCell - - -class BlockingPlasticSynapse(ExpTwoSynapse): - subclass = None - superclass = ExpTwoSynapse - def __init__(self, id=None, neuroLexId=None, name=None, metaid=None, notes=None, annotation=None, gbase=None, erev=None, tauDecay=None, tauRise=None, plasticityMechanism=None, blockMechanism=None): - self.original_tagname_ = None - super(BlockingPlasticSynapse, self).__init__(id, neuroLexId, name, metaid, notes, annotation, gbase, erev, tauDecay, tauRise, ) - self.plasticityMechanism = plasticityMechanism - self.blockMechanism = blockMechanism - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, BlockingPlasticSynapse) - if subclass is not None: - return subclass(*args_, **kwargs_) - if BlockingPlasticSynapse.subclass: - return BlockingPlasticSynapse.subclass(*args_, **kwargs_) - else: - return BlockingPlasticSynapse(*args_, **kwargs_) - factory = staticmethod(factory) - def get_plasticityMechanism(self): return self.plasticityMechanism - def set_plasticityMechanism(self, plasticityMechanism): self.plasticityMechanism = plasticityMechanism - def get_blockMechanism(self): return self.blockMechanism - def set_blockMechanism(self, blockMechanism): self.blockMechanism = blockMechanism - def hasContent_(self): - if ( - self.plasticityMechanism is not None or - self.blockMechanism is not None or - super(BlockingPlasticSynapse, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='BlockingPlasticSynapse', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='BlockingPlasticSynapse') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='BlockingPlasticSynapse', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='BlockingPlasticSynapse'): - super(BlockingPlasticSynapse, self).exportAttributes(outfile, level, already_processed, namespace_, name_='BlockingPlasticSynapse') - def exportChildren(self, outfile, level, namespace_='', name_='BlockingPlasticSynapse', fromsubclass_=False, pretty_print=True): - super(BlockingPlasticSynapse, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.plasticityMechanism is not None: - self.plasticityMechanism.export(outfile, level, namespace_, name_='plasticityMechanism', pretty_print=pretty_print) - if self.blockMechanism is not None: - self.blockMechanism.export(outfile, level, namespace_, name_='blockMechanism', pretty_print=pretty_print) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(BlockingPlasticSynapse, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'plasticityMechanism': - obj_ = PlasticityMechanism.factory() - obj_.build(child_) - self.plasticityMechanism = obj_ - obj_.original_tagname_ = 'plasticityMechanism' - elif nodeName_ == 'blockMechanism': - obj_ = BlockMechanism.factory() - obj_.build(child_) - self.blockMechanism = obj_ - obj_.original_tagname_ = 'blockMechanism' - super(BlockingPlasticSynapse, self).buildChildren(child_, node, nodeName_, True) -# end class BlockingPlasticSynapse - - -class EIF_cond_alpha_isfa_ista(basePyNNIaFCondCell): - subclass = None - superclass = basePyNNIaFCondCell - def __init__(self, id=None, neuroLexId=None, name=None, metaid=None, notes=None, annotation=None, cm=None, i_offset=None, tau_syn_E=None, tau_syn_I=None, v_init=None, tau_m=None, tau_refrac=None, v_reset=None, v_rest=None, v_thresh=None, e_rev_E=None, e_rev_I=None, a=None, b=None, delta_T=None, tau_w=None, v_spike=None): - self.original_tagname_ = None - super(EIF_cond_alpha_isfa_ista, self).__init__(id, neuroLexId, name, metaid, notes, annotation, cm, i_offset, tau_syn_E, tau_syn_I, v_init, tau_m, tau_refrac, v_reset, v_rest, v_thresh, e_rev_E, e_rev_I, ) - self.a = _cast(float, a) - self.b = _cast(float, b) - self.delta_T = _cast(float, delta_T) - self.tau_w = _cast(float, tau_w) - self.v_spike = _cast(float, v_spike) - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, EIF_cond_alpha_isfa_ista) - if subclass is not None: - return subclass(*args_, **kwargs_) - if EIF_cond_alpha_isfa_ista.subclass: - return EIF_cond_alpha_isfa_ista.subclass(*args_, **kwargs_) - else: - return EIF_cond_alpha_isfa_ista(*args_, **kwargs_) - factory = staticmethod(factory) - def get_a(self): return self.a - def set_a(self, a): self.a = a - def get_b(self): return self.b - def set_b(self, b): self.b = b - def get_delta_T(self): return self.delta_T - def set_delta_T(self, delta_T): self.delta_T = delta_T - def get_tau_w(self): return self.tau_w - def set_tau_w(self, tau_w): self.tau_w = tau_w - def get_v_spike(self): return self.v_spike - def set_v_spike(self, v_spike): self.v_spike = v_spike - def hasContent_(self): - if ( - super(EIF_cond_alpha_isfa_ista, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='EIF_cond_alpha_isfa_ista', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='EIF_cond_alpha_isfa_ista') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='EIF_cond_alpha_isfa_ista', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='EIF_cond_alpha_isfa_ista'): - super(EIF_cond_alpha_isfa_ista, self).exportAttributes(outfile, level, already_processed, namespace_, name_='EIF_cond_alpha_isfa_ista') - if self.a is not None and 'a' not in already_processed: - already_processed.add('a') - outfile.write(' a="%s"' % self.gds_format_double(self.a, input_name='a')) - if self.b is not None and 'b' not in already_processed: - already_processed.add('b') - outfile.write(' b="%s"' % self.gds_format_double(self.b, input_name='b')) - if self.delta_T is not None and 'delta_T' not in already_processed: - already_processed.add('delta_T') - outfile.write(' delta_T="%s"' % self.gds_format_double(self.delta_T, input_name='delta_T')) - if self.tau_w is not None and 'tau_w' not in already_processed: - already_processed.add('tau_w') - outfile.write(' tau_w="%s"' % self.gds_format_double(self.tau_w, input_name='tau_w')) - if self.v_spike is not None and 'v_spike' not in already_processed: - already_processed.add('v_spike') - outfile.write(' v_spike="%s"' % self.gds_format_double(self.v_spike, input_name='v_spike')) - def exportChildren(self, outfile, level, namespace_='', name_='EIF_cond_alpha_isfa_ista', fromsubclass_=False, pretty_print=True): - super(EIF_cond_alpha_isfa_ista, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - value = find_attr_value_('a', node) - if value is not None and 'a' not in already_processed: - already_processed.add('a') - try: - self.a = float(value) - except ValueError as exp: - raise ValueError('Bad float/double attribute (a): %s' % exp) - value = find_attr_value_('b', node) - if value is not None and 'b' not in already_processed: - already_processed.add('b') - try: - self.b = float(value) - except ValueError as exp: - raise ValueError('Bad float/double attribute (b): %s' % exp) - value = find_attr_value_('delta_T', node) - if value is not None and 'delta_T' not in already_processed: - already_processed.add('delta_T') - try: - self.delta_T = float(value) - except ValueError as exp: - raise ValueError('Bad float/double attribute (delta_T): %s' % exp) - value = find_attr_value_('tau_w', node) - if value is not None and 'tau_w' not in already_processed: - already_processed.add('tau_w') - try: - self.tau_w = float(value) - except ValueError as exp: - raise ValueError('Bad float/double attribute (tau_w): %s' % exp) - value = find_attr_value_('v_spike', node) - if value is not None and 'v_spike' not in already_processed: - already_processed.add('v_spike') - try: - self.v_spike = float(value) - except ValueError as exp: - raise ValueError('Bad float/double attribute (v_spike): %s' % exp) - super(EIF_cond_alpha_isfa_ista, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(EIF_cond_alpha_isfa_ista, self).buildChildren(child_, node, nodeName_, True) - pass -# end class EIF_cond_alpha_isfa_ista - - -class EIF_cond_exp_isfa_ista(basePyNNIaFCondCell): - subclass = None - superclass = basePyNNIaFCondCell - def __init__(self, id=None, neuroLexId=None, name=None, metaid=None, notes=None, annotation=None, cm=None, i_offset=None, tau_syn_E=None, tau_syn_I=None, v_init=None, tau_m=None, tau_refrac=None, v_reset=None, v_rest=None, v_thresh=None, e_rev_E=None, e_rev_I=None, a=None, b=None, delta_T=None, tau_w=None, v_spike=None): - self.original_tagname_ = None - super(EIF_cond_exp_isfa_ista, self).__init__(id, neuroLexId, name, metaid, notes, annotation, cm, i_offset, tau_syn_E, tau_syn_I, v_init, tau_m, tau_refrac, v_reset, v_rest, v_thresh, e_rev_E, e_rev_I, ) - self.a = _cast(float, a) - self.b = _cast(float, b) - self.delta_T = _cast(float, delta_T) - self.tau_w = _cast(float, tau_w) - self.v_spike = _cast(float, v_spike) - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, EIF_cond_exp_isfa_ista) - if subclass is not None: - return subclass(*args_, **kwargs_) - if EIF_cond_exp_isfa_ista.subclass: - return EIF_cond_exp_isfa_ista.subclass(*args_, **kwargs_) - else: - return EIF_cond_exp_isfa_ista(*args_, **kwargs_) - factory = staticmethod(factory) - def get_a(self): return self.a - def set_a(self, a): self.a = a - def get_b(self): return self.b - def set_b(self, b): self.b = b - def get_delta_T(self): return self.delta_T - def set_delta_T(self, delta_T): self.delta_T = delta_T - def get_tau_w(self): return self.tau_w - def set_tau_w(self, tau_w): self.tau_w = tau_w - def get_v_spike(self): return self.v_spike - def set_v_spike(self, v_spike): self.v_spike = v_spike - def hasContent_(self): - if ( - super(EIF_cond_exp_isfa_ista, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='EIF_cond_exp_isfa_ista', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='EIF_cond_exp_isfa_ista') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='EIF_cond_exp_isfa_ista', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='EIF_cond_exp_isfa_ista'): - super(EIF_cond_exp_isfa_ista, self).exportAttributes(outfile, level, already_processed, namespace_, name_='EIF_cond_exp_isfa_ista') - if self.a is not None and 'a' not in already_processed: - already_processed.add('a') - outfile.write(' a="%s"' % self.gds_format_double(self.a, input_name='a')) - if self.b is not None and 'b' not in already_processed: - already_processed.add('b') - outfile.write(' b="%s"' % self.gds_format_double(self.b, input_name='b')) - if self.delta_T is not None and 'delta_T' not in already_processed: - already_processed.add('delta_T') - outfile.write(' delta_T="%s"' % self.gds_format_double(self.delta_T, input_name='delta_T')) - if self.tau_w is not None and 'tau_w' not in already_processed: - already_processed.add('tau_w') - outfile.write(' tau_w="%s"' % self.gds_format_double(self.tau_w, input_name='tau_w')) - if self.v_spike is not None and 'v_spike' not in already_processed: - already_processed.add('v_spike') - outfile.write(' v_spike="%s"' % self.gds_format_double(self.v_spike, input_name='v_spike')) - def exportChildren(self, outfile, level, namespace_='', name_='EIF_cond_exp_isfa_ista', fromsubclass_=False, pretty_print=True): - super(EIF_cond_exp_isfa_ista, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - value = find_attr_value_('a', node) - if value is not None and 'a' not in already_processed: - already_processed.add('a') - try: - self.a = float(value) - except ValueError as exp: - raise ValueError('Bad float/double attribute (a): %s' % exp) - value = find_attr_value_('b', node) - if value is not None and 'b' not in already_processed: - already_processed.add('b') - try: - self.b = float(value) - except ValueError as exp: - raise ValueError('Bad float/double attribute (b): %s' % exp) - value = find_attr_value_('delta_T', node) - if value is not None and 'delta_T' not in already_processed: - already_processed.add('delta_T') - try: - self.delta_T = float(value) - except ValueError as exp: - raise ValueError('Bad float/double attribute (delta_T): %s' % exp) - value = find_attr_value_('tau_w', node) - if value is not None and 'tau_w' not in already_processed: - already_processed.add('tau_w') - try: - self.tau_w = float(value) - except ValueError as exp: - raise ValueError('Bad float/double attribute (tau_w): %s' % exp) - value = find_attr_value_('v_spike', node) - if value is not None and 'v_spike' not in already_processed: - already_processed.add('v_spike') - try: - self.v_spike = float(value) - except ValueError as exp: - raise ValueError('Bad float/double attribute (v_spike): %s' % exp) - super(EIF_cond_exp_isfa_ista, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(EIF_cond_exp_isfa_ista, self).buildChildren(child_, node, nodeName_, True) - pass -# end class EIF_cond_exp_isfa_ista - - -class IF_cond_exp(basePyNNIaFCondCell): - subclass = None - superclass = basePyNNIaFCondCell - def __init__(self, id=None, neuroLexId=None, name=None, metaid=None, notes=None, annotation=None, cm=None, i_offset=None, tau_syn_E=None, tau_syn_I=None, v_init=None, tau_m=None, tau_refrac=None, v_reset=None, v_rest=None, v_thresh=None, e_rev_E=None, e_rev_I=None): - self.original_tagname_ = None - super(IF_cond_exp, self).__init__(id, neuroLexId, name, metaid, notes, annotation, cm, i_offset, tau_syn_E, tau_syn_I, v_init, tau_m, tau_refrac, v_reset, v_rest, v_thresh, e_rev_E, e_rev_I, ) - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, IF_cond_exp) - if subclass is not None: - return subclass(*args_, **kwargs_) - if IF_cond_exp.subclass: - return IF_cond_exp.subclass(*args_, **kwargs_) - else: - return IF_cond_exp(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(IF_cond_exp, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='IF_cond_exp', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='IF_cond_exp') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='IF_cond_exp', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='IF_cond_exp'): - super(IF_cond_exp, self).exportAttributes(outfile, level, already_processed, namespace_, name_='IF_cond_exp') - def exportChildren(self, outfile, level, namespace_='', name_='IF_cond_exp', fromsubclass_=False, pretty_print=True): - super(IF_cond_exp, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(IF_cond_exp, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(IF_cond_exp, self).buildChildren(child_, node, nodeName_, True) - pass -# end class IF_cond_exp - - -class IF_cond_alpha(basePyNNIaFCondCell): - subclass = None - superclass = basePyNNIaFCondCell - def __init__(self, id=None, neuroLexId=None, name=None, metaid=None, notes=None, annotation=None, cm=None, i_offset=None, tau_syn_E=None, tau_syn_I=None, v_init=None, tau_m=None, tau_refrac=None, v_reset=None, v_rest=None, v_thresh=None, e_rev_E=None, e_rev_I=None): - self.original_tagname_ = None - super(IF_cond_alpha, self).__init__(id, neuroLexId, name, metaid, notes, annotation, cm, i_offset, tau_syn_E, tau_syn_I, v_init, tau_m, tau_refrac, v_reset, v_rest, v_thresh, e_rev_E, e_rev_I, ) - def factory(*args_, **kwargs_): - if CurrentSubclassModule_ is not None: - subclass = getSubclassFromModule_( - CurrentSubclassModule_, IF_cond_alpha) - if subclass is not None: - return subclass(*args_, **kwargs_) - if IF_cond_alpha.subclass: - return IF_cond_alpha.subclass(*args_, **kwargs_) - else: - return IF_cond_alpha(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(IF_cond_alpha, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='IF_cond_alpha', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='IF_cond_alpha') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='IF_cond_alpha', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='IF_cond_alpha'): - super(IF_cond_alpha, self).exportAttributes(outfile, level, already_processed, namespace_, name_='IF_cond_alpha') - def exportChildren(self, outfile, level, namespace_='', name_='IF_cond_alpha', fromsubclass_=False, pretty_print=True): - super(IF_cond_alpha, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(IF_cond_alpha, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(IF_cond_alpha, self).buildChildren(child_, node, nodeName_, True) - pass -# end class IF_cond_alpha - - -GDSClassesMapping = { - 'adExIaFCell': AdExIaFCell, - 'alphaCondSynapse': AlphaCondSynapse, - 'alphaCurrSynapse': AlphaCurrSynapse, - 'annotation': Annotation, - 'baseCell': BaseCell, - 'biophysicalProperties': BiophysicalProperties, - 'blockMechanism': BlockMechanism, - 'blockingPlasticSynapse': BlockingPlasticSynapse, - 'cell': Cell, - 'cellSet': CellSet, - 'channelDensity': ChannelDensity, - 'channelPopulation': ChannelPopulation, - 'connection': Connection, - 'decayingPoolConcentrationModel': DecayingPoolConcentrationModel, - 'distal': DistalDetails, - 'expCondSynapse': ExpCondSynapse, - 'expCurrSynapse': ExpCurrSynapse, - 'expOneSynapse': ExpOneSynapse, - 'expTwoSynapse': ExpTwoSynapse, - 'explicitInput': ExplicitInput, - 'extracellularProperties': ExtracellularPropertiesLocal, - 'forwardRate': HHRate, - 'from': SegmentEndPoint, - 'gate': GateHHUndetermined, - 'gateHHrates': GateHHRates, - 'gateHHratesInf': GateHHRatesInf, - 'gateHHratesTau': GateHHRatesTau, - 'gateHHtauInf': GateHHTauInf, - 'grid': GridLayout, - 'iafCell': IaFCell, - 'iafRefCell': IaFRefCell, - 'iafTauCell': IaFTauCell, - 'iafTauRefCell': IaFTauRefCell, - 'include': Include, - 'inhomogeneousParam': InhomogeneousParam, - 'inhomogeneousValue': InhomogeneousValue, - 'initMembPotential': ValueAcrossSegOrSegGroup, - 'input': Input, - 'inputList': InputList, - 'instance': Instance, - 'intracellularProperties': IntracellularProperties, - 'ionChannel': IonChannel, - 'izhikevichCell': IzhikevichCell, - 'layout': Layout, - 'location': Location, - 'member': Member, - 'membraneProperties': MembraneProperties, - 'morphology': Morphology, - 'network': Network, - 'neuroml': NeuroMLDocument, - 'parent': SegmentParent, - 'path': Path, - 'plasticityMechanism': PlasticityMechanism, - 'population': Population, - 'projection': Projection, - 'proximal': ProximalDetails, - 'pulseGenerator': PulseGenerator, - 'q10Settings': Q10Settings, - 'rampGenerator': RampGenerator, - 'random': RandomLayout, - 'region': Region, - 'resistivity': ValueAcrossSegOrSegGroup, - 'reversalPotential': ReversalPotential, - 'reverseRate': HHRate, - 'segment': Segment, - 'segmentGroup': SegmentGroup, - 'sineGenerator': SineGenerator, - 'space': Space, - 'species': Species, - 'specificCapacitance': ValueAcrossSegOrSegGroup, - 'spike': Spike, - 'spikeArray': SpikeArray, - 'spikeGenerator': SpikeGenerator, - 'spikeGeneratorPoisson': SpikeGeneratorPoisson, - 'spikeGeneratorRandom': SpikeGeneratorRandom, - 'spikeThresh': ValueAcrossSegOrSegGroup, - 'steadyState': HHVariable, - 'structure': SpaceStructure, - 'subTree': SubTree, - 'synapticConnection': SynapticConnection, - 'timeCourse': HHTime, - 'to': SegmentEndPoint, - 'unstructured': UnstructuredLayout, - 'variableParameter': VariableParameter, - 'voltageClamp': VoltageClamp, -} - - -USAGE_TEXT = """ -Usage: python <Parser>.py [ -s ] <in_xml_file> -""" - - -def usage(): - print(USAGE_TEXT) - sys.exit(1) - - -def get_root_tag(node): - tag = Tag_pattern_.match(node.tag).groups()[-1] - rootClass = GDSClassesMapping.get(tag) - if rootClass is None: - rootClass = globals().get(tag) - return tag, rootClass - - -def parse(inFileName, silence=False): - parser = None - doc = parsexml_(inFileName, parser) - rootNode = doc.getroot() - rootTag, rootClass = get_root_tag(rootNode) - if rootClass is None: - rootTag = 'Annotation' - rootClass = Annotation - rootObj = rootClass.factory() - rootObj.build(rootNode) - # Enable Python to collect the space used by the DOM. - doc = None - if not silence: - sys.stdout.write('<?xml version="1.0" ?>\n') - rootObj.export( - sys.stdout, 0, name_=rootTag, - namespacedef_='', - pretty_print=True) - return rootObj - - -def parseEtree(inFileName, silence=False): - parser = None - doc = parsexml_(inFileName, parser) - rootNode = doc.getroot() - rootTag, rootClass = get_root_tag(rootNode) - if rootClass is None: - rootTag = 'Annotation' - rootClass = Annotation - rootObj = rootClass.factory() - rootObj.build(rootNode) - # Enable Python to collect the space used by the DOM. - doc = None - mapping = {} - rootElement = rootObj.to_etree(None, name_=rootTag, mapping_=mapping) - reverse_mapping = rootObj.gds_reverse_node_mapping(mapping) - if not silence: - content = etree_.tostring( - rootElement, pretty_print=True, - xml_declaration=True, encoding="utf-8") - sys.stdout.write(content) - sys.stdout.write('\n') - return rootObj, rootElement, mapping, reverse_mapping - - -def parseString(inString, silence=False): - from StringIO import StringIO - parser = None - doc = parsexml_(StringIO(inString), parser) - rootNode = doc.getroot() - rootTag, rootClass = get_root_tag(rootNode) - if rootClass is None: - rootTag = 'Annotation' - rootClass = Annotation - rootObj = rootClass.factory() - rootObj.build(rootNode) - # Enable Python to collect the space used by the DOM. - doc = None - if not silence: - sys.stdout.write('<?xml version="1.0" ?>\n') - rootObj.export( - sys.stdout, 0, name_=rootTag, - namespacedef_='') - return rootObj - - -def parseLiteral(inFileName, silence=False): - parser = None - doc = parsexml_(inFileName, parser) - rootNode = doc.getroot() - rootTag, rootClass = get_root_tag(rootNode) - if rootClass is None: - rootTag = 'Annotation' - rootClass = Annotation - rootObj = rootClass.factory() - rootObj.build(rootNode) - # Enable Python to collect the space used by the DOM. - doc = None - if not silence: - sys.stdout.write('#from generated_neuroml import *\n\n') - sys.stdout.write('import generated_neuroml as model_\n\n') - sys.stdout.write('rootObj = model_.rootClass(\n') - rootObj.exportLiteral(sys.stdout, 0, name_=rootTag) - sys.stdout.write(')\n') - return rootObj - - -def main(): - args = sys.argv[1:] - if len(args) == 1: - parse(args[0]) - else: - usage() - - -if __name__ == '__main__': - #import pdb; pdb.set_trace() - main() - - -__all__ = [ - "AdExIaFCell", - "AlphaCondSynapse", - "AlphaCurrSynapse", - "Annotation", - "Base", - "BaseCell", - "BaseConductanceBasedSynapse", - "BasePynnSynapse", - "BaseSynapse", - "BiophysicalProperties", - "BlockMechanism", - "BlockingPlasticSynapse", - "Cell", - "CellSet", - "ChannelDensity", - "ChannelPopulation", - "ComponentType", - "ConcentrationModel_D", - "Connection", - "DecayingPoolConcentrationModel", - "DistalDetails", - "EIF_cond_alpha_isfa_ista", - "EIF_cond_exp_isfa_ista", - "ExpCondSynapse", - "ExpCurrSynapse", - "ExpOneSynapse", - "ExpTwoSynapse", - "ExplicitInput", - "ExtracellularProperties", - "ExtracellularPropertiesLocal", - "GateHHRates", - "GateHHRatesInf", - "GateHHRatesTau", - "GateHHTauInf", - "GateHHUndetermined", - "GridLayout", - "HHRate", - "HHTime", - "HHVariable", - "HH_cond_exp", - "IF_cond_alpha", - "IF_cond_exp", - "IF_curr_alpha", - "IF_curr_exp", - "IaFCell", - "IaFRefCell", - "IaFTauCell", - "IaFTauRefCell", - "Include", - "IncludeType", - "InhomogeneousParam", - "InhomogeneousValue", - "Input", - "InputList", - "Instance", - "IntracellularProperties", - "IonChannel", - "IzhikevichCell", - "Layout", - "Location", - "Member", - "MembraneProperties", - "Morphology", - "Network", - "NeuroMLDocument", - "Path", - "PlasticityMechanism", - "Point3DWithDiam", - "Population", - "Projection", - "ProximalDetails", - "PulseGenerator", - "Q10Settings", - "RampGenerator", - "RandomLayout", - "ReactionScheme", - "Region", - "ReversalPotential", - "Segment", - "SegmentEndPoint", - "SegmentGroup", - "SegmentParent", - "SineGenerator", - "Space", - "SpaceStructure", - "Species", - "Spike", - "SpikeArray", - "SpikeGenerator", - "SpikeGeneratorPoisson", - "SpikeGeneratorRandom", - "SpikeSourcePoisson", - "Standalone", - "SubTree", - "SynapticConnection", - "UnstructuredLayout", - "ValueAcrossSegOrSegGroup", - "VariableParameter", - "VoltageClamp", - "basePyNNCell", - "basePyNNIaFCell", - "basePyNNIaFCondCell" -] diff --git a/moose-core/python/moose/neuroml2/generated_neuromlsub.py b/moose-core/python/moose/neuroml2/generated_neuromlsub.py deleted file mode 100644 index 662fd4485ff818c701d77d92015dc430c8c29233..0000000000000000000000000000000000000000 --- a/moose-core/python/moose/neuroml2/generated_neuromlsub.py +++ /dev/null @@ -1,876 +0,0 @@ -# -*- coding: utf-8 -*- - - -# -# Generated Sun Apr 17 15:01:32 2016 by generateDS.py version 2.22a. -# -# Command line options: -# ('-o', 'generated_neuroml.py') -# ('-s', 'generated_neuromlsub.py') -# -# Command line arguments: -# /home/subha/src/neuroml_dev/NeuroML2/Schemas/NeuroML2/NeuroML_v2beta.xsd -# -# Command line: -# /home/subha/.local/bin/generateDS.py -o "generated_neuroml.py" -s "generated_neuromlsub.py" /home/subha/src/neuroml_dev/NeuroML2/Schemas/NeuroML2/NeuroML_v2beta.xsd -# -# Current working directory (os.getcwd()): -# neuroml2 -# - -import sys -from lxml import etree as etree_ - -# FIXME: Comment it out -# import ??? as supermod - -def parsexml_(infile, parser=None, **kwargs): - if parser is None: - # Use the lxml ElementTree compatible parser so that, e.g., - # we ignore comments. - parser = etree_.ETCompatXMLParser() - doc = etree_.parse(infile, parser=parser, **kwargs) - return doc - -# -# Globals -# - -ExternalEncoding = 'ascii' - -# -# Data representation classes -# - - -class AnnotationSub(supermod.Annotation): - def __init__(self, anytypeobjs_=None): - super(AnnotationSub, self).__init__(anytypeobjs_, ) -supermod.Annotation.subclass = AnnotationSub -# end class AnnotationSub - - -class ComponentTypeSub(supermod.ComponentType): - def __init__(self, name=None, extends=None, description=None, anytypeobjs_=None): - super(ComponentTypeSub, self).__init__(name, extends, description, anytypeobjs_, ) -supermod.ComponentType.subclass = ComponentTypeSub -# end class ComponentTypeSub - - -class IncludeTypeSub(supermod.IncludeType): - def __init__(self, href=None, valueOf_=None, mixedclass_=None, content_=None): - super(IncludeTypeSub, self).__init__(href, valueOf_, mixedclass_, content_, ) -supermod.IncludeType.subclass = IncludeTypeSub -# end class IncludeTypeSub - - -class Q10SettingsSub(supermod.Q10Settings): - def __init__(self, type_=None, fixedQ10=None, q10Factor=None, experimentalTemp=None): - super(Q10SettingsSub, self).__init__(type_, fixedQ10, q10Factor, experimentalTemp, ) -supermod.Q10Settings.subclass = Q10SettingsSub -# end class Q10SettingsSub - - -class HHRateSub(supermod.HHRate): - def __init__(self, type_=None, rate=None, midpoint=None, scale=None): - super(HHRateSub, self).__init__(type_, rate, midpoint, scale, ) -supermod.HHRate.subclass = HHRateSub -# end class HHRateSub - - -class HHVariableSub(supermod.HHVariable): - def __init__(self, type_=None, rate=None, midpoint=None, scale=None): - super(HHVariableSub, self).__init__(type_, rate, midpoint, scale, ) -supermod.HHVariable.subclass = HHVariableSub -# end class HHVariableSub - - -class HHTimeSub(supermod.HHTime): - def __init__(self, type_=None, rate=None, midpoint=None, scale=None, tau=None): - super(HHTimeSub, self).__init__(type_, rate, midpoint, scale, tau, ) -supermod.HHTime.subclass = HHTimeSub -# end class HHTimeSub - - -class BlockMechanismSub(supermod.BlockMechanism): - def __init__(self, type_=None, species=None, blockConcentration=None, scalingConc=None, scalingVolt=None): - super(BlockMechanismSub, self).__init__(type_, species, blockConcentration, scalingConc, scalingVolt, ) -supermod.BlockMechanism.subclass = BlockMechanismSub -# end class BlockMechanismSub - - -class PlasticityMechanismSub(supermod.PlasticityMechanism): - def __init__(self, type_=None, initReleaseProb=None, tauRec=None, tauFac=None): - super(PlasticityMechanismSub, self).__init__(type_, initReleaseProb, tauRec, tauFac, ) -supermod.PlasticityMechanism.subclass = PlasticityMechanismSub -# end class PlasticityMechanismSub - - -class SegmentParentSub(supermod.SegmentParent): - def __init__(self, segment=None, fractionAlong='1'): - super(SegmentParentSub, self).__init__(segment, fractionAlong, ) -supermod.SegmentParent.subclass = SegmentParentSub -# end class SegmentParentSub - - -class Point3DWithDiamSub(supermod.Point3DWithDiam): - def __init__(self, x=None, y=None, z=None, diameter=None): - super(Point3DWithDiamSub, self).__init__(x, y, z, diameter, ) -supermod.Point3DWithDiam.subclass = Point3DWithDiamSub -# end class Point3DWithDiamSub - - -class ProximalDetailsSub(supermod.ProximalDetails): - def __init__(self, translationStart=None): - super(ProximalDetailsSub, self).__init__(translationStart, ) -supermod.ProximalDetails.subclass = ProximalDetailsSub -# end class ProximalDetailsSub - - -class DistalDetailsSub(supermod.DistalDetails): - def __init__(self, normalizationEnd=None): - super(DistalDetailsSub, self).__init__(normalizationEnd, ) -supermod.DistalDetails.subclass = DistalDetailsSub -# end class DistalDetailsSub - - -class MemberSub(supermod.Member): - def __init__(self, segment=None): - super(MemberSub, self).__init__(segment, ) -supermod.Member.subclass = MemberSub -# end class MemberSub - - -class IncludeSub(supermod.Include): - def __init__(self, segmentGroup=None): - super(IncludeSub, self).__init__(segmentGroup, ) -supermod.Include.subclass = IncludeSub -# end class IncludeSub - - -class PathSub(supermod.Path): - def __init__(self, from_=None, to=None): - super(PathSub, self).__init__(from_, to, ) -supermod.Path.subclass = PathSub -# end class PathSub - - -class SubTreeSub(supermod.SubTree): - def __init__(self, from_=None, to=None): - super(SubTreeSub, self).__init__(from_, to, ) -supermod.SubTree.subclass = SubTreeSub -# end class SubTreeSub - - -class SegmentEndPointSub(supermod.SegmentEndPoint): - def __init__(self, segment=None): - super(SegmentEndPointSub, self).__init__(segment, ) -supermod.SegmentEndPoint.subclass = SegmentEndPointSub -# end class SegmentEndPointSub - - -class MembranePropertiesSub(supermod.MembraneProperties): - def __init__(self, channelPopulation=None, channelDensity=None, spikeThresh=None, specificCapacitance=None, initMembPotential=None, reversalPotential=None): - super(MembranePropertiesSub, self).__init__(channelPopulation, channelDensity, spikeThresh, specificCapacitance, initMembPotential, reversalPotential, ) -supermod.MembraneProperties.subclass = MembranePropertiesSub -# end class MembranePropertiesSub - - -class ValueAcrossSegOrSegGroupSub(supermod.ValueAcrossSegOrSegGroup): - def __init__(self, value=None, segmentGroup='all', segment=None, extensiontype_=None): - super(ValueAcrossSegOrSegGroupSub, self).__init__(value, segmentGroup, segment, extensiontype_, ) -supermod.ValueAcrossSegOrSegGroup.subclass = ValueAcrossSegOrSegGroupSub -# end class ValueAcrossSegOrSegGroupSub - - -class VariableParameterSub(supermod.VariableParameter): - def __init__(self, parameter=None, segmentGroup=None, inhomogeneousValue=None): - super(VariableParameterSub, self).__init__(parameter, segmentGroup, inhomogeneousValue, ) -supermod.VariableParameter.subclass = VariableParameterSub -# end class VariableParameterSub - - -class InhomogeneousValueSub(supermod.InhomogeneousValue): - def __init__(self, inhomogeneousParam=None, value=None): - super(InhomogeneousValueSub, self).__init__(inhomogeneousParam, value, ) -supermod.InhomogeneousValue.subclass = InhomogeneousValueSub -# end class InhomogeneousValueSub - - -class ReversalPotentialSub(supermod.ReversalPotential): - def __init__(self, value=None, segmentGroup='all', segment=None, species=None): - super(ReversalPotentialSub, self).__init__(value, segmentGroup, segment, species, ) -supermod.ReversalPotential.subclass = ReversalPotentialSub -# end class ReversalPotentialSub - - -class SpeciesSub(supermod.Species): - def __init__(self, value=None, segmentGroup='all', segment=None, id=None, concentrationModel=None, ion=None, initialConcentration=None, initialExtConcentration=None): - super(SpeciesSub, self).__init__(value, segmentGroup, segment, id, concentrationModel, ion, initialConcentration, initialExtConcentration, ) -supermod.Species.subclass = SpeciesSub -# end class SpeciesSub - - -class IntracellularPropertiesSub(supermod.IntracellularProperties): - def __init__(self, species=None, resistivity=None): - super(IntracellularPropertiesSub, self).__init__(species, resistivity, ) -supermod.IntracellularProperties.subclass = IntracellularPropertiesSub -# end class IntracellularPropertiesSub - - -class ExtracellularPropertiesLocalSub(supermod.ExtracellularPropertiesLocal): - def __init__(self, temperature=None, species=None): - super(ExtracellularPropertiesLocalSub, self).__init__(temperature, species, ) -supermod.ExtracellularPropertiesLocal.subclass = ExtracellularPropertiesLocalSub -# end class ExtracellularPropertiesLocalSub - - -class SpaceStructureSub(supermod.SpaceStructure): - def __init__(self, xSpacing=None, ySpacing=None, zSpacing=None, xStart=0, yStart=0, zStart=0): - super(SpaceStructureSub, self).__init__(xSpacing, ySpacing, zSpacing, xStart, yStart, zStart, ) -supermod.SpaceStructure.subclass = SpaceStructureSub -# end class SpaceStructureSub - - -class LayoutSub(supermod.Layout): - def __init__(self, space=None, random=None, grid=None, unstructured=None): - super(LayoutSub, self).__init__(space, random, grid, unstructured, ) -supermod.Layout.subclass = LayoutSub -# end class LayoutSub - - -class UnstructuredLayoutSub(supermod.UnstructuredLayout): - def __init__(self, number=None): - super(UnstructuredLayoutSub, self).__init__(number, ) -supermod.UnstructuredLayout.subclass = UnstructuredLayoutSub -# end class UnstructuredLayoutSub - - -class RandomLayoutSub(supermod.RandomLayout): - def __init__(self, number=None, region=None): - super(RandomLayoutSub, self).__init__(number, region, ) -supermod.RandomLayout.subclass = RandomLayoutSub -# end class RandomLayoutSub - - -class GridLayoutSub(supermod.GridLayout): - def __init__(self, xSize=None, ySize=None, zSize=None): - super(GridLayoutSub, self).__init__(xSize, ySize, zSize, ) -supermod.GridLayout.subclass = GridLayoutSub -# end class GridLayoutSub - - -class InstanceSub(supermod.Instance): - def __init__(self, id=None, i=None, j=None, k=None, location=None): - super(InstanceSub, self).__init__(id, i, j, k, location, ) -supermod.Instance.subclass = InstanceSub -# end class InstanceSub - - -class LocationSub(supermod.Location): - def __init__(self, x=None, y=None, z=None): - super(LocationSub, self).__init__(x, y, z, ) -supermod.Location.subclass = LocationSub -# end class LocationSub - - -class SynapticConnectionSub(supermod.SynapticConnection): - def __init__(self, from_=None, to=None, synapse=None): - super(SynapticConnectionSub, self).__init__(from_, to, synapse, ) -supermod.SynapticConnection.subclass = SynapticConnectionSub -# end class SynapticConnectionSub - - -class ConnectionSub(supermod.Connection): - def __init__(self, id=None, preCellId=None, postCellId=None): - super(ConnectionSub, self).__init__(id, preCellId, postCellId, ) -supermod.Connection.subclass = ConnectionSub -# end class ConnectionSub - - -class ExplicitInputSub(supermod.ExplicitInput): - def __init__(self, target=None, input=None, destination=None): - super(ExplicitInputSub, self).__init__(target, input, destination, ) -supermod.ExplicitInput.subclass = ExplicitInputSub -# end class ExplicitInputSub - - -class InputSub(supermod.Input): - def __init__(self, id=None, target=None, destination=None): - super(InputSub, self).__init__(id, target, destination, ) -supermod.Input.subclass = InputSub -# end class InputSub - - -class BaseSub(supermod.Base): - def __init__(self, id=None, neuroLexId=None, extensiontype_=None): - super(BaseSub, self).__init__(id, neuroLexId, extensiontype_, ) -supermod.Base.subclass = BaseSub -# end class BaseSub - - -class StandaloneSub(supermod.Standalone): - def __init__(self, id=None, neuroLexId=None, name=None, metaid=None, notes=None, annotation=None, extensiontype_=None): - super(StandaloneSub, self).__init__(id, neuroLexId, name, metaid, notes, annotation, extensiontype_, ) -supermod.Standalone.subclass = StandaloneSub -# end class StandaloneSub - - -class SpikeSourcePoissonSub(supermod.SpikeSourcePoisson): - def __init__(self, id=None, neuroLexId=None, name=None, metaid=None, notes=None, annotation=None, start=None, duration=None, rate=None): - super(SpikeSourcePoissonSub, self).__init__(id, neuroLexId, name, metaid, notes, annotation, start, duration, rate, ) -supermod.SpikeSourcePoisson.subclass = SpikeSourcePoissonSub -# end class SpikeSourcePoissonSub - - -class InputListSub(supermod.InputList): - def __init__(self, id=None, neuroLexId=None, population=None, component=None, input=None): - super(InputListSub, self).__init__(id, neuroLexId, population, component, input, ) -supermod.InputList.subclass = InputListSub -# end class InputListSub - - -class ProjectionSub(supermod.Projection): - def __init__(self, id=None, neuroLexId=None, presynapticPopulation=None, postsynapticPopulation=None, synapse=None, connection=None): - super(ProjectionSub, self).__init__(id, neuroLexId, presynapticPopulation, postsynapticPopulation, synapse, connection, ) -supermod.Projection.subclass = ProjectionSub -# end class ProjectionSub - - -class CellSetSub(supermod.CellSet): - def __init__(self, id=None, neuroLexId=None, select=None, anytypeobjs_=None): - super(CellSetSub, self).__init__(id, neuroLexId, select, anytypeobjs_, ) -supermod.CellSet.subclass = CellSetSub -# end class CellSetSub - - -class PopulationSub(supermod.Population): - def __init__(self, id=None, neuroLexId=None, name=None, metaid=None, notes=None, annotation=None, cell=None, network=None, component=None, size=None, type_=None, extracellularProperties=None, layout=None, instance=None): - super(PopulationSub, self).__init__(id, neuroLexId, name, metaid, notes, annotation, cell, network, component, size, type_, extracellularProperties, layout, instance, ) -supermod.Population.subclass = PopulationSub -# end class PopulationSub - - -class RegionSub(supermod.Region): - def __init__(self, id=None, neuroLexId=None, space=None, anytypeobjs_=None): - super(RegionSub, self).__init__(id, neuroLexId, space, anytypeobjs_, ) -supermod.Region.subclass = RegionSub -# end class RegionSub - - -class SpaceSub(supermod.Space): - def __init__(self, id=None, neuroLexId=None, basedOn=None, structure=None): - super(SpaceSub, self).__init__(id, neuroLexId, basedOn, structure, ) -supermod.Space.subclass = SpaceSub -# end class SpaceSub - - -class NetworkSub(supermod.Network): - def __init__(self, id=None, neuroLexId=None, name=None, metaid=None, notes=None, annotation=None, space=None, region=None, extracellularProperties=None, population=None, cellSet=None, synapticConnection=None, projection=None, explicitInput=None, inputList=None): - super(NetworkSub, self).__init__(id, neuroLexId, name, metaid, notes, annotation, space, region, extracellularProperties, population, cellSet, synapticConnection, projection, explicitInput, inputList, ) -supermod.Network.subclass = NetworkSub -# end class NetworkSub - - -class SpikeGeneratorPoissonSub(supermod.SpikeGeneratorPoisson): - def __init__(self, id=None, neuroLexId=None, name=None, metaid=None, notes=None, annotation=None, averageRate=None): - super(SpikeGeneratorPoissonSub, self).__init__(id, neuroLexId, name, metaid, notes, annotation, averageRate, ) -supermod.SpikeGeneratorPoisson.subclass = SpikeGeneratorPoissonSub -# end class SpikeGeneratorPoissonSub - - -class SpikeGeneratorRandomSub(supermod.SpikeGeneratorRandom): - def __init__(self, id=None, neuroLexId=None, name=None, metaid=None, notes=None, annotation=None, maxISI=None, minISI=None): - super(SpikeGeneratorRandomSub, self).__init__(id, neuroLexId, name, metaid, notes, annotation, maxISI, minISI, ) -supermod.SpikeGeneratorRandom.subclass = SpikeGeneratorRandomSub -# end class SpikeGeneratorRandomSub - - -class SpikeGeneratorSub(supermod.SpikeGenerator): - def __init__(self, id=None, neuroLexId=None, name=None, metaid=None, notes=None, annotation=None, period=None): - super(SpikeGeneratorSub, self).__init__(id, neuroLexId, name, metaid, notes, annotation, period, ) -supermod.SpikeGenerator.subclass = SpikeGeneratorSub -# end class SpikeGeneratorSub - - -class SpikeArraySub(supermod.SpikeArray): - def __init__(self, id=None, neuroLexId=None, name=None, metaid=None, notes=None, annotation=None, spike=None): - super(SpikeArraySub, self).__init__(id, neuroLexId, name, metaid, notes, annotation, spike, ) -supermod.SpikeArray.subclass = SpikeArraySub -# end class SpikeArraySub - - -class SpikeSub(supermod.Spike): - def __init__(self, id=None, neuroLexId=None, name=None, metaid=None, notes=None, annotation=None, time=None): - super(SpikeSub, self).__init__(id, neuroLexId, name, metaid, notes, annotation, time, ) -supermod.Spike.subclass = SpikeSub -# end class SpikeSub - - -class VoltageClampSub(supermod.VoltageClamp): - def __init__(self, id=None, neuroLexId=None, name=None, metaid=None, notes=None, annotation=None, delay=None, duration=None, targetVoltage=None, seriesResistance=None): - super(VoltageClampSub, self).__init__(id, neuroLexId, name, metaid, notes, annotation, delay, duration, targetVoltage, seriesResistance, ) -supermod.VoltageClamp.subclass = VoltageClampSub -# end class VoltageClampSub - - -class RampGeneratorSub(supermod.RampGenerator): - def __init__(self, id=None, neuroLexId=None, name=None, metaid=None, notes=None, annotation=None, delay=None, duration=None, startAmplitude=None, finishAmplitude=None, baselineAmplitude=None): - super(RampGeneratorSub, self).__init__(id, neuroLexId, name, metaid, notes, annotation, delay, duration, startAmplitude, finishAmplitude, baselineAmplitude, ) -supermod.RampGenerator.subclass = RampGeneratorSub -# end class RampGeneratorSub - - -class SineGeneratorSub(supermod.SineGenerator): - def __init__(self, id=None, neuroLexId=None, name=None, metaid=None, notes=None, annotation=None, delay=None, phase=None, duration=None, amplitude=None, period=None): - super(SineGeneratorSub, self).__init__(id, neuroLexId, name, metaid, notes, annotation, delay, phase, duration, amplitude, period, ) -supermod.SineGenerator.subclass = SineGeneratorSub -# end class SineGeneratorSub - - -class PulseGeneratorSub(supermod.PulseGenerator): - def __init__(self, id=None, neuroLexId=None, name=None, metaid=None, notes=None, annotation=None, delay=None, duration=None, amplitude=None): - super(PulseGeneratorSub, self).__init__(id, neuroLexId, name, metaid, notes, annotation, delay, duration, amplitude, ) -supermod.PulseGenerator.subclass = PulseGeneratorSub -# end class PulseGeneratorSub - - -class ReactionSchemeSub(supermod.ReactionScheme): - def __init__(self, id=None, neuroLexId=None, source=None, type_=None, anytypeobjs_=None): - super(ReactionSchemeSub, self).__init__(id, neuroLexId, source, type_, anytypeobjs_, ) -supermod.ReactionScheme.subclass = ReactionSchemeSub -# end class ReactionSchemeSub - - -class ExtracellularPropertiesSub(supermod.ExtracellularProperties): - def __init__(self, id=None, neuroLexId=None, temperature=None, species=None): - super(ExtracellularPropertiesSub, self).__init__(id, neuroLexId, temperature, species, ) -supermod.ExtracellularProperties.subclass = ExtracellularPropertiesSub -# end class ExtracellularPropertiesSub - - -class ChannelDensitySub(supermod.ChannelDensity): - def __init__(self, id=None, neuroLexId=None, ionChannel=None, condDensity=None, erev=None, segmentGroup='all', segment=None, ion=None, variableParameter=None): - super(ChannelDensitySub, self).__init__(id, neuroLexId, ionChannel, condDensity, erev, segmentGroup, segment, ion, variableParameter, ) -supermod.ChannelDensity.subclass = ChannelDensitySub -# end class ChannelDensitySub - - -class ChannelPopulationSub(supermod.ChannelPopulation): - def __init__(self, id=None, neuroLexId=None, ionChannel=None, number=None, erev=None, segmentGroup='all', segment=None, ion=None, variableParameter=None): - super(ChannelPopulationSub, self).__init__(id, neuroLexId, ionChannel, number, erev, segmentGroup, segment, ion, variableParameter, ) -supermod.ChannelPopulation.subclass = ChannelPopulationSub -# end class ChannelPopulationSub - - -class BiophysicalPropertiesSub(supermod.BiophysicalProperties): - def __init__(self, id=None, neuroLexId=None, name=None, metaid=None, notes=None, annotation=None, membraneProperties=None, intracellularProperties=None, extracellularProperties=None): - super(BiophysicalPropertiesSub, self).__init__(id, neuroLexId, name, metaid, notes, annotation, membraneProperties, intracellularProperties, extracellularProperties, ) -supermod.BiophysicalProperties.subclass = BiophysicalPropertiesSub -# end class BiophysicalPropertiesSub - - -class InhomogeneousParamSub(supermod.InhomogeneousParam): - def __init__(self, id=None, neuroLexId=None, variable=None, metric=None, proximal=None, distal=None): - super(InhomogeneousParamSub, self).__init__(id, neuroLexId, variable, metric, proximal, distal, ) -supermod.InhomogeneousParam.subclass = InhomogeneousParamSub -# end class InhomogeneousParamSub - - -class SegmentGroupSub(supermod.SegmentGroup): - def __init__(self, id=None, neuroLexId=None, member=None, include=None, path=None, subTree=None, inhomogeneousParam=None): - super(SegmentGroupSub, self).__init__(id, neuroLexId, member, include, path, subTree, inhomogeneousParam, ) -supermod.SegmentGroup.subclass = SegmentGroupSub -# end class SegmentGroupSub - - -class SegmentSub(supermod.Segment): - def __init__(self, id=None, neuroLexId=None, name=None, parent=None, proximal=None, distal=None): - super(SegmentSub, self).__init__(id, neuroLexId, name, parent, proximal, distal, ) -supermod.Segment.subclass = SegmentSub -# end class SegmentSub - - -class MorphologySub(supermod.Morphology): - def __init__(self, id=None, neuroLexId=None, name=None, metaid=None, notes=None, annotation=None, segment=None, segmentGroup=None): - super(MorphologySub, self).__init__(id, neuroLexId, name, metaid, notes, annotation, segment, segmentGroup, ) -supermod.Morphology.subclass = MorphologySub -# end class MorphologySub - - -class BaseCellSub(supermod.BaseCell): - def __init__(self, id=None, neuroLexId=None, name=None, metaid=None, notes=None, annotation=None, extensiontype_=None): - super(BaseCellSub, self).__init__(id, neuroLexId, name, metaid, notes, annotation, extensiontype_, ) -supermod.BaseCell.subclass = BaseCellSub -# end class BaseCellSub - - -class BaseSynapseSub(supermod.BaseSynapse): - def __init__(self, id=None, neuroLexId=None, name=None, metaid=None, notes=None, annotation=None, extensiontype_=None): - super(BaseSynapseSub, self).__init__(id, neuroLexId, name, metaid, notes, annotation, extensiontype_, ) -supermod.BaseSynapse.subclass = BaseSynapseSub -# end class BaseSynapseSub - - -class DecayingPoolConcentrationModelSub(supermod.DecayingPoolConcentrationModel): - def __init__(self, id=None, neuroLexId=None, name=None, metaid=None, notes=None, annotation=None, ion=None, restingConc=None, decayConstant=None, shellThickness=None, extensiontype_=None): - super(DecayingPoolConcentrationModelSub, self).__init__(id, neuroLexId, name, metaid, notes, annotation, ion, restingConc, decayConstant, shellThickness, extensiontype_, ) -supermod.DecayingPoolConcentrationModel.subclass = DecayingPoolConcentrationModelSub -# end class DecayingPoolConcentrationModelSub - - -class GateHHRatesInfSub(supermod.GateHHRatesInf): - def __init__(self, id=None, neuroLexId=None, instances=1, type_=None, notes=None, q10Settings=None, forwardRate=None, reverseRate=None, steadyState=None): - super(GateHHRatesInfSub, self).__init__(id, neuroLexId, instances, type_, notes, q10Settings, forwardRate, reverseRate, steadyState, ) -supermod.GateHHRatesInf.subclass = GateHHRatesInfSub -# end class GateHHRatesInfSub - - -class GateHHRatesTauSub(supermod.GateHHRatesTau): - def __init__(self, id=None, neuroLexId=None, instances=1, type_=None, notes=None, q10Settings=None, forwardRate=None, reverseRate=None, timeCourse=None): - super(GateHHRatesTauSub, self).__init__(id, neuroLexId, instances, type_, notes, q10Settings, forwardRate, reverseRate, timeCourse, ) -supermod.GateHHRatesTau.subclass = GateHHRatesTauSub -# end class GateHHRatesTauSub - - -class GateHHTauInfSub(supermod.GateHHTauInf): - def __init__(self, id=None, neuroLexId=None, instances=1, type_=None, notes=None, q10Settings=None, timeCourse=None, steadyState=None): - super(GateHHTauInfSub, self).__init__(id, neuroLexId, instances, type_, notes, q10Settings, timeCourse, steadyState, ) -supermod.GateHHTauInf.subclass = GateHHTauInfSub -# end class GateHHTauInfSub - - -class GateHHRatesSub(supermod.GateHHRates): - def __init__(self, id=None, neuroLexId=None, instances=1, type_=None, notes=None, q10Settings=None, forwardRate=None, reverseRate=None): - super(GateHHRatesSub, self).__init__(id, neuroLexId, instances, type_, notes, q10Settings, forwardRate, reverseRate, ) -supermod.GateHHRates.subclass = GateHHRatesSub -# end class GateHHRatesSub - - -class GateHHUndeterminedSub(supermod.GateHHUndetermined): - def __init__(self, id=None, neuroLexId=None, instances=1, type_=None, notes=None, q10Settings=None, forwardRate=None, reverseRate=None, timeCourse=None, steadyState=None): - super(GateHHUndeterminedSub, self).__init__(id, neuroLexId, instances, type_, notes, q10Settings, forwardRate, reverseRate, timeCourse, steadyState, ) -supermod.GateHHUndetermined.subclass = GateHHUndeterminedSub -# end class GateHHUndeterminedSub - - -class IonChannelSub(supermod.IonChannel): - def __init__(self, id=None, neuroLexId=None, name=None, metaid=None, notes=None, annotation=None, species=None, type_=None, conductance=None, gate=None, gateHHrates=None, gateHHratesTau=None, gateHHtauInf=None, gateHHratesInf=None): - super(IonChannelSub, self).__init__(id, neuroLexId, name, metaid, notes, annotation, species, type_, conductance, gate, gateHHrates, gateHHratesTau, gateHHtauInf, gateHHratesInf, ) -supermod.IonChannel.subclass = IonChannelSub -# end class IonChannelSub - - -class NeuroMLDocumentSub(supermod.NeuroMLDocument): - def __init__(self, id=None, neuroLexId=None, name=None, metaid=None, notes=None, annotation=None, include=None, extracellularProperties=None, intracellularProperties=None, morphology=None, ionChannel=None, decayingPoolConcentrationModel=None, expOneSynapse=None, expTwoSynapse=None, blockingPlasticSynapse=None, biophysicalProperties=None, cell=None, baseCell=None, iafTauCell=None, iafTauRefCell=None, iafCell=None, iafRefCell=None, izhikevichCell=None, adExIaFCell=None, pulseGenerator=None, sineGenerator=None, rampGenerator=None, voltageClamp=None, spikeArray=None, spikeGenerator=None, spikeGeneratorRandom=None, spikeGeneratorPoisson=None, IF_curr_alpha=None, IF_curr_exp=None, IF_cond_alpha=None, IF_cond_exp=None, EIF_cond_exp_isfa_ista=None, EIF_cond_alpha_isfa_ista=None, HH_cond_exp=None, expCondSynapse=None, alphaCondSynapse=None, expCurrSynapse=None, alphaCurrSynapse=None, SpikeSourcePoisson=None, network=None, ComponentType=None): - super(NeuroMLDocumentSub, self).__init__(id, neuroLexId, name, metaid, notes, annotation, include, extracellularProperties, intracellularProperties, morphology, ionChannel, decayingPoolConcentrationModel, expOneSynapse, expTwoSynapse, blockingPlasticSynapse, biophysicalProperties, cell, baseCell, iafTauCell, iafTauRefCell, iafCell, iafRefCell, izhikevichCell, adExIaFCell, pulseGenerator, sineGenerator, rampGenerator, voltageClamp, spikeArray, spikeGenerator, spikeGeneratorRandom, spikeGeneratorPoisson, IF_curr_alpha, IF_curr_exp, IF_cond_alpha, IF_cond_exp, EIF_cond_exp_isfa_ista, EIF_cond_alpha_isfa_ista, HH_cond_exp, expCondSynapse, alphaCondSynapse, expCurrSynapse, alphaCurrSynapse, SpikeSourcePoisson, network, ComponentType, ) -supermod.NeuroMLDocument.subclass = NeuroMLDocumentSub -# end class NeuroMLDocumentSub - - -class BasePynnSynapseSub(supermod.BasePynnSynapse): - def __init__(self, id=None, neuroLexId=None, name=None, metaid=None, notes=None, annotation=None, tau_syn=None, extensiontype_=None): - super(BasePynnSynapseSub, self).__init__(id, neuroLexId, name, metaid, notes, annotation, tau_syn, extensiontype_, ) -supermod.BasePynnSynapse.subclass = BasePynnSynapseSub -# end class BasePynnSynapseSub - - -class basePyNNCellSub(supermod.basePyNNCell): - def __init__(self, id=None, neuroLexId=None, name=None, metaid=None, notes=None, annotation=None, cm=None, i_offset=None, tau_syn_E=None, tau_syn_I=None, v_init=None, extensiontype_=None): - super(basePyNNCellSub, self).__init__(id, neuroLexId, name, metaid, notes, annotation, cm, i_offset, tau_syn_E, tau_syn_I, v_init, extensiontype_, ) -supermod.basePyNNCell.subclass = basePyNNCellSub -# end class basePyNNCellSub - - -class ConcentrationModel_DSub(supermod.ConcentrationModel_D): - def __init__(self, id=None, neuroLexId=None, name=None, metaid=None, notes=None, annotation=None, ion=None, restingConc=None, decayConstant=None, shellThickness=None, type_=None): - super(ConcentrationModel_DSub, self).__init__(id, neuroLexId, name, metaid, notes, annotation, ion, restingConc, decayConstant, shellThickness, type_, ) -supermod.ConcentrationModel_D.subclass = ConcentrationModel_DSub -# end class ConcentrationModel_DSub - - -class CellSub(supermod.Cell): - def __init__(self, id=None, neuroLexId=None, name=None, metaid=None, notes=None, annotation=None, morphology_attr=None, biophysicalProperties_attr=None, morphology=None, biophysicalProperties=None): - super(CellSub, self).__init__(id, neuroLexId, name, metaid, notes, annotation, morphology_attr, biophysicalProperties_attr, morphology, biophysicalProperties, ) -supermod.Cell.subclass = CellSub -# end class CellSub - - -class AdExIaFCellSub(supermod.AdExIaFCell): - def __init__(self, id=None, neuroLexId=None, name=None, metaid=None, notes=None, annotation=None, C=None, gL=None, EL=None, reset=None, VT=None, thresh=None, delT=None, tauw=None, refract=None, a=None, b=None): - super(AdExIaFCellSub, self).__init__(id, neuroLexId, name, metaid, notes, annotation, C, gL, EL, reset, VT, thresh, delT, tauw, refract, a, b, ) -supermod.AdExIaFCell.subclass = AdExIaFCellSub -# end class AdExIaFCellSub - - -class IzhikevichCellSub(supermod.IzhikevichCell): - def __init__(self, id=None, neuroLexId=None, name=None, metaid=None, notes=None, annotation=None, v0=None, thresh=None, a=None, b=None, c=None, d=None): - super(IzhikevichCellSub, self).__init__(id, neuroLexId, name, metaid, notes, annotation, v0, thresh, a, b, c, d, ) -supermod.IzhikevichCell.subclass = IzhikevichCellSub -# end class IzhikevichCellSub - - -class IaFCellSub(supermod.IaFCell): - def __init__(self, id=None, neuroLexId=None, name=None, metaid=None, notes=None, annotation=None, leakReversal=None, thresh=None, reset=None, C=None, leakConductance=None, extensiontype_=None): - super(IaFCellSub, self).__init__(id, neuroLexId, name, metaid, notes, annotation, leakReversal, thresh, reset, C, leakConductance, extensiontype_, ) -supermod.IaFCell.subclass = IaFCellSub -# end class IaFCellSub - - -class IaFTauCellSub(supermod.IaFTauCell): - def __init__(self, id=None, neuroLexId=None, name=None, metaid=None, notes=None, annotation=None, leakReversal=None, thresh=None, reset=None, tau=None, extensiontype_=None): - super(IaFTauCellSub, self).__init__(id, neuroLexId, name, metaid, notes, annotation, leakReversal, thresh, reset, tau, extensiontype_, ) -supermod.IaFTauCell.subclass = IaFTauCellSub -# end class IaFTauCellSub - - -class BaseConductanceBasedSynapseSub(supermod.BaseConductanceBasedSynapse): - def __init__(self, id=None, neuroLexId=None, name=None, metaid=None, notes=None, annotation=None, gbase=None, erev=None, extensiontype_=None): - super(BaseConductanceBasedSynapseSub, self).__init__(id, neuroLexId, name, metaid, notes, annotation, gbase, erev, extensiontype_, ) -supermod.BaseConductanceBasedSynapse.subclass = BaseConductanceBasedSynapseSub -# end class BaseConductanceBasedSynapseSub - - -class AlphaCurrSynapseSub(supermod.AlphaCurrSynapse): - def __init__(self, id=None, neuroLexId=None, name=None, metaid=None, notes=None, annotation=None, tau_syn=None): - super(AlphaCurrSynapseSub, self).__init__(id, neuroLexId, name, metaid, notes, annotation, tau_syn, ) -supermod.AlphaCurrSynapse.subclass = AlphaCurrSynapseSub -# end class AlphaCurrSynapseSub - - -class ExpCurrSynapseSub(supermod.ExpCurrSynapse): - def __init__(self, id=None, neuroLexId=None, name=None, metaid=None, notes=None, annotation=None, tau_syn=None): - super(ExpCurrSynapseSub, self).__init__(id, neuroLexId, name, metaid, notes, annotation, tau_syn, ) -supermod.ExpCurrSynapse.subclass = ExpCurrSynapseSub -# end class ExpCurrSynapseSub - - -class AlphaCondSynapseSub(supermod.AlphaCondSynapse): - def __init__(self, id=None, neuroLexId=None, name=None, metaid=None, notes=None, annotation=None, tau_syn=None, e_rev=None): - super(AlphaCondSynapseSub, self).__init__(id, neuroLexId, name, metaid, notes, annotation, tau_syn, e_rev, ) -supermod.AlphaCondSynapse.subclass = AlphaCondSynapseSub -# end class AlphaCondSynapseSub - - -class ExpCondSynapseSub(supermod.ExpCondSynapse): - def __init__(self, id=None, neuroLexId=None, name=None, metaid=None, notes=None, annotation=None, tau_syn=None, e_rev=None): - super(ExpCondSynapseSub, self).__init__(id, neuroLexId, name, metaid, notes, annotation, tau_syn, e_rev, ) -supermod.ExpCondSynapse.subclass = ExpCondSynapseSub -# end class ExpCondSynapseSub - - -class HH_cond_expSub(supermod.HH_cond_exp): - def __init__(self, id=None, neuroLexId=None, name=None, metaid=None, notes=None, annotation=None, cm=None, i_offset=None, tau_syn_E=None, tau_syn_I=None, v_init=None, v_offset=None, e_rev_E=None, e_rev_I=None, e_rev_K=None, e_rev_Na=None, e_rev_leak=None, g_leak=None, gbar_K=None, gbar_Na=None): - super(HH_cond_expSub, self).__init__(id, neuroLexId, name, metaid, notes, annotation, cm, i_offset, tau_syn_E, tau_syn_I, v_init, v_offset, e_rev_E, e_rev_I, e_rev_K, e_rev_Na, e_rev_leak, g_leak, gbar_K, gbar_Na, ) -supermod.HH_cond_exp.subclass = HH_cond_expSub -# end class HH_cond_expSub - - -class basePyNNIaFCellSub(supermod.basePyNNIaFCell): - def __init__(self, id=None, neuroLexId=None, name=None, metaid=None, notes=None, annotation=None, cm=None, i_offset=None, tau_syn_E=None, tau_syn_I=None, v_init=None, tau_m=None, tau_refrac=None, v_reset=None, v_rest=None, v_thresh=None, extensiontype_=None): - super(basePyNNIaFCellSub, self).__init__(id, neuroLexId, name, metaid, notes, annotation, cm, i_offset, tau_syn_E, tau_syn_I, v_init, tau_m, tau_refrac, v_reset, v_rest, v_thresh, extensiontype_, ) -supermod.basePyNNIaFCell.subclass = basePyNNIaFCellSub -# end class basePyNNIaFCellSub - - -class IaFRefCellSub(supermod.IaFRefCell): - def __init__(self, id=None, neuroLexId=None, name=None, metaid=None, notes=None, annotation=None, leakReversal=None, thresh=None, reset=None, C=None, leakConductance=None, refract=None): - super(IaFRefCellSub, self).__init__(id, neuroLexId, name, metaid, notes, annotation, leakReversal, thresh, reset, C, leakConductance, refract, ) -supermod.IaFRefCell.subclass = IaFRefCellSub -# end class IaFRefCellSub - - -class IaFTauRefCellSub(supermod.IaFTauRefCell): - def __init__(self, id=None, neuroLexId=None, name=None, metaid=None, notes=None, annotation=None, leakReversal=None, thresh=None, reset=None, tau=None, refract=None): - super(IaFTauRefCellSub, self).__init__(id, neuroLexId, name, metaid, notes, annotation, leakReversal, thresh, reset, tau, refract, ) -supermod.IaFTauRefCell.subclass = IaFTauRefCellSub -# end class IaFTauRefCellSub - - -class ExpTwoSynapseSub(supermod.ExpTwoSynapse): - def __init__(self, id=None, neuroLexId=None, name=None, metaid=None, notes=None, annotation=None, gbase=None, erev=None, tauDecay=None, tauRise=None, extensiontype_=None): - super(ExpTwoSynapseSub, self).__init__(id, neuroLexId, name, metaid, notes, annotation, gbase, erev, tauDecay, tauRise, extensiontype_, ) -supermod.ExpTwoSynapse.subclass = ExpTwoSynapseSub -# end class ExpTwoSynapseSub - - -class ExpOneSynapseSub(supermod.ExpOneSynapse): - def __init__(self, id=None, neuroLexId=None, name=None, metaid=None, notes=None, annotation=None, gbase=None, erev=None, tauDecay=None): - super(ExpOneSynapseSub, self).__init__(id, neuroLexId, name, metaid, notes, annotation, gbase, erev, tauDecay, ) -supermod.ExpOneSynapse.subclass = ExpOneSynapseSub -# end class ExpOneSynapseSub - - -class IF_curr_expSub(supermod.IF_curr_exp): - def __init__(self, id=None, neuroLexId=None, name=None, metaid=None, notes=None, annotation=None, cm=None, i_offset=None, tau_syn_E=None, tau_syn_I=None, v_init=None, tau_m=None, tau_refrac=None, v_reset=None, v_rest=None, v_thresh=None): - super(IF_curr_expSub, self).__init__(id, neuroLexId, name, metaid, notes, annotation, cm, i_offset, tau_syn_E, tau_syn_I, v_init, tau_m, tau_refrac, v_reset, v_rest, v_thresh, ) -supermod.IF_curr_exp.subclass = IF_curr_expSub -# end class IF_curr_expSub - - -class IF_curr_alphaSub(supermod.IF_curr_alpha): - def __init__(self, id=None, neuroLexId=None, name=None, metaid=None, notes=None, annotation=None, cm=None, i_offset=None, tau_syn_E=None, tau_syn_I=None, v_init=None, tau_m=None, tau_refrac=None, v_reset=None, v_rest=None, v_thresh=None): - super(IF_curr_alphaSub, self).__init__(id, neuroLexId, name, metaid, notes, annotation, cm, i_offset, tau_syn_E, tau_syn_I, v_init, tau_m, tau_refrac, v_reset, v_rest, v_thresh, ) -supermod.IF_curr_alpha.subclass = IF_curr_alphaSub -# end class IF_curr_alphaSub - - -class basePyNNIaFCondCellSub(supermod.basePyNNIaFCondCell): - def __init__(self, id=None, neuroLexId=None, name=None, metaid=None, notes=None, annotation=None, cm=None, i_offset=None, tau_syn_E=None, tau_syn_I=None, v_init=None, tau_m=None, tau_refrac=None, v_reset=None, v_rest=None, v_thresh=None, e_rev_E=None, e_rev_I=None, extensiontype_=None): - super(basePyNNIaFCondCellSub, self).__init__(id, neuroLexId, name, metaid, notes, annotation, cm, i_offset, tau_syn_E, tau_syn_I, v_init, tau_m, tau_refrac, v_reset, v_rest, v_thresh, e_rev_E, e_rev_I, extensiontype_, ) -supermod.basePyNNIaFCondCell.subclass = basePyNNIaFCondCellSub -# end class basePyNNIaFCondCellSub - - -class BlockingPlasticSynapseSub(supermod.BlockingPlasticSynapse): - def __init__(self, id=None, neuroLexId=None, name=None, metaid=None, notes=None, annotation=None, gbase=None, erev=None, tauDecay=None, tauRise=None, plasticityMechanism=None, blockMechanism=None): - super(BlockingPlasticSynapseSub, self).__init__(id, neuroLexId, name, metaid, notes, annotation, gbase, erev, tauDecay, tauRise, plasticityMechanism, blockMechanism, ) -supermod.BlockingPlasticSynapse.subclass = BlockingPlasticSynapseSub -# end class BlockingPlasticSynapseSub - - -class EIF_cond_alpha_isfa_istaSub(supermod.EIF_cond_alpha_isfa_ista): - def __init__(self, id=None, neuroLexId=None, name=None, metaid=None, notes=None, annotation=None, cm=None, i_offset=None, tau_syn_E=None, tau_syn_I=None, v_init=None, tau_m=None, tau_refrac=None, v_reset=None, v_rest=None, v_thresh=None, e_rev_E=None, e_rev_I=None, a=None, b=None, delta_T=None, tau_w=None, v_spike=None): - super(EIF_cond_alpha_isfa_istaSub, self).__init__(id, neuroLexId, name, metaid, notes, annotation, cm, i_offset, tau_syn_E, tau_syn_I, v_init, tau_m, tau_refrac, v_reset, v_rest, v_thresh, e_rev_E, e_rev_I, a, b, delta_T, tau_w, v_spike, ) -supermod.EIF_cond_alpha_isfa_ista.subclass = EIF_cond_alpha_isfa_istaSub -# end class EIF_cond_alpha_isfa_istaSub - - -class EIF_cond_exp_isfa_istaSub(supermod.EIF_cond_exp_isfa_ista): - def __init__(self, id=None, neuroLexId=None, name=None, metaid=None, notes=None, annotation=None, cm=None, i_offset=None, tau_syn_E=None, tau_syn_I=None, v_init=None, tau_m=None, tau_refrac=None, v_reset=None, v_rest=None, v_thresh=None, e_rev_E=None, e_rev_I=None, a=None, b=None, delta_T=None, tau_w=None, v_spike=None): - super(EIF_cond_exp_isfa_istaSub, self).__init__(id, neuroLexId, name, metaid, notes, annotation, cm, i_offset, tau_syn_E, tau_syn_I, v_init, tau_m, tau_refrac, v_reset, v_rest, v_thresh, e_rev_E, e_rev_I, a, b, delta_T, tau_w, v_spike, ) -supermod.EIF_cond_exp_isfa_ista.subclass = EIF_cond_exp_isfa_istaSub -# end class EIF_cond_exp_isfa_istaSub - - -class IF_cond_expSub(supermod.IF_cond_exp): - def __init__(self, id=None, neuroLexId=None, name=None, metaid=None, notes=None, annotation=None, cm=None, i_offset=None, tau_syn_E=None, tau_syn_I=None, v_init=None, tau_m=None, tau_refrac=None, v_reset=None, v_rest=None, v_thresh=None, e_rev_E=None, e_rev_I=None): - super(IF_cond_expSub, self).__init__(id, neuroLexId, name, metaid, notes, annotation, cm, i_offset, tau_syn_E, tau_syn_I, v_init, tau_m, tau_refrac, v_reset, v_rest, v_thresh, e_rev_E, e_rev_I, ) -supermod.IF_cond_exp.subclass = IF_cond_expSub -# end class IF_cond_expSub - - -class IF_cond_alphaSub(supermod.IF_cond_alpha): - def __init__(self, id=None, neuroLexId=None, name=None, metaid=None, notes=None, annotation=None, cm=None, i_offset=None, tau_syn_E=None, tau_syn_I=None, v_init=None, tau_m=None, tau_refrac=None, v_reset=None, v_rest=None, v_thresh=None, e_rev_E=None, e_rev_I=None): - super(IF_cond_alphaSub, self).__init__(id, neuroLexId, name, metaid, notes, annotation, cm, i_offset, tau_syn_E, tau_syn_I, v_init, tau_m, tau_refrac, v_reset, v_rest, v_thresh, e_rev_E, e_rev_I, ) -supermod.IF_cond_alpha.subclass = IF_cond_alphaSub -# end class IF_cond_alphaSub - - -def get_root_tag(node): - tag = supermod.Tag_pattern_.match(node.tag).groups()[-1] - rootClass = None - rootClass = supermod.GDSClassesMapping.get(tag) - if rootClass is None and hasattr(supermod, tag): - rootClass = getattr(supermod, tag) - return tag, rootClass - - -def parse(inFilename, silence=False): - parser = None - doc = parsexml_(inFilename, parser) - rootNode = doc.getroot() - rootTag, rootClass = get_root_tag(rootNode) - if rootClass is None: - rootTag = 'Annotation' - rootClass = supermod.Annotation - rootObj = rootClass.factory() - rootObj.build(rootNode) - # Enable Python to collect the space used by the DOM. - doc = None - if not silence: - sys.stdout.write('<?xml version="1.0" ?>\n') - rootObj.export( - sys.stdout, 0, name_=rootTag, - namespacedef_='', - pretty_print=True) - return rootObj - - -def parseEtree(inFilename, silence=False): - parser = None - doc = parsexml_(inFilename, parser) - rootNode = doc.getroot() - rootTag, rootClass = get_root_tag(rootNode) - if rootClass is None: - rootTag = 'Annotation' - rootClass = supermod.Annotation - rootObj = rootClass.factory() - rootObj.build(rootNode) - # Enable Python to collect the space used by the DOM. - doc = None - mapping = {} - rootElement = rootObj.to_etree(None, name_=rootTag, mapping_=mapping) - reverse_mapping = rootObj.gds_reverse_node_mapping(mapping) - if not silence: - content = etree_.tostring( - rootElement, pretty_print=True, - xml_declaration=True, encoding="utf-8") - sys.stdout.write(content) - sys.stdout.write('\n') - return rootObj, rootElement, mapping, reverse_mapping - - -def parseString(inString, silence=False): - from StringIO import StringIO - parser = None - doc = parsexml_(StringIO(inString), parser) - rootNode = doc.getroot() - rootTag, rootClass = get_root_tag(rootNode) - if rootClass is None: - rootTag = 'Annotation' - rootClass = supermod.Annotation - rootObj = rootClass.factory() - rootObj.build(rootNode) - # Enable Python to collect the space used by the DOM. - doc = None - if not silence: - sys.stdout.write('<?xml version="1.0" ?>\n') - rootObj.export( - sys.stdout, 0, name_=rootTag, - namespacedef_='') - return rootObj - - -def parseLiteral(inFilename, silence=False): - parser = None - doc = parsexml_(inFilename, parser) - rootNode = doc.getroot() - rootTag, rootClass = get_root_tag(rootNode) - if rootClass is None: - rootTag = 'Annotation' - rootClass = supermod.Annotation - rootObj = rootClass.factory() - rootObj.build(rootNode) - # Enable Python to collect the space used by the DOM. - doc = None - if not silence: - sys.stdout.write('#from ??? import *\n\n') - sys.stdout.write('import ??? as model_\n\n') - sys.stdout.write('rootObj = model_.rootClass(\n') - rootObj.exportLiteral(sys.stdout, 0, name_=rootTag) - sys.stdout.write(')\n') - return rootObj - - -USAGE_TEXT = """ -Usage: python ???.py <infilename> -""" - - -def usage(): - print(USAGE_TEXT) - sys.exit(1) - - -def main(): - args = sys.argv[1:] - if len(args) != 1: - usage() - infilename = args[0] - parse(infilename) - - -if __name__ == '__main__': - #import pdb; pdb.set_trace() - main() diff --git a/moose-core/python/moose/neuroml2/hhfit.py b/moose-core/python/moose/neuroml2/hhfit.py index dc64618268bc63996a3a40b89d7645d893f69230..c4eb339139598f18082dd75fc37be59874e0c83d 100644 --- a/moose-core/python/moose/neuroml2/hhfit.py +++ b/moose-core/python/moose/neuroml2/hhfit.py @@ -53,19 +53,59 @@ import traceback import warnings -from collections import deque +import moose.utils as mu import numpy as np -from scipy.optimize import curve_fit -from matplotlib import pyplot as plt + +try: + from scipy.optimize import curve_fit +except ImportError as e: + mu.error( "To use this feature/module, please install python-scipy" ) + raise e + +def exponential2(x, a, scale, x0, y0=0): + res = a * np.exp((x - x0)/scale) + y0 + #print('============ Calculating exponential2 for %s, a=%s, scale=%s, x0=%s, y0=%s; = %s'%(x, a, scale, x0, y0, res)) + return res def exponential(x, a, k, x0, y0=0): - return a * np.exp(k * (x - x0)) + y0 + res = a * np.exp(k * (x - x0)) + y0 + #print('============ Calculating exponential for %s, a=%s, k=%s, x0=%s, y0=%s; = %s'%(x, a, k, x0, y0, res)) + return res + +def sigmoid2(x, a, scale, x0, y0=0): + res = a / (np.exp(-1*(x - x0)/scale) + 1.0) + y0 + #print('============ Calculating sigmoid for %s, a=%s, scale=%s, x0=%s, y0=%s; = %s'%(x, a, scale, x0, y0, res)) + return res def sigmoid(x, a, k, x0, y0=0): - return a / (np.exp(k * (x - x0)) + 1.0) + y0 + res = a / (np.exp(k * (x - x0)) + 1.0) + y0 + #print('============ Calculating sigmoid for %s, a=%s, k=%s, x0=%s, y0=%s; = %s'%(x, a, k, x0, y0, res)) + return res + +def linoid2(x, a, scale, x0, y0=0): + """The so called linoid function. Called explinear in neuroml.""" + + denominator = 1 - np.exp(-1 * (x - x0)/scale) + # Linoid often includes a zero denominator - we need to fill those + # points with interpolated values (interpolation is simpler than + # finding limits). + ret = (a/scale) * (x - x0) / denominator + infidx = np.flatnonzero((ret == np.inf) | (ret == -np.inf)) + if len(infidx) > 0: + for ii in infidx: + if ii == 0: + ret[ii] = ret[ii+1] - (ret[ii+2] - ret[ii+1]) + elif ii == len(ret): + ret[ii] = ret[ii-1] + (ret[ii-1] - ret[ii-2]) + else: + ret[ii] = (ret[ii+1] + ret[ii+2]) * 0.5 + res = ret + y0 + #print('============ Calculating linoid2 for %s, a=%s, scale=%s, x0=%s, y0=%s; res=%s'%(x, a, scale, x0, y0,res)) + return res def linoid(x, a, k, x0, y0=0): - """The so called linoid function. Called explinear in neurml.""" + """The so called linoid function. Called explinear in neuroml.""" + denominator = np.exp(k * (x - x0)) - 1.0 # Linoid often includes a zero denominator - we need to fill those # points with interpolated values (interpolation is simpler than @@ -80,7 +120,9 @@ def linoid(x, a, k, x0, y0=0): ret[ii] = ret[ii-1] + (ret[ii-1] - ret[ii-2]) else: ret[ii] = (ret[ii+1] + ret[ii+2]) * 0.5 - return ret + y0 + res = ret + y0 + #print('============ Calculating linoid for %s, a=%s, k=%s, x0=%s, y0=%s; res=%s'%(x, a, k, x0, y0,res)) + return res def double_exp(x, a, k1, x1, k2, x2, y0=0): """For functions of the form: diff --git a/moose-core/python/moose/neuroml2/reader.py b/moose-core/python/moose/neuroml2/reader.py index eb33f1fb546f4f070b60bc701df21f00cc3c53a2..1fdf4fc197ae8976016156cc632a8bee5c53b639 100644 --- a/moose-core/python/moose/neuroml2/reader.py +++ b/moose-core/python/moose/neuroml2/reader.py @@ -1,20 +1,19 @@ # -*- coding: utf-8 -*- # reader.py --- -# +# # Filename: reader.py # Description: -# Author: Subhasis Ray -# Maintainer: +# Author: Subhasis Ray, Padraig Gleeson +# Maintainer: # Created: Wed Jul 24 15:55:54 2013 (+0530) -# Version: -# Last-Updated: Sun Apr 17 16:32:59 2016 (-0400) -# By: subha -# Update #: 455 +# Version: +# Last-Updated: 15 Jan 2018, pgleeson +# 16 Jan 2018, dilawar, python3 compatible imports. +# # URL: # Keywords: # Compatibility: # -# # Commentary: # @@ -31,12 +30,12 @@ # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 3, or # (at your option) any later version. -# +# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with this program; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, Fifth @@ -48,33 +47,29 @@ """Implementation of reader for NeuroML 2 models. -TODO: handle include statements (start with simple ion channel -prototype includes. +TODO: handle morphologies of more than one segment... """ -from __future__ import print_function +from __future__ import print_function, division, absolute_import + try: from future_builtins import zip, map except ImportError: pass -import sys, os -import numpy as np -import moose -import generated_neuroml as nml -from units import SI -import hhfit -import logging -loglevel = logging.DEBUG -logstream = logging.StreamHandler() -logstream.setLevel(loglevel) -logstream.setFormatter(logging.Formatter('%s(asctime)s %(name)s %(filename)s %(funcName)s: %(message)s')) -logger = logging.getLogger('nml2_reader') -logger.addHandler(logstream) +import sys +import os +import math +import numpy as np +import neuroml as nml +from pyneuroml import pynml +import moose +import moose.utils as mu -# Utility functions +from .units import SI +from . import hhfit def sarea(comp): """ @@ -109,47 +104,39 @@ def setRa(comp, resistivity): else: comp.Ra = resistivity * 8.0 / (comp.diameter * np.pi) -def setRm(comp, resistivity): +def setRm(comp, condDensity): """Set membrane resistance""" - comp.Rm = resistivity / sarea(comp) + comp.Rm = 1/(condDensity * sarea(comp)) + +def setEk(comp, erev): + """Set reversal potential""" + comp.setEm(erev) def getSegments(nmlcell, component, sg_to_segments): """Get the list of segments the `component` is applied to""" - sg = component.segmentGroup - seg = component.segment + sg = component.segment_groups + #seg = component.segment if sg is None: - if seg: - segments = [seg] - else: - segments = nmlcell.morphology.segment + segments = nmlcell.morphology.segments elif sg == 'all': # Special case segments = [seg for seglist in sg_to_segments.values() for seg in seglist] else: segments = sg_to_segments[sg] - return segments - -rate_fn_map = { - 'HHExpRate': hhfit.exponential, - 'HHSigmoidRate': hhfit.sigmoid, - 'HHExpLinearRate': hhfit.linoid } + + return list(set(segments)) -def calculateRateFn(ratefn, vmin, vmax, tablen=3000): - """Returns A / B table from ngate.""" - midpoint, rate, scale = map(SI, (ratefn.midpoint, ratefn.rate, ratefn.scale)) - tab = np.linspace(vmin, vmax, tablen) - return rate_fn_map[ratefn.type_](tab, rate, scale, midpoint) class NML2Reader(object): - """Reads NeuroML2 and creates MOOSE model. + """Reads NeuroML2 and creates MOOSE model. NML2Reader.read(filename) reads an NML2 model under `/library` with the toplevel name defined in the NML2 file. Example: - >>> from moose import neuroml2 as nml - >>> reader = nml.NML2Reader() + >>> import moose + >>> reader = moose.NML2Reader() >>> reader.read('moose/neuroml2/test_files/Purk2M9s.nml') creates a passive neuronal morphology `/library/Purk2M9s`. @@ -158,7 +145,7 @@ class NML2Reader(object): self.lunit = 1e-6 # micron is the default length unit self.verbose = verbose self.doc = None - self.filename = None + self.filename = None self.nml_to_moose = {} # NeuroML object to MOOSE object self.moose_to_nml = {} # Moose object to NeuroML object self.proto_cells = {} # map id to prototype cell in moose @@ -168,19 +155,83 @@ class NML2Reader(object): self.lib = moose.Neutral('/library') self.id_to_ionChannel = {} self._cell_to_sg = {} # nml cell to dict - the dict maps segment groups to segments - - def read(self, filename): - self.doc = nml.parse(filename, silence=True) + + self.cells_in_populations = {} + self.pop_to_cell_type = {} + self.seg_id_to_comp_name = {} + self.paths_to_chan_elements = {} + + def read(self, filename, symmetric=True): + filename = os.path.realpath( filename ) + self.doc = nml.loaders.read_neuroml2_file( + filename, include_includes=True, verbose=self.verbose) + if self.verbose: - print('Parsed', filename) + mu.info('Parsed NeuroML2 file: %s'% filename) self.filename = filename - self.importIncludes(self.doc) + + if len(self.doc.networks)>=1: + self.network = self.doc.networks[0] + + moose.celsius = self._getTemperature() + self.importConcentrationModels(self.doc) self.importIonChannels(self.doc) - for cell in self.doc.cell: - self.createCellPrototype(cell) - - def createCellPrototype(self, cell, symmetric=False): + self.importInputs(self.doc) + + + for cell in self.doc.cells: + self.createCellPrototype(cell, symmetric=symmetric) + + if len(self.doc.networks)>=1: + self.createPopulations() + self.createInputs() + mu.info("Read all from %s"%filename) + + def _getTemperature(self): + if self.network.type=="networkWithTemperature": + return SI(self.network.temperature) + else: + return 0 # Why not, if there's no temp dependence in nml..? + + def getCellInPopulation(self, pop_id, index): + return self.cells_in_populations[pop_id][index] + + def getComp(self, pop_id, cellIndex, segId): + return moose.element('%s/%s/%s/%s' % (self.lib.path, pop_id, cellIndex, self.seg_id_to_comp_name[self.pop_to_cell_type[pop_id]][segId])) + + def createPopulations(self): + for pop in self.network.populations: + mpop = moose.Neutral('%s/%s' % (self.lib.path, pop.id)) + self.cells_in_populations[pop.id] ={} + for i in range(pop.size): + mu.info("Creating %s/%s instances of %s under %s"%(i,pop.size,pop.component, mpop)) + self.pop_to_cell_type[pop.id]=pop.component + chid = moose.copy(self.proto_cells[pop.component], mpop, '%s'%(i)) + self.cells_in_populations[pop.id][i]=chid + + + def getInput(self, input_id): + return moose.element('%s/inputs/%s'%(self.lib.path,input_id)) + + + def createInputs(self): + for el in self.network.explicit_inputs: + pop_id = el.target.split('[')[0] + i = el.target.split('[')[1].split(']')[0] + seg_id = 0 + if '/' in el.target: + seg_id = el.target.split('/')[1] + input = self.getInput(el.input) + moose.connect(input, 'output', self.getComp(pop_id,i,seg_id), 'injectMsg') + + for il in self.network.input_lists: + for ii in il.input: + input = self.getInput(il.component) + moose.connect(input, 'output', self.getComp(il.populations,ii.get_target_cell_id(),ii.get_segment_id()), 'injectMsg') + + + def createCellPrototype(self, cell, symmetric=True): """To be completed - create the morphology, channels in prototype""" nrn = moose.Neuron('%s/%s' % (self.lib.path, cell.id)) self.proto_cells[cell.id] = nrn @@ -190,15 +241,16 @@ class NML2Reader(object): self.importBiophysics(cell, nrn) return cell, nrn - def createMorphology(self, nmlcell, moosecell, symmetric=False): + + def createMorphology(self, nmlcell, moosecell, symmetric=True): """Create the MOOSE compartmental morphology in `moosecell` using the segments in NeuroML2 cell `nmlcell`. Create symmetric compartments if `symmetric` is True. """ morphology = nmlcell.morphology - segments = morphology.segment - id_to_segment = dict([(seg.id, seg) for seg in segments]) + segments = morphology.segments + id_to_segment = dict([(seg.id, seg) for seg in segments]) if symmetric: compclass = moose.SymCompartment else: @@ -207,11 +259,15 @@ class NML2Reader(object): # naming convention does not clash with that in MOOSE cellpath = moosecell.path id_to_comp = {} + self.seg_id_to_comp_name[nmlcell.id]={} for seg in segments: if seg.name is not None: id_to_comp[seg.id] = compclass('%s/%s' % (cellpath, seg.name)) + self.seg_id_to_comp_name[nmlcell.id][seg.id] = seg.name else: - id_to_comp[seg.id] = compclass('%s/comp_%s' % (cellpath, seg.id)) + name = 'comp_%s'%seg.id + id_to_comp[seg.id] = compclass('%s/%s' % (cellpath, name)) + self.seg_id_to_comp_name[nmlcell.id][seg.id] = name # Now assign the positions and connect up axial resistance if not symmetric: src, dst = 'axial', 'raxial' @@ -220,12 +276,12 @@ class NML2Reader(object): for segid, comp in id_to_comp.items(): segment = id_to_segment[segid] try: - parent = id_to_segment[str(segment.parent.segment)] + parent = id_to_segment[segment.parent.segments] except AttributeError: parent = None self.moose_to_nml[comp] = segment - self.nml_to_moose[segment] = comp - p0 = segment.proximal + self.nml_to_moose[segment] = comp + p0 = segment.proximal if p0 is None: if parent: p0 = parent.distal @@ -244,36 +300,55 @@ class NML2Reader(object): if parent: pcomp = id_to_comp[parent.id] moose.connect(comp, src, pcomp, dst) - sg_to_segments = {} - for sg in morphology.segmentGroup: - sg_to_segments[sg.id] = [id_to_segment[str(m.segment)] for m in sg.member] + sg_to_segments = {} + for sg in morphology.segment_groups: + sg_to_segments[sg.id] = [id_to_segment[m.segments] for m in sg.members] + for sg in morphology.segment_groups: + if not sg.id in sg_to_segments: + sg_to_segments[sg.id] = [] + for inc in sg.includes: + for cseg in sg_to_segments[inc.segment_groups]: + sg_to_segments[sg.id].append(cseg) + + if not 'all' in sg_to_segments: + sg_to_segments['all'] = [ s for s in segments ] + self._cell_to_sg[nmlcell] = sg_to_segments return id_to_comp, id_to_segment, sg_to_segments def importBiophysics(self, nmlcell, moosecell): """Create the biophysical components in moose Neuron `moosecell` according to NeuroML2 cell `nmlcell`.""" - bp = nmlcell.biophysicalProperties + bp = nmlcell.biophysical_properties if bp is None: - print('Warning: %s in %s has no biophysical properties' % (nmlcell.id, self.filename)) + mu.info('Warning: %s in %s has no biophysical properties' % (nmlcell.id, self.filename)) return - self.importMembraneProperties(nmlcell, moosecell, bp.membraneProperties) - self.importIntracellularProperties(nmlcell, moosecell, bp.intracellularProperties) + self.importMembraneProperties(nmlcell, moosecell, bp.membrane_properties) + self.importIntracellularProperties(nmlcell, moosecell, bp.intracellular_properties) def importMembraneProperties(self, nmlcell, moosecell, mp): """Create the membrane properties from nmlcell in moosecell""" if self.verbose: - print('Importing membrane properties') - self.importCapacitances(nmlcell, moosecell, mp.specificCapacitance) + mu.info('Importing membrane properties') + self.importCapacitances(nmlcell, moosecell, mp.specific_capacitances) self.importChannelsToCell(nmlcell, moosecell, mp) + self.importInitMembPotential(nmlcell, moosecell, mp) def importCapacitances(self, nmlcell, moosecell, specificCapacitances): sg_to_segments = self._cell_to_sg[nmlcell] for specific_cm in specificCapacitances: cm = SI(specific_cm.value) - for seg in sg_to_segments[specific_cm.segmentGroup]: + for seg in sg_to_segments[specific_cm.segment_groups]: comp = self.nml_to_moose[seg] - comp.Cm = np.pi * sarea(comp) + comp.Cm = sarea(comp) * cm + + def importInitMembPotential(self, nmlcell, moosecell, membraneProperties): + sg_to_segments = self._cell_to_sg[nmlcell] + for imp in membraneProperties.init_memb_potentials: + initv = SI(imp.value) + for seg in sg_to_segments[imp.segment_groups]: + comp = self.nml_to_moose[seg] + comp.initVm = initv def importIntracellularProperties(self, nmlcell, moosecell, properties): self.importAxialResistance(nmlcell, properties) @@ -282,12 +357,12 @@ class NML2Reader(object): def importSpecies(self, nmlcell, properties): sg_to_segments = self._cell_to_sg[nmlcell] for species in properties.species: - if (species.concentrationModel is not None) and \ - (species.concentrationModel.id not in self.proto_pools): + if (species.concentration_model is not None) and \ + (species.concentration_model.id not in self.proto_pools): continue segments = getSegments(nmlcell, species, sg_to_segments) for seg in segments: - comp = self.nml_to_moose[seg] + comp = self.nml_to_moose[seg] self.copySpecies(species, comp) def copySpecies(self, species, compartment): @@ -295,77 +370,132 @@ class NML2Reader(object): decaying pool of Ca2+ supported""" proto_pool = None if species.concentrationModel in self.proto_pools: - proto_pool = self.proto_pools[species.concentrationModel] + proto_pool = self.proto_pools[species.concentration_model] else: for innerReader in self.includes.values(): if species.concentrationModel in innerReader.proto_pools: proto_pool = innerReader.proto_pools[species.concentrationModel] break if not proto_pool: - raise Exception('No prototype pool for %s referred to by %s' % (species.concentrationModel, species.id)) + raise Exception('No prototype pool for %s referred to by %s' % (species.concentration_model, species.id)) pool_id = moose.copy(proto_pool, comp, species.id) pool = moose.element(pool_id) - pool.B = pool.B / (np.pi * compartment.length * (0.5 * compartment.diameter + pool.thickness) * (0.5 * compartment.diameter - pool.thickness)) + pool.B = pool.B / (np.pi * compartment.length * (0.5 * compartment.diameter + pool.thickness) * (0.5 * compartment.diameter - pool.thickness)) return pool def importAxialResistance(self, nmlcell, intracellularProperties): sg_to_segments = self._cell_to_sg[nmlcell] - for r in intracellularProperties.resistivity: + for r in intracellularProperties.resistivities: segments = getSegments(nmlcell, r, sg_to_segments) for seg in segments: comp = self.nml_to_moose[seg] - setRa(comp, SI(r.value)) - - def importChannelsToCell(self, nmlcell, moosecell, membraneProperties): + setRa(comp, SI(r.value)) + + def isPassiveChan(self,chan): + if chan.type == 'ionChannelPassive': + return True + if hasattr(chan,'gates'): + return len(chan.gate_hh_rates)+len(chan.gates)==0 + return False + + + rate_fn_map = { + 'HHExpRate': hhfit.exponential2, + 'HHSigmoidRate': hhfit.sigmoid2, + 'HHSigmoidVariable': hhfit.sigmoid2, + 'HHExpLinearRate': hhfit.linoid2 } + + def calculateRateFn(self, ratefn, vmin, vmax, tablen=3000, vShift='0mV'): + """Returns A / B table from ngate.""" + tab = np.linspace(vmin, vmax, tablen) + if self._is_standard_nml_rate(ratefn): + midpoint, rate, scale = map(SI, (ratefn.midpoint, ratefn.rate, ratefn.scale)) + return self.rate_fn_map[ratefn.type](tab, rate, scale, midpoint) + else: + for ct in self.doc.ComponentType: + if ratefn.type == ct.name: + mu.info("Using %s to evaluate rate"%ct.name) + rate = [] + for v in tab: + vals = pynml.evaluate_component(ct,req_variables={'v':'%sV'%v,'vShift':vShift,'temperature':self._getTemperature()}) + '''mu.info vals''' + if 'x' in vals: + rate.append(vals['x']) + if 't' in vals: + rate.append(vals['t']) + if 'r' in vals: + rate.append(vals['r']) + return np.array(rate) + + def importChannelsToCell(self, nmlcell, moosecell, membrane_properties): sg_to_segments = self._cell_to_sg[nmlcell] - for chdens in membraneProperties.channelDensity: + for chdens in membrane_properties.channel_densities + membrane_properties.channel_density_v_shifts: segments = getSegments(nmlcell, chdens, sg_to_segments) - condDensity = SI(chdens.condDensity) + condDensity = SI(chdens.cond_density) + erev = SI(chdens.erev) try: - ionChannel = self.id_to_ionChannel[chdens.ionChannel] + ionChannel = self.id_to_ionChannel[chdens.ion_channel] except KeyError: - print('No channel with id', chdens.ionChannel) + mu.info('No channel with id', chdens.ion_channel) continue - if ionChannel.type_ == 'ionChannelPassive': + + if self.verbose: + mu.info('Setting density of channel %s in %s to %s; erev=%s (passive: %s)'%(chdens.id, segments, condDensity,erev,self.isPassiveChan(ionChannel))) + + if self.isPassiveChan(ionChannel): for seg in segments: - self.setRm(self.nml_to_moose[seg], condDensity) + comp = self.nml_to_moose[seg] + setRm(self.nml_to_moose[seg], condDensity) + setEk(self.nml_to_moose[seg], erev) else: for seg in segments: - self.copyChannel(chdens, self.nml_to_moose[seg], condDensity) + self.copyChannel(chdens, self.nml_to_moose[seg], condDensity, erev) + '''moose.le(self.nml_to_moose[seg]) + moose.showfield(self.nml_to_moose[seg], field="*", showtype=True)''' - def copyChannel(self, chdens, comp, condDensity): + def copyChannel(self, chdens, comp, condDensity, erev): """Copy moose prototype for `chdens` condutcance density to `comp` compartment. """ proto_chan = None - if chdens.ionChannel in self.proto_chans: - proto_chan = self.proto_chans[chdens.ionChannel] + if chdens.ion_channel in self.proto_chans: + proto_chan = self.proto_chans[chdens.ion_channel] else: for innerReader in self.includes.values(): if chdens.ionChannel in innerReader.proto_chans: - proto_chan = innerReader.proto_chans[chdens.ionChannel] + proto_chan = innerReader.proto_chans[chdens.ion_channel] break if not proto_chan: - raise Exception('No prototype channel for %s referred to by %s' % (chdens.ionChannel, chdens.id)) + raise Exception('No prototype channel for %s referred to by %s' % (chdens.ion_channel, chdens.id)) + + if self.verbose: + mu.info('Copying %s to %s, %s; erev=%s'%(chdens.id, comp, condDensity, erev)) + orig = chdens.id chid = moose.copy(proto_chan, comp, chdens.id) chan = moose.element(chid) + for p in self.paths_to_chan_elements.keys(): + pp = p.replace('%s/'%chdens.ion_channel,'%s/'%orig) + self.paths_to_chan_elements[pp] = self.paths_to_chan_elements[p].replace('%s/'%chdens.ion_channel,'%s/'%orig) + #mu.info(self.paths_to_chan_elements) chan.Gbar = sarea(comp) * condDensity + chan.Ek = erev moose.connect(chan, 'channel', comp, 'channel') - return chan + return chan - def importIncludes(self, doc): + ''' + def importIncludes(self, doc): for include in doc.include: if self.verbose: - print(self.filename, 'Loading include', include) + mu.info(self.filename, 'Loading include', include) error = None inner = NML2Reader(self.verbose) paths = [include.href, os.path.join(os.path.dirname(self.filename), include.href)] for path in paths: try: - inner.read(path) + inner.read(path) if self.verbose: - print(self.filename, 'Loaded', path, '... OK') + mu.info(self.filename, 'Loaded', path, '... OK') except IOError as e: error = e else: @@ -376,14 +506,24 @@ class NML2Reader(object): error = None break if error: - print(self.filename, 'Last exception:', error) - raise IOError('Could not read any of the locations: %s' % (paths)) - - def createHHChannel(self, chan): + mu.info(self.filename, 'Last exception:', error) + raise IOError('Could not read any of the locations: %s' % (paths))''' + + def _is_standard_nml_rate(self, rate): + return rate.type=='HHExpLinearRate' \ + or rate.type=='HHExpRate' or \ + rate.type=='HHSigmoidRate' or \ + rate.type=='HHSigmoidVariable' + + def createHHChannel(self, chan, vmin=-150e-3, vmax=100e-3, vdivs=5000): mchan = moose.HHChannel('%s/%s' % (self.lib.path, chan.id)) mgates = map(moose.element, (mchan.gateX, mchan.gateY, mchan.gateZ)) - assert(len(chan.gate) <= 3) # We handle only up to 3 gates in HHCHannel - for ngate, mgate in zip(chan.gate, mgates): + assert(len(chan.gate_hh_rates) <= 3) # We handle only up to 3 gates in HHCHannel + + if self.verbose: + mu.info('== Creating channel: %s (%s) -> %s (%s)'%(chan.id, chan.gate_hh_rates, mchan, mgates)) + all_gates = chan.gates + chan.gate_hh_rates + for ngate, mgate in zip(all_gates,mgates): if mgate.name.endswith('X'): mchan.Xpower = ngate.instances elif mgate.name.endswith('Y'): @@ -401,63 +541,100 @@ class NML2Reader(object): # FateHHTauInf the meaning of timeCourse and # steady state is not obvious. Is the last one # refering to tau_inf and m_inf?? - fwd = ngate.forwardRate - rev = ngate.reverseRate + fwd = ngate.forward_rate + rev = ngate.reverse_rate + + self.paths_to_chan_elements['%s/%s'%(chan.id,ngate.id)] = '%s/%s'%(chan.id,mgate.name) + + q10_scale = 1 + if ngate.q10_settings: + if ngate.q10_settings.type == 'q10Fixed': + q10_scale= float(ngate.q10_settings.fixed_q10) + elif ngate.q10_settings.type == 'q10ExpTemp': + q10_scale = math.pow(float(ngate.q10_settings.q10_factor),(self._getTemperature()- SI(ngate.q10_settings.experimental_temp))/10) + #mu.info('Q10: %s; %s; %s; %s'%(ngate.q10_settings.q10_factor, self._getTemperature(),SI(ngate.q10_settings.experimental_temp),q10_scale)) + else: + raise Exception('Unknown Q10 scaling type %s: %s'%(ngate.q10_settings.type,ngate.q10_settings)) + + if self.verbose: + mu.info(' === Gate: %s; %s; %s; %s; %s; scale=%s'%(ngate.id, mgate.path, mchan.Xpower, fwd, rev, q10_scale)) + if (fwd is not None) and (rev is not None): - beta = calculateRateFn(fwd, vmin, vmax, vdivs) - alpha = calculateRateFn(rev, vmin, vmax, vdivs) - mgate.tableA = alpha - mgate.tableB = alpha + beta - break + alpha = self.calculateRateFn(fwd, vmin, vmax, vdivs) + beta = self.calculateRateFn(rev, vmin, vmax, vdivs) + mgate.tableA = q10_scale * (alpha) + mgate.tableB = q10_scale * (alpha + beta) # Assuming the meaning of the elements in GateHHTauInf ... - tau = ngate.timeCourse - inf = ngate.steadyState - if (tau is not None) and (inf is not None): - tau = calculateRateFn(tau, vmin, vmax, vdivs) - inf = calculateRateFn(inf, vmin, vmax, vdivs) - mgate.tableA = inf / tau - mgate.tableB = 1 / tau - break + if hasattr(ngate,'time_course') and hasattr(ngate,'steady_state') \ + and (ngate.time_course is not None) and (ngate.steady_state is not None): + tau = ngate.time_course + inf = ngate.steady_state + tau = self.calculateRateFn(tau, vmin, vmax, vdivs) + inf = self.calculateRateFn(inf, vmin, vmax, vdivs) + mgate.tableA = q10_scale * (inf / tau) + mgate.tableB = q10_scale * (1 / tau) + + if hasattr(ngate,'steady_state') and (ngate.time_course is None) and (ngate.steady_state is not None): + inf = ngate.steady_state + tau = 1 / (alpha + beta) + if (inf is not None): + inf = self.calculateRateFn(inf, vmin, vmax, vdivs) + mgate.tableA = q10_scale * (inf / tau) + mgate.tableB = q10_scale * (1 / tau) + if self.verbose: - print(self.filename, 'Created', mchan.path, 'for', chan.id) + mu.info(self.filename, '== Created', mchan.path, 'for', chan.id) return mchan - def createPassiveChannel(chan): + def createPassiveChannel(self, chan): mchan = moose.Leakage('%s/%s' % (self.lib.path, chan.id)) if self.verbose: - print(self.filename, 'Created', mchan.path, 'for', chan.id) + mu.info(self.filename, 'Created', mchan.path, 'for', chan.id) return mchan - def importIonChannels(self, doc, vmin=-120e-3, vmax=40e-3, vdivs=3000): + def importInputs(self, doc): + minputs = moose.Neutral('%s/inputs' % (self.lib.path)) + for pg_nml in doc.pulse_generators: + + pg = moose.PulseGen('%s/%s' % (minputs.path, pg_nml.id)) + pg.firstDelay = SI(pg_nml.delay) + pg.firstWidth = SI(pg_nml.duration) + pg.firstLevel = SI(pg_nml.amplitude) + pg.secondDelay = 1e9 + + + def importIonChannels(self, doc, vmin=-150e-3, vmax=100e-3, vdivs=5000): if self.verbose: - print(self.filename, 'Importing ion channels') - print(self.filename, doc.ionChannel) - for chan in doc.ionChannel: - print(self.filename, chan.id) - if chan.type_ == 'ionChannelHH': + mu.info(self.filename, 'Importing the ion channels') + + for chan in doc.ion_channel+doc.ion_channel_hhs: + if chan.type == 'ionChannelHH': mchan = self.createHHChannel(chan) - elif chan.type_ == 'ionChannelPassive': + elif self.isPassiveChan(chan): mchan = self.createPassiveChannel(chan) + else: + mchan = self.createHHChannel(chan) + self.id_to_ionChannel[chan.id] = chan self.nml_to_moose[chan] = mchan self.proto_chans[chan.id] = mchan if self.verbose: - print(self.filename, 'Created ion channel', mchan.path, 'for', chan.type_, chan.id) + mu.info(self.filename, 'Created ion channel', mchan.path, 'for', chan.type, chan.id) def importConcentrationModels(self, doc): - for concModel in doc.decayingPoolConcentrationModel: + for concModel in doc.decaying_pool_concentration_models: proto = self.createDecayingPoolConcentrationModel(concModel) def createDecayingPoolConcentrationModel(self, concModel): - """Create prototype for concentration model""" + """Create prototype for concentration model""" if concModel.name is not None: name = concModel.name else: name = concModel.id ca = moose.CaConc('%s/%s' % (self.lib.path, id)) - print('11111', concModel.restingConc) - print('2222', concModel.decayConstant) - print('33333', concModel.shellThickness) + mu.info('11111', concModel.restingConc) + mu.info('2222', concModel.decayConstant) + mu.info('33333', concModel.shellThickness) ca.CaBasal = SI(concModel.restingConc) ca.tau = SI(concModel.decayConstant) @@ -471,5 +648,5 @@ class NML2Reader(object): -# +# # reader.py ends here diff --git a/moose-core/python/moose/neuroml2/run_cell.py b/moose-core/python/moose/neuroml2/run_cell.py new file mode 100644 index 0000000000000000000000000000000000000000..a95e2a29d5c3df18e2e826bcdcaf248c904a93a4 --- /dev/null +++ b/moose-core/python/moose/neuroml2/run_cell.py @@ -0,0 +1,116 @@ +# -*- coding: utf-8 -*- +# run_cell.py --- +# +# Filename: run_cell.py +# Description: +# Author: +# Maintainer: P Gleeson +# Version: +# URL: +# Keywords: +# Compatibility: +# +# + +# Commentary: +# +# +# +# + +# Change log: +# +# +# +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 3, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, Fifth +# Floor, Boston, MA 02110-1301, USA. +# +# + +# Code: + +import moose +import sys +from reader import NML2Reader +import numpy as np + + +def run(nogui): + + reader = NML2Reader(verbose=True) + + filename = 'test_files/passiveCell.nml' + print('Loading: %s'%filename) + reader.read(filename) + + + msoma = reader.getComp(reader.doc.networks[0].populations[0].id,0,0) + print(msoma) + + + data = moose.Neutral('/data') + + pg = reader.getInput('pulseGen1') + + inj = moose.Table('%s/pulse' % (data.path)) + moose.connect(inj, 'requestOut', pg, 'getOutputValue') + + + vm = moose.Table('%s/Vm' % (data.path)) + moose.connect(vm, 'requestOut', msoma, 'getVm') + + simdt = 1e-6 + plotdt = 1e-4 + simtime = 150e-3 + + if (1): + #moose.showmsg( '/clock' ) + for i in range(8): + moose.setClock( i, simdt ) + moose.setClock( 8, plotdt ) + moose.reinit() + else: + utils.resetSim([model.path, data.path], simdt, plotdt, simmethod='ee') + moose.showmsg( '/clock' ) + + moose.start(simtime) + + print("Finished simulation!") + + t = np.linspace(0, simtime, len(vm.vector)) + + if not nogui: + import matplotlib.pyplot as plt + + plt.subplot(211) + plt.plot(t, vm.vector * 1e3, label='Vm (mV)') + plt.legend() + plt.title('Vm') + plt.subplot(212) + plt.title('Input') + plt.plot(t, inj.vector * 1e9, label='injected (nA)') + #plt.plot(t, gK.vector * 1e6, label='K') + #plt.plot(t, gNa.vector * 1e6, label='Na') + plt.legend() + plt.show() + plt.close() + + +if __name__ == '__main__': + + nogui = '-nogui' in sys.argv + + run(nogui) \ No newline at end of file diff --git a/moose-core/python/moose/neuroml2/run_hhcell.py b/moose-core/python/moose/neuroml2/run_hhcell.py new file mode 100644 index 0000000000000000000000000000000000000000..61e18afc8d73e2214e252cc45d60b8aa2e86799e --- /dev/null +++ b/moose-core/python/moose/neuroml2/run_hhcell.py @@ -0,0 +1,167 @@ +# -*- coding: utf-8 -*- +# run_hhcell.py --- +# +# Filename: run_hhcell.py +# Description: +# Author: +# Maintainer: P Gleeson +# Version: +# URL: +# Keywords: +# Compatibility: +# +# + +# Commentary: +# +# +# +# + +# Change log: +# +# +# +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 3, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, Fifth +# Floor, Boston, MA 02110-1301, USA. +# +# + +# Code: + +import moose +import sys +from reader import NML2Reader +import numpy as np + + +def test_channel_gates(): + """Creates prototype channels under `/library` and plots the time + constants (tau) and activation (minf, hinf, ninf) parameters for the + channel gates. + + """ + import matplotlib.pyplot as plt + lib = moose.Neutral('/library') + m = moose.element('/library[0]/naChan[0]/gateX') + h = moose.element('/library[0]/naChan[0]/gateY') + n = moose.element('/library[0]/kChan[0]/gateX') + v = np.linspace(n.min,n.max, n.divs+1) + + plt.subplot(221) + plt.plot(v, 1/m.tableB, label='tau_m') + plt.plot(v, 1/h.tableB, label='tau_h') + plt.plot(v, 1/n.tableB, label='tau_n') + plt.legend() + + plt.subplot(222) + plt.plot(v, m.tableA/m.tableB, label='m_inf') + plt.plot(v, h.tableA/h.tableB, label='h_inf') + plt.plot(v, n.tableA/n.tableB, label='n_inf') + plt.legend() + + plt.subplot(223) + plt.plot(v, m.tableA, label='mA(alpha)') + plt.plot(v, h.tableA, label='hA(alpha)') + plt.plot(v, n.tableA, label='nA(alpha)') + plt.legend() + plt.subplot(224) + + plt.plot(v, m.tableB, label='mB') + plt.plot(v, m.tableB-m.tableA, label='mB-A(beta)') + + plt.plot(v, h.tableB, label='hB') + plt.plot(v, h.tableB-h.tableA, label='hB-A(beta)') + + plt.plot(v, n.tableB, label='nB') + plt.plot(v, n.tableB-n.tableA, label='nB-nA(beta)') + plt.legend() + + plt.show() + + +def run(nogui): + + reader = NML2Reader(verbose=True) + + filename = 'test_files/NML2_SingleCompHHCell.nml' + print('Loading: %s'%filename) + reader.read(filename, symmetric=True) + + + msoma = reader.getComp(reader.doc.networks[0].populations[0].id,0,0) + print(msoma) + + + data = moose.Neutral('/data') + + pg = reader.getInput('pulseGen1') + + inj = moose.Table('%s/pulse' % (data.path)) + moose.connect(inj, 'requestOut', pg, 'getOutputValue') + + + vm = moose.Table('%s/Vm' % (data.path)) + moose.connect(vm, 'requestOut', msoma, 'getVm') + + simdt = 1e-6 + plotdt = 1e-4 + simtime = 300e-3 + if (1): + #moose.showmsg( '/clock' ) + for i in range(8): + moose.setClock( i, simdt ) + moose.setClock( 8, plotdt ) + moose.reinit() + else: + utils.resetSim([model.path, data.path], simdt, plotdt, simmethod='ee') + moose.showmsg( '/clock' ) + moose.start(simtime) + + print("Finished simulation!") + + t = np.linspace(0, simtime, len(vm.vector)) + + if not nogui: + import matplotlib.pyplot as plt + + vfile = open('moose_v_hh.dat','w') + + for i in range(len(t)): + vfile.write('%s\t%s\n'%(t[i],vm.vector[i])) + vfile.close() + plt.subplot(211) + plt.plot(t, vm.vector * 1e3, label='Vm (mV)') + plt.legend() + plt.title('Vm') + plt.subplot(212) + plt.title('Input') + plt.plot(t, inj.vector * 1e9, label='injected (nA)') + #plt.plot(t, gK.vector * 1e6, label='K') + #plt.plot(t, gNa.vector * 1e6, label='Na') + plt.legend() + plt.figure() + test_channel_gates() + plt.show() + plt.close() + + +if __name__ == '__main__': + + nogui = '-nogui' in sys.argv + + run(nogui) + \ No newline at end of file diff --git a/moose-core/python/moose/neuroml2/schema/NeuroMLCoreDimensions.xml b/moose-core/python/moose/neuroml2/schema/NeuroMLCoreDimensions.xml new file mode 100644 index 0000000000000000000000000000000000000000..e4f3e0df27d69f0827e393bcb2bb584ae8ed26e2 --- /dev/null +++ b/moose-core/python/moose/neuroml2/schema/NeuroMLCoreDimensions.xml @@ -0,0 +1,149 @@ +<Lems xmlns="http://www.neuroml.org/lems/0.7.4" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.neuroml.org/lems/0.7.4 ../../LEMS/Schemas/LEMS/LEMS_v0.7.4.xsd"> + + <!-- The core dimensional quantities as used in NeuroML version 2.0 --> + <!-- Will be used in Type definitions, e.g. <StateVariable name="v" dimension="voltage"/> --> + + <Dimension name="time" t="1"/> + <Dimension name="per_time" t="-1"/> + + <Dimension name="voltage" m="1" l="2" t="-3" i="-1"/> + <Dimension name="per_voltage" m="-1" l="-2" t="3" i="1"/> + + <Dimension name="conductance" m="-1" l="-2" t="3" i="2"/> + <Dimension name="conductanceDensity" m="-1" l="-4" t="3" i="2"/> + + <Dimension name="capacitance" m="-1" l="-2" t="4" i="2"/> + <Dimension name="specificCapacitance" m="-1" l="-4" t="4" i="2"/> + + <Dimension name="resistance" m="1" l="2" t="-3" i="-2"/> + <Dimension name="resistivity" m="2" l="2" t="-3" i="-2"/> + + <Dimension name="charge" i="1" t="1"/> + + <Dimension name="charge_per_mole" i="1" t="1" n="-1"/> + + <Dimension name="current" i="1"/> + + <Dimension name="currentDensity" i="1" l="-2"/> + + <Dimension name="length" l="1"/> + <Dimension name="area" l="2"/> + <Dimension name="volume" l="3"/> + + <Dimension name="concentration" l="-3" n="1"/> + + <Dimension name="substance" n="1"/> + + <Dimension name="permeability" l="1" t="-1"/> + + <Dimension name="temperature" k="1"/> + + <Dimension name="idealGasConstantDims" m="1" l="2" t="-2" k="-1" n="-1"/> + + <Dimension name="conductance_per_voltage" m="-2" l="-4" t="6" i="3"/> + + <!-- Note: it's unlikely that this dimension/unit for rho in fixedFactorConcentrationModel will be needed anywhere else--> + <Dimension name="rho_factor" l="-1" n="1" i="-1" t="-1"/> + + <!-- The core units as used in NeuroML version 2.0. --> + <!-- Will be used in Component definitions, e.g. duration="60ms" amplitude="0.2 nA" --> + <!-- Note, new units can be defined in a NeuroML file based on the dimensions above --> + + <Unit symbol="s" dimension="time" power="0"/> + <Unit symbol="per_s" dimension="per_time" power="0"/> + <Unit symbol="Hz" dimension="per_time" power="0"/> + <Unit symbol="ms" dimension="time" power="-3"/> <!-- Physiological Units --> + <Unit symbol="per_ms" dimension="per_time" power="3"/> <!-- Physiological Units --> + + <Unit symbol="min" dimension="time" power="0" scale="60"/> + <Unit symbol="per_min" dimension="per_time" power="0" scale="0.01666666667"/> + <Unit symbol="hour" dimension="time" power="0" scale="3600"/> + <Unit symbol="per_hour" dimension="per_time" power="0" scale="0.00027777777778"/> + + <Unit symbol="m" dimension="length" power="0"/> + <Unit symbol="cm" dimension="length" power="-2"/> <!-- Physiological Units --> + <Unit symbol="um" dimension="length" power="-6"/> + + <Unit symbol="m2" dimension="area" power="0"/> + <Unit symbol="cm2" dimension="area" power="-4"/> <!-- Physiological Units --> + <Unit symbol="um2" dimension="area" power="-12"/> + + <Unit symbol="m3" dimension="volume" power="0"/> + <Unit symbol="cm3" dimension="volume" power="-6"/> <!-- Physiological Units --> + <Unit symbol="litre" dimension="volume" power="-3"/> + <Unit symbol="um3" dimension="volume" power="-18"/> + + <Unit symbol="V" dimension="voltage" power="0"/> + <Unit symbol="mV" dimension="voltage" power="-3"/> <!-- Physiological Units --> + <Unit symbol="per_V" dimension="per_voltage" power="0"/> + <Unit symbol="per_mV" dimension="per_voltage" power="3"/> + + <Unit symbol="ohm" dimension="resistance" power="0"/> + <Unit symbol="kohm" dimension="resistance" power="3"/> <!-- Physiological Units --> + <Unit symbol="Mohm" dimension="resistance" power="6"/> + + <Unit symbol="S" dimension="conductance" power="0"/> + <Unit symbol="mS" dimension="conductance" power="-3"/> <!-- Physiological Units --> + <Unit symbol="uS" dimension="conductance" power="-6"/> + <Unit symbol="nS" dimension="conductance" power="-9"/> + <Unit symbol="pS" dimension="conductance" power="-12"/> + + <Unit symbol="S_per_m2" dimension="conductanceDensity" power="0"/> + <Unit symbol="mS_per_cm2" dimension="conductanceDensity" power="1"/> <!-- Physiological Units --> + <Unit symbol="S_per_cm2" dimension="conductanceDensity" power="4"/> <!-- NEURON preferred Units --> + + <Unit symbol="F" dimension="capacitance" power="0"/> + <Unit symbol="uF" dimension="capacitance" power="-6"/> <!-- Physiological Units --> + <Unit symbol="nF" dimension="capacitance" power="-9"/> + <Unit symbol="pF" dimension="capacitance" power="-12"/> + + <Unit symbol="F_per_m2" dimension="specificCapacitance" power="0"/> + <Unit symbol="uF_per_cm2" dimension="specificCapacitance" power="-2"/> <!-- Physiological Units --> + + <Unit symbol="ohm_m" dimension="resistivity" power="0"/> + <Unit symbol="kohm_cm" dimension="resistivity" power="1"/> <!-- Physiological Units --> + <Unit symbol="ohm_cm" dimension="resistivity" power="-2"/> <!-- NEURON preferred Units --> + + <Unit symbol="C" dimension="charge" power="0"/> + + <Unit symbol="C_per_mol" dimension="charge_per_mole" power="0"/> + <Unit symbol="nA_ms_per_amol" dimension="charge_per_mole" power="6"/> <!-- NEURON preferred Units --> + + <Unit symbol="A" dimension="current" power="0"/> + <Unit symbol="uA" dimension="current" power="-6"/> <!-- Physiological Units --> + <Unit symbol="nA" dimension="current" power="-9"/> + <Unit symbol="pA" dimension="current" power="-12"/> + + <Unit symbol="A_per_m2" dimension="currentDensity" power="0"/> + <Unit symbol="uA_per_cm2" dimension="currentDensity" power="-2"/> <!-- Physiological Units --> + <Unit symbol="mA_per_cm2" dimension="currentDensity" power="1"/> <!-- NEURON preferred Units --> + + <Unit symbol="mol_per_m3" dimension="concentration" power="0"/> + <Unit symbol="mol_per_cm3" dimension="concentration" power="6"/> <!-- Physiological Units --> + <Unit symbol="M" dimension="concentration" power="3"/> + <Unit symbol="mM" dimension="concentration" power="0"/> + + <Unit symbol="mol" dimension="substance" power="0"/> + + <Unit symbol="m_per_s" dimension="permeability" power="0"/> + <Unit symbol="cm_per_s" dimension="permeability" power="-2"/> + <Unit symbol="um_per_ms" dimension="permeability" power="-3"/> + <Unit symbol="cm_per_ms" dimension="permeability" power="1"/> + + + <Unit symbol="degC" dimension="temperature" offset="273.15"/> + + <Unit symbol="K" dimension="temperature" power="0"/> + + <Unit symbol="J_per_K_per_mol" dimension="idealGasConstantDims" power="0"/> + + <Unit symbol="S_per_V" dimension="conductance_per_voltage" power="0"/> + <Unit symbol="nS_per_mV" dimension="conductance_per_voltage" power="-6"/> <!-- NEURON preferred Units --> + + <!-- Note: it's unlikely that this dimension/unit for rho in fixedFactorConcentrationModel will be needed anywhere else--> + <Unit symbol="mol_per_m_per_A_per_s" dimension="rho_factor" power="0"/> <!-- SI --> + <Unit symbol="mol_per_cm_per_uA_per_ms" dimension="rho_factor" power="11"/> <!-- SI --> + +</Lems> \ No newline at end of file diff --git a/moose-core/python/moose/neuroml2/test_files/LEMS_hhCell.xml b/moose-core/python/moose/neuroml2/test_files/LEMS_hhCell.xml new file mode 100644 index 0000000000000000000000000000000000000000..09363c309e48d758f063323bfefcb482cff9eb66 --- /dev/null +++ b/moose-core/python/moose/neuroml2/test_files/LEMS_hhCell.xml @@ -0,0 +1,43 @@ +<Lems> + + <!-- Specify which component to run --> + <Target component="sim1"/> + + <!-- Include core NeuroML2 ComponentType definitions --> + <Include file="Cells.xml"/> + <Include file="Networks.xml"/> + <Include file="Simulation.xml"/> + + <Include file="NML2_SingleCompHHCell.nml"/> + + + <!-- End of NeuroML2 content --> + + + <Simulation id="sim1" length="300ms" step="0.01ms" target="net1"> + + <Display id="d1" title="Voltage" timeScale="1ms" xmin="-20" xmax="320" ymin="-90" ymax="60"> + <Line id="v" quantity="hhpop[0]/v" scale="1mV" color="#ffffff" timeScale="1ms"/> + </Display> + + <!-- + <Display id="d2" title="Ex1: Simple HH example: rate variables" timeScale="1ms" xmin="0" xmax="150" ymin="-0.1" ymax="1.1"> + + <Line id="na_m" quantity="hhpop[0]/naChans/na/m/q" scale="1" color="#000000" timeScale="1ms"/> + <Line id="na_h" quantity="hhpop[0]/naChans/na/h/q" scale="1" color="#ff0000" timeScale="1ms"/> + <Line id="k_n" quantity="hhpop[0]/kChans/k/n/q" scale="1" color="#0000ff" timeScale="1ms"/> + </Display>--> + + <Display id="d3" title="Injected current" timeScale="1ms" xmin="-20" xmax="320" ymin="-0.01" ymax=".11"> + <Line id="i" quantity="hhpop[0]/pulseGen1/i" scale="1nA" color="#ffffff" timeScale="1ms"/> + </Display> + + <OutputFile id="of0" fileName="hh_v.dat"> + <OutputColumn id="v" quantity="hhpop[0]/v"/> + </OutputFile> + + </Simulation> + + + +</Lems> \ No newline at end of file diff --git a/moose-core/python/moose/neuroml2/test_files/LEMS_passiveCell.xml b/moose-core/python/moose/neuroml2/test_files/LEMS_passiveCell.xml new file mode 100644 index 0000000000000000000000000000000000000000..f6e48f6842121c104eb498a98fd9607cbfdf010a --- /dev/null +++ b/moose-core/python/moose/neuroml2/test_files/LEMS_passiveCell.xml @@ -0,0 +1,33 @@ +<Lems> + + <!-- Specify which component to run --> + <Target component="sim1"/> + + <!-- Include core NeuroML2 ComponentType definitions --> + <Include file="Cells.xml"/> + <Include file="Networks.xml"/> + <Include file="Simulation.xml"/> + + <Include file="passiveCell.nml"/> + + + + <Simulation id="sim1" length="150ms" step="0.01ms" target="net1"> + + <Display id="d1" title="Voltage" timeScale="1ms" xmin="0" xmax="150" ymin="-90" ymax="60"> + <Line id="v" quantity="pop0[0]/v" scale="1mV" color="#000000" timeScale="1ms"/> + </Display> + + <Display id="d3" title="Injected current" timeScale="1ms" xmin="0" xmax="150" ymin="-0.01" ymax=".11"> + <Line id="i" quantity="pop0[0]/pulseGen1/i" scale="1nA" color="#000000" timeScale="1ms"/> + </Display> + + <OutputFile id="of0" fileName="passive_v.dat"> + <OutputColumn id="v" quantity="pop0[0]/v"/> + </OutputFile> + + </Simulation> + + + +</Lems> \ No newline at end of file diff --git a/moose-core/python/moose/neuroml2/test_files/NML2_FullCell.nml b/moose-core/python/moose/neuroml2/test_files/NML2_FullCell.nml index b69375040420117818269c1c5789f67af37cd606..6ad0941ac2f8a2cc63ca7a0231a9b892a47fb62b 100644 --- a/moose-core/python/moose/neuroml2/test_files/NML2_FullCell.nml +++ b/moose-core/python/moose/neuroml2/test_files/NML2_FullCell.nml @@ -3,7 +3,7 @@ <neuroml xmlns="http://www.neuroml.org/schema/neuroml2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xi="http://www.w3.org/2001/XInclude" - xsi:schemaLocation="http://www.neuroml.org/schema/neuroml2 ../Schemas/NeuroML2/NeuroML_v2beta3.xsd" + xsi:schemaLocation="http://www.neuroml.org/schema/neuroml2 ../Schemas/NeuroML2/NeuroML_v2beta4.xsd" id="NML2_FullCell"> @@ -13,6 +13,8 @@ jLEMS/jNeuroML however, as jLEMS does not yet support multicompartmental cells --> <include href="SimpleIonChannel.xml"/> <!-- Contains ionChannel NaConductance --> + + <ionChannel type="ionChannelPassive" id="pas" conductance="10pS"/> <!--For use in example cell below--> <!-- Note, no <cells> element... --> @@ -81,11 +83,11 @@ <membraneProperties> - <channelPopulation id="naChansDend" ionChannel="NaConductance" segment="2" number="120000" erev="50mV"/> <!-- Use population instead of density --> + <channelPopulation id="naChansDend" ionChannel="NaConductance" segment="2" number="120000" erev="50mV" ion="na"/> <!-- Use population instead of density --> - <channelDensity id="pasChans" ionChannel="pas" condDensity="3.0 S_per_m2" erev="-70mV"/> <!-- no segmentGroup => all segments! --> + <channelDensity id="pasChans" ionChannel="pas" condDensity="3.0 S_per_m2" erev="-70mV" ion="non_specific"/> <!-- no segmentGroup => all segments! --> - <channelDensity id="naChansSoma" ionChannel="NaConductance" segmentGroup="soma_group" condDensity="120.0 mS_per_cm2" erev="50mV"/> + <channelDensity id="naChansSoma" ionChannel="NaConductance" segmentGroup="soma_group" condDensity="120.0 mS_per_cm2" erev="50mV" ion="na"/> <specificCapacitance segmentGroup="soma_group" value="1.0 uF_per_cm2"/> diff --git a/moose-core/python/moose/neuroml2/test_files/NML2_SingleCompHHCell.nml b/moose-core/python/moose/neuroml2/test_files/NML2_SingleCompHHCell.nml new file mode 100644 index 0000000000000000000000000000000000000000..1b1d43b92606d2c1e0b78e88315c5d3b11b11271 --- /dev/null +++ b/moose-core/python/moose/neuroml2/test_files/NML2_SingleCompHHCell.nml @@ -0,0 +1,90 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<neuroml xmlns="http://www.neuroml.org/schema/neuroml2" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.neuroml.org/schema/neuroml2 ../Schemas/NeuroML2/NeuroML_v2beta4.xsd" + id="NML2_SingleCompHHCell"> + + <!-- Single compartment cell with HH channels --> + + <!-- This is a "pure" NeuroML 2 file. It can be included in a LEMS file for use in a simulaton + by the LEMS interpreter, see LEMS_NML2_Ex5_DetCell.xml --> + + <ionChannelHH id="passiveChan" conductance="10pS"> + <notes>Leak conductance</notes> + </ionChannelHH> + + + <ionChannelHH id="naChan" conductance="10pS" species="na"> + <notes>Na channel</notes> + + <gateHHrates id="m" instances="3"> + <forwardRate type="HHExpLinearRate" rate="1per_ms" midpoint="-40mV" scale="10mV"/> + <reverseRate type="HHExpRate" rate="4per_ms" midpoint="-65mV" scale="-18mV"/> + </gateHHrates> + + <gateHHrates id="h" instances="1"> + <forwardRate type="HHExpRate" rate="0.07per_ms" midpoint="-65mV" scale="-20mV"/> + <reverseRate type="HHSigmoidRate" rate="1per_ms" midpoint="-35mV" scale="10mV"/> + </gateHHrates> + + </ionChannelHH> + + + <ionChannelHH id="kChan" conductance="10pS" species="k"> + + <gateHHrates id="n" instances="4"> + <forwardRate type="HHExpLinearRate" rate="0.1per_ms" midpoint="-55mV" scale="10mV"/> + <reverseRate type="HHExpRate" rate="0.125per_ms" midpoint="-65mV" scale="-80mV"/> + </gateHHrates> + + </ionChannelHH> + + + + <cell id="hhcell"> + + <morphology id="morph1"> + <segment id="0" name="soma"> + <proximal x="0" y="0" z="0" diameter="17.841242"/> <!--Gives a convenient surface area of 1000.0 um^2--> + <distal x="0" y="0" z="0" diameter="17.841242"/> + </segment> + + <segmentGroup id="soma_group"> + <member segment="0"/> + </segmentGroup> + + </morphology> + + <biophysicalProperties id="bioPhys1"> + + <membraneProperties> + + <channelDensity id="leak" ionChannel="passiveChan" condDensity="3.0 S_per_m2" erev="-54.3mV" ion="non_specific"/> + <channelDensity id="naChans" ionChannel="naChan" condDensity="120.0 mS_per_cm2" erev="50.0 mV" ion="na"/> + <channelDensity id="kChans" ionChannel="kChan" condDensity="360 S_per_m2" erev="-77mV" ion="k"/> + + <spikeThresh value="-20mV"/> + <specificCapacitance value="1.0 uF_per_cm2"/> + <initMembPotential value="-65mV"/> + + </membraneProperties> + + <intracellularProperties> + <resistivity value="0.03 kohm_cm"/> <!-- Note: not used in single compartment simulations --> + </intracellularProperties> + + </biophysicalProperties> + + </cell> + + <pulseGenerator id="pulseGen1" delay="100ms" duration="100ms" amplitude="0.08nA"/> + + + <network id="net1"> + <population id="hhpop" component="hhcell" size="1"/> + <explicitInput target="hhpop[0]" input="pulseGen1"/> + </network> + +</neuroml> + diff --git a/moose-core/python/moose/neuroml2/test_files/SimpleIonChannel.xml b/moose-core/python/moose/neuroml2/test_files/SimpleIonChannel.xml index 354cf2ebd0474ab10165e2bbae2087315a50398b..02188151df5681cc29e706223898abfdba6c8d3f 100644 --- a/moose-core/python/moose/neuroml2/test_files/SimpleIonChannel.xml +++ b/moose-core/python/moose/neuroml2/test_files/SimpleIonChannel.xml @@ -2,12 +2,12 @@ <neuroml xmlns="http://www.neuroml.org/schema/neuroml2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://www.neuroml.org/schema/neuroml2 ../Schemas/NeuroML2/NeuroML_v2beta3.xsd" + xsi:schemaLocation="http://www.neuroml.org/schema/neuroml2 ../Schemas/NeuroML2/NeuroML_v2beta4.xsd" id="NML2_SimpleIonChannel"> <!-- Example of a simple Na+ ion channel in NeuroML 2 --> - <ionChannelHH id="na" conductance="10pS" species="na"> + <ionChannel type="ionChannelHH" id="NaConductance" conductance="10pS" species="na"> <gateHHrates id="m" instances="3"> <forwardRate type="HHExpLinearRate" rate="1per_ms" midpoint="-40mV" scale="10mV"/> @@ -19,6 +19,6 @@ <reverseRate type="HHSigmoidRate" rate="1per_ms" midpoint="-35mV" scale="10mV"/> </gateHHrates> - </ionChannelHH> + </ionChannel> </neuroml> diff --git a/moose-core/python/moose/neuroml2/test_files/passiveCell.nml b/moose-core/python/moose/neuroml2/test_files/passiveCell.nml new file mode 100644 index 0000000000000000000000000000000000000000..9b91f2530dc08dd5a2d50b9e01f133b94552cf7a --- /dev/null +++ b/moose-core/python/moose/neuroml2/test_files/passiveCell.nml @@ -0,0 +1,52 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<neuroml xmlns="http://www.neuroml.org/schema/neuroml2" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.neuroml.org/schema/neuroml2 ../Schemas/NeuroML2/NeuroML_v2beta4.xsd" + id="NML2_SingleCompHHCell"> + + + <ionChannel type="ionChannelPassive" id="passiveChan" conductance="10pS"> + <notes>Leak conductance</notes> + </ionChannel> + + <cell id="passiveCell"> + + <morphology id="morph1"> + <segment id="0" name="soma"> + <proximal x="0" y="0" z="0" diameter="17.841242"/> <!--Gives a convenient surface area of 1000.0 ?m�--> + <distal x="0" y="0" z="0" diameter="17.841242"/> + </segment> + + <segmentGroup id="soma_group"> + <member segment="0"/> + </segmentGroup> + + </morphology> + + <biophysicalProperties id="bioPhys1"> + + <membraneProperties> + <channelDensity id="leak" ionChannel="passiveChan" condDensity="3.0S_per_m2" erev="-54.3mV" ion="non_specific"/> + <spikeThresh value="-20mV"/> + <specificCapacitance value="1.0uF_per_cm2"/> + <initMembPotential value="-66.6mV"/> + </membraneProperties> + + <intracellularProperties> + <resistivity value="0.03kohm_cm"/> <!-- Note: not used in single compartment simulations --> + </intracellularProperties> + + </biophysicalProperties> + + </cell> + + <pulseGenerator id="pulseGen1" delay="50ms" duration="50ms" amplitude="0.08nA"/> + + + <network id="net1"> + <population id="pop0" component="passiveCell" size="1"/> + <explicitInput target="pop0[0]" input="pulseGen1"/> + </network> + +</neuroml> diff --git a/moose-core/python/moose/neuroml2/test_reader.py b/moose-core/python/moose/neuroml2/test_reader.py index 4482eb6b7c698db9bd1b1994e5d84e882a51e25c..53d420d853755e02bd0cc009b5f688d52237c97d 100644 --- a/moose-core/python/moose/neuroml2/test_reader.py +++ b/moose-core/python/moose/neuroml2/test_reader.py @@ -50,7 +50,7 @@ from __future__ import print_function import unittest import numpy as np import moose -import generated_neuroml as nml +import neuroml as nml from reader import NML2Reader class TestFullCell(unittest.TestCase): @@ -94,15 +94,18 @@ class TestFullCell(unittest.TestCase): def test_connectivity(self): """Test raxial-axial connectivity between MOOSE compartments when there is parent->child relation in NML2.""" - id_to_seg = dict([(seg.id, seg) for seg in self.ncell.morphology.segment]) - for seg in self.ncell.morphology.segment: + id_to_seg = dict([(seg.id, seg) for seg in self.ncell.morphology.segments]) + for seg in self.ncell.morphology.segments: try: - pseg = id_to_seg[str(seg.parent.segment)] + pseg = id_to_seg[seg.parent.segment] except AttributeError: continue comp = self.reader.nml_to_moose[seg] pcomp = self.reader.nml_to_moose[pseg] - self.assertIn(comp.id_, pcomp.neighbours['raxial']) + + ''' + TODO: what should this be updated to??? + self.assertIn(comp.id_, pcomp.neighbours['raxial'])''' def test_capacitance(self): for comp_id in moose.wildcardFind(self.mcell.path + '/##[ISA=Compartment]'): @@ -121,8 +124,10 @@ class TestFullCell(unittest.TestCase): soma_na = moose.element(self.soma.path+'/naChansSoma') chans = moose.wildcardFind(self.mcell.path + '/##[ISA=HHChannel]') self.assertTrue(len(chans) < 3) # Only soma and dendrite2 have the channels - self.assertAlmostEqual(soma_na.Gbar, 120e-2 * self.soma.diameter * self.soma.diameter * np.pi) + self.assertAlmostEqual(soma_na.Gbar, 120e-2 * self.soma.diameter * self.soma.diameter * np.pi, places=6) +''' +Not yet working in NML2... class TestGran98(unittest.TestCase): def setUp(self): @@ -138,6 +143,7 @@ class TestGran98(unittest.TestCase): def test_CaPool(self): pass +''' if __name__ == '__main__': unittest.main() diff --git a/moose-core/python/moose/neuroml2/test_reader2.py b/moose-core/python/moose/neuroml2/test_reader2.py new file mode 100644 index 0000000000000000000000000000000000000000..35a123f3c0713113d173e6acb70498b03e14284f --- /dev/null +++ b/moose-core/python/moose/neuroml2/test_reader2.py @@ -0,0 +1,105 @@ +# -*- coding: utf-8 -*- +# test_reader.py --- +# +# Filename: test_reader2.py +# Description: +# Author: +# Maintainer: P Gleeson +# Version: +# URL: +# Keywords: +# Compatibility: +# +# + +# Commentary: +# +# +# +# + +# Change log: +# +# +# +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 3, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, Fifth +# Floor, Boston, MA 02110-1301, USA. +# +# + +# Code: + +from __future__ import print_function +import unittest +import moose +from reader import NML2Reader +import neuroml as nml + +class TestPassiveCell(unittest.TestCase): + def setUp(self): + self.reader = NML2Reader(verbose=True) + + self.lib = moose.Neutral('/library') + self.filename = 'test_files/passiveCell.nml' + print('Loading: %s'%self.filename) + self.reader.read(self.filename) + for ncell in self.reader.nml_to_moose: + if isinstance(ncell, nml.Cell): + self.ncell = ncell + break + self.mcell = moose.element('/library/%s'%self.ncell.id) + self.soma = moose.element(self.mcell.path + '/soma') + + + def test_basicLoading(self): + pass + self.assertEqual(self.reader.filename, self.filename, 'filename was not set') + self.assertIsNotNone(self.reader.doc, 'doc is None') + + def test_createCellPrototype(self): + self.assertIsInstance(self.mcell, moose.Neuron) + self.assertEqual(self.mcell.name, self.ncell.id) + + def test_createMorphology(self): + for comp_id in moose.wildcardFind(self.mcell.path + '/##[ISA=Compartment]'): + comp = moose.element(comp_id) + p0 = self.reader.moose_to_nml[comp].proximal + if p0: + self.assertAlmostEqual(comp.x0, float(p0.x)*1e-6) # Assume micron unit for length + self.assertAlmostEqual(comp.y0, float(p0.y)*1e-6) + self.assertAlmostEqual(comp.z0, float(p0.z)*1e-6) + p1 = self.reader.moose_to_nml[comp].distal + self.assertAlmostEqual(comp.x, float(p1.x)*1e-6) + self.assertAlmostEqual(comp.y, float(p1.y)*1e-6) + self.assertAlmostEqual(comp.z, float(p1.z)*1e-6) + + def test_capacitance(self): + for comp_id in moose.wildcardFind(self.mcell.path + '/##[ISA=Compartment]'): + comp = moose.element(comp_id) + # We know that a few um^2 compartment with uF/cm^2 specific capacitance must be around a pico Farad. + self.assertTrue((comp.Cm > 0) and (comp.Cm < 1e-6)) + + def test_protochans(self): + """TODO: verify the prototype cahnnel.""" + for chan_id in moose.wildcardFind('/library/##[ISA=HHChannel]'): + print(moose.element(chan_id)) + +if __name__ == '__main__': + unittest.main() + #p = TestPassiveCell() + +# +# test_reader.py ends here diff --git a/moose-core/python/moose/neuroml2/units.py b/moose-core/python/moose/neuroml2/units.py index 69839872ffbdc22b9d9eacd817dc2ba106234abc..795129a51377b232354eb480ebe0ab898074483c 100644 --- a/moose-core/python/moose/neuroml2/units.py +++ b/moose-core/python/moose/neuroml2/units.py @@ -52,15 +52,14 @@ in NeuroMLCoreDimensions.xml) to SI """ from __future__ import print_function import os -import numpy as np import re from xml.etree import ElementTree # The units and dimensions used in NeuroML2 are defined in this file: # https://github.com/NeuroML/NeuroML2/blob/master/NeuroML2CoreTypes/NeuroMLCoreDimensions.xml unitsdoc = ElementTree.parse(os.path.join(os.path.dirname(__file__),'schema', 'NeuroMLCoreDimensions.xml')) -dims = dict([(el.name, el) for el in unitsdoc.getroot() if el.tag == 'Dimension']) -units = dict([(el.symbol, el) for el in unitsdoc.getroot() if el.tag == 'Unit']) +dims = dict([(el.attrib['name'], el) for el in unitsdoc.getroot() if el.tag == '{http://www.neuroml.org/lems/0.7.4}Dimension']) +units = dict([(el.attrib['symbol'], el) for el in unitsdoc.getroot() if el.tag == '{http://www.neuroml.org/lems/0.7.4}Unit']) # optional +/- followed by 0 or more digits followed by optional # decimal point followed by optional digits followed by optional @@ -69,17 +68,35 @@ units = dict([(el.symbol, el) for el in unitsdoc.getroot() if el.tag == 'Unit']) magnitude_regex = re.compile(r'^[\+-]?\d*\.?\d*([eE][\+-]?\d+)?') def SI(expression): + try: + return float(expression) + except: + pass + expression=expression.replace(" ", "") match = magnitude_regex.match(expression) magnitude = float(match.group(0)) unitstr = re.split(magnitude_regex, expression)[-1] + + #print("Converting %s: mag: %s, unitstr: %s"%(expression, magnitude, unitstr)) try: unit = units[unitstr] - except KeyError: + #print('Unit: %s'%unit.attrib) + except KeyError as ke: + print("Error in converting %s: %s, using %s"%(expression, ke, magnitude)) return magnitude - try: - return magnitude * np.power(10, int(unit.power)) - except AttributeError: # degC has offset in stead of magnitude - return magnitude + float(unit.offset) + power = int(unit.attrib['power']) if 'power' in unit.attrib else 0 + offset = float(unit.attrib['offset']) if 'offset' in unit.attrib else 0 + scale = float(unit.attrib['scale']) if 'scale' in unit.attrib else 1 + + si = (magnitude + offset) * scale * 10**power + + return si + + +if __name__ == "__main__": + examples = ['-70mV','5 V','1',2,3.3, '330mM','15K','0 degC','-300degC','1min'] + for e in examples: + print(SI(e)) # # units.py ends here diff --git a/moose-core/python/moose/utils.py b/moose-core/python/moose/utils.py index d4fcf16e06632ea20e16b02933cf12c9bc57b3aa..37bf0deb9f82cc233d4f8f96de103b2c0c83cc15 100644 --- a/moose-core/python/moose/utils.py +++ b/moose-core/python/moose/utils.py @@ -7,11 +7,8 @@ from __future__ import print_function, division, absolute_import -__author__ = 'Subhasis Ray, Aditya Gilra, Dilawar Singh' -__copyright__ = "Copyright 2013, NCBS Bangalore" -__credits__ = ["NCBS Bangalore", "Bhalla Lab"] -__license__ = "GPL" -__version__ = "1.0.0" +from __future__ import print_function, division +from __future__ import absolute_import import types import parser @@ -25,10 +22,15 @@ from collections import defaultdict import re from moose.moose_constants import * +from moose.print_utils import * # Print and Plot utilities. -from moose.plot_utils import * -from moose.print_utils import * +try: + from moose.plot_utils import * +except Exception as e: + info( "Plot utilities are not loaded due to '%s'" ) + pass + def create_table_path(model, graph, element, field): diff --git a/moose-core/python/rdesigneur/__init__.py b/moose-core/python/rdesigneur/__init__.py index caa67eabfcbe9b8311e36d0f7bcb300bf02d3305..9f73e8ef57b320f57e850fa3ed965a675ee2166f 100644 --- a/moose-core/python/rdesigneur/__init__.py +++ b/moose-core/python/rdesigneur/__init__.py @@ -3,4 +3,6 @@ from __future__ import print_function, absolute_import from rdesigneur.rdesigneur import * from rdesigneur.rdesigneur import rdesigneur -import rdesigneur.rmoogli as rmoogli + + + diff --git a/moose-core/python/rdesigneur/rmoogli.py b/moose-core/python/rdesigneur/rmoogli.py index 597303810f8dfc430b24a55415403eda3902d514..bd4ad97927876d076fb2c3c3610d80e036b66ed4 100644 --- a/moose-core/python/rdesigneur/rmoogli.py +++ b/moose-core/python/rdesigneur/rmoogli.py @@ -10,7 +10,6 @@ ######################################################################### import math -import matplotlib import sys import moose import os @@ -30,6 +29,7 @@ hasMoogli = True if hasDisplay: try: + import matplotlib from PyQt4 import QtGui import moogli import moogli.extensions.moose diff --git a/moose-core/python/setup.cmake.py b/moose-core/python/setup.cmake.py index 54bcc4257a3364dfa1d2dc5089ecf2449ec2e3c2..8cd9faf17329584b8eb251b51428567130a53b7c 100644 --- a/moose-core/python/setup.cmake.py +++ b/moose-core/python/setup.cmake.py @@ -24,7 +24,7 @@ script_dir = os.path.dirname( os.path.abspath( __file__ ) ) version = '3.2.git' try: - with open( os.path.join( script_dir, '..', 'VERSION'), 'r' ) as f: + with open( os.path.join( script_dir, '..', '..', 'VERSION'), 'r' ) as f: version = f.read( ) except Exception as e: print( 'Failed to read VERSION %s' % e ) @@ -51,6 +51,7 @@ setup( , 'moose' , 'moose.SBML' , 'moose.neuroml' + , 'moose.neuroml2' , 'moose.genesis' , 'moose.chemUtil' , 'moose.chemMerge' @@ -59,5 +60,5 @@ setup( 'moose' : 'moose' , 'rdesigneur' : 'rdesigneur' }, - package_data = { 'moose' : ['_moose' + suffix] }, + package_data = { 'moose' : ['_moose' + suffix, 'neuroml2/schema/NeuroMLCoreDimensions.xml'] }, ) diff --git a/moose-core/python/setup.py b/moose-core/python/setup.py deleted file mode 100644 index 93c432cd4afaeda4153e7a2d0e8909f27764da71..0000000000000000000000000000000000000000 --- a/moose-core/python/setup.py +++ /dev/null @@ -1,74 +0,0 @@ -# -*- coding: utf-8 -*- -# This file is part of MOOSE simulator: http://moose.ncbs.res.in. - -# MOOSE is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. - -# MOOSE is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# You should have received a copy of the GNU General Public License -# along with MOOSE. If not, see <http://www.gnu.org/licenses/>. - - -"""setup.py: - - Script to install python targets. - -""" - -__author__ = "Dilawar Singh" -__copyright__ = "Copyright 2013, Dilawar Singh and NCBS Bangalore" -__credits__ = ["NCBS Bangalore"] -__license__ = "GNU GPL" -__version__ = "1.0.0" -__maintainer__ = "Dilawar Singh" -__email__ = "dilawars@ncbs.res.in" -__status__ = "Development" - -import os -from distutils.core import setup - -script_dir = os.path.dirname( os.path.abspath( __file__ ) ) - -version = '3.1' -try: - with open( os.path.join( script_dir, '..', 'VERSION'), 'r' ) as f: - version = f.read( ) -except Exception as e: - print( 'Failed to read VERSION %s' % e ) - print( 'Using default 3.1' ) - -try: - import importlib.machinery - suffix = importlib.machinery.EXTENSION_SUFFIXES[0] -except Exception as e: - suffix = '.so' - -setup( - name='moose', - version=version, - description='MOOSE python scripting module.', - author='MOOSERes', - author_email='bhalla@ncbs.res.in', - maintainer='Dilawar Singh', - maintainer_email='dilawars@ncbs.res.in', - url='http://moose.ncbs.res.in', - packages=[ - 'rdesigneur' - , 'moose' - , 'moose.SBML' - , 'moose.neuroml' - , 'moose.genesis' - , 'moose.chemUtil' - , 'moose.chemMerge' - ], - package_dir = { - 'moose' : 'moose' - , 'rdesigneur' : 'rdesigneur' - }, - package_data = { 'moose' : ['_moose' + suffix] }, - ) diff --git a/moose-core/scripts/Makefile.wheel b/moose-core/scripts/Makefile.wheel new file mode 100644 index 0000000000000000000000000000000000000000..86f502625bb50ba083a52562f3e39395e2d9fc83 --- /dev/null +++ b/moose-core/scripts/Makefile.wheel @@ -0,0 +1,18 @@ +all : fix + @echo "All done" + +wheel : ./setup.wheel.py + python ./setup.wheel.py bdist_wheel + +check : wheel + auditwheel show dist/*.whl + echo "If successful then run `make fix`" + +fix : check + auditwheel repair dist/*.whl + +upload : fix + twine upload dist/*.whl + + + diff --git a/moose-core/tests/python/Rallpacks/rallpacks_cable_hhchannel.py b/moose-core/tests/python/Rallpacks/rallpacks_cable_hhchannel.py index ba0773c7761aa1e5bc3802b65fc56059400f6e0b..efad0d37382bd45c7b5e47edccc4f850be34d5eb 100644 --- a/moose-core/tests/python/Rallpacks/rallpacks_cable_hhchannel.py +++ b/moose-core/tests/python/Rallpacks/rallpacks_cable_hhchannel.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- """rallpacks_cable_hhchannel.py: - A cable with 1000 compartments with HH-type channels in it. +A cable with 1000 compartments with HH-type channels in it. Last modified: Wed May 21, 2014 09:51AM @@ -22,7 +22,6 @@ from moose import utils import time import os import numpy as np -import matplotlib.pyplot as plt import compartment as comp diff --git a/moose-core/tests/python/neuroml/CA1.net.xml b/moose-core/tests/python/_neuroml/CA1.net.xml similarity index 100% rename from moose-core/tests/python/neuroml/CA1.net.xml rename to moose-core/tests/python/_neuroml/CA1.net.xml diff --git a/moose-core/tests/python/neuroml/CA1.py b/moose-core/tests/python/_neuroml/CA1.py similarity index 100% rename from moose-core/tests/python/neuroml/CA1.py rename to moose-core/tests/python/_neuroml/CA1.py diff --git a/moose-core/tests/python/neuroml/CA1_hsolve.py b/moose-core/tests/python/_neuroml/CA1_hsolve.py similarity index 100% rename from moose-core/tests/python/neuroml/CA1_hsolve.py rename to moose-core/tests/python/_neuroml/CA1_hsolve.py diff --git a/moose-core/tests/python/neuroml/CA1inhomog.net.xml b/moose-core/tests/python/_neuroml/CA1inhomog.net.xml similarity index 100% rename from moose-core/tests/python/neuroml/CA1inhomog.net.xml rename to moose-core/tests/python/_neuroml/CA1inhomog.net.xml diff --git a/moose-core/tests/python/neuroml/CA1soma.net.xml b/moose-core/tests/python/_neuroml/CA1soma.net.xml similarity index 100% rename from moose-core/tests/python/neuroml/CA1soma.net.xml rename to moose-core/tests/python/_neuroml/CA1soma.net.xml diff --git a/moose-core/tests/python/neuroml/FvsI_CA1.py b/moose-core/tests/python/_neuroml/FvsI_CA1.py similarity index 100% rename from moose-core/tests/python/neuroml/FvsI_CA1.py rename to moose-core/tests/python/_neuroml/FvsI_CA1.py diff --git a/moose-core/tests/python/neuroml/README b/moose-core/tests/python/_neuroml/README similarity index 100% rename from moose-core/tests/python/neuroml/README rename to moose-core/tests/python/_neuroml/README diff --git a/moose-core/tests/python/neuroml/__init__.py b/moose-core/tests/python/_neuroml/__init__.py similarity index 100% rename from moose-core/tests/python/neuroml/__init__.py rename to moose-core/tests/python/_neuroml/__init__.py diff --git a/moose-core/tests/python/neuroml/cells_channels/CA1soma.morph.xml b/moose-core/tests/python/_neuroml/cells_channels/CA1soma.morph.xml similarity index 100% rename from moose-core/tests/python/neuroml/cells_channels/CA1soma.morph.xml rename to moose-core/tests/python/_neuroml/cells_channels/CA1soma.morph.xml diff --git a/moose-core/tests/python/neuroml/cells_channels/Gran_KDr_98.xml b/moose-core/tests/python/_neuroml/cells_channels/Gran_KDr_98.xml similarity index 100% rename from moose-core/tests/python/neuroml/cells_channels/Gran_KDr_98.xml rename to moose-core/tests/python/_neuroml/cells_channels/Gran_KDr_98.xml diff --git a/moose-core/tests/python/neuroml/cells_channels/Gran_NaF_98.xml b/moose-core/tests/python/_neuroml/cells_channels/Gran_NaF_98.xml similarity index 100% rename from moose-core/tests/python/neuroml/cells_channels/Gran_NaF_98.xml rename to moose-core/tests/python/_neuroml/cells_channels/Gran_NaF_98.xml diff --git a/moose-core/tests/python/neuroml/cells_channels/Purkinje_KA.xml b/moose-core/tests/python/_neuroml/cells_channels/Purkinje_KA.xml similarity index 100% rename from moose-core/tests/python/neuroml/cells_channels/Purkinje_KA.xml rename to moose-core/tests/python/_neuroml/cells_channels/Purkinje_KA.xml diff --git a/moose-core/tests/python/neuroml/cells_channels/README b/moose-core/tests/python/_neuroml/cells_channels/README similarity index 100% rename from moose-core/tests/python/neuroml/cells_channels/README rename to moose-core/tests/python/_neuroml/cells_channels/README diff --git a/moose-core/tests/python/neuroml/cells_channels/hd.xml b/moose-core/tests/python/_neuroml/cells_channels/hd.xml similarity index 100% rename from moose-core/tests/python/neuroml/cells_channels/hd.xml rename to moose-core/tests/python/_neuroml/cells_channels/hd.xml diff --git a/moose-core/tests/python/neuroml/cells_channels/hd_minus73.xml b/moose-core/tests/python/_neuroml/cells_channels/hd_minus73.xml similarity index 100% rename from moose-core/tests/python/neuroml/cells_channels/hd_minus73.xml rename to moose-core/tests/python/_neuroml/cells_channels/hd_minus73.xml diff --git a/moose-core/tests/python/neuroml/cells_channels/kad.xml b/moose-core/tests/python/_neuroml/cells_channels/kad.xml similarity index 100% rename from moose-core/tests/python/neuroml/cells_channels/kad.xml rename to moose-core/tests/python/_neuroml/cells_channels/kad.xml diff --git a/moose-core/tests/python/neuroml/cells_channels/kap.xml b/moose-core/tests/python/_neuroml/cells_channels/kap.xml similarity index 100% rename from moose-core/tests/python/neuroml/cells_channels/kap.xml rename to moose-core/tests/python/_neuroml/cells_channels/kap.xml diff --git a/moose-core/tests/python/neuroml/cells_channels/kdr.xml b/moose-core/tests/python/_neuroml/cells_channels/kdr.xml similarity index 100% rename from moose-core/tests/python/neuroml/cells_channels/kdr.xml rename to moose-core/tests/python/_neuroml/cells_channels/kdr.xml diff --git a/moose-core/tests/python/neuroml/cells_channels/na3.xml b/moose-core/tests/python/_neuroml/cells_channels/na3.xml similarity index 100% rename from moose-core/tests/python/neuroml/cells_channels/na3.xml rename to moose-core/tests/python/_neuroml/cells_channels/na3.xml diff --git a/moose-core/tests/python/neuroml/cells_channels/nax.xml b/moose-core/tests/python/_neuroml/cells_channels/nax.xml similarity index 100% rename from moose-core/tests/python/neuroml/cells_channels/nax.xml rename to moose-core/tests/python/_neuroml/cells_channels/nax.xml diff --git a/moose-core/tests/python/neuroml/cells_channels/pas.xml b/moose-core/tests/python/_neuroml/cells_channels/pas.xml similarity index 100% rename from moose-core/tests/python/neuroml/cells_channels/pas.xml rename to moose-core/tests/python/_neuroml/cells_channels/pas.xml diff --git a/moose-core/tests/python/neuroml/count.py b/moose-core/tests/python/_neuroml/count.py similarity index 100% rename from moose-core/tests/python/neuroml/count.py rename to moose-core/tests/python/_neuroml/count.py diff --git a/moose-core/tests/python/genesis/acc11.g b/moose-core/tests/python/genesis/acc11.g new file mode 100644 index 0000000000000000000000000000000000000000..43c1fbacd8031a9bcf83c60ae952133402ceecaa --- /dev/null +++ b/moose-core/tests/python/genesis/acc11.g @@ -0,0 +1,204 @@ +//genesis +// kkit Version 8 flat dumpfile + +// Saved on Mon Nov 12 13:36:11 2001 + +include kkit {argv 1} + +FASTDT = 1e-05 +SIMDT = 0.001 +CONTROLDT = 1 +PLOTDT = 0.1 +MAXTIME = 400 +TRANSIENT_TIME = 5 +VARIABLE_DT_FLAG = 1 +DEFAULT_VOL = 1.6667e-21 +VERSION = 8.0 +setfield /file/modpath value /home2/bhalla/scripts/modules +kparms + +//genesis + +initdump -version 3 -ignoreorphans 1 +simobjdump table input output alloced step_mode stepsize x y z +simobjdump xtree path script namemode sizescale +simobjdump xcoredraw xmin xmax ymin ymax +simobjdump xtext editable +simobjdump xgraph xmin xmax ymin ymax overlay +simobjdump xplot pixflags script fg ysquish do_slope wy +simobjdump group xtree_fg_req xtree_textfg_req plotfield expanded movealone \ + link savename file version md5sum mod_save_flag x y z +simobjdump kpool CoTotal CoInit Co n nInit nTotal nMin vol slave_enable notes \ + xtree_fg_req xtree_textfg_req x y z +simobjdump kreac kf kb notes xtree_fg_req xtree_textfg_req x y z +simobjdump kenz CoComplexInit CoComplex nComplexInit nComplex vol k1 k2 k3 \ + keepconc usecomplex notes xtree_fg_req xtree_textfg_req link x y z +simobjdump stim level1 width1 delay1 level2 width2 delay2 baselevel trig_time \ + trig_mode notes xtree_fg_req xtree_textfg_req is_running x y z +simobjdump xtab input output alloced step_mode stepsize notes editfunc \ + xtree_fg_req xtree_textfg_req baselevel last_x last_y is_running x y z +simobjdump kchan perm gmax Vm is_active use_nernst notes xtree_fg_req \ + xtree_textfg_req x y z +simobjdump proto x y z +simobjdump linkinfo xtree_fg_req xtree_textfg_req uplink downlink x y z +simobjdump uplink xtree_fg_req xtree_textfg_req x y z +simobjdump downlink xtree_fg_req xtree_textfg_req x y z +simobjdump mirror notes xtree_fg_req x y z +simundump group /kinetics/neuroNOS 0 yellow black x 0 0 "" neuroNOS \ + /home2/bhalla/scripts/modules/neuroNOS_0.g 0 0 0 -19 -20 0 +simundump kpool /kinetics/neuroNOS/nNOS 0 5 0.5 0.5 0.5 0.5 5 0 1 0 "" 27 \ + yellow -15 -17 0 +simundump kpool /kinetics/neuroNOS/Ca-CaM_nNOS 0 0 0 0 0 0 0 0 1 0 "" 33 \ + yellow -17 -11 0 +simundump kreac /kinetics/neuroNOS/Ca-CaMbind-nNOS 0 3.25 0.05 "" white \ + yellow -16 -14 0 +simundump kreac /kinetics/neuroNOS/nNOSbindArg 0 0.5 81 "" white yellow -18 \ + -14 0 +simundump kpool /kinetics/neuroNOS/L-Arg 0 100 100 100 100 100 100 0 1 0 "" 9 \ + yellow -17 -17 0 +simundump kreac /kinetics/neuroNOS/k1 0 25 0 "" white yellow -20 -14 0 +simundump kreac /kinetics/neuroNOS/k3 0 19 0 "" white yellow -22 -14 0 +simundump kpool /kinetics/neuroNOS/OH.Arg 0 0 0 0 0 0 0 0 1 0 "" 34 yellow \ + -25 -11 0 +simundump kpool /kinetics/neuroNOS/nNOS.Cit+NO 0 0 0 0 0 0 0 0 1 0 "" 62 \ + yellow -21 -17 0 +simundump kpool /kinetics/neuroNOS/Cit 0 0 0 0 0 0 0 0 1 0 "" 12 yellow -23 \ + -17 0 +simundump kpool /kinetics/neuroNOS/NO 0 5 0 0 0 0 5 0 1 0 "" 4 yellow -25 -17 \ + 0 +simundump kreac /kinetics/neuroNOS/k4 0 2.7 0 "" white yellow -22 -20 0 +simundump kpool /kinetics/neuroNOS/nNOS.OH.Arg 0 0 0 0 0 0 0 0 1 0 "" 27 \ + yellow -21 -11 0 +simundump kpool /kinetics/neuroNOS/nNOS.arg 0 0 0 0 0 0 0 0 1 0 "" 6 yellow \ + -19 -11 0 +simundump kreac /kinetics/neuroNOS/k2 0 4.4 0 "" white yellow -24 -14 0 +simundump kpool /kinetics/neuroNOS/CaM-Ca4 1 5.0003 0 0 0 0 5.0003 0 1 0 "" \ + blue yellow -15 -11 0 +simundump xgraph /graphs/conc1 0 0 400 -0.05 0.05 0 +simundump xgraph /graphs/conc2 0 0 400 0 0.0015779 0 +simundump xplot /graphs/conc1/neurogranin.Co 3 524288 \ + "delete_plot.w <s> <d>; edit_plot.D <w>" red 0 0 1 +simundump xplot /graphs/conc1/neurogranin*.Co 3 524288 \ + "delete_plot.w <s> <d>; edit_plot.D <w>" red 0 0 1 +simundump xplot /graphs/conc2/CaM-Ca4.Co 3 524288 \ + "delete_plot.w <s> <d>; edit_plot.D <w>" blue 0 0 1 +simundump xgraph /moregraphs/conc3 0 0 400 99.666 100 0 +simundump xgraph /moregraphs/conc4 0 0 400 0 0.27092 0 +simundump xplot /moregraphs/conc3/L-Arg.Co 3 524288 \ + "delete_plot.w <s> <d>; edit_plot.D <w>" 9 0 0 1 +simundump xplot /moregraphs/conc4/nNOS.OH.Arg.Co 3 524288 \ + "delete_plot.w <s> <d>; edit_plot.D <w>" 27 0 0 1 +simundump xplot /moregraphs/conc4/NO.Co 3 524288 \ + "delete_plot.w <s> <d>; edit_plot.D <w>" 4 0 0 1 +simundump xcoredraw /edit/draw 0 -27 -13 -22 -9 +simundump xtree /edit/draw/tree 0 \ + /kinetics/#[],/kinetics/#[]/#[],/kinetics/#[]/#[]/#[][TYPE!=proto],/kinetics/#[]/#[]/#[][TYPE!=linkinfo]/##[] \ + "edit_elm.D <v>; drag_from_edit.w <d> <S> <x> <y> <z>" auto 0.6 +simundump xtext /file/notes 0 1 +xtextload /file/notes \ +"Incorporated basal dephosph of " \ +"neurogranin which gives around 20%" \ +"phosph at basal PKC activity." \ +"Deleted CONSERVE msg from Ca to" \ +"itself." +addmsg /kinetics/neuroNOS/Ca-CaMbind-nNOS /kinetics/neuroNOS/nNOS REAC A B +addmsg /kinetics/neuroNOS/Ca-CaMbind-nNOS /kinetics/neuroNOS/Ca-CaM_nNOS REAC B A +addmsg /kinetics/neuroNOS/nNOSbindArg /kinetics/neuroNOS/Ca-CaM_nNOS REAC A B +addmsg /kinetics/neuroNOS/Ca-CaM_nNOS /kinetics/neuroNOS/Ca-CaMbind-nNOS PRODUCT n +addmsg /kinetics/neuroNOS/nNOS /kinetics/neuroNOS/Ca-CaMbind-nNOS SUBSTRATE n +addmsg /kinetics/neuroNOS/CaM-Ca4 /kinetics/neuroNOS/Ca-CaMbind-nNOS SUBSTRATE n +addmsg /kinetics/neuroNOS/L-Arg /kinetics/neuroNOS/nNOSbindArg SUBSTRATE n +addmsg /kinetics/neuroNOS/nNOS.arg /kinetics/neuroNOS/nNOSbindArg PRODUCT n +addmsg /kinetics/neuroNOS/Ca-CaM_nNOS /kinetics/neuroNOS/nNOSbindArg SUBSTRATE n +addmsg /kinetics/neuroNOS/nNOSbindArg /kinetics/neuroNOS/L-Arg REAC A B +addmsg /kinetics/neuroNOS/nNOS.arg /kinetics/neuroNOS/k1 SUBSTRATE n +addmsg /kinetics/neuroNOS/nNOS.OH.Arg /kinetics/neuroNOS/k1 PRODUCT n +addmsg /kinetics/neuroNOS/nNOS.OH.Arg /kinetics/neuroNOS/k3 SUBSTRATE n +addmsg /kinetics/neuroNOS/nNOS.Cit+NO /kinetics/neuroNOS/k3 PRODUCT n +addmsg /kinetics/neuroNOS/k2 /kinetics/neuroNOS/OH.Arg REAC B A +addmsg /kinetics/neuroNOS/k3 /kinetics/neuroNOS/nNOS.Cit+NO REAC B A +addmsg /kinetics/neuroNOS/k4 /kinetics/neuroNOS/nNOS.Cit+NO REAC A B +addmsg /kinetics/neuroNOS/k4 /kinetics/neuroNOS/Cit REAC B A +addmsg /kinetics/neuroNOS/k4 /kinetics/neuroNOS/NO REAC B A +addmsg /kinetics/neuroNOS/nNOS.Cit+NO /kinetics/neuroNOS/k4 SUBSTRATE n +addmsg /kinetics/neuroNOS/Cit /kinetics/neuroNOS/k4 PRODUCT n +addmsg /kinetics/neuroNOS/NO /kinetics/neuroNOS/k4 PRODUCT n +addmsg /kinetics/neuroNOS/k2 /kinetics/neuroNOS/nNOS.OH.Arg REAC A B +addmsg /kinetics/neuroNOS/k3 /kinetics/neuroNOS/nNOS.OH.Arg REAC A B +addmsg /kinetics/neuroNOS/k1 /kinetics/neuroNOS/nNOS.OH.Arg REAC B A +addmsg /kinetics/neuroNOS/nNOSbindArg /kinetics/neuroNOS/nNOS.arg REAC B A +addmsg /kinetics/neuroNOS/k1 /kinetics/neuroNOS/nNOS.arg REAC A B +addmsg /kinetics/neuroNOS/nNOS.OH.Arg /kinetics/neuroNOS/k2 SUBSTRATE n +addmsg /kinetics/neuroNOS/OH.Arg /kinetics/neuroNOS/k2 PRODUCT n +addmsg /kinetics/neuroNOS/Ca-CaMbind-nNOS /kinetics/neuroNOS/CaM-Ca4 REAC A B +addmsg /kinetics/neuroNOS/CaM-Ca4 /graphs/conc2/CaM-Ca4.Co PLOT Co *CaM-Ca4.Co *blue +addmsg /kinetics/neuroNOS/L-Arg /moregraphs/conc3/L-Arg.Co PLOT Co *L-Arg.Co *9 +addmsg /kinetics/neuroNOS/nNOS.OH.Arg /moregraphs/conc4/nNOS.OH.Arg.Co PLOT Co *nNOS.OH.Arg.Co *27 +addmsg /kinetics/neuroNOS/NO /moregraphs/conc4/NO.Co PLOT Co *NO.Co *4 +enddump +// End of dump + +call /kinetics/neuroNOS/nNOS/notes LOAD \ +"neuronal Nitric Oxide Synthase." \ +"Found in the neurons, activity is dependent on CaM binding," \ +"in response to Ca levels." \ +"" \ +"Molecular weight ~160 kDa." \ +"" +call /kinetics/neuroNOS/Ca-CaM_nNOS/notes LOAD \ +"The CaM-Ca bound nNOS, which is the acitve form." +call /kinetics/neuroNOS/Ca-CaMbind-nNOS/notes LOAD \ +"Those binding CaM have a high Kd, including nNOS, ~ <=10 nM." \ +"Calcium mediated nNOS activity is required for NO synthesis." \ +"Rates from experiments...The binding of CaM to NOS has been " \ +"demonstrated to act as the trigger necessary for electron " \ +"transfer and catalytic activity.(Marletta, Biochemistry," \ +"1997;36:12337-12345)" \ +"" +call /kinetics/neuroNOS/nNOSbindArg/notes LOAD \ +"from Stuehr et al., Biochem,1999,38(38):12446-12451." \ +"Steuhr et al., from stopped flow expts of sub binding to nNOS report" \ +"0.5 (k-1) and 81 (k2)." \ +"" \ +"rates used straight from results." \ +"" +call /kinetics/neuroNOS/L-Arg/notes LOAD \ +"The intracellular concentrations are atleast 100 uM." \ +"Substrate for nNOS." +call /kinetics/neuroNOS/k1/notes LOAD \ +"Rates from Iwanaga et al., Biochem, 1999;38(50):16629-16635." \ +"Obtained from rapid quenching expts at 25 C." \ +"" \ +">>>>>> 25 +/- 2.0 " +call /kinetics/neuroNOS/k3/notes LOAD \ +"Rate from Biochem., 1999, 38(50), 16629-16635." \ +"Obtained from rapid queching expts at 25 C" \ +"" \ +">>>>>> 19 +/- 3.0" +call /kinetics/neuroNOS/nNOS.Cit+NO/notes LOAD \ +"Citrulline and NO basically dissociate from the NOS enzyme " \ +"complex, and this is the NOS bound with Citrulline and NO, and" \ +"they dissociate in the subsequent step." \ +"" +call /kinetics/neuroNOS/NO/notes LOAD \ +"Endogenously produced NO concentrations in the course of" \ +"signal transduction processes are < 100 nM. (Varner et al.," \ +"Nitric oxide in the nervous system, Academic press, London, UK," \ +"pp.191-206.)" +call /kinetics/neuroNOS/k4/notes LOAD \ +"Rate from Biochem., 1999, 38(50), 16629-16635." \ +"from rapid quenching expts at 25 C" \ +"" \ +">>>>>> 2.7 +/- 0.3" +call /kinetics/neuroNOS/nNOS.OH.Arg/notes LOAD \ +"This is the intermediate formed during the catalytic activity " \ +"of NOS in synthesising NO, N-hydroxy arginine." +call /kinetics/neuroNOS/nNOS.arg/notes LOAD \ +"Arginine binds to NOS first before the synthesis of NO from" \ +"L-Arginine." +call /kinetics/neuroNOS/k2/notes LOAD \ +"Rates from Biochem., 1999, 38(50), 16629-16635." \ +"obtained from rapid quenching expts at 25 C...." \ +"" \ +">>>>>> 4.4 +/- 0.5" +complete_loading diff --git a/moose-core/tests/python/mus/rc19.py b/moose-core/tests/python/mus/rc19.py index b98e4f2fd7cf2899a68ac77219c9f4042a862a67..fa0d596b78a08f491a1f8b5505147cae31951a41 100644 --- a/moose-core/tests/python/mus/rc19.py +++ b/moose-core/tests/python/mus/rc19.py @@ -47,18 +47,15 @@ # Code: """Cell morphology and passive properties from Branco et al 2010.""" from __future__ import print_function - -__author__ = 'Subhasis Ray' +__author__ = 'Subhasis Ray, Dilawar Sing' import sys import moose from moose import utils as mutils from synapse import * -from matplotlib import pyplot as plt import numpy as np from settings import * - from nachannel import * from kchannel import * from cachannel import * @@ -232,7 +229,6 @@ def run_sim_parallel(passive=True, solver='hsolve'): moose.reinit() moose.start(tstop) print('$$$$$$$$$$$', moose.element('/clock' ).currentTime) - fig = plt.figure() axes_vm = fig.add_subplot(111) # axes_vm_out = fig.add_subplot(121) # axes_vm_in = fig.add_subplot(122, sharex=axes_vm_out, sharey=axes_vm_out) @@ -250,28 +246,6 @@ def run_sim_parallel(passive=True, solver='hsolve'): v = dinfo['soma_vm'].vector t = np.linspace(0, tstop, len(v)) print('num points=', len(t), 't0=', t[0], 't_last=', t[-1], 'v0=', v[0], 'v_last=', v[-1]) - axes_vm.plot(t, v) - # if ii % 2 == 0: - # axes_vm_in.plot(t, - # v, - # color=color[ii]) - # else: - # axes_vm_out.plot(t, - # v, - # color=color[ii]) - # for tab in dinfo['nmda_gk']: - # axes_nmda.plot(np.linspace(0, tstop, len(tab.vector)), - # tab.vector, color=color[ii]) - # # axes_nmda.legend() - # for tab in dinfo['ampa_gk']: - # axes_ampa.plot(np.linspace(0, tstop, len(tab.vector)), - # tab.vector, label='%s/%s' % (dinfo['data'].name, tab.name), color=color[ii]) - # axes_vm.legend([plt.Line2D([0], [0], color=color[ii]) for ii in range(len(stim_order))], - # [str(st) for st in stim_order]) - #axes_vm.legend() - #axes_nmda.legend() - #axes_ampa.legend() - plt.show() if __name__ == '__main__': if len(sys.argv) > 1: diff --git a/moose-core/tests/python/test_difshells.py b/moose-core/tests/python/test_difshells.py index 005899d17e555cb59342cee7a13bed2c4171a6dc..4ba00d8a59d15fc53de39e4bd3b07c34b0eff0d8 100644 --- a/moose-core/tests/python/test_difshells.py +++ b/moose-core/tests/python/test_difshells.py @@ -1,15 +1,12 @@ # -*- coding: utf-8 -*- import moose import numpy as np -import matplotlib.pyplot as plt import chan_proto import param_chan from params import * def linoid(x, param): - # plt.figure() - # plt.plot(x,(param[2]+np.exp((V+param[3])/param[4]))) den = (param[2] + np.exp((V + param[3]) / param[4])) nom = (param[0] + param[1] * V) return nom / den @@ -190,4 +187,3 @@ if __name__ == '__main__': header += ' difshell_' + str(i) + '_difbuff_' + str(j) np.savetxt(fname, res, header=header, comments='') - # plt.show() diff --git a/moose-core/tests/python/test_files b/moose-core/tests/python/test_files new file mode 120000 index 0000000000000000000000000000000000000000..6866342fef1358942b9b3b6ec9cab60ca636824c --- /dev/null +++ b/moose-core/tests/python/test_files @@ -0,0 +1 @@ +../../python/moose/neuroml2/test_files \ No newline at end of file diff --git a/moose-core/tests/python/test_kkit.py b/moose-core/tests/python/test_kkit.py index de2a1c692ddcd9243f2262fd314d853c76215eaf..8ba4fd2b3f57eb643e4bf537695c5f4012b4ea5a 100644 --- a/moose-core/tests/python/test_kkit.py +++ b/moose-core/tests/python/test_kkit.py @@ -1,9 +1,5 @@ # -*- coding: utf-8 -*- -import matplotlib -# Tests may be run over ssh without -X e.g. on travis. -matplotlib.use( 'Agg' ) -import matplotlib.pyplot as plt import numpy import sys import os @@ -49,15 +45,11 @@ def main(): # Display all plots. for x in moose.wildcardFind( '/model/#graphs/conc#/#' ): t = numpy.arange( 0, x.vector.size, 1 ) * x.dt - plt.plot( t, x.vector, label=x.name ) vals = x.vector stats = [ vals.min(), vals.max( ), vals.mean(), vals.std( ) ] expected = [ 0.0, 0.00040464 , 0.0001444 , 0.00013177 ] assert numpy.allclose(stats, expected, rtol=1e-4) , 'Got %s expected %s' % (stats, expected ) - plt.legend() - plt.savefig( '%s.png' % sys.argv[0] ) - print( 'Wrote results to %s.png' % sys.argv[0] ) # Run the 'main' if this script is executed standalone. if __name__ == '__main__': diff --git a/moose-core/tests/python/test_negative_value_flag.py b/moose-core/tests/python/test_negative_value_flag.py new file mode 100644 index 0000000000000000000000000000000000000000..35c37ad7c83c01dc35faeaa28e6abb568cda2fc6 --- /dev/null +++ b/moose-core/tests/python/test_negative_value_flag.py @@ -0,0 +1,70 @@ +# test_negative_value_flag.py --- +# +# Filename: test_negative_value_flag.py +# Description: +# Author: Upi Bhalla +# Maintainer: Dilawar Singh <dilawars@ncbs.res.in> +# Created: Sat Oct 04 12:14:15 2014 (+0530) + +import moose +import numpy as np +import sys +import os + +scriptDir = os.path.dirname( os.path.realpath( __file__ ) ) + +def main(): + """ + This example illustrates loading, running, and saving a kinetic + model defined in kkit format. It uses a default kkit model but + you can specify another using the command line + ``python filename runtime solver``. + We use the gsl solver here. + The model already defines a couple of plots and sets the runtime 20 secs. + """ + + solver = "gsl" # Pick any of gsl, gssa, ee.. + mfile = os.path.join( scriptDir, './genesis/acc11.g' ) + runtime = 1000.0 + if ( len( sys.argv ) >= 3 ): + if sys.argv[1][0] == '/': + mfile = sys.argv[1] + else: + mfile = sys.argv[1] + runtime = float( sys.argv[2] ) + if ( len( sys.argv ) == 4 ): + solver = sys.argv[3] + + modelId = moose.loadModel( mfile, 'model', solver ) + moose.element( '/model/kinetics/neuroNOS/nNOS.arg' ).concInit = 0.1 + moose.reinit() + moose.start( runtime ) + + # Display all plots. + for x in moose.wildcardFind( '/model/#graphs/conc#/#' ): + t = np.arange( 0, x.vector.size, 1 ) * x.dt + print( x.vector ) + if x.vector.size > 0: + assert min( x.vector ) >= 0.0, min(x.vector) + assert x.vector.size in [0, 10001], x.vector.size + + ######################################################## + # Run it again with negative values allowed + moose.element( '/model/kinetics/stoich' ).allowNegative = True + moose.reinit() + moose.start( runtime ) + oneValIsBelowZero = False + allVals = [ ] + for x in moose.wildcardFind( '/model/#graphs/conc#/#' ): + t = np.arange( 0, x.vector.size, 1 ) * x.dt + if x.vector.size > 0: + allVals.append( min( x.vector ) ) + if min( x.vector ) <= 0.0: + oneValIsBelowZero = True + + if allVals: + assert oneValIsBelowZero, "No value is negative: %s" % allVals + assert x.vector.size in [0, 10001], x.vector.size + +if __name__ == '__main__': + main() diff --git a/moose-core/tests/python/test_neuroml.py b/moose-core/tests/python/test_neuroml.py index b6174b611b502994135266ddbb4dbcd81331f7f9..6bca818d6429fa85381bed6ba515692ada652bd3 100644 --- a/moose-core/tests/python/test_neuroml.py +++ b/moose-core/tests/python/test_neuroml.py @@ -1,9 +1,6 @@ # -*- coding: utf-8 -*- -"""ca1_test.py: - Testing scripts for CA1. - -""" +from __future__ import absolute_import, print_function, division __author__ = "Dilawar Singh" __copyright__ = "Copyright 2015, Dilawar Singh and NCBS Bangalore" @@ -19,15 +16,16 @@ import os # the model lives in the same directory as the test script modeldir = os.path.dirname(__file__) -from neuroml.FvsI_CA1 import ca1_main, loadModel -from neuroml.CA1 import loadGran98NeuroML_L123 +import _neuroml +from _neuroml.FvsI_CA1 import ca1_main, loadModel +from _neuroml.CA1 import loadGran98NeuroML_L123 def test_all(): test_ca1() test_gran() def test_ca1(): - p = os.path.join(modeldir, 'neuroml/cells_channels/CA1soma.morph.xml') + p = os.path.join(modeldir, '_neuroml/cells_channels/CA1soma.morph.xml') loadModel(p) assert 10 == ca1_main(4e-13) assert 20 == ca1_main(8e-13) @@ -35,7 +33,7 @@ def test_ca1(): assert 34 == ca1_main(18e-13) def test_gran(): - p = os.path.join(modeldir, 'neuroml/CA1soma.net.xml') + p = os.path.join(modeldir, '_neuroml/CA1soma.net.xml') assert loadGran98NeuroML_L123(p) in [8,9] if __name__ == '__main__': diff --git a/moose-core/tests/python/test_neuroml2.py b/moose-core/tests/python/test_neuroml2.py new file mode 100644 index 0000000000000000000000000000000000000000..5155515d12e139bef053aaba01f3b9b2c219b387 --- /dev/null +++ b/moose-core/tests/python/test_neuroml2.py @@ -0,0 +1,90 @@ +# -*- coding: utf-8 -*- +# test_neurom2.py, modified from run_cell.py +# Description: +# Author: +# Maintainer: P Gleeson, Dilawar Singh +# Version: +# URL: +# Keywords: +# Compatibility: +# +# + +# Commentary: +# +# +# +# + +# Change log: +# +# +# +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 3, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, Fifth +# Floor, Boston, MA 02110-1301, USA. +# +# + +# Code: + +from __future__ import absolute_import, print_function, division + +import moose +import moose.utils as mu +import sys +import os +import numpy as np + +SCRIPT_DIR = os.path.dirname( os.path.realpath( __file__ ) ) + +def run( nogui = True ): + global SCRIPT_DIR + filename = os.path.join(SCRIPT_DIR, 'test_files/passiveCell.nml' ) + mu.info('Loading: %s' % filename ) + nml = moose.mooseReadNML2( filename ) + if not nml: + mu.warn( "Failed to parse NML2 file" ) + return + + assert nml, "Expecting NML2 object" + msoma = nml.getComp(nml.doc.networks[0].populations[0].id,0,0) + data = moose.Neutral('/data') + pg = nml.getInput('pulseGen1') + + inj = moose.Table('%s/pulse' % (data.path)) + moose.connect(inj, 'requestOut', pg, 'getOutputValue') + + + vm = moose.Table('%s/Vm' % (data.path)) + moose.connect(vm, 'requestOut', msoma, 'getVm') + + simtime = 150e-3 + moose.reinit() + moose.start(simtime) + print("Finished simulation!") + t = np.linspace(0, simtime, len(vm.vector)) + yvec = vm.vector + injvec = inj.vector * 1e12 + m1, u1 = np.mean( yvec ), np.std( yvec ) + m2, u2 = np.mean( injvec ), np.std( injvec ) + assert np.isclose( m1, -0.0456943 ), m1 + assert np.isclose( u1, 0.0121968 ), u1 + assert np.isclose( m2, 26.64890 ), m2 + assert np.isclose( u2, 37.70607574 ), u2 + quit( 0 ) + +if __name__ == '__main__': + run( ) diff --git a/moose-core/tests/python/test_nsdf.py b/moose-core/tests/python/test_nsdf.py index bdec9641e6dab406d585246dc353754c84acf256..eb9a7f773884448075ed1f1c096963a8b3836d0c 100644 --- a/moose-core/tests/python/test_nsdf.py +++ b/moose-core/tests/python/test_nsdf.py @@ -81,7 +81,13 @@ crossing times as Event data. ''' nsdf.stringAttr[eventDataPath] = 's' if __name__ == '__main__': - setup_model() + try: + setup_model() + except AttributeError as e: + print( 'This MOOSE is not compiled with NSDF support' ) + quit(0) + except Exception as e: + raise e # Very basic tests nsdfFile = 'nsdf.txt' if not os.path.exists( nsdf.filename ): diff --git a/moose-core/tests/python/test_snippets.py b/moose-core/tests/python/test_snippets.py index c956f27a82084b2fd3f6f5a9e445e218ff7b41e8..45a00ba7a3086f948cb1f7b8bd9997421ec21030 100644 --- a/moose-core/tests/python/test_snippets.py +++ b/moose-core/tests/python/test_snippets.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- """test_snippets.py: - This script tests all the snippets. +This script tests all the snippets. """ from __future__ import print_function @@ -41,13 +41,6 @@ def executeCode(filepath): else: results_[filepath] = 'Failed' - #p = subprocess.Popen(["python", newfile.name] - #, stderr = subprocess.PIPE - #, stdout = subprocess.PIPE - #) - #output, err = p.communicate() - #print output, err - def main(): snippetPath = os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../Demos/snippets') print("Testing snippets in %s" % snippetPath)