superneuromat.SNN.from_jsons#
- SNN.from_jsons(json_str: str, net_id: int | str = 0, skipkeys: list[str] | tuple[str] | None = None)[source]#
Update this SNN from a SuperNeuroMat JSON string.
- Parameters:
json_str (str) – _description_
net_id (int | str (default: 0)) – ID of the network to load. Can be an integer, which represents its index in the JSON network list, or a string, which represents the name of the network stored in
json_dict["networks"]["meta"]["name"]
.skipkeys (list[str] | tuple[str] | None (default: None)) – Keys from
json_dict["networks"]["data"]
to skip when loading the network.
- Returns:
This SNN will be updated with the specified network data from the JSON string.
- Return type:
self
- Raises:
ValueError – If network with given ID not found, or if multiple networks with the given ID are found.
Examples
>>> snn = SNN() >>> with open('my_model.snn.json', 'r') as f: >>> snn.from_jsons(f.read(), net_id="My SNN")