superneuromat.SNN.to_json#
- SNN.to_json(array_representation='json-native', skipkeys: list[str] | tuple[str] | set[str] | None = None, net_name: str | None = None, extra: dict | None = None, indent=2, **kwargs)[source]#
Exports the SNN to a JSON string.
- Parameters:
array_representation (str, default="json-native") – The representation to use for arrays. Can be “json-native”, “base64”, or “base85”.
skipkeys (list[str] | None, default=None) – The names of variables to omit from the export. Can contain any key from
eqvars
. Can also be None or empty list[]
to export all variables.net_name (str | None, default=None) – The name of the network to export. If None, the resulting JSON will not have a
"name"
key.extra (dict | None, default=None) – User-defined data to include in the exported JSON. If None, the resulting JSON will not have an
"extra"
key.indent (int, default=2) – The indentation to use for the JSON. Set to
None
to get a compact JSON string.
This function additionally accepts the same arguments as
json.dumps()
.- Returns:
The SNN as a JSON string.
- Return type:
Examples
>>> snn.to_json(net_name="My SNN", indent=None) {"$schema": "https://ornl.github.io/superneuromat/schema/0.1/snn.json", "version": "0.1", "networks": [{"meta": {"array_representation": "json-native", "from": {"module": "superneuromat", "version": "3.1.0"}, "format": "snm", "format_version": "0.1", "type": "SNN"}, "data": {"neuron_refractory_periods": [0, 0], "neuron_states": [0.0, 0.0], "num_synapses": 2, "post_synaptic_neuron_ids": [1, 0], "aneg": [], "enable_stdp": [0, 0], "pre_synaptic_neuron_ids": [0, 1], "neuron_thresholds": [3.141592653589793115997963468544185161590576171875, 0.0], "neuron_refractory_periods_state": [0.0, 0.0], "neuron_reset_states": [0.0, 0.0], "stdp_positive_update": true, "input_spikes": {"3": {"nids": [1], "values": [1.0]}}, "synaptic_delays": [1, 1], "allow_signed_leak": false, "num_neurons": 2, "_sparse": "auto", "_backend": "auto", "apos": [], "manual_setup": false, "spike_train": [[1, 0], [0, 1], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0]], "neuron_leaks": [Infinity, Infinity], "allow_incorrect_stdp_sign": false, "stdp": true, "synaptic_weights": [1.0, 1.0], "default_dtype": "float64", "stdp_negative_update": true}}]}