Database module#
NNGT provides a database to store NEST simulations.
This database requires peewee>3
to work and can be switched on using:
nngt.set_config("use_database", True)
The commands are then used by calling nngt.database
to access the database
tools.
Functions#
- nngt.database.get_results(table, column=None, value=None)#
Return the entries where the attribute column satisfies the required equality.
- Parameters
table (str) – Name of the table where the search should be performed (among
'simulation'
,'computer'
,'neuralnetwork'
,'activity'
,'synapse'
,'neuron'
, or'connection'
).column (str, optional (default: None)) – Name of the variable of interest (a column on the table). If None, the whole table is returned.
value (column corresponding type, optional (default: None)) – Specific value for the variable of interest. If None, the whole column is returned.
- Returns
peewee.SelectQuery
with entries matching the request.
- nngt.database.is_clear()#
Check that the logs are clear.
- nngt.database.log_simulation_end(network=None, log_activity=True)#
Record the simulation completion and simulated times, save the data, then reset.
- nngt.database.log_simulation_start(network, simulator, save_network=True)#
Record the simulation start time, all nodes, connections, network, and computer properties, as well as some of simulation’s.
- Parameters
network (
Network
or subclass) – Network used for the current simulation.simulator (str) – Name of the simulator.
save_network (bool, optional (default: True)) – Whether to save the network or not.
- nngt.database.reset()#
Reset log status.
Recording a simulation#
nngt.database.log_simulation_start(net, "nest-2.14")
nest.Simulate(1000.)
nngt.database.log_simulation_end()
Checking results in the database#
The database contains the following tables, associated to their respective fields:
‘activity’:
Activity
,‘computer’:
Computer
,‘connection’:
Connection
,‘neuralnetwork’:
NeuralNetwork
,‘neuron’:
Neuron
,‘simulation’:
Simulation
,‘synapse’:
Synapse
.
These tables are the first keyword passed to get_results()
,
you can find the existing columns for each of the tables in the following
classes descriptions:
Store results into a database