pyneuroml.nsgr module#

Module for working with NSG. See OpenSourceBrain/pynsgr

File: pyneuroml/nsgr.py

Copyright 2024 NeuroML contributors

pyneuroml.nsgr.run_on_nsg(engine: str, lems_file_name: str, root_dir: str | None = None, nsg_sim_config: Dict[Any, Any] = {}, run_dir: str | None = None, dry_run: bool = False, *engine_args: Any, **engine_kwargs: Any)#

Run NeuroML/LEMS simulation on NSG.

Since the versions of tools on NSG may differ from what you have installed locally, this method first generates the simulation engine specific files (runner script for NEURON and mod files, for example) for the provided engine in a new folder, zips them up, writes the config files, and then submits the job to NSG using pynsgr.

The data generated by the job (if the command is not interrupted) is also downloaded to the newly created directory.

Please ensure that you have set up an account and have your NSG configuration file populated as noted in pynsgr.

Default for the nsg_sim_config is below, keys provided by the user in nsg_sim_config overwrite these:

nsg_sim_config_dict = {
    "number_cores_": "1",
    "number_nodes_": "1",
    "number_gbmemorypernode_": "1",
    "tasks_per_node_": "1",
    "runtime_": "0.5",
    'toolId': "PY_EXPANSE",
    'nrnivmodl_o_': "1",
    "cmdlineopts_": "-nogui"
}

Added in version 1.0.10.

Parameters:
  • engine (str) – name of engine: suffixes of the run_lems_with functions

  • lems_file_name (str) – name of LEMS simulation file

  • root_dir (str) – directory in which LEMS simulation file lives Any included files must be relative to this main directory

  • nsg_sim_config (dict) – dict containing params and values that will be printed to testParam.properties

  • run_dir (str) –

    directory in which model files are copied, backend specific files are generated, and from which the archive is sent to NSG. Results from the NSG run will also be downloaded to this directory.

    By default, this is the directory that the command is run from (“.”)

    It is good practice to separate directories where simulations are run from the source of the model/simulations.

  • engine_args – positional args to be passed to the engine runner function

  • engine_kwargs – keyword args to be be passed to the engine runner function

  • dry_run (bool) – do everything but do not submit

Returns:

name of new directory

Return type:

str