superneuromat.SNN.saveas_json#

SNN.saveas_json(fp, 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 file.

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.dump().

Examples

>>> with open('my_model.snn.json', 'w') as f:
>>>     snn.saveas_json(f, net_name="My SNN")