diff --git a/moose-core/.pre-commit-config.yaml b/moose-core/.pre-commit-config.yaml index 5eccd7a7ee9cc0f150c876dff4905a98545b0306..f8aa18ad4cd7e81f73c6436ad0071e89de8ddce5 100644 --- a/moose-core/.pre-commit-config.yaml +++ b/moose-core/.pre-commit-config.yaml @@ -1,5 +1,6 @@ +repos: - repo: https://github.com/pre-commit/pre-commit-hooks - sha: v0.8.0 + sha: v1.2.1 hooks: - id: check-added-large-files - id: check-ast diff --git a/moose-core/.travis.yml b/moose-core/.travis.yml index f38c78cc58ebcdb6b26d6b499187f9e0cc48e36a..d1de05b822fc17bd41eb64d523a7a150ee23d96b 100644 --- a/moose-core/.travis.yml +++ b/moose-core/.travis.yml @@ -1,31 +1,37 @@ language: cpp -dist: trusty sudo: required group: edge -os: - - linux - - osx +services: + - docker +os: +- linux +- osx notifications: - email: - recipients: - - bhalla@ncbs.res.in - - dilawar.s.rajput@gmail.com - - hrani@ncbs.res.in - on_success: change - on_failure: always - -before_script : - - echo "OSX related" - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then nvm get head || true; fi - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then ./.travis/travis_prepare_osx.sh; fi - - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo ./.travis/travis_prepare_linux.sh; fi + email: + recipients: + - bhalla@ncbs.res.in + - dilawar.s.rajput@gmail.com + - hrani@ncbs.res.in + on_success: change + on_failure: always +before_script: +- echo "OSX related" +- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then nvm get head || true; fi +- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then ./.travis/travis_prepare_osx.sh; fi +- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo ./.travis/travis_prepare_linux.sh; + fi script: - - # checking if any python3 incompatible file is in the source tree. - - python2 -m compileall -q . - - if type python3 > /dev/null; then python3 -m compileall -q . ; fi - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then ./.travis/travis_build_osx.sh; fi - - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then ./.travis/travis_build_linux.sh; fi - - set +e +- +- python2 -m compileall -q . +- if type python3 > /dev/null; then python3 -m compileall -q . ; fi +- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then ./.travis/travis_build_osx.sh; fi +- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then ./.travis/travis_build_linux.sh; fi +- set +e + +deploy: + on: tags + provider: script + script: ./.travis/deploy_pypi.sh diff --git a/moose-core/.travis/deploy_pypi.sh b/moose-core/.travis/deploy_pypi.sh new file mode 100755 index 0000000000000000000000000000000000000000..ed7c978d94670761a90d4427abc71ef9c664ba2a --- /dev/null +++ b/moose-core/.travis/deploy_pypi.sh @@ -0,0 +1,22 @@ +#!/bin/bash - +#=============================================================================== +# +# FILE: deploy_pypi.sh +# +# USAGE: ./deploy_pypi.sh +# +# DESCRIPTION: Build docker image and deploy on PyPI. +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: Dilawar Singh (), dilawars@ncbs.res.in +# ORGANIZATION: NCBS Bangalore +# CREATED: Sunday 04 February 2018 11:46:32 IST +# REVISION: --- +#=============================================================================== +set -o nounset # Treat unset variables as an error + +git clone https://github.com/BhallaLab/pymoose-wheels +cd pymoose-wheels && docker build -t bhallalab/wheels . diff --git a/moose-core/CMakeLists.txt b/moose-core/CMakeLists.txt index f91b68e213f79a13762f83b5446734edfa703129..8737681d2a56b3d7eb57a3537f985075dda561b5 100644 --- a/moose-core/CMakeLists.txt +++ b/moose-core/CMakeLists.txt @@ -16,18 +16,28 @@ set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules") include(CheckCXXCompiler.cmake) include(CheckIncludeFileCXX) include(FindPkgConfig) -include(GetRevision) + +# getgit revision number +find_program( GIT_EXEC git ) +if(GIT_EXEC) + execute_process(COMMAND ${GIT_EXEC} rev-parse --short HEAD + OUTPUT_VARIABLE GIT_HEAD + OUTPUT_STRIP_TRAILING_WHITESPACE + ) +endif() # 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. -set(MOOSE_VERSION 3.2-git) -add_definitions( -DMOOSE_VERSION="${MOOSE_VERSION}") -message( STATUS "MOOSE Version ${MOOSE_VERSION}" ) +if(NOT VERSION_MOOSE) + set(VERSION_MOOSE "3.2.0rc1-${GIT_HEAD}") +endif( ) +add_definitions( -DMOOSE_VERSION="${VERSION_MOOSE}") +message( STATUS "MOOSE Version ${VERSION_MOOSE}" ) -# 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} ) +# Write VERSION to a file VERSION so that setup.cmake.py can use it. +set(VERSION_FILE ${CMAKE_CURRENT_SOURCE_DIR}/python/VERSION) +message(STATUS "+ Writing ${VERSION_MOOSE} to ${VERSION_FILE}" ) +file(WRITE ${VERSION_FILE} ${VERSION_MOOSE} ) # This snippet is from LLVM project. # Sanity check our source directory to make sure that we are not trying to @@ -268,19 +278,24 @@ endif(WITH_BOOST) # these two types because of --whole-archive option. See # BhallaLab/moose-core#66, if(WITH_GSL) - message(STATUS "Using gsl libraries: ${GSL_LIBRARIES}") - foreach(GSL_LIB ${GSL_LIBRARIES} ) - if(GSL_LIB) - get_filename_component( GSL_LIB_EXT ${GSL_LIB} EXT ) - if(GSL_LIB_EXT) - if(GSL_LIB_EXT STREQUAL ".a" ) - list(APPEND STATIC_LIBRARIES ${GSL_LIB}) - else() - list(APPEND SYSTEM_SHARED_LIBS ${GSL_LIB}) - endif( ) - endif( ) - endif( ) - endforeach( ) + if(GSL_STATIC_LIBRARIES) + message( STATUS "Using static libraries ${GSL_STATIC_LIBRARIES}" ) + list(APPEND STATIC_LIBRARIES ${GSL_STATIC_LIBRARIES}) + else( ) + message(STATUS "Using gsl libraries: ${GSL_LIBRARIES}") + foreach(GSL_LIB ${GSL_LIBRARIES} ) + if(GSL_LIB) + get_filename_component( GSL_LIB_EXT ${GSL_LIB} EXT ) + if(GSL_LIB_EXT) + if(GSL_LIB_EXT STREQUAL ".a" ) + list(APPEND STATIC_LIBRARIES ${GSL_LIB}) + else() + list(APPEND SYSTEM_SHARED_LIBS ${GSL_LIB}) + endif( ) + endif( ) + endif( ) + endforeach( ) + endif( ) endif() if(WITH_MPI) @@ -374,6 +389,7 @@ if(DEBUG) endif( WITH_BOOST ) endif() + ######################### BUILD PYMOOSE ######################################## add_subdirectory( pymoose ) @@ -434,8 +450,6 @@ if(${CMAKE_BUILD_TOOL} MATCHES "make") endif() - - ############################ CTEST ###################################### include( CTest ) # If CTEST_OUTPUT_ON_FAILURE environment variable is set, the output is printed diff --git a/moose-core/Jenkinsfile b/moose-core/Jenkinsfile deleted file mode 100644 index 2b8f686e173b685a42466d93da4128042eeca188..0000000000000000000000000000000000000000 --- a/moose-core/Jenkinsfile +++ /dev/null @@ -1,15 +0,0 @@ -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/README.md b/moose-core/README.md index 90d19144aadc5d514300fe7acb7805020739d400..dd8e63621de6d0da31186fdb10fd7f940c15e276 100644 --- a/moose-core/README.md +++ b/moose-core/README.md @@ -1,6 +1,18 @@ -[](https://travis-ci.org/BhallaLab/moose-core) +[](https://travis-ci.org/BhallaLab/moose-core) | [](https://badge.fury.io/py/pymoose) This is the core computational engine of [MOOSE simulator](https://github.com/BhallaLab/moose). This repository contains -C++ codebase and python interface. For more details about MOOSE simulator, see https://github.com/BhallaLab/moose/blob/master/README.md +C++ codebase and python interface called `pymoose`. For more details about MOOSE simulator, visit https://moose.ncbs.res.in . -This repository is sufficient for using MOOSE as a python module. If you just want to build moose python module, follow instructions given here at https://github.com/BhallaLab/moose-core/blob/master/INSTALL.md . +# Download and Install + +This repository is sufficient for using MOOSE as a python module. We provide python package via `pip`. + + $ pip install pymoose --user + +`pymoose` is part of [MOOSE simulator](https://github.com/BhallaLab/moose). We also provide linux packages of +MOOSE simlulator. It can be downloaded from [Open Build Service](https://software.opensuse.org//download.html?project=home%3Amoose&package=moose). +In addition to `pymoose`, it also contain a `GUI` to create and visualize chemical network, and `moogli`, a visualizer of neural activity. + +# Build + +To build `pymoose`, follow instructions given here at https://github.com/BhallaLab/moose-core/blob/master/INSTALL.md diff --git a/moose-core/builtins/Function.cpp b/moose-core/builtins/Function.cpp index 54224b27fc2a8c0bc3b04fb961cf3a02703f013d..79413c1bb0fea17bee2ebaff277423c278421456 100644 --- a/moose-core/builtins/Function.cpp +++ b/moose-core/builtins/Function.cpp @@ -150,7 +150,7 @@ const Cinfo * Function::initCinfo() "log2 1 logarithm to the base 2\n" "log10 1 logarithm to the base 10\n" "log 1 logarithm to the base 10\n" - "ln 1 logarithm to base e (2.71828...)\n" + "ln 1 logarithm to base e (2.71828...)\n" "exp 1 e raised to the power of x\n" "sqrt 1 square root of a value\n" "sign 1 sign function -1 if x<0; 1 if x>0\n" @@ -166,32 +166,34 @@ const Cinfo * Function::initCinfo() " if seed = -1, a 'random' seed is created using either\n" " by random_device or by reading system clock\n" "\nOperators\n" - "Op meaning priority\n" - "= assignment -1\n" - "&& logical and 1\n" - "|| logical or 2\n" - "<= less or equal 4\n" - ">= greater or equal 4\n" - "!= not equal 4\n" - "== equal 4\n" - "> greater than 4\n" - "< less than 4\n" - "+ addition 5\n" - "- subtraction 5\n" - "* multiplication 6\n" - "/ division 6\n" - "^ raise x to the power of y 7\n" - "% floating point modulo 7\n" + "Op meaning priority\n" + "= assignment -1\n" + "&& logical and 1\n" + "|| logical or 2\n" + "<= less or equal 4\n" + ">= greater or equal 4\n" + "!= not equal 4\n" + "== equal 4\n" + "> greater than 4\n" + "< less than 4\n" + "+ addition 5\n" + "- subtraction 5\n" + "* multiplication 6\n" + "/ division 6\n" + "^ raise x to the power of y 7\n" + "% floating point modulo 7\n" "\n" - "?: if then else operator C++ style syntax\n", + "?: if then else operator C++ style syntax\n", &Function::setExpr, - &Function::getExpr); + &Function::getExpr + ); static ValueFinfo< Function, unsigned int > numVars( "numVars", "Number of variables used by Function.", &Function::setNumVar, - &Function::getNumVar); + &Function::getNumVar + ); static FieldElementFinfo< Function, Variable > inputs( "x", @@ -199,7 +201,8 @@ const Cinfo * Function::initCinfo() Variable::initCinfo(), &Function::getVar, &Function::setNumVar, - &Function::getNumVar); + &Function::getNumVar + ); static LookupValueFinfo < Function, string, double > constants( "c", @@ -229,10 +232,7 @@ const Cinfo * Function::initCinfo() static DestFinfo reinit( "reinit", "Handles reinit call.", new ProcOpFunc< Function >( &Function::reinit ) ); - static Finfo* processShared[] = - { - &process, &reinit - }; + static Finfo* processShared[] = { &process, &reinit }; static SharedFinfo proc( "proc", "This is a shared message to receive Process messages " @@ -382,7 +382,7 @@ Function::Function(const Function& rhs): _numVar(rhs._numVar), Function& Function::operator=(const Function rhs) { - static Eref er; + static Eref er; _clearBuffer(); _mode = rhs._mode; _lastValue = rhs._lastValue; diff --git a/moose-core/cmake_modules/GetGitRevisionDescription.cmake b/moose-core/cmake_modules/GetGitRevisionDescription.cmake new file mode 100644 index 0000000000000000000000000000000000000000..8ab03bc5f0b766462e05edb6afbe9c20e8115b46 --- /dev/null +++ b/moose-core/cmake_modules/GetGitRevisionDescription.cmake @@ -0,0 +1,168 @@ +# - Returns a version string from Git +# +# These functions force a re-configure on each git commit so that you can +# trust the values of the variables in your build system. +# +# get_git_head_revision(<refspecvar> <hashvar> [<additional arguments to git describe> ...]) +# +# Returns the refspec and sha hash of the current head revision +# +# git_describe(<var> [<additional arguments to git describe> ...]) +# +# Returns the results of git describe on the source tree, and adjusting +# the output so that it tests false if an error occurs. +# +# git_get_exact_tag(<var> [<additional arguments to git describe> ...]) +# +# Returns the results of git describe --exact-match on the source tree, +# and adjusting the output so that it tests false if there was no exact +# matching tag. +# +# git_local_changes(<var>) +# +# Returns either "CLEAN" or "DIRTY" with respect to uncommitted changes. +# Uses the return code of "git diff-index --quiet HEAD --". +# Does not regard untracked files. +# +# Requires CMake 2.6 or newer (uses the 'function' command) +# +# Original Author: +# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net> +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010. +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +if(__get_git_revision_description) + return() +endif() +set(__get_git_revision_description YES) + +# We must run the following at "include" time, not at function call time, +# to find the path to this module rather than the path to a calling list file +get_filename_component(_gitdescmoddir ${CMAKE_CURRENT_LIST_FILE} PATH) + +function(get_git_head_revision _refspecvar _hashvar) + set(GIT_PARENT_DIR "${CMAKE_CURRENT_SOURCE_DIR}") + set(GIT_DIR "${GIT_PARENT_DIR}/.git") + while(NOT EXISTS "${GIT_DIR}") # .git dir not found, search parent directories + set(GIT_PREVIOUS_PARENT "${GIT_PARENT_DIR}") + get_filename_component(GIT_PARENT_DIR ${GIT_PARENT_DIR} PATH) + if(GIT_PARENT_DIR STREQUAL GIT_PREVIOUS_PARENT) + # We have reached the root directory, we are not in git + set(${_refspecvar} "GITDIR-NOTFOUND" PARENT_SCOPE) + set(${_hashvar} "GITDIR-NOTFOUND" PARENT_SCOPE) + return() + endif() + set(GIT_DIR "${GIT_PARENT_DIR}/.git") + endwhile() + # check if this is a submodule + if(NOT IS_DIRECTORY ${GIT_DIR}) + file(READ ${GIT_DIR} submodule) + string(REGEX REPLACE "gitdir: (.*)\n$" "\\1" GIT_DIR_RELATIVE ${submodule}) + get_filename_component(SUBMODULE_DIR ${GIT_DIR} PATH) + get_filename_component(GIT_DIR ${SUBMODULE_DIR}/${GIT_DIR_RELATIVE} ABSOLUTE) + endif() + set(GIT_DATA "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/git-data") + if(NOT EXISTS "${GIT_DATA}") + file(MAKE_DIRECTORY "${GIT_DATA}") + endif() + + if(NOT EXISTS "${GIT_DIR}/HEAD") + return() + endif() + set(HEAD_FILE "${GIT_DATA}/HEAD") + configure_file("${GIT_DIR}/HEAD" "${HEAD_FILE}" COPYONLY) + + configure_file("${_gitdescmoddir}/GetGitRevisionDescription.cmake.in" + "${GIT_DATA}/grabRef.cmake" + @ONLY) + include("${GIT_DATA}/grabRef.cmake") + + set(${_refspecvar} "${HEAD_REF}" PARENT_SCOPE) + set(${_hashvar} "${HEAD_HASH}" PARENT_SCOPE) +endfunction() + +function(git_describe _var) + if(NOT GIT_FOUND) + find_package(Git QUIET) + endif() + get_git_head_revision(refspec hash) + if(NOT GIT_FOUND) + set(${_var} "GIT-NOTFOUND" PARENT_SCOPE) + return() + endif() + if(NOT hash) + set(${_var} "HEAD-HASH-NOTFOUND" PARENT_SCOPE) + return() + endif() + + # TODO sanitize + #if((${ARGN}" MATCHES "&&") OR + # (ARGN MATCHES "||") OR + # (ARGN MATCHES "\\;")) + # message("Please report the following error to the project!") + # message(FATAL_ERROR "Looks like someone's doing something nefarious with git_describe! Passed arguments ${ARGN}") + #endif() + + #message(STATUS "Arguments to execute_process: ${ARGN}") + + execute_process(COMMAND + "${GIT_EXECUTABLE}" + describe + ${hash} + ${ARGN} + WORKING_DIRECTORY + "${CMAKE_CURRENT_SOURCE_DIR}" + RESULT_VARIABLE + res + OUTPUT_VARIABLE + out + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + if(NOT res EQUAL 0) + set(out "${out}-${res}-NOTFOUND") + endif() + + set(${_var} "${out}" PARENT_SCOPE) +endfunction() + +function(git_get_exact_tag _var) + git_describe(out --exact-match ${ARGN}) + set(${_var} "${out}" PARENT_SCOPE) +endfunction() + +function(git_local_changes _var) + if(NOT GIT_FOUND) + find_package(Git QUIET) + endif() + get_git_head_revision(refspec hash) + if(NOT GIT_FOUND) + set(${_var} "GIT-NOTFOUND" PARENT_SCOPE) + return() + endif() + if(NOT hash) + set(${_var} "HEAD-HASH-NOTFOUND" PARENT_SCOPE) + return() + endif() + + execute_process(COMMAND + "${GIT_EXECUTABLE}" + diff-index --quiet HEAD -- + WORKING_DIRECTORY + "${CMAKE_CURRENT_SOURCE_DIR}" + RESULT_VARIABLE + res + OUTPUT_VARIABLE + out + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + if(res EQUAL 0) + set(${_var} "CLEAN" PARENT_SCOPE) + else() + set(${_var} "DIRTY" PARENT_SCOPE) + endif() +endfunction() diff --git a/moose-core/cmake_modules/GetGitRevisionDescription.cmake.in b/moose-core/cmake_modules/GetGitRevisionDescription.cmake.in new file mode 100644 index 0000000000000000000000000000000000000000..6d8b708efe56a66852752a7a30ec5c16b51cdc9e --- /dev/null +++ b/moose-core/cmake_modules/GetGitRevisionDescription.cmake.in @@ -0,0 +1,41 @@ +# +# Internal file for GetGitRevisionDescription.cmake +# +# Requires CMake 2.6 or newer (uses the 'function' command) +# +# Original Author: +# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net> +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010. +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +set(HEAD_HASH) + +file(READ "@HEAD_FILE@" HEAD_CONTENTS LIMIT 1024) + +string(STRIP "${HEAD_CONTENTS}" HEAD_CONTENTS) +if(HEAD_CONTENTS MATCHES "ref") + # named branch + string(REPLACE "ref: " "" HEAD_REF "${HEAD_CONTENTS}") + if(EXISTS "@GIT_DIR@/${HEAD_REF}") + configure_file("@GIT_DIR@/${HEAD_REF}" "@GIT_DATA@/head-ref" COPYONLY) + else() + configure_file("@GIT_DIR@/packed-refs" "@GIT_DATA@/packed-refs" COPYONLY) + file(READ "@GIT_DATA@/packed-refs" PACKED_REFS) + if(${PACKED_REFS} MATCHES "([0-9a-z]*) ${HEAD_REF}") + set(HEAD_HASH "${CMAKE_MATCH_1}") + endif() + endif() +else() + # detached HEAD + configure_file("@GIT_DIR@/HEAD" "@GIT_DATA@/head-ref" COPYONLY) +endif() + +if(NOT HEAD_HASH) + file(READ "@GIT_DATA@/head-ref" HEAD_HASH LIMIT 1024) + string(STRIP "${HEAD_HASH}" HEAD_HASH) +endif() diff --git a/moose-core/cmake_moose_cpack.cmake b/moose-core/cmake_moose_cpack.cmake index 985c3fc40307d6a50c52680e8d9459e5d51b5d83..05e7f11498ea91f8b752601bdf5c4ac723e69199 100644 --- a/moose-core/cmake_moose_cpack.cmake +++ b/moose-core/cmake_moose_cpack.cmake @@ -58,7 +58,9 @@ if(APPLE) SET(BUNDLE_NAME ${CMAKE_PROJECT_NAME}) SET(CPACK_BUNDLE_NAME ${BUNDLE_NAME}) - SET_TARGET_PROPERTIES(moose.bin PROPERTIES MACOSX_BUNDLE TRUE) + if(DEBUG) + SET_TARGET_PROPERTIES(moose.bin PROPERTIES MACOSX_BUNDLE TRUE) + endif(DEBUG) SET_TARGET_PROPERTIES(_moose PROPERTIES MACOSX_BUNDLE TRUE) endif(APPLE) diff --git a/moose-core/pymoose/CMakeLists.txt b/moose-core/pymoose/CMakeLists.txt index d7c5c3c93f13d06713473e8537397fb9ee64f888..713ade07302e224a9600177fce2952d0a61dc791 100644 --- a/moose-core/pymoose/CMakeLists.txt +++ b/moose-core/pymoose/CMakeLists.txt @@ -76,7 +76,7 @@ ELSE(MACOSX) ${MOOSE_LIBRARIES} ${STATIC_LIBRARIES} "-Wl,--no-whole-archive" - ${PYTHON_LIBRARIES} + # ${PYTHON_LIBRARIES} ${SYSTEM_SHARED_LIBS} ) endif(MACOSX) diff --git a/moose-core/python/moose/SBML/readSBML.py b/moose-core/python/moose/SBML/readSBML.py index ff7b7dbc5d9bcefb3754ba172b17618f51ed396b..06de82bc3a7317fa1d8525be13e86fb1013d3026 100644 --- a/moose-core/python/moose/SBML/readSBML.py +++ b/moose-core/python/moose/SBML/readSBML.py @@ -970,7 +970,7 @@ def createRules(model, specInfoMap, globparameterIdValue): if (rule.isAssignment()): rule_variable = rule.getVariable() - if specInfoMap.has_key(rule_variable): + if rule_variable in specInfoMap: #In assignment rule only if pool exist, then that is conveted to moose as # this can be used as summation of pool's, P1+P2+P3 etc rule_variable = parentSp = str(idBeginWith(rule_variable)) @@ -993,10 +993,9 @@ def createRules(model, specInfoMap, globparameterIdValue): if found: allPools = True for i in ruleMemlist: - if specInfoMap.has_key(i): - pass - else: + if i not in specInfoMap: allPools = False + break if allPools: #only if addition then summation works, only then I create a function in moose # which is need to get the summation's output to a pool diff --git a/moose-core/python/rdesigneur/rdesigneur.py b/moose-core/python/rdesigneur/rdesigneur.py index 8665281d89c7954d9828930c5e492c18c59e5930..30906a2502bbe8143afb96d91bd8cc9ff3211af5 100644 --- a/moose-core/python/rdesigneur/rdesigneur.py +++ b/moose-core/python/rdesigneur/rdesigneur.py @@ -80,6 +80,8 @@ class rdesigneur: elecDt= 50e-6, # Same default as from MOOSE chemPlotDt = 1.0, # Same default as from MOOSE elecPlotDt = 0.1e-3, # Same default as from MOOSE + funcDt = 0.1e-3, # Used when turnOffElec is False. + # Otherwise system uses chemDt. cellProto = [], spineProto = [], chanProto = [], @@ -113,6 +115,7 @@ class rdesigneur: self.diffDt= diffDt self.elecDt= elecDt self.elecPlotDt= elecPlotDt + self.funcDt= funcDt self.chemPlotDt= chemPlotDt self.cellProtoList = cellProto @@ -640,8 +643,8 @@ class rdesigneur: ################################################################ # Here we display the plots and moogli ################################################################ - def displayMoogli( self, moogliDt, runtime, rotation = math.pi/500.0): - rmoogli.displayMoogli( self, moogliDt, runtime, rotation ) + def displayMoogli( self, moogliDt, runtime, rotation = math.pi/500.0, fullscreen = False): + rmoogli.displayMoogli( self, moogliDt, runtime, rotation, fullscreen ) def display( self ): import matplotlib.pyplot as plt @@ -925,12 +928,14 @@ class rdesigneur: elecPlotDt = self.elecPlotDt diffDt = self.diffDt chemDt = self.chemDt - for i in range( 0, 9 ): + for i in range( 0, 9 ): # Assign elec family of clocks moose.setClock( i, elecDt ) - moose.setClock( 8, elecPlotDt ) - moose.setClock( 10, diffDt ) - for i in range( 11, 18 ): + moose.setClock( 8, elecPlotDt ) + moose.setClock( 10, diffDt )# Assign diffusion clock. + for i in range( 11, 18 ): # Assign the chem family of clocks. moose.setClock( i, chemDt ) + if not self.turnOffElec: # Assign the Function clock + moose.setClock( 12, self.funcDt ) moose.setClock( 18, self.chemPlotDt ) hsolve = moose.HSolve( self.elecid.path + '/hsolve' ) hsolve.dt = elecDt diff --git a/moose-core/python/rdesigneur/rmoogli.py b/moose-core/python/rdesigneur/rmoogli.py index bd4ad97927876d076fb2c3c3610d80e036b66ed4..fcb1a1209f03b4f542f63b0fee38f169588dabb0 100644 --- a/moose-core/python/rdesigneur/rmoogli.py +++ b/moose-core/python/rdesigneur/rmoogli.py @@ -157,7 +157,7 @@ def makeMoogli( rd, mooObj, moogliEntry, fieldInfo ): viewer.attach_view(view) return viewer -def displayMoogli( rd, _dt, _runtime, _rotation ): +def displayMoogli( rd, _dt, _runtime, _rotation, fullscreen = False ): if not hasMoogli: return None global runtime @@ -167,7 +167,10 @@ def displayMoogli( rd, _dt, _runtime, _rotation ): moogliDt = _dt rotation = _rotation for i in rd.moogNames: - i.show() + if fullscreen: + i.showMaximized() + else: + i.show() i.start() #viewer.showMaximized() #viewer.show() diff --git a/moose-core/python/setup.cmake.py b/moose-core/python/setup.cmake.py index 8cd9faf17329584b8eb251b51428567130a53b7c..ebce90693b110574df448678fab379642e644880 100644 --- a/moose-core/python/setup.cmake.py +++ b/moose-core/python/setup.cmake.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- """setup.py: -Script to install python targets. +Script to install python targets. NOTE: This script is to be called by CMake. Not intended to be used standalone. @@ -19,12 +19,17 @@ __status__ = "Development" import os import sys -from distutils.core import setup +try: + from setuptools import setup +except Exception as e: + from distutils.core import setup + script_dir = os.path.dirname( os.path.abspath( __file__ ) ) -version = '3.2.git' +version = '3.2pre1' + 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 ) @@ -38,9 +43,9 @@ except Exception as e: suffix = '.so' setup( - name='moose', + name='pymoose', version=version, - description='MOOSE python scripting module.', + description='Python scripting interface of MOOSE Simulator (https://moose.ncbs.res.in)', author='MOOSERes', author_email='bhalla@ncbs.res.in', maintainer='Dilawar Singh', @@ -56,9 +61,9 @@ setup( , 'moose.chemUtil' , 'moose.chemMerge' ], + install_requires = [ 'python-libsbml', 'numpy' ], package_dir = { - 'moose' : 'moose' - , 'rdesigneur' : 'rdesigneur' + 'moose' : 'moose', 'rdesigneur' : 'rdesigneur' }, package_data = { 'moose' : ['_moose' + suffix, 'neuroml2/schema/NeuroMLCoreDimensions.xml'] }, ) diff --git a/moose-core/scripts/setup.py b/moose-core/setup.py similarity index 97% rename from moose-core/scripts/setup.py rename to moose-core/setup.py index 746ba5a078982dc72b6b08f694ee5adcce5bfb62..f7eec4a35346b44bb6c2a30ccf08369c151cfbe2 100755 --- a/moose-core/scripts/setup.py +++ b/moose-core/setup.py @@ -95,7 +95,7 @@ class InstallCommand(_install): self.new_dir = os.path.join(os.path.split(__file__)[0], 'python') os.chdir(self.new_dir) try: - ds.spawn(["python", "setup.py", "install"]) + ds.spawn(["python", "setup.cmake.py", "install"]) except ds.DistutilsExecError as e: print("Can't install PyMOOSE") print(e) @@ -150,7 +150,7 @@ setup( , description = description , license = "LGPL" , url = url - , long_description = read('README') + , long_description = read('./README.md') , ext_modules = [ Extension('_moose', [ '*' ]) ] diff --git a/moose-core/setup_/__init__.py b/moose-core/setup_/__init__.py deleted file mode 100644 index 50aca64a597d87ddbda39b60ac2ed743b7ccb993..0000000000000000000000000000000000000000 --- a/moose-core/setup_/__init__.py +++ /dev/null @@ -1,203 +0,0 @@ -# -*- coding: utf-8 -*- -sources = [ - 'basecode/consts.cpp', - 'basecode/Element.cpp', - 'basecode/Qinfo.cpp', - 'basecode/DataHandler.cpp', - 'basecode/ZeroDimHandler.cpp', - 'basecode/ZeroDimParallelHandler.cpp', - 'basecode/BlockHandler.cpp', - 'basecode/OneDimHandler.cpp', - 'basecode/TwoDimHandler.cpp', - 'basecode/AnyDimHandler.cpp', - 'basecode/DataHandlerWrapper.cpp', - 'basecode/FieldDataHandlerBase.cpp', - 'basecode/MsgDataHandler.cpp', - 'basecode/ZombieHandler.cpp', - 'basecode/Eref.cpp', - 'basecode/Finfo.cpp', - 'basecode/DestFinfo.cpp', - 'basecode/Cinfo.cpp', - 'basecode/SrcFinfo.cpp', - 'basecode/ValueFinfo.cpp', - 'basecode/SharedFinfo.cpp', - 'basecode/FieldElementFinfo.cpp', - 'basecode/Id.cpp', - 'basecode/ObjId.cpp', - 'basecode/DataId.cpp', - 'basecode/SetGet.cpp', - 'basecode/OpFunc.cpp', - 'basecode/FieldOpFunc.cpp', - 'basecode/SparseMatrix.cpp', - 'basecode/PrepackedBuffer.cpp', - 'basecode/FuncBarrier.cpp', - 'basecode/doubleEq.cpp', - 'basecode/ReduceBase.cpp', - 'basecode/main.cpp', - 'basecode/testAsync.cpp', - - 'biophysics/SynBase.cpp', - 'biophysics/IntFire.cpp', - 'biophysics/IzhikevichNrn.cpp', - 'biophysics/LeakyIaF.cpp', - 'biophysics/Synapse.cpp', - 'biophysics/Compartment.cpp', - 'biophysics/SymCompartment.cpp', - 'biophysics/ChanBase.cpp', - 'biophysics/SynChanBase.cpp', - 'biophysics/HHChannel.cpp', - 'biophysics/HHGate.cpp', - 'biophysics/SynChan.cpp', - 'biophysics/SpikeGen.cpp', - 'biophysics/CaConc.cpp', - 'biophysics/Nernst.cpp', - 'biophysics/GHK.cpp', - 'biophysics/NMDAChan.cpp', - 'biophysics/HHGate2D.cpp', - 'biophysics/HHChannel2D.cpp', - 'biophysics/MgBlock.cpp', - 'biophysics/VectorTable.cpp', - 'biophysics/MarkovRateTable.cpp', - 'biophysics/MarkovChannel.cpp', - 'biophysics/MarkovGslSolver.cpp', - 'biophysics/MatrixOps.cpp', - 'biophysics/MarkovSolverBase.cpp', - 'biophysics/MarkovSolver.cpp', - 'biophysics/ReadCell.cpp', - 'biophysics/testBiophysics.cpp', - - 'builtins/Arith.cpp', - 'builtins/Group.cpp', - 'builtins/Mdouble.cpp', - 'builtins/Mstring.cpp', - 'builtins/TableBase.cpp', - 'builtins/TableEntry.cpp', - 'builtins/Table.cpp', - 'builtins/StimulusTable.cpp', - 'builtins/Stats.cpp', - 'builtins/Interpol2D.cpp', - 'builtins/HDF5WriterBase.cpp', - 'builtins/HDF5DataWriter.cpp', - 'builtins/testBuiltins.cpp', - - 'device/PulseGen.cpp', - 'device/DiffAmp.cpp', - 'device/PIDController.cpp', - 'device/RC.cpp', - - 'geom/Geometry.cpp', - 'geom/Surface.cpp', - 'geom/Panel.cpp', - 'geom/CylPanel.cpp', - 'geom/SpherePanel.cpp', - 'geom/HemispherePanel.cpp', - 'geom/DiskPanel.cpp', - 'geom/RectPanel.cpp', - 'geom/TriPanel.cpp', - 'geom/testGeom.cpp', - - 'hsolve/HSolveStruct.cpp', - 'hsolve/HinesMatrix.cpp', - 'hsolve/HSolvePassive.cpp', - 'hsolve/RateLookup.cpp', - 'hsolve/HSolveActive.cpp', - 'hsolve/HSolveActiveSetup.cpp', - 'hsolve/HSolveInterface.cpp', - 'hsolve/HSolve.cpp', - 'hsolve/HSolveUtils.cpp', - 'hsolve/testHSolve.cpp', - 'hsolve/ZombieCompartment.cpp', - 'hsolve/ZombieCaConc.cpp', - 'hsolve/ZombieHHChannel.cpp', - - 'kinetics/PoolBase.cpp', - 'kinetics/Pool.cpp', - 'kinetics/BufPool.cpp', - 'kinetics/FuncPool.cpp', - 'kinetics/Reac.cpp', - 'kinetics/Enz.cpp', - 'kinetics/MMenz.cpp', - 'kinetics/Species.cpp', - 'kinetics/ReadKkit.cpp', - 'kinetics/ReadCspace.cpp', - 'kinetics/MathFunc.cpp', - 'kinetics/SumFunc.cpp', - 'kinetics/lookupSizeFromMesh.cpp', - 'kinetics/testKinetics.cpp', - - 'ksolve/Port.cpp', - 'ksolve/Stoich.cpp', - 'ksolve/KinSparseMatrix.cpp', - 'ksolve/ZombiePool.cpp', - 'ksolve/ZombieBufPool.cpp', - 'ksolve/ZombieFuncPool.cpp', - 'ksolve/ZombieReac.cpp', - 'ksolve/ZombieEnz.cpp', - 'ksolve/ZombieMMenz.cpp', - 'ksolve/ZombieSumFunc.cpp', - 'ksolve/RateTerm.cpp', - 'ksolve/FuncTerm.cpp', - 'ksolve/GssaStoich.cpp', - 'ksolve/testKsolve.cpp', - - 'manager/SimManager.cpp', - 'manager/testSimManager.cpp', - - 'mesh/ChemMesh.cpp', - 'mesh/MeshEntry.cpp', - 'mesh/CylMesh.cpp', - 'mesh/CubeMesh.cpp', - 'mesh/Boundary.cpp', - 'mesh/Stencil.cpp', - 'mesh/testMesh.cpp', - - 'msg/Msg.cpp', - 'msg/DiagonalMsg.cpp', - 'msg/OneToAllMsg.cpp', - 'msg/OneToOneMsg.cpp', - 'msg/SingleMsg.cpp', - 'msg/SparseMsg.cpp', - 'msg/ReduceMsg.cpp', - 'msg/testMsg.cpp', - - 'pymoose/moosemodule.cpp', - - 'randnum/mt19937ar.cpp', - - 'regressionTests/regressionTest.cpp', - 'regressionTests/rtTable.cpp', - 'regressionTests/rtReadKkit.cpp', - 'regressionTests/rtHHnetwork.cpp', - 'regressionTests/rtReacDiff.cpp', - 'regressionTests/perfTestMarkovSolver.cpp', - 'regressionTests/benchmarkTests.cpp', - - 'scheduling/Clock.cpp', - 'scheduling/Tick.cpp', - 'scheduling/TickMgr.cpp', - 'scheduling/testScheduling.cpp', - - 'shell/Shell.cpp', - 'shell/ShellCopy.cpp', - 'shell/ShellSetGet.cpp', - 'shell/ShellThreads.cpp', - 'shell/ProcessLoop.cpp', - 'shell/LoadModels.cpp', - 'shell/Neutral.cpp', - 'shell/Wildcard.cpp', - 'shell/testShell.cpp', - - #~ 'smol/SmolSim.cpp', - #~ 'smol/SmolPool.cpp', - #~ 'smol/SmolMol.cpp', - #~ 'smol/SmolReac.cpp', - #~ 'smol/SmolEnz.cpp', - #~ 'smol/SmolMMenz.cpp', - #~ 'smol/testSmol.cpp', - - 'utility/strutil.cpp', - 'utility/types.cpp', - 'utility/setupenv.cpp', - 'utility/numutil.cpp', - 'utility/Annotator.cpp', -] diff --git a/moose-core/synapse/GraupnerBrunel2012CaPlasticitySynHandler.cpp b/moose-core/synapse/GraupnerBrunel2012CaPlasticitySynHandler.cpp index 6734a574b696f169131f02acab90247a8788db69..835dc72b7d31f24c95d585567dee6439a33eb3c2 100644 --- a/moose-core/synapse/GraupnerBrunel2012CaPlasticitySynHandler.cpp +++ b/moose-core/synapse/GraupnerBrunel2012CaPlasticitySynHandler.cpp @@ -305,6 +305,15 @@ void GraupnerBrunel2012CaPlasticitySynHandler::addSpike( delayDPreEvents_.push( PreSynEvent( index, time+delayD_, weight ) ); } +double GraupnerBrunel2012CaPlasticitySynHandler::getTopSpike( + unsigned int index ) const +{ + if ( events_.empty() ) + return 0.0; + return events_.top().time; +} + + void GraupnerBrunel2012CaPlasticitySynHandler::addPostSpike( const Eref& e, double time ) { postEvents_.push( PostSynEvent( time ) ); diff --git a/moose-core/synapse/GraupnerBrunel2012CaPlasticitySynHandler.h b/moose-core/synapse/GraupnerBrunel2012CaPlasticitySynHandler.h index 2c3055593acdba3bae06331e45b6a4cb2f5b1f8b..f7888602545b6b9742369e12dca5a4fcbbbb44be 100644 --- a/moose-core/synapse/GraupnerBrunel2012CaPlasticitySynHandler.h +++ b/moose-core/synapse/GraupnerBrunel2012CaPlasticitySynHandler.h @@ -95,6 +95,7 @@ class GraupnerBrunel2012CaPlasticitySynHandler: public SynHandlerBase unsigned int addSynapse(); void dropSynapse( unsigned int droppedSynNumber ); void addSpike( unsigned int index, double time, double weight ); + double getTopSpike( unsigned int index ) const; //////////////////////////////////////////////////////////////// void addPostSpike( const Eref& e, double time ); diff --git a/moose-core/synapse/STDPSynHandler.cpp b/moose-core/synapse/STDPSynHandler.cpp index 372e6d66dc60267e8f0997afd95fac722f0cb9bb..a414913b23b3d41d605158671d53c2a3fc0b53a6 100644 --- a/moose-core/synapse/STDPSynHandler.cpp +++ b/moose-core/synapse/STDPSynHandler.cpp @@ -190,6 +190,13 @@ void STDPSynHandler::addSpike( events_.push( PreSynEvent( index, time, weight ) ); } +double STDPSynHandler::getTopSpike( unsigned int index ) const +{ + if ( events_.empty() ) + return 0.0; + return events_.top().time; +} + void STDPSynHandler::addPostSpike( const Eref& e, double time ) { postEvents_.push( PostSynEvent( time ) ); diff --git a/moose-core/synapse/STDPSynHandler.h b/moose-core/synapse/STDPSynHandler.h index 947db5f13387af002c573e35dfb5affca8dbd672..c0f1446eff724a4f72b0283b9f3640da0fb6e6de 100644 --- a/moose-core/synapse/STDPSynHandler.h +++ b/moose-core/synapse/STDPSynHandler.h @@ -77,6 +77,7 @@ class STDPSynHandler: public SynHandlerBase unsigned int addSynapse(); void dropSynapse( unsigned int droppedSynNumber ); void addSpike( unsigned int index, double time, double weight ); + double getTopSpike( unsigned int index ) const; //////////////////////////////////////////////////////////////// void addPostSpike( const Eref& e, double time ); diff --git a/moose-core/synapse/SeqSynHandler.cpp b/moose-core/synapse/SeqSynHandler.cpp index 0f29f3d4fe21bc6e4cc1930c065b2749f115fdaa..cb8bb0b69f0670f156fb70bf9525cec45590b62b 100644 --- a/moose-core/synapse/SeqSynHandler.cpp +++ b/moose-core/synapse/SeqSynHandler.cpp @@ -513,6 +513,13 @@ void SeqSynHandler::addSpike(unsigned int index, double time, double weight) latestSpikes_[ synapseOrder_[index] ] += weight; } +double SeqSynHandler::getTopSpike( unsigned int index ) const +{ + if ( events_.empty() ) + return 0.0; + return events_.top().time; +} + unsigned int SeqSynHandler::addSynapse() { unsigned int newSynIndex = synapses_.size(); diff --git a/moose-core/synapse/SeqSynHandler.h b/moose-core/synapse/SeqSynHandler.h index 58ede36a4ef3042c185b803740ed56fb0c644baf..97b4800f507cdf133f91d480983da05e21b28b16 100644 --- a/moose-core/synapse/SeqSynHandler.h +++ b/moose-core/synapse/SeqSynHandler.h @@ -44,6 +44,7 @@ class SeqSynHandler: public SynHandlerBase unsigned int addSynapse(); void dropSynapse( unsigned int droppedSynNumber ); void addSpike( unsigned int index, double time, double weight ); + double getTopSpike( unsigned int index ) const; //////////////////////////////////////////////////////////////// // New fields. //////////////////////////////////////////////////////////////// diff --git a/moose-core/synapse/SimpleSynHandler.cpp b/moose-core/synapse/SimpleSynHandler.cpp index b1323cb101783a530a8545f25849eb404f36841c..51100cd28bd0a3badb3ca8476356fa5e3ece8cfc 100644 --- a/moose-core/synapse/SimpleSynHandler.cpp +++ b/moose-core/synapse/SimpleSynHandler.cpp @@ -104,6 +104,13 @@ void SimpleSynHandler::addSpike( events_.push( SynEvent( time, weight ) ); } +double SimpleSynHandler::getTopSpike( unsigned int index ) const +{ + if ( events_.empty() ) + return 0.0; + return events_.top().time; +} + void SimpleSynHandler::vProcess( const Eref& e, ProcPtr p ) { double activation = 0.0; diff --git a/moose-core/synapse/SimpleSynHandler.h b/moose-core/synapse/SimpleSynHandler.h index 9b3138bf0337783f9b4bfd95c800ab5aa6991d14..22ee6c90e8eb366da221254d9fc6a82dc0c3d0d2 100644 --- a/moose-core/synapse/SimpleSynHandler.h +++ b/moose-core/synapse/SimpleSynHandler.h @@ -61,6 +61,7 @@ class SimpleSynHandler: public SynHandlerBase unsigned int addSynapse(); void dropSynapse( unsigned int droppedSynNumber ); void addSpike( unsigned int index, double time, double weight ); + double getTopSpike( unsigned int index ) const; //////////////////////////////////////////////////////////////// static const Cinfo* initCinfo(); private: diff --git a/moose-core/synapse/SynHandlerBase.h b/moose-core/synapse/SynHandlerBase.h index 660da06d6c8b7d63bcd70878b0d05d2c21839099..e3b3a3834c9008cff8e217a75c7580aa51d2f4d7 100644 --- a/moose-core/synapse/SynHandlerBase.h +++ b/moose-core/synapse/SynHandlerBase.h @@ -79,6 +79,7 @@ class SynHandlerBase */ virtual void addSpike( unsigned int index, double time, double weight ) = 0; + virtual double getTopSpike( unsigned int index ) const = 0; //////////////////////////////////////////////////////////////// // Virtual func definitions for fields. //////////////////////////////////////////////////////////////// diff --git a/moose-core/synapse/Synapse.cpp b/moose-core/synapse/Synapse.cpp index 17aa5a0daeb64bdcc31efb1cfc5c5ebc27f88186..30c97b1b8021622966b72b3320602e76dfdeb1dd 100644 --- a/moose-core/synapse/Synapse.cpp +++ b/moose-core/synapse/Synapse.cpp @@ -8,6 +8,7 @@ **********************************************************************/ #include "header.h" +#include "ElementValueFinfo.h" #include "SynHandlerBase.h" #include "Synapse.h" @@ -26,6 +27,13 @@ const Cinfo* Synapse::initCinfo() &Synapse::setDelay, &Synapse::getDelay ); + static ElementValueFinfo< Synapse, double > spikeTime( + "spikeTime", + "Value field interface to add spike (by assignment) and to " + "read the value of the spike on top of the queue.", + &Synapse::addSpike, + &Synapse::getTopSpike + ); static DestFinfo addSpike( "addSpike", "Handles arriving spike messages, inserts into event queue.", @@ -34,6 +42,7 @@ const Cinfo* Synapse::initCinfo() static Finfo* synapseFinfos[] = { &weight, // Field &delay, // Field + &spikeTime, // ElementField &addSpike, // DestFinfo }; @@ -103,6 +112,11 @@ void Synapse::addSpike( const Eref& e, double time ) handler_->addSpike( e.fieldIndex(), time + delay_, weight_ ); } +double Synapse::getTopSpike( const Eref& e ) const +{ + return handler_->getTopSpike( e.fieldIndex() ); +} + ///////////////////////////////////////////////////////////// // Callbacks for message add/drop ///////////////////////////////////////////////////////////// diff --git a/moose-core/synapse/Synapse.h b/moose-core/synapse/Synapse.h index 12e5915de832eab23cf8eaa5cb2d3af6c0a8d10b..4ac1593c8fd7a19a205099904a5d1fc9b90b1471 100644 --- a/moose-core/synapse/Synapse.h +++ b/moose-core/synapse/Synapse.h @@ -26,6 +26,7 @@ class Synapse double getDelay() const; void addSpike( const Eref& e, double time ); + double getTopSpike( const Eref& e ) const; void setHandler( SynHandlerBase* h ); diff --git a/moose-core/wheels/Dockerfile b/moose-core/wheels/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..cec973ab7386cb5fb611c360b6f4152ee026359b --- /dev/null +++ b/moose-core/wheels/Dockerfile @@ -0,0 +1,17 @@ +FROM quay.io/pypa/manylinux1_x86_64 +MAINTAINER Dilawar Singh <dilawar.s.rajput@gmail.com> + +# If you are behind proxy, uncomment the following lines with appropriate +# values. Otherwise comment them out. +ENV http_proxy http://proxy.ncbs.res.in:3128 +ENV https_proxy http://proxy.ncbs.res.in:3128 +ENV PATH=/usr/local/bin:$PATH + +RUN yum update +RUN yum install -y cmake28 && ln -sf /usr/bin/cmake28 /usr/bin/cmake +RUN yum install -y wget +RUN if [ ! -f /usr/local/lib/libgsl.a ]; then \ + wget --no-check-certificate ftp://ftp.gnu.org/gnu/gsl/gsl-2.4.tar.gz && \ + tar xvf gsl-2.4.tar.gz && cd gsl-2.4 && ./configure && make -j2 && \ + make install && cd; fi +RUN ./build_wheels.sh diff --git a/moose-core/wheels/build_wheels.sh b/moose-core/wheels/build_wheels.sh new file mode 100755 index 0000000000000000000000000000000000000000..5509ea8530b8a80b009d79fd8db29de334ef8fa4 --- /dev/null +++ b/moose-core/wheels/build_wheels.sh @@ -0,0 +1,46 @@ +#!/bin/bash +set -e +set -x + +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +MOOSE_SOURCE_DIR=/tmp/moose-core +# Clone git or update. +if [ ! -d $MOOSE_SOURCE_DIR ]; then + git clone -b wheels https://github.com/BhallaLab/moose-core --depth 10 $MOOSE_SOURCE_DIR +else + cd $MOOSE_SOURCE_DIR && git pull && git merge master -X theirs && cd - +fi + +# Try to link statically. +GSL_STATIC_LIBS="/usr/local/lib/libgsl.a;/usr/local/lib/libgslcblas.a" +CMAKE=/usr/bin/cmake28 + +WHEELHOUSE=$HOME/wheelhouse +mkdir -p $WHEELHOUSE +for PYDIR in /opt/python/cp27-cp27m/ /opt/python/cp34-cp34m/ /opt/python/cp36-cp36m/; do + PYVER=$(basename $PYDIR) + mkdir -p $PYVER + ( + cd $PYVER + echo "Building using $PYDIR in $PYVER" + PYTHON=$(ls $PYDIR/bin/python?.?) + $PYTHON -m pip install numpy + $CMAKE -DPYTHON_EXECUTABLE=$PYTHON \ + -DGSL_STATIC_LIBRARIES=$GSL_STATIC_LIBS \ + -DMOOSE_VERSION="3.2rc1" ${MOOSE_SOURCE_DIR} + make -j4 + + # Now build bdist_wheel + cd python + cp setup.cmake.py setup.py + $PYDIR/bin/pip wheel . -w $WHEELHOUSE + ) +done + +# now check the wheels. +for whl in $WHEELHOUSE/*.whl; do + #auditwheel repair "$whl" -w $WHEELHOUSE + auditwheel show "$whl" +done +ls -lh $WHEELHOUSE/*.whl