Skip to content

Commit c5893cd

Browse files
authored
Merge pull request #5 from kenblu24/snn-json
Export & Import SuperNeuroMAT models to/from an `.snn.json` file.
2 parents a7e4764 + 7bd1e44 commit c5893cd

File tree

7 files changed

+1062
-3
lines changed

7 files changed

+1062
-3
lines changed

docs/source/api/SNN.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,10 @@ Methods
211211
~SNN.unmemoize
212212
~SNN.zero_neuron_states
213213
~SNN.zero_refractory_periods
214+
~SNN.rebuild_connection_ids
215+
~SNN.to_json
216+
~SNN.saveas_json
217+
~SNN.from_jsons
214218

215219

216220
Attributes

docs/source/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868

6969

7070
html_theme = 'pydata_sphinx_theme'
71-
html_static_path = ['_static']
71+
html_static_path = ['_static', 'schema']
7272
html_title = "SuperNeuroMAT"
7373

7474
github_version = "main"

docs/source/schema/0.1/snn.json

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"$id": "https://ornl.github.io/superneuromat/schema/0.1/snn.json",
4+
"title": "SuperNeuroMAT Networks Schema",
5+
"description": "JSON file containing a list of networks for use with SuperNeuroMAT",
6+
"type": "object",
7+
"properties": {
8+
"version": {
9+
"description": "The version of the schema",
10+
"type": "string",
11+
"const": "0.1"
12+
},
13+
"networks": {
14+
"description": "A list of networks",
15+
"type": "array",
16+
"items": {
17+
"type": "object",
18+
"properties": {
19+
"name": {
20+
"description": "The name of the network",
21+
"type": "string"
22+
},
23+
"meta": {
24+
"description": "Metadata about the network",
25+
"type": "object",
26+
"properties": {
27+
"array_representation": {
28+
"description": "The representation of the network data in the SNN",
29+
"type": "string",
30+
"enum": ["json-native", "base85", "base64"]
31+
},
32+
"from": {
33+
"description": "The module and version used to create the network",
34+
"type": "object",
35+
"properties": {
36+
"module": {
37+
"description": "The module used to create the network",
38+
"type": "string"
39+
},
40+
"version": {
41+
"description": "The version of the module used to create the network",
42+
"type": "string"
43+
}
44+
},
45+
"required": ["module", "version"]
46+
},
47+
"format": {
48+
"description": "The format of the network",
49+
"type": "string",
50+
"enum": ["snm"]
51+
},
52+
"format_version": {
53+
"description": "The version of the format of the network",
54+
"type": "string",
55+
"const": "0.1.0"
56+
}
57+
},
58+
"required": ["array_representation", "from", "format", "format_version"]
59+
},
60+
"data": {
61+
"description": "The data of the network",
62+
"type": "object"
63+
},
64+
"extra": {
65+
"description": "Extra data about the network",
66+
"type": "object"
67+
}
68+
},
69+
"required": ["meta", "data"]
70+
}
71+
},
72+
},
73+
"required": ["version", "networks"],
74+
"additionalProperties": false
75+
}
76+

pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ commands = [
9494
["python", "test_display.py",],
9595
["python", "test_reset.py",],
9696
["python", "test_dtype.py",],
97+
["python", "test_json.py",],
9798
]
9899

99100
[tool.tox.env.jit]
@@ -157,6 +158,7 @@ commands = [
157158
["python", "test_reset.py",],
158159
["python", "test_dtype.py",],
159160
["python", "test_spikes.py",],
161+
["python", "test_json.py",],
160162
]
161163

162164
[tool.tox.env.numpy20]
@@ -172,4 +174,5 @@ commands = [
172174
["python", "test_reset.py",],
173175
["python", "test_dtype.py",],
174176
["python", "test_spikes.py",],
177+
["python", "test_json.py",],
175178
]

0 commit comments

Comments
 (0)