Command Line Interface¶
The Pype9 command line interface will be installed on your system path when
Pype9 is installed with Pip (see Installation), otherwise it can be
found in the bin
directory of the repository.
In a similar style to many popular command line tools (e.g. Git, Pip,
Homebrew, etc..) there is a single command, pype9
, which is used to switch
between different pipelines, i.e.:
$ pype9 <cmd> <options> <args>
There are currently four pipeline switches:
- simulate
- plot
- convert
- help
Simulate¶
Simulates a single cell defined by a 9ML Dynamics or DynamicsProperties, or a complete 9ML network, using either Neuron or NEST as the simulator backend.
Send ports and state-variables of the simulation can be recorded and saved to file in Neo format using the ‘–record’ option, e.g.:
$ pype9 simulate my_cell.xml nest 100.0 0.01 \
--record my_event_port ~/my_even_port.neo.pkl
For single-cell simulations, analog and event inputs stored in Neo format can be “played” into ports of the Dynamics class using the ‘–play’ option e.g.:
$ pype9 simulate my_cell.xml nest 100.0 0.01 \
--record my_event_port data-dir/my_even_port.neo.pkl \
--play my_analog_receive_port data-dir/my_input_current.neo.pkl
Properties, initial values and the initial regime (for single cells) can be overridden with the ‘–prop’, ‘–initial_value’ and ‘–initial_regime’ respectively and must be provided for every parameter/state-variable if they are not in the model description file.
usage: pype9 simulate [-h] [--prop PARAM VALUE UNITS]
[--init_regime INIT_REGIME]
[--init_value STATE-VARIABLE VALUE UNITS]
[--record RECORD [RECORD ...]] [--play PORT FILENAME]
[--seed SEED] [--properties_seed PROPERTIES_SEED]
[--min_delay DELAY UNITS] [--device_delay DELAY UNITS]
[--build_mode BUILD_MODE] [--build_dir BUILD_DIR]
[--build_version BUILD_VERSION]
model {neuron,nest} time timestep
Positional Arguments¶
model | Path to nineml model file which to simulate. It can be a relative path, absolute path, URL or if the path starts with ‘//’ it will be interpreted as a ninemlcatalog path. For files with multiple components, the name of component to simulated must be appended after a #, e.g. //neuron/izhikevich#izhikevich |
simulator | Possible choices: neuron, nest Which simulator backend to use |
time | Time to run the simulation for (ms) |
timestep | Timestep used to solve the differential equations (ms) |
Named Arguments¶
--prop | Set the property to the given value Default: [] |
--init_regime | Initial regime for dynamics |
--init_value | Initial regime for dynamics Default: [] |
--record | Record the values from the send port or state variable and the filename to save it into. Each record option can have either 2 or 4 arguments: PORT/STATE-VARIABLE FILENAME [T_START T_START_UNITS] Default: [] |
--play | Name of receive port and filename with signal to play it into Default: [] |
--seed | Random seed used to create network and properties |
--properties_seed | |
Random seed used to create network connections and properties. If not provided it is generated from the ‘–seed’ option. | |
--min_delay | The minimum delay of the model (only applicable for single cell NEST simulations) |
--device_delay | The delay applied to signals played into ports of the model (only applicable for NEST simulations) |
--build_mode | The strategy used to build and compile the model. Can be one of ‘lazy’, ‘force’, ‘require’, ‘build_only’, ‘generate_only’, ‘purge’ (default “lazy”) Default: “lazy” |
--build_dir | Base build directory |
--build_version | |
Version to append to name to use when building component classes |
Note
To simulate network simulations on Neuron over multiple cores you need to
use the MPI command mpirun -n <ncores> pype9 simulate <options>
and have installed Neuron with the --with-mpi
option
(see Installation)
Plot¶
Simple tool for plotting the output of PyPe9 simulations using Matplotlib. Since Pype9 output is stored in Neo format, it can be used to plot generic Neo files but it also includes handling of Pype9-specific annotations, such as regime transitions.
usage: pype9 plot [-h] [--save SAVE] [--dims WIDTH HEIGHT] [--hide]
[--resolution RESOLUTION]
filename
Positional Arguments¶
filename | Neo file outputted from a PyPe9 simulation |
Named Arguments¶
--save | Location to save the figure to |
--dims | Dimensions of the plot Default: (10, 8) |
--hide | Whether to show the plot or not Default: False |
--resolution | Resolution of the figure when it is saved Default: 300.0 |
Convert¶
Tool to convert 9ML files between different supported formats (e.g. XML, JSON, YAML) and 9ML versions.
usage: pype9 convert [-h] [--nineml_version NINEML_VERSION] in_file out_file
Positional Arguments¶
in_file | 9ML file to be converted |
out_file | Converted filename |
Named Arguments¶
--nineml_version, -v | |
The version of nineml to output |
Help¶
Prints help information associated with a PyPe9 command
usage: pype9 help [-h] cmd
Positional Arguments¶
cmd | Name of the command to print help information |
Examples¶
The available pipelines can be listed with:
$ pype9 help
usage: pype9 <cmd> <args>
available commands:
convert
Converts a 9ML file from one supported format to another
help
Prints help information associated with a PyPe9 command
plot
Convenient script for plotting the output of PyPe9 simulations (actually not
9ML specific as the signals are stored in Neo format)
simulate
Runs a simulation described by an Experiment layer 9ML file
More detailed help messages for each available pipeline can be viewed by supplying its name to the help:
$ pype9 help plot
usage: pype9 plot [-h] [--save SAVE] [--dims WIDTH HEIGHT] [--hide]
[--resolution RESOLUTION]
filename
Convenient script for plotting the output of PyPe9 simulations (actually not
9ML specific as the signals are stored in Neo format)
positional arguments:
filename Neo file outputted from a PyPe9 simulation
optional arguments:
-h, --help show this help message and exit
--save SAVE Location to save the figure to
--dims WIDTH HEIGHT Dimensions of the plot
--hide Whether to show the plot or not
--resolution RESOLUTION
Resolution of the figure when it is saved