Sonata module¶
Build and simulate networks represented by the SONATA format
See also
See the NEST SONATA guide guide for more details
Functions to build and simulate networks with the SONATA format
- class nest.lib.hl_api_sonata.SonataNetwork(config, sim_config=None)¶
Bases:
object
Class for building and simulating networks represented by the SONATA format.
SonataNetwork
provides native NEST support for building and simulating network models represented by the SONATA format. In the SONATA format, information about nodes, edges (synapses) and their respective properties are stored in the table-based file formats HDF5 and CSV. Model metadata, such as the path relation between files on disk and simulation parameters, are stored in JSON configuration files. See the NEST SONATA guide for details on the NEST support of the SONATA format.The constructor takes the JSON configuration file specifying the paths to the HDF5 and CSV files describing the network. In case simulation parameters are stored in a separate JSON configuration file, the constructor also has the option to pass a second configuration file.
- Parameters:
config ([str | pathlib.Path | pathlib.PurePath]) – String or pathlib object describing the path to the JSON configuration file.
sim_config ([str | pathlib.Path | pathlib.PurePath], optional) – String or pathlib object describing the path to a JSON configuration file containing simulation parameters. This is only needed if simulation parameters are given in a separate configuration file.
Example
import nest nest.ResetKernel() # Instantiate SonataNetwork sonata_net = nest.SonataNetwork("path/to/config.json") # Create and connect nodes node_collections = sonata_net.BuildNetwork() # Connect spike recorder to a population s_rec = nest.Create("spike_recorder") nest.Connect(node_collections["name_of_population_to_record"], s_rec) # Simulate the network sonata_net.Simulate()
- BuildNetwork(hdf5_hyperslab_size=None)¶
Build SONATA network.
Convenience function for building the SONATA network. The function first calls the membership function
Create()
to create the network nodes and then the membership functionConnect()
to create their connections.For more details, see
Create()
andConnect()
.- Parameters:
hdf5_hyperslab_size (int, optional) – Size of hyperslab that is read into memory in one read operation. Applies to all HDF5 datasets relevant for creating the connections. Default:
2**20
.- Returns:
node_collections – A dictionary containing the created
NodeCollection
for each population. The population names are keys.- Return type:
- Connect(hdf5_hyperslab_size=None)¶
Connect the SONATA network nodes.
The connections are created by first parsing the edge (synapse) CSV files to create a map of synaptic properties on the Python level. This is then sent to the NEST kernel together with the edge HDF5 files to create the connections.
For large networks, the edge HDF5 files might not fit into memory in their entirety. In the NEST kernel, the edge HDF5 datasets are therefore read sequentially as blocks of contiguous hyperslabs. The hyperslab size is modifiable so that the user is able to achieve a balance between the number of read operations and memory overhead.
- Parameters:
hdf5_hyperslab_size (int, optional) – Size of the hyperslab to read in one read operation. The hyperslab size is applied to all HDF5 datasets that need to be read in order to create the connections. Default:
2**20
.
- Create()¶
Create the SONATA network nodes.
Creates the network nodes. In the SONATA format, node populations are serialized in node HDF5 files. Each node in a population has a node type. Each node population has a single associated node types CSV file that assigns properties to all nodes with a given node type.
Please note that it is assumed that all relevant node properties are stored in the node types CSV file. For neuron nodes, the relevant properties are model type, model template and reference to a JSON file describing the parametrization.
- Returns:
node_collections – A dictionary containing the created
NodeCollection
for each population. The population names are keys.- Return type:
- Simulate()¶
Simulate the SONATA network.
The simulation time and resolution are expected to be provided in the JSON configuration file.
- property config¶
- property node_collections¶