nnmt.models.Network

class nnmt.models.Network(network_params=None, analysis_params=None, file=None)[source]

Basic Network parent class all other models inherit from.

This class serves as a container for network parameters, analysis parameters, and results calculated using the toolbox. It has convenient saving and loading methods.

Parameters:
network_params[str | dict], optional

Path to yaml file containing network parameters or dictionary of network parameters.

analysis_params[str | dict], optional

Path to yaml file containing analysis parameters or dictionary of analysis parameters.

filestr, optional

File name of h5 file from which network can be loaded. Default is None.

Attributes:
analysis_paramsdict

Collection of parameters needed for analysing the network model. For example the frequencies a quantity should be calculated for.

analysis_params_yamlstr

File name of yaml analysis parameter file that is read in and converted to analysis_params.

input_unitsdict

Any read in quantities are converted to SI units and the original units are stored in this this dictionary.

network_paramsdict

Collection of network parameters like numbers of neurons, etc.

network_params_yamlstr

File name of yaml network parameter file that is read in and coverted to network_params.

resultsdict

This dictionary stores the most recently calculated results. If an already calculated quantity is calculated with another method, the new version is stored here. Functions needing some previosly calculated results search for them in this dictionary.

results_hash_dictdict

This dictionary stores all calcluated results using a unique hash. When a quantity that already has been calculated is to be calculated another time, the result is retrieved from this dictionary.

result_unitsdict

This is where the units of the results are stored. They are retrieved when saving results.

Methods

save(file) Save network to h5 file.
save_results(file) Saves results and parameters to h5 file.
load(file) Load network from h5 file.
show() Returns which results have already been calculated.
change_parameters([changed_network_params, ...]) Change parameters and return network with specified parameters.
copy() Returns a deep copy of the network.
clear_results([results]) Remove calculated results or specified ones from internal dicts.