Example #1
0
def testAll(argv=None):
    if argv is None:
        argv = sys.argv

    if len(argv)==1:
        print("\nNo options specified! Run this file using\n" + \
              "   nC.sh -python %s [-neuron|-genesis]\n"%argv[0])
        quit()
    
    if '-neuron' in argv:
        simulators.append('NEURON')
    if '-genesis' in argv:
        simulators.append('GENESIS_SI')
        
        
    if '-neuroml2' in argv:
        # Not yet working...
        nc.generateNeuroML2(projFile, simConfigs)
    
    if len(simulators)>0:
        print "Loading project from "+ projFile.getCanonicalPath()

        simManager = nc.SimulationManager(projFile,
                                          numConcurrentSims = numConcurrentSims,
                                          verbose = verbose)

        simManager.runMultipleSims(simConfigs =           simConfigs,
                                   simDt =                simDt,
                                   simulators =           simulators,
                                   runInBackground =      runInBackground,
                                   varTimestepNeuron =    varTimestepNeuron,
                                   varTimestepTolerance = varTimestepTolerance)

        print("\nSimulation(s) set running. Check the ../simulations directory for output.\n")
        
    quit()
import os

try:
    from java.io import File
except ImportError:
    print "Note: this file should be run using ..\\..\\..\\nC.bat -python XXX.py' or '../../../nC.sh -python XXX.py'"
    print "See http://www.neuroconstruct.org/docs/python.html for more details"
    quit()

sys.path.append(os.environ["NC_HOME"]+"/pythonNeuroML/nCUtils")

import ncutils as nc # Many useful functions such as SimManager.runMultipleSims found here

projFile = File(os.getcwd(), "../Ex8_PyNNDemo.ncx")

simConfigs = []
simConfigs.append("TestPyNN_NML2")

nc.generateNeuroML2(projFile, simConfigs)

extra_files = []
if len(sys.argv)==2 and sys.argv[1] == "-f":
    extra_files.append('Ex8_PyNNDemo.net.nml')
    extra_files.append('LEMS_Ex8_PyNNDemo.xml')
    
from subprocess import call
for f in extra_files:
    call(["git", "checkout", "../generatedNeuroML2/%s"%f])


quit()
    print "Note: this file should be run using 'nC.bat -python XXX.py' or 'nC.sh -python XXX.py'"
    print "which use Jython (and so can access the Java classes in nC), as opposed to standard C based Python"
    print "See http://www.neuroconstruct.org/docs/python.html for more details"
    quit()

sys.path.append(os.environ["NC_HOME"]+"/pythonNeuroML/nCUtils")

import ncutils as nc # Many useful functions such as SimManager.runMultipleSims found here

projFile = File(os.getcwd(), "../SolinasEtAl-GolgiCell.ncx")

print("Generating NeuroML v1.8.1 files...")
nc.generateNeuroML1(projFile, ['Fig. 2A: Pacemaking'])
    

print("Generating NeuroML v2 files...")
nc.generateNeuroML2(projFile, ['Fig. 2A: Pacemaking'])

# Some extra files have been committed for testing or to provide other LEMS/NeuroML 2 examples
# This just pulls them from the repository, since they get wiped by the generateNeuroML2 function 
extra_files = ['.test.*', 'channel_summary', 'analyse_chans.sh', 'compare_nml2_mods.py', '../generatedNeuroML/.test.validate.omt']
               
if len(sys.argv)==2 and sys.argv[1] == "-f":
    extra_files.append('SolinasEtAl-GolgiCell.net.nml')
    
from subprocess import call
for f in extra_files:
    call(["git", "checkout", "../generatedNeuroML2/%s"%f])

quit()