Skip to content
Snippets Groups Projects
Select Git revision
  • 6ebbb5e668d57a892f7d1b7c7a670a077b002dea
  • master default protected
  • aca
  • improve_README
  • v1.2.0
  • v1.1.1 protected
  • v1.1.0 protected
  • v1.0.0 protected
8 results

run_simulation.py

Blame
  • run_simulation.py 941 B
    """
    This script is used to run a simulation from the given command-line
    arguments:
    1. Label of the simulation
    2. Label of the network to be simulated
    
    It initializes the network class and then runs the simulate method of
    the simulation class instance.
    
    This script should be used in the `jobscript_template` defined in the
    config.py file. See config_template.py.
    """
    
    import json
    import nest
    import os
    import sys
    
    from config import data_path
    from multiarea_model import MultiAreaModel
    
    label = sys.argv[1]
    network_label = sys.argv[2]
    fn = os.path.join(data_path,
                      label,
                      '_'.join(('custom_params',
                                label,
                               str(nest.Rank()))))
    with open(fn, 'r') as f:
        custom_params = json.load(f)
    
    os.remove(fn)
    
    M = MultiAreaModel(network_label,
                       simulation=True,
                       sim_spec=custom_params['sim_params'])
    M.simulation.simulate()