def run(self):
        try:
            nml2_comp_type_def_dir = os.path.join(default_nml2_dir,
                                                  'NeuroML2CoreTypes')

            inform(
                "Running file %s with %s, including path: %s" %
                (trim_path(self.modelpath), self.name, nml2_comp_type_def_dir),
                indent=1)

            self.stdout = sp.check_output([
                'pylems', '-I', nml2_comp_type_def_dir, self.modelpath,
                '-nogui'
            ],
                                          cwd=os.path.dirname(self.modelpath))
            self.returncode = 0
        except sp.CalledProcessError as err:
            self.returncode = err.returncode
            self.stdout = err.output
            raise EngineExecutionError
        except Exception as err:
            inform("Another error with running %s: " % self.name,
                   err,
                   indent=1)
            self.returncode = -1
            self.stdout = "???"
Beispiel #2
0
 def is_installed(version):
     if is_verbose():
         inform("Checking whether %s is installed..." %
                JNeuroMLPyNNNRNEngine.name,
                indent=1)
     return JNeuroMLEngine.is_installed(
         None) and PyNNNRNEngine.is_installed(None)
 def install(version):
     if not PyNeuroMLEngine.is_installed(None):
         PyNeuroMLEngine.install(None)
         inform("%s installed PyNeuroML..." % PyNNNeuroMLEngine.name, indent=2, verbosity =1)
     if not PyNNEngine.is_installed(None):
         PyNNEngine.install(None)
         inform("%s installed PyNN..." % PyNNNeuroMLEngine.name, indent=2, verbosity =1)
 def install(cls, engine_version):
     from omv.engines.getgenesis import install_genesis
     home = os.environ['HOME']
     cls.path = os.path.join(home, 'genesis',
                             'genesis2.4gamma-master', 'src')
     inform('Will fetch and install genesis-2.4', indent=1)
     install_genesis()
 def is_installed(version):
     if is_verbose():
         inform("Checking whether %s is installed..." %
                PyNNBrian1Engine.name,
                indent=1)
     return PyNNEngine.is_installed(None) and Brian1Engine.is_installed(
         None)
 def install(version):
     from getbrian2 import install_brian2
     home = os.environ['HOME']
     inform('Will fetch and install the latest Brian (version 2.x)',
            indent=2)
     install_brian2()
     inform('Done...', indent=2)
 def install(version):
     from omv.engines.getbrian1 import install_brian
     home = os.environ['HOME']
     inform('Will fetch and install the latest Brian (version 1.x)',
            indent=2)
     install_brian()
     inform('Done...', indent=2)
def install_nest(version):
    
    if not version:
        version='2.18.0'
        
    inform('Installing NEST', indent=2, verbosity=1)
    nestpath = os.path.join(os.environ['HOME'],'nest')
    nestpath2 = os.path.join(os.environ['HOME'],'nest/nest')
    nestinstallpath = os.path.join(os.environ['HOME'],'nest/nest')
    if 'NEST_INSTALL_DIR' in os.environ:
            nestinstallpath = os.environ['NEST_INSTALL_DIR']+'/'
            
    inform('Installing NEST (src: %s), (tgt: %s)'%(nestpath, nestinstallpath), indent=2, verbosity=1)
    os.mkdir(nestpath)
    
    with working_dir(nestpath):
        #version='2.10.0'
        check_output(['wget', 'https://github.com/nest/nest-simulator/archive/v%s.tar.gz'%(version)])
        
        check_output(['tar', 'xzvf', 'v%s.tar.gz'%version])
        check_output(['mv', 'nest-simulator-%s'%version, 'nest'], cwd=nestpath)
            
    with working_dir(nestpath2):
        check_output(["cmake", "-DCMAKE_INSTALL_PREFIX:PATH=%s"%(nestinstallpath)])
        check_output(['make','-j4'])
        check_output(['make', 'install'])
    def install(version):

        from omv.engines.getneuroconstruct import install_neuroconstruct
        
        inform('Will fetch and install the latest neuroConstruct', indent=2)
        install_neuroconstruct()
        inform('Done...', indent=2)
Beispiel #10
0
    def is_installed(version):

        PyNestEngine.environment_vars = NestEngine.get_nest_environment()

        ret = True
        try:

            ret_str = check_output(
                ['python -c "import nest; print(nest.version())"'], shell=True)
            ret = len(ret_str) > 0

            if ret and is_verbose():
                inform("%s is correctly installed..." % (PyNestEngine.name),
                       indent=2)

            if is_verbose():
                inform("NEST is installed with Python support...", indent=2)
                inform("Env vars: %s" % PyNestEngine.environment_vars,
                       indent=2)

        except Exception as err:
            inform("Couldn't import NEST into Python: ", err, indent=1)
            inform("NEST env vars: %s" % PyNestEngine.environment_vars,
                   indent=1)
            ret = False
        return ret
Beispiel #11
0
def install_neuron(version):
    if not version:
        version = '7.6'

    nrnpath = os.path.join(os.environ['HOME'], 'neuron')

    inform('Installing NEURON %s into %s' % (version, nrnpath), indent=1)
    os.mkdir(nrnpath)
    with working_dir(nrnpath):
        print(
            co([
                'wget',
                'https://www.neuron.yale.edu/ftp/neuron/versions/v%s/nrn-%s.tar.gz'
                % (version, version)
            ]))
        print(co(['tar', 'xzvf', 'nrn-%s.tar.gz' % version]))
        print(co(['mv', 'nrn-%s' % version, 'nrn']))
        os.chdir('nrn')

        path = os.getcwd()
        pyexec = sys.executable
        co([
            "./configure --prefix=%s --without-iv --with-nrnpython=%s" %
            (path, pyexec)
        ],
           shell=True)
        print(co(['make', '-j4']))
        print(co(['make', 'install']))

        os.chdir('src/nrnpython')
        run_setup('./setup.py', ['install'])
Beispiel #12
0
    def is_installed(version):
        ret = True
        if is_verbose():
            inform("Checking whether %s is installed..." % NeuronEngine.name,
                   indent=1)
        try:
            output = check_output(['nrniv', '--version'], verbosity=2)
            if is_verbose():
                inform('%s is installed' % output.strip(), indent=2)
            ret = 'v%s' % output.split()[3]
        except OSError:
            try:
                environment_vars, path = NeuronEngine.get_nrn_environment()

                inform('Testing NEURON with env: %s and path: %s' %
                       (environment_vars, path),
                       indent=2)
                output = check_output([path + '/nrniv', '--version'])
                if is_verbose():
                    inform('%s was already installed (by OMV..?)' %
                           output.strip(),
                           indent=2)

                ret = 'v%s' % output.split()[3]
            except OSError:
                inform('NEURON not currently installed', indent=2)
                ret = False
        return ret
Beispiel #13
0
    def install(cls, version):
        from omv.engines.getnrn import install_neuron

        cls.environment_vars, cls.path = NeuronEngine.get_nrn_environment()

        inform('Will fetch and install the latest NEURON version', indent=2)
        install_neuron(version)
 def install(version):
     if not PyNestEngine.is_installed(None):
         PyNestEngine.install(version)  # interpret version as version of NEST!
         inform("%s installed PyNest..." % PyNNNestEngine.name, indent=2, verbosity =1)
     if not PyNNEngine.is_installed(None):
         PyNNEngine.install(None)
         inform("%s installed PyNN..." % PyNNNestEngine.name, indent=2, verbosity =1)
Beispiel #15
0
 def install(cls, engine_version):
     from omv.engines.getgenesis import install_genesis
     home = os.environ['HOME']
     cls.path = os.path.join(home, 'genesis', 'genesis2.4gamma-master',
                             'src')
     inform('Will fetch and install genesis-2.4', indent=1)
     install_genesis()
Beispiel #16
0
    def run(self):
        
        try:
            self.stdout = NeuronEngine.compile_modfiles(self.modelpath)
        except sp.CalledProcessError as err:
            self.stderr = err.output
            self.returncode = err.returncode
            inform('Error compiling modfiles:', self.stderr, indent=2)
            
        with working_dir(dirname(self.modelpath)):
            
            inform("Running %s on %s..." % (self.name, self.modelpath),
                   indent=1)
            p = sp.Popen(['nrniv', '-python', self.modelpath, '-nogui'],
                         stdin=sp.PIPE, stdout=sp.PIPE, stderr=sp.PIPE)
            cmd = '''\
            %s
            ''' % ('\n'.join(self.extra_pars))
            if sys.version_info[0]==3:
                c = dedent(cmd).encode()
            else:
                c = dedent(cmd)
            stdout, stderr = p.communicate(c)
            # with open('/tmp/omv_test.nrn.stdout', 'w') as f:
            #     f.write(stdout)
            self.stdout = str(stdout.decode())
            self.stderr = str(stderr.decode())
            
            inform("OUT: %s"% self.stdout, verbosity=1, indent=2)
            inform("ERR: %s"% self.stderr, verbosity=1, indent=2)
            inform("returncode: [%s]"% p.returncode, verbosity=1, indent=2)

            self.returncode = p.returncode
            if self.returncode != 0:
                raise EngineExecutionError
    def install(version):

        from omv.engines.getneuroconstruct import install_neuroconstruct
        
        inform('Will fetch and install the latest neuroConstruct', indent=2)
        install_neuroconstruct()
        inform('Done...', indent=2)
    def is_installed(version):
        ret = True
        try:

            ret_str = sp.check_output(
                ['python -c "import numba; print(numba.__version__)"'],
                shell=True,
                stderr=sp.STDOUT)
            ret = len(ret_str) > 0

            if isinstance(ret_str, bytes):
                ret_str = ret_str.decode('utf-8')

            ret = 'v%s' % ret_str.strip()
            if is_verbose():
                inform("numba %s is correctly installed..." % ret,
                       indent=2,
                       verbosity=2)

        except Exception as err:
            inform("Couldn't import numba into Python: ",
                   err,
                   indent=1,
                   verbosity=2)
            ret = False
        return ret
def install_nest(version):
    
    if not version:
        version='2.12.0'
        
    inform('Installing NEST', indent=2, verbosity=1)
    nestpath = os.path.join(os.environ['HOME'],'nest')
    nestpath2 = os.path.join(os.environ['HOME'],'nest/nest')
    nestinstallpath = os.path.join(os.environ['HOME'],'nest/nest')
    if 'NEST_INSTALL_DIR' in os.environ:
            nestinstallpath = os.environ['NEST_INSTALL_DIR']+'/'
            
    inform('Installing NEST (src: %s), (tgt: %s)'%(nestpath, nestinstallpath), indent=2, verbosity=1)
    os.mkdir(nestpath)
    
    with working_dir(nestpath):
        #version='2.10.0'
        check_output(['wget', 'https://github.com/nest/nest-simulator/archive/v%s.tar.gz'%(version)])
        
        check_output(['tar', 'xzvf', 'v%s.tar.gz'%version])
        check_output(['mv', 'nest-simulator-%s'%version, 'nest'], cwd=nestpath)
            
    with working_dir(nestpath2):
        check_output(["cmake", "-DCMAKE_INSTALL_PREFIX:PATH=%s"%(nestinstallpath)])
        check_output(['make'])
        check_output(['make', 'install'])
 def __call__(self):
     obs = self.parse_observable()
     allin = ts.all_within_bounds(obs, (0, 1))
     if not allin:
         inform('Activation variable outside of (0,1) interval: ',
                obs, indent=1)
     return allin
def get_spike_rate(spikes,
                   method=ISI_BASED_SPIKERATE_CALC,
                   start_time=0,
                   end_time=float('inf')):
    inform(
        'Calculating average of %i spike rate(s) with method "%s" from %s->%s'
        % (len(spikes), method, start_time, end_time),
        verbosity=1,
        indent=2)

    if isinstance(spikes, list):
        return _get_single_spike_rate(spikes, method, start_time, end_time)

    if isinstance(spikes, dict):
        tot_rates = 0
        all_rates = []
        if len(spikes) == 0:
            avg_rate = 0
        else:
            for s in spikes.values():
                r = _get_single_spike_rate(s, method, start_time, end_time)
                all_rates.append(r)
                tot_rates += r
            avg_rate = float(tot_rates) / len(spikes)
        inform(
            'Calculated average of %i spike rate(s) with method "%s": %s %s' %
            (len(spikes), method, avg_rate, all_rates),
            verbosity=1,
            indent=2)
        return avg_rate
 def is_installed(version):
     
     PyNestEngine.environment_vars = NestEngine.get_nest_environment()
     
     ret = True
     try:
         
         ret_str = check_output(['python -c "import nest; print(nest.version())"'], shell=True, verbosity=2)
         ret = len(ret_str) > 0
         
         if ret:
             ret = 'v%s'%ret_str.split('Version')[-1].split()[0]
         
         if ret and is_verbose():
             inform("%s is correctly installed..." % (PyNestEngine.name), indent=2)
         
         if is_verbose():
             inform("NEST is installed with Python support...", indent=2)
             inform("Env vars: %s" % PyNestEngine.environment_vars, indent=2)
         
     except Exception as err:
         inform("Couldn't import NEST into Python: ", err, indent=1)
         inform("NEST env vars: %s" % PyNestEngine.environment_vars, indent=1)
         ret = False
     return ret
    def run(self):
        
        try:
            self.stdout = self.compile_modfiles(self.modelpath)
        except sp.CalledProcessError as err:
            self.stderr = err.output
            self.returncode = err.returncode
            inform('Error compiling modfiles:', self.stderr, indent=2)
        
        with working_dir(dirname(self.modelpath)):
            
            inform("Running %s on %s..." % (self.name, self.modelpath),
                   indent=1)
            p = sp.Popen(['nrniv'],
                         stdin=sp.PIPE, stdout=sp.PIPE, stderr=sp.PIPE)
            cmd = '''\
            load_file("noload.hoc")
            //cvode_active(1)
            load_file("%s")
            %s
            ''' % (self.modelpath, '\n'.join(self.extra_pars))
            stdout, stderr = p.communicate(dedent(cmd))
            # with open('/tmp/omv_test.nrn.stdout', 'w') as f:
            #     f.write(stdout)
            self.stdout = stdout
            self.stderr = stderr
            
            inform("OUT: ", stdout, verbosity=1, indent=2)
            inform("ERR: ", stderr, verbosity=1, indent=2)
            inform("returncode: ", p.returncode, verbosity=1, indent=2)

            self.returncode = p.returncode
            if self.returncode is not 0:
                raise EngineExecutionError
 def install(cls, engine_version):
     import getnrn
     
     cls.environment_vars, cls.path = NeuronEngine.get_nrn_environment()
     
     inform('Will fetch and install the latest NEURON version', indent=2)
     getnrn.install_neuron(get_latest=True)
    def run(self):
        try:
            path_s = resolve_paths(self.modelpath)

            from omv.engines.jneuroml import JNeuroMLEngine
            jnml = JNeuroMLEngine.get_executable()
            cmds = [jnml, '-validatev1']
            for p in path_s:
                cmds.append(p)

            inform("Running with %s, using %s..." %
                   (JNeuroMLValidateV1Engine.name, cmds),
                   indent=1)
            self.stdout = sp.check_output(cmds,
                                          cwd=os.path.dirname(self.modelpath),
                                          env=JNeuroMLEngine.get_environment())
            inform("Success with running ",
                   JNeuroMLValidateV1Engine.name,
                   indent=1,
                   verbosity=1)
            self.returncode = 0
        except sp.CalledProcessError as err:
            self.returncode = err.returncode
            self.stdout = err.output
            raise EngineExecutionError
 def install(version):
     if not PyNestEngine.is_installed(None):
         PyNestEngine.install(version)  # interpret version as version of NEST!
         inform("%s installed PyNest..." % PyNNNestEngine.name, indent=2, verbosity =1)
     if not PyNNEngine.is_installed(None):
         PyNNEngine.install(None)
         inform("%s installed PyNN..." % PyNNNestEngine.name, indent=2, verbosity =1)
    def run(self):
        
        try:
            self.stdout = NeuronEngine.compile_modfiles(self.modelpath)
        except sp.CalledProcessError as err:
            self.stderr = err.output
            self.returncode = err.returncode
            inform('Error compiling modfiles:', self.stderr, indent=2)
            
        with working_dir(dirname(self.modelpath)):
            
            inform("Running %s on %s..." % (self.name, self.modelpath),
                   indent=1)
            p = sp.Popen(['nrniv', '-python', self.modelpath, '-nogui'],
                         stdin=sp.PIPE, stdout=sp.PIPE, stderr=sp.PIPE)
            cmd = '''\
            %s
            ''' % ('\n'.join(self.extra_pars))
            stdout, stderr = p.communicate(dedent(cmd))
            # with open('/tmp/omv_test.nrn.stdout', 'w') as f:
            #     f.write(stdout)
            self.stdout = stdout
            self.stderr = stderr
            
            inform("OUT: ", stdout, verbosity=1, indent=2)
            inform("ERR: ", stderr, verbosity=1, indent=2)
            inform("returncode: ", p.returncode, verbosity=1, indent=2)

            self.returncode = p.returncode
            if self.returncode is not 0:
                raise EngineExecutionError
Beispiel #28
0
def install_pynn():
    try:
        
        print(check_output(['pip', 'install', 'lazyarray']))  # This should ideally be automatically installed with PyNN...
        print(check_output(['pip', 'install', 'neo==0.5.1']))  # This should ideally be automatically installed with PyNN...

        install_root = os.environ['HOME']

        pyNN_src = 'PyNN_src'
        with working_dir(install_root):
            check_output(['git', 'clone', 'https://github.com/NeuralEnsemble/PyNN.git', pyNN_src])

        path = os.path.join(install_root, pyNN_src)

        with working_dir(path):
            print(check_output(['git','checkout','neuroml']))  # neuroml branch has the latest NML2 import/export code!
            #check_output(['git','checkout','master'])
            print(check_output(['python', 'setup.py', 'install']))
            print(check_output(['pwd']))
            print("Finished attempting to install PyNN")
        #import pyNN
        m = 'Successfully installed pyNN...'
    except Exception as e:
        m = 'ERROR during install_pynn: %s'%e
    finally:
        inform(m)
 def is_installed(version):
     if is_verbose():
         inform("Checking whether %s is installed correctly..." %
                PyNNNRNEngine.name, indent=1)
     installed = PyNNEngine.is_installed(None) and NeuronEngine.is_installed(None)
     
     return installed
Beispiel #30
0
    def is_installed(cls, version):
        from tempfile import NamedTemporaryFile

        ret = True
        try:
            temp = NamedTemporaryFile(suffix='.g')
            temp.writelines([b'echo "version: "{version} \n', b'quit \n'])
            temp.seek(0)
            out = sp.check_output(
                ['genesis', '-nox', '-batch', '-notty', temp.name])
            m = re.search(b'version:\s*([0-9]*\.?[0-9]+)\s*', out)
            if m:
                ver = m.groups()[0]

                if isinstance(ver, bytes):
                    ver = ver.decode('utf-8')
                ret = 'v%s' % ver
                inform("Found GENESIS in path, version %s" % ret,
                       verbosity=1,
                       indent=2)
        except OSError:
            ret = False
        finally:
            temp.close()

        return ret
 def install(version):
     from omv.engines.getnumba import install_numba
     #install_pynn
     home = os.environ['HOME']
     inform('Will fetch and install the latest numba', indent=2)
     install_numba()
     inform('Done, numba is correctly installed...', indent=2)
    def install(self, version):

        if not PyLemsEngine.is_installed(None):
            PyLemsEngine.install(None)
        if not os.path.isdir(default_nml2_dir):
            install_nml2()

        inform('Finished installation of %s...' % self.name, indent=2)
 def install(version):
     from omv.engines.getjnml import install_jnml
     home = os.environ['HOME']
     p = os.path.join(home, 'jnml/jNeuroMLJar')
     JNeuroMLEngine.path = p
     JNeuroMLEngine.environment_vars = {'JNML_HOME': p}
     inform('Will fetch and install the latest jNeuroML jar', indent=2)
     install_jnml()
 def install(version):
     from getpyneuroml import install_pynml
     home = os.environ['HOME']
     p = os.path.join(home, 'test.sh/pyNeuroML')
     PyNeuroMLEngine.path = p
     PyNeuroMLEngine.environment_vars = {'PYNML_HOME': p}
     inform('Will fetch and install the latest pyNeuroML', indent=2)
     install_pynml()
 def before_running(self):
     if 'file' in self.observable:
         self.fo = fn.FileNodeHelper(self.observable['file'], self.omt_root)
         if self.fo.tstamp:
             inform('Attention! Preexistent datafile: ',
                    self.fo.filename,
                    indent=2,
                    verbosity=1)
Beispiel #36
0
def install_nml2():
    
    with working_dir(install_root):
        print(co(['git', 'clone', 'https://github.com/NeuroML/NeuroML2.git']))
    with working_dir(default_nml2_dir):
        print(co(['git', 'checkout', 'development']))
        
    inform('Successfully cloned NeuroML2', indent=2, verbosity=1)
def install_nml2():
    
    with working_dir(install_root):
        print(co(['git', 'clone', 'https://github.com/NeuroML/NeuroML2.git']))
    with working_dir(default_nml2_dir):
        print(co(['git', 'checkout', 'development']))
        
    inform('Successfully cloned NeuroML2', indent=2, verbosity=1)
 def install(version):
     from getjnml import install_jnml
     home = os.environ['HOME']
     p = os.path.join(home, 'jnml/jNeuroMLJar')
     JNeuroMLEngine.path = p
     JNeuroMLEngine.environment_vars = {'JNML_HOME': p}
     inform('Will fetch and install the latest jNeuroML jar', indent=2)
     install_jnml()
 def install(version):
     from getpyneuroml import install_pynml
     home = os.environ['HOME']
     p = os.path.join(home, 'test.sh/pyNeuroML')
     PyNeuroMLEngine.path = p
     PyNeuroMLEngine.environment_vars = {'PYNML_HOME': p}
     inform('Will fetch and install the latest pyNeuroML', indent=2)
     install_pynml()
 def fetch_query(self, key):
     import re
     match_float = '\s*([0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)\s*'
     m = re.search(key+':' + match_float, self.stdout)
     if m:
         return m.groups()[0]
     else:
         inform('Not found!')
         raise KeyError
 def parse_expected(self):
     to_parse = self.expected
     if isinstance(to_parse, list):
         ts = to_parse
     elif 'file' in to_parse:
         f = fn.FileNodeHelper(to_parse['file'], self.mep_root)
         ts = f.get_timeseries()
         inform('Reading timeseries from: ', f, indent=1, verbosity=1)
     return ts
 def install(version):
     from getpylems import install_pylems
     home = os.environ['HOME']
     p = os.path.join(home, 'pylems')
     PyLemsEngine.path = p
     PyLemsEngine.environment_vars = {'PYLEMS_HOME': p}
     inform('Will fetch and install the latest PyLEMS', indent=2)
     install_pylems()
     inform('Done...', indent=2)
 def is_installed(version):
     ret = True
     try:
         FNULL = open(os.devnull, 'w')
         sp.check_call(['pylems', '-h'], stdout=FNULL)
     except Exception as err:
         inform("Couldn't execute PyLEMS: ", err, indent=1)
         ret = False
     return ret
 def set_environment(self):
     if self.environment_vars:
         for name, val in self.environment_vars.items():
             if name in environ and not 'HOME' in name:
                 if not ':%s:'%val in environ[name]:
                     environ[name] = '%s:%s'%(environ[name],val)
             else:
                 environ[name] = val
             inform('Set env var %s: ' % name, environ[name],indent=2, verbosity=1)
Beispiel #45
0
 def install(self, version):
     from omv.engines.getjlems import install_jlems
     home = os.environ['HOME']
     p = os.path.join(home, 'jLEMS')
     self.path = p
     self.environment_vars = {'LEMS_HOME': p}
     inform('Will fetch and install the latest jLEMS', indent=2)
     install_jlems()
     inform('Done...', indent=2)
 def install(self, version):
     from omv.engines.getjlems import install_jlems
     home = os.environ['HOME']
     p = os.path.join(home, 'jLEMS')
     self.path = p
     self.environment_vars = {'LEMS_HOME': p}
     inform('Will fetch and install the latest jLEMS', indent=2)
     install_jlems()
     inform('Done...', indent=2)
 def is_installed(version):
     ret = True
     try:
         ret_str = check_output(['lems', '-h'], verbosity=1)
         ret = 'v%s'%ret_str.split('-jar')[-1].split()[0].split('-')[1][:-4]
     except OSError as err:
         inform("Couldn't execute lems:", err, indent=1)
         ret = False
     return ret
def install_pynml():
    
    try:
        print(check_output(['pip', 'install', 'pyneuroml']))
        import neuroml
        import pyneuroml
        m = 'Successfully installed pyNeuroML...'
    except Exception as e:
        m = 'ERROR installing pyNeuroML: ' + str(e)
    finally:
        inform(m, indent=2)
 def run(self):
     try:
         inform("Running file %s with %s" % (trim_path(self.modelpath), self.name),
                indent=1)
         self.stdout = sp.check_output(['pynml' if os.name != 'nt' else 'pynml.bat', self.modelpath, '-nogui'],
                                       cwd=os.path.dirname(self.modelpath))
         self.returncode = 0
     except sp.CalledProcessError as err:
         self.returncode = err.returncode
         self.stdout = err.output
         raise EngineExecutionError
 def is_installed(version):
     ret = True
     try:
         if is_verbose():
             inform("Checking whether %s is installed..." %
                PyNeuroMLEngine.name, indent=1)
         FNULL = open(os.devnull, 'w')
         sp.check_call(['pynml' if os.name != 'nt' else 'pynml.bat', '-h'], stdout=FNULL)
     except OSError:
         ret = False
     return ret
 def is_installed(version):
     
     inform('Checking whether neuroConstruct is installed', indent=2, verbosity=2)
     ret = True
     try:
         with working_dir(PyneuroConstructEngine.get_nC_environment()['NC_HOME']):
             r = co(['./nC.sh','-v'], verbosity=1)
             ret = 'v%s'%r.split()[-1]
     except Exception as err:
         inform("Couldn't execute neuroConstruct:", err, indent=1)
         ret = False
     return ret
 def is_installed(version):
     ret = True
     try:
         if is_verbose():
             inform("Checking whether %s is installed..." %
                JNeuroMLEngine.name, indent=1)
         FNULL = open(os.devnull, 'w')
         r = check_output(['jnml' if os.name != 'nt' else 'jnml.bat', '-v'], verbosity=2)
         ret = '%s'%r.split()[1]
     except OSError:
         ret = False
     return ret
 def is_installed(version):
     ret = True
     try:
         import brian2
         inform("Brian2 version %s is correctly installed..." % brian2.__version__, indent=2, verbosity=2)
         
         ret = 'v%s'%brian2.__version__
         
     except Exception as err:
         inform("Couldn't import Brian2 into Python: ", err, indent=1, verbosity=1)
         ret = False
     return ret
def install_pylems():
    
    install_root = os.environ['HOME']
    
    with working_dir(install_root):
        check_output(['git', 'clone', 'https://github.com/LEMS/pylems.git'])
        inform('Successfully cloned PyLEMS', indent=2, verbosity=1)
    
    path = os.path.join(install_root,'pylems')
    
    with working_dir(path):
        check_output(['python', 'setup.py', 'install'])
        inform('Successfully installed PyLEMS', indent=2, verbosity=1)
 def run(self):
     
     try:
         inform("Running file %s with Py_neuroConstruct" % trim_path(self.modelpath), indent=1)
         
         nC_sh = os.path.join(PyneuroConstructEngine.get_nC_environment()['NC_HOME'], 'nC.sh')
         self.stdout = co([nC_sh, '-python', self.modelpath, '-nogui'],
                                       cwd=os.path.dirname(self.modelpath))
         self.returncode = 0
     except Exception as err:
         inform("Error with running Py_neuroConstruct:", err, indent=1)
         self.returncode = -1
         self.stdout = "???"
 def is_installed(version):
     if is_verbose():
         inform("Checking whether the engine %s has been installed correctly..." %
                MooseEngine.name, indent=1)
 
     ret = True
     try:
         
         ret_str = sp.check_output(['python -c "import moose; print(moose.__version__)"'], shell=True,stderr=sp.STDOUT)
         ret = len(ret_str) > 0
         
         if ret and is_verbose():
             inform("%s is correctly installed..." % (MooseEngine.name), indent=2)
         if ret:    
             import moose
             ret = 'v%s'%moose.__version__
         
     except Exception as err:
         inform("Couldn't import moose into Python: ", err, indent=1)
         ret = False
     if not ret or not PyNeuroMLEngine.is_installed(None):
         ret = False
     
     inform("Moose is_installed(): %s"%ret, "", indent=1, verbosity=2)
     return ret
 def is_installed(version, silent=True):
     if is_verbose():
         inform("Checking whether the engine %s has been installed correctly..." %
                NetPyNEEngine.name, indent=1)
 
     ret = True
     try:
         
         ret_str = sp.check_output(['python -c "import netpyne; print(netpyne.__version__)"'], shell=True,stderr=sp.STDOUT)
         
         ret = len(ret_str) > 0
         
         if ret and is_verbose():
             inform("%s is correctly installed..." % (NetPyNEEngine.name), indent=2)
             
         if ret:
             ret = 'v%s'%str(ret_str.strip())
             
     except Exception as err:
         inform("Couldn't import netpyne into Python: ", err, indent=1)
         ret = False
         
     if not PyNRNEngine.is_installed(None) or not PyNeuroMLEngine.is_installed(None):
         ret = False
     
     if not silent:
         inform("NetPyNE is_installed: %s"%ret, "", indent=1)
     return ret
 def run(self):
     try:
         inform("Running file %s with jLEMS" % trim_path(self.modelpath), indent=1)
         self.stdout = sp.check_output(['lems', self.modelpath, '-nogui'],
                                       cwd=os.path.dirname(self.modelpath))
         self.returncode = 0
     except sp.CalledProcessError as err:
         self.returncode = err.returncode
         self.stdout = err.output
         raise EngineExecutionError
     except Exception as err:
         inform("Another error with running jLEMS:", err, indent=1)
         self.returncode = -1
         self.stdout = "???"
def install_brian():
    
    install_root = os.environ['HOME']
    
    with working_dir(install_root):
        check_output(['git', 'clone', 'https://github.com/brian-team/brian.git'])
        inform('Successfully cloned Brian', indent=2, verbosity=1)
    
    path = os.path.join(install_root,'brian')
    
    with working_dir(path):
        check_output(['git','checkout','master'])
        check_output(['python', 'setup.py', 'install'])
        inform('Successfully installed Brian', indent=2, verbosity=1)