@science-corporation/synapse 1.1.0 → 2.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -0
- package/package.json +3 -2
- package/src/config.ts +4 -6
- package/src/device.ts +35 -6
- package/src/nodes/index.ts +2 -3
- package/src/nodes/spike_binner.ts +30 -0
- package/src/nodes/spike_detector.ts +30 -0
- package/synapse-api/.github/pull_request_template.md +10 -0
- package/synapse-api/README.md +1 -1
- package/synapse-api/api/app.proto +55 -0
- package/synapse-api/api/channel.proto +15 -1
- package/synapse-api/api/datatype.proto +98 -1
- package/synapse-api/api/device.proto +65 -0
- package/synapse-api/api/node.proto +25 -21
- package/synapse-api/api/nodes/application.proto +24 -0
- package/synapse-api/api/nodes/broadband_source.proto +1 -0
- package/synapse-api/api/nodes/disk_writer.proto +17 -0
- package/synapse-api/api/nodes/optical_stimulation.proto +29 -0
- package/synapse-api/api/nodes/signal_config.proto +2 -0
- package/synapse-api/api/nodes/spike_binner.proto +7 -0
- package/synapse-api/api/nodes/spike_detector.proto +19 -0
- package/synapse-api/api/performance.proto +29 -0
- package/synapse-api/api/query.proto +27 -1
- package/synapse-api/api/status.proto +6 -1
- package/synapse-api/api/synapse.proto +9 -31
- package/synapse-api/api/tap.proto +35 -0
- package/synapse-api/api/time.proto +53 -0
- package/dist/api/api.d.ts +0 -6233
- package/dist/api/api.d.ts.map +0 -1
- package/dist/api/api.js +0 -14553
- package/dist/api/api.js.map +0 -1
- package/dist/api/proto.json +0 -1077
- package/dist/browser.d.ts +0 -4
- package/dist/browser.d.ts.map +0 -1
- package/dist/browser.js +0 -22
- package/dist/browser.js.map +0 -1
- package/dist/config.d.ts +0 -17
- package/dist/config.d.ts.map +0 -1
- package/dist/config.js +0 -113
- package/dist/config.js.map +0 -1
- package/dist/demo.d.ts +0 -2
- package/dist/demo.d.ts.map +0 -1
- package/dist/demo.js +0 -285
- package/dist/demo.js.map +0 -1
- package/dist/device.d.ts +0 -32
- package/dist/device.d.ts.map +0 -1
- package/dist/device.js +0 -160
- package/dist/device.js.map +0 -1
- package/dist/index.d.ts +0 -7
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -30
- package/dist/index.js.map +0 -1
- package/dist/node.d.ts +0 -10
- package/dist/node.d.ts.map +0 -1
- package/dist/node.js +0 -14
- package/dist/node.js.map +0 -1
- package/dist/nodes/broadband_source.d.ts +0 -11
- package/dist/nodes/broadband_source.d.ts.map +0 -1
- package/dist/nodes/broadband_source.js +0 -28
- package/dist/nodes/broadband_source.js.map +0 -1
- package/dist/nodes/disk_writer.d.ts +0 -11
- package/dist/nodes/disk_writer.d.ts.map +0 -1
- package/dist/nodes/disk_writer.js +0 -28
- package/dist/nodes/disk_writer.js.map +0 -1
- package/dist/nodes/electrical_stimulation.d.ts +0 -11
- package/dist/nodes/electrical_stimulation.d.ts.map +0 -1
- package/dist/nodes/electrical_stimulation.js +0 -28
- package/dist/nodes/electrical_stimulation.js.map +0 -1
- package/dist/nodes/index.d.ts +0 -11
- package/dist/nodes/index.d.ts.map +0 -1
- package/dist/nodes/index.js +0 -25
- package/dist/nodes/index.js.map +0 -1
- package/dist/nodes/optical_stimulation.d.ts +0 -11
- package/dist/nodes/optical_stimulation.d.ts.map +0 -1
- package/dist/nodes/optical_stimulation.js +0 -28
- package/dist/nodes/optical_stimulation.js.map +0 -1
- package/dist/nodes/spectral_filter.d.ts +0 -11
- package/dist/nodes/spectral_filter.d.ts.map +0 -1
- package/dist/nodes/spectral_filter.js +0 -28
- package/dist/nodes/spectral_filter.js.map +0 -1
- package/dist/nodes/spike_detect.d.ts +0 -11
- package/dist/nodes/spike_detect.d.ts.map +0 -1
- package/dist/nodes/spike_detect.js +0 -28
- package/dist/nodes/spike_detect.js.map +0 -1
- package/dist/nodes/spike_source.d.ts +0 -11
- package/dist/nodes/spike_source.d.ts.map +0 -1
- package/dist/nodes/spike_source.js +0 -28
- package/dist/nodes/spike_source.js.map +0 -1
- package/dist/nodes/stream_in.d.ts +0 -15
- package/dist/nodes/stream_in.d.ts.map +0 -1
- package/dist/nodes/stream_in.js +0 -66
- package/dist/nodes/stream_in.js.map +0 -1
- package/dist/nodes/stream_out.d.ts +0 -23
- package/dist/nodes/stream_out.d.ts.map +0 -1
- package/dist/nodes/stream_out.js +0 -105
- package/dist/nodes/stream_out.js.map +0 -1
- package/dist/utils/client.d.ts +0 -10
- package/dist/utils/client.d.ts.map +0 -1
- package/dist/utils/client.js +0 -39
- package/dist/utils/client.js.map +0 -1
- package/dist/utils/discover.d.ts +0 -10
- package/dist/utils/discover.d.ts.map +0 -1
- package/dist/utils/discover.js +0 -49
- package/dist/utils/discover.js.map +0 -1
- package/dist/utils/enum.d.ts +0 -2
- package/dist/utils/enum.d.ts.map +0 -1
- package/dist/utils/enum.js +0 -13
- package/dist/utils/enum.js.map +0 -1
- package/dist/utils/index.d.ts +0 -2
- package/dist/utils/index.d.ts.map +0 -1
- package/dist/utils/index.js +0 -6
- package/dist/utils/index.js.map +0 -1
- package/dist/utils/ip.d.ts +0 -2
- package/dist/utils/ip.d.ts.map +0 -1
- package/dist/utils/ip.js +0 -52
- package/dist/utils/ip.js.map +0 -1
- package/dist/utils/status.d.ts +0 -28
- package/dist/utils/status.d.ts.map +0 -1
- package/dist/utils/status.js +0 -54
- package/dist/utils/status.js.map +0 -1
- package/src/api/api.d.ts +0 -6233
- package/src/api/api.js +0 -15524
- package/src/api/proto.json +0 -1077
- package/src/demo.ts +0 -325
- package/src/nodes/spike_detect.ts +0 -30
- package/src/nodes/stream_in.ts +0 -78
- package/src/nodes/stream_out.ts +0 -109
- package/synapse-api/api/nodes/spike_detect.proto +0 -16
- package/synapse-api/api/nodes/stream_in.proto +0 -14
- package/synapse-api/api/nodes/stream_out.proto +0 -42
package/README.md
CHANGED
|
@@ -79,3 +79,10 @@ config.connect(broadband, streamOut);
|
|
|
79
79
|
await device.configure(config);
|
|
80
80
|
await device.start();
|
|
81
81
|
```
|
|
82
|
+
|
|
83
|
+
## Bumping Version
|
|
84
|
+
```
|
|
85
|
+
npm version patch # increment last part of version number
|
|
86
|
+
npm version minor # increment middle part
|
|
87
|
+
npm version major # increment first part
|
|
88
|
+
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@science-corporation/synapse",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.2.2",
|
|
4
4
|
"description": "Client library and CLI for the Synapse API",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -63,7 +63,8 @@
|
|
|
63
63
|
"@grpc/proto-loader": "^0.7.13",
|
|
64
64
|
"google-protobuf": "^3.21.2",
|
|
65
65
|
"long": "^5.3.1",
|
|
66
|
-
"protobufjs-cli": "^1.1.
|
|
66
|
+
"protobufjs-cli": "^1.1.3",
|
|
67
|
+
"tmp": "^0.2.5",
|
|
67
68
|
"yargs": "^17.7.2"
|
|
68
69
|
}
|
|
69
70
|
}
|
package/src/config.ts
CHANGED
|
@@ -5,10 +5,9 @@ import DiskWriter from "./nodes/disk_writer";
|
|
|
5
5
|
import ElectricalStimulation from "./nodes/electrical_stimulation";
|
|
6
6
|
import OpticalStimulation from "./nodes/optical_stimulation";
|
|
7
7
|
import SpectralFilter from "./nodes/spectral_filter";
|
|
8
|
-
import
|
|
8
|
+
import SpikeBinner from "./nodes/spike_binner";
|
|
9
|
+
import SpikeDetector from "./nodes/spike_detector";
|
|
9
10
|
import SpikeSource from "./nodes/spike_source";
|
|
10
|
-
import StreamIn from "./nodes/stream_in";
|
|
11
|
-
import StreamOut from "./nodes/stream_out";
|
|
12
11
|
import { Status, StatusCode } from "./utils/status";
|
|
13
12
|
|
|
14
13
|
type Connection = [number, number];
|
|
@@ -19,9 +18,8 @@ const kNodeTypeObjectMap = {
|
|
|
19
18
|
[synapse.NodeType.kSpikeSource]: SpikeSource,
|
|
20
19
|
[synapse.NodeType.kOpticalStimulation]: OpticalStimulation,
|
|
21
20
|
[synapse.NodeType.kSpectralFilter]: SpectralFilter,
|
|
22
|
-
[synapse.NodeType.
|
|
23
|
-
[synapse.NodeType.
|
|
24
|
-
[synapse.NodeType.kStreamOut]: StreamOut,
|
|
21
|
+
[synapse.NodeType.kSpikeBinner]: SpikeBinner,
|
|
22
|
+
[synapse.NodeType.kSpikeDetector]: SpikeDetector
|
|
25
23
|
};
|
|
26
24
|
|
|
27
25
|
class Config {
|
package/src/device.ts
CHANGED
|
@@ -11,14 +11,13 @@ const kSynapseService = "synapse.SynapseDevice";
|
|
|
11
11
|
class Device {
|
|
12
12
|
rpc: any | null = null;
|
|
13
13
|
channel: Channel | null = null;
|
|
14
|
-
sockets: synapse.INodeSocket[] = [];
|
|
15
14
|
|
|
16
15
|
constructor(public uri: string) {
|
|
17
16
|
const { status, client } = create(protos, kSynapseService)(uri, credentials.createInsecure());
|
|
18
17
|
if (!status.ok() || !client) {
|
|
19
18
|
throw new Error(`Failed to create client for ${uri}: ${status.message}`);
|
|
20
19
|
}
|
|
21
|
-
this.rpc = client;
|
|
20
|
+
this.rpc = client as synapse.SynapseDevice;
|
|
22
21
|
}
|
|
23
22
|
|
|
24
23
|
async configure(config: Config, options: CallOptions = {}): Promise<Status> {
|
|
@@ -48,8 +47,6 @@ class Device {
|
|
|
48
47
|
} else if (!res) {
|
|
49
48
|
reject(new Status(err.code, "failed to get device info: " + err.message));
|
|
50
49
|
} else {
|
|
51
|
-
const { sockets } = res.status;
|
|
52
|
-
this.sockets = sockets || [];
|
|
53
50
|
resolve({ status: new Status(), response: res });
|
|
54
51
|
}
|
|
55
52
|
});
|
|
@@ -90,6 +87,39 @@ class Device {
|
|
|
90
87
|
});
|
|
91
88
|
}
|
|
92
89
|
|
|
90
|
+
async streamQuery(
|
|
91
|
+
query: synapse.IStreamQueryRequest,
|
|
92
|
+
options: CallOptions = {},
|
|
93
|
+
callbacks: {
|
|
94
|
+
onData: (data: synapse.StreamQueryResponse) => void;
|
|
95
|
+
onEnd?: () => void;
|
|
96
|
+
onError?: (err: Error) => void;
|
|
97
|
+
onStatus?: (status: Status) => void;
|
|
98
|
+
}
|
|
99
|
+
) {
|
|
100
|
+
const { onData, onEnd, onError, onStatus } = callbacks;
|
|
101
|
+
const call = this.rpc.streamQuery(query, options);
|
|
102
|
+
call.on("data", (data: synapse.StreamQueryResponse) => {
|
|
103
|
+
onData(data);
|
|
104
|
+
});
|
|
105
|
+
if (onEnd) {
|
|
106
|
+
call.on("end", () => {
|
|
107
|
+
onEnd();
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
if (onError) {
|
|
111
|
+
call.on("error", (err: ServiceError) => {
|
|
112
|
+
onError(err);
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
if (onStatus) {
|
|
116
|
+
call.on("status", (grpcStatus) => {
|
|
117
|
+
onStatus?.(new Status(grpcStatus.code, grpcStatus.details));
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
return call;
|
|
121
|
+
}
|
|
122
|
+
|
|
93
123
|
// Logs
|
|
94
124
|
|
|
95
125
|
async getLogs(
|
|
@@ -135,11 +165,10 @@ class Device {
|
|
|
135
165
|
}
|
|
136
166
|
|
|
137
167
|
_handleStatusResponse(status: synapse.IStatus): Status {
|
|
138
|
-
const { code, message
|
|
168
|
+
const { code, message } = status;
|
|
139
169
|
if (code !== synapse.StatusCode.kOk) {
|
|
140
170
|
return fromDeviceStatus({ code, message });
|
|
141
171
|
} else {
|
|
142
|
-
this.sockets = sockets || [];
|
|
143
172
|
return new Status();
|
|
144
173
|
}
|
|
145
174
|
}
|
package/src/nodes/index.ts
CHANGED
|
@@ -3,9 +3,8 @@ export { default as DiskWriter } from "./disk_writer";
|
|
|
3
3
|
export { default as ElectricalStimulation } from "./electrical_stimulation";
|
|
4
4
|
export { default as OpticalStimulation } from "./optical_stimulation";
|
|
5
5
|
export { default as SpectralFilter } from "./spectral_filter";
|
|
6
|
-
export { default as
|
|
6
|
+
export { default as SpikeBinner } from "./spike_binner";
|
|
7
|
+
export { default as SpikeDetector } from "./spike_detector";
|
|
7
8
|
export { default as SpikeSource } from "./spike_source";
|
|
8
|
-
export { default as StreamIn } from "./stream_in";
|
|
9
|
-
export { default as StreamOut } from "./stream_out";
|
|
10
9
|
|
|
11
10
|
export type * from "../api/api";
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { synapse } from "../api/api";
|
|
2
|
+
import Node from "../node";
|
|
3
|
+
|
|
4
|
+
class SpikeBinner extends Node {
|
|
5
|
+
type = synapse.NodeType.kSpikeBinner;
|
|
6
|
+
config: synapse.ISpikeBinnerConfig;
|
|
7
|
+
|
|
8
|
+
constructor(config: synapse.ISpikeBinnerConfig = {}) {
|
|
9
|
+
super();
|
|
10
|
+
|
|
11
|
+
this.config = config;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
toProto(): synapse.NodeConfig {
|
|
15
|
+
return super.toProto({
|
|
16
|
+
spikeBinner: this.config,
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
static fromProto(proto: synapse.INodeConfig): SpikeBinner {
|
|
21
|
+
const { spikeBinner } = proto;
|
|
22
|
+
if (!spikeBinner) {
|
|
23
|
+
throw new Error("Invalid config, missing spikeBinner");
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return new SpikeBinner(proto.spikeBinner);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export default SpikeBinner;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { synapse } from "../api/api";
|
|
2
|
+
import Node from "../node";
|
|
3
|
+
|
|
4
|
+
class SpikeDetector extends Node {
|
|
5
|
+
type = synapse.NodeType.kSpikeDetector;
|
|
6
|
+
config: synapse.ISpikeDetectorConfig;
|
|
7
|
+
|
|
8
|
+
constructor(config: synapse.ISpikeDetectorConfig = {}) {
|
|
9
|
+
super();
|
|
10
|
+
|
|
11
|
+
this.config = config;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
toProto(): synapse.NodeConfig {
|
|
15
|
+
return super.toProto({
|
|
16
|
+
spikeDetector: this.config,
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
static fromProto(proto: synapse.INodeConfig): SpikeDetector {
|
|
21
|
+
const { spikeDetector } = proto;
|
|
22
|
+
if (!spikeDetector) {
|
|
23
|
+
throw new Error("Invalid config, missing spikeDetector");
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return new SpikeDetector(proto.spikeDetector);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export default SpikeDetector;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Summary
|
|
2
|
+
Brief overview of the changes
|
|
3
|
+
|
|
4
|
+
# Changes
|
|
5
|
+
* Detailed breakdown of what changed and why. If there are new/changed API concepts, explain how they are meant to be used.
|
|
6
|
+
|
|
7
|
+
# Testing
|
|
8
|
+
How can this change be tested?
|
|
9
|
+
|
|
10
|
+
Please provide a link to a reference server and client implementation in synapse-python.
|
package/synapse-api/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
The Synapse Protocol defines a standard interface for interacting with a wide range of possible neural interface devices.
|
|
4
4
|
|
|
5
|
-
Synapse uses gRPC for its control plane API and
|
|
5
|
+
Synapse uses gRPC for its control plane API and Taps for streaming data. Read the full Synapse protocol docs [here](https://science.xyz/docs/d/synapse/index).
|
|
6
6
|
|
|
7
7
|
# Python Installation
|
|
8
8
|
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package synapse;
|
|
4
|
+
|
|
5
|
+
import "api/status.proto";
|
|
6
|
+
import "api/performance.proto";
|
|
7
|
+
import "api/device.proto";
|
|
8
|
+
|
|
9
|
+
import "google/protobuf/struct.proto";
|
|
10
|
+
|
|
11
|
+
message AppManifest {
|
|
12
|
+
// Your application name
|
|
13
|
+
string name = 1;
|
|
14
|
+
|
|
15
|
+
// JSON Schema for validating configuration
|
|
16
|
+
google.protobuf.Struct config_schema = 2;
|
|
17
|
+
|
|
18
|
+
// DeviceConfiguration describing the signal chain/device config
|
|
19
|
+
DeviceConfiguration device_config = 3;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
message PackageMetadata {
|
|
23
|
+
// the package name
|
|
24
|
+
// e.g. synapse-example-app_0.1.0_arm64.deb
|
|
25
|
+
string name = 1;
|
|
26
|
+
|
|
27
|
+
// The version of the package to be uploaded
|
|
28
|
+
string version = 2;
|
|
29
|
+
|
|
30
|
+
// Package size, in bytes
|
|
31
|
+
uint64 size = 3;
|
|
32
|
+
|
|
33
|
+
// sha256 of the package, for verification
|
|
34
|
+
string sha256_sum = 4;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
message AppPackageChunk {
|
|
38
|
+
// The first chunk is the metadata, with subsequent chunks being the file to install
|
|
39
|
+
oneof data {
|
|
40
|
+
PackageMetadata metadata = 1;
|
|
41
|
+
bytes file_chunk = 2;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
message AppDeployResponse {
|
|
46
|
+
StatusCode status = 1;
|
|
47
|
+
|
|
48
|
+
// Informational messages
|
|
49
|
+
string message = 2;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
message AppPerformanceSummary {
|
|
53
|
+
uint64 timestamp_ns = 1;
|
|
54
|
+
repeated FunctionProfile function_profiles = 2;
|
|
55
|
+
}
|
|
@@ -2,8 +2,22 @@ syntax = "proto3";
|
|
|
2
2
|
|
|
3
3
|
package synapse;
|
|
4
4
|
|
|
5
|
+
enum ChannelType {
|
|
6
|
+
ELECTRODE = 0;
|
|
7
|
+
GPIO = 1;
|
|
8
|
+
}
|
|
9
|
+
|
|
5
10
|
message Channel {
|
|
6
11
|
uint32 id = 1;
|
|
7
12
|
uint32 electrode_id = 2;
|
|
8
13
|
uint32 reference_id = 3;
|
|
9
|
-
|
|
14
|
+
ChannelType type = 4;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
message ChannelRange {
|
|
18
|
+
ChannelType type = 1;
|
|
19
|
+
uint32 count = 2;
|
|
20
|
+
// Optional: for non-contiguous channels (e.g., GPIO), specifies which
|
|
21
|
+
// channel ids are included, in order. Empty for contiguous
|
|
22
|
+
repeated uint32 channel_ids = 3;
|
|
23
|
+
}
|
|
@@ -2,6 +2,9 @@ syntax = "proto3";
|
|
|
2
2
|
|
|
3
3
|
package synapse;
|
|
4
4
|
|
|
5
|
+
import "google/protobuf/struct.proto";
|
|
6
|
+
import "api/channel.proto";
|
|
7
|
+
|
|
5
8
|
enum DataType {
|
|
6
9
|
kDataTypeUnknown = 0;
|
|
7
10
|
kAny = 1;
|
|
@@ -9,4 +12,98 @@ enum DataType {
|
|
|
9
12
|
kSpiketrain = 3;
|
|
10
13
|
kTimestamps = 4;
|
|
11
14
|
kImage = 5;
|
|
12
|
-
|
|
15
|
+
kWaveforms = 6;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// A simple tensor with timestamped data
|
|
19
|
+
message Tensor {
|
|
20
|
+
// Timestamp in ns since the unix epoch
|
|
21
|
+
uint64 timestamp_ns = 1;
|
|
22
|
+
|
|
23
|
+
// Shape of the tensor
|
|
24
|
+
// The number of values should equal to the product of the dimensions
|
|
25
|
+
// e.g. shape = [2, 3] => 2 rows, 3 columns
|
|
26
|
+
repeated int32 shape = 2;
|
|
27
|
+
|
|
28
|
+
// Expected data type to parse out
|
|
29
|
+
enum DType {
|
|
30
|
+
DT_INVALID = 0;
|
|
31
|
+
DT_FLOAT = 1;
|
|
32
|
+
DT_DOUBLE = 2;
|
|
33
|
+
DT_UINT8 = 3;
|
|
34
|
+
DT_UINT16 = 4;
|
|
35
|
+
DT_UINT32 = 5;
|
|
36
|
+
DT_UINT64 = 6;
|
|
37
|
+
DT_INT8 = 7;
|
|
38
|
+
DT_INT16 = 8;
|
|
39
|
+
DT_INT32 = 9;
|
|
40
|
+
DT_INT64 = 10;
|
|
41
|
+
DT_BOOL = 11;
|
|
42
|
+
}
|
|
43
|
+
DType dtype = 3;
|
|
44
|
+
|
|
45
|
+
enum Endianness {
|
|
46
|
+
TENSOR_LITTLE_ENDIAN = 0;
|
|
47
|
+
TENSOR_BIG_ENDIAN = 1;
|
|
48
|
+
}
|
|
49
|
+
// We default to little because that covers most of the use cases
|
|
50
|
+
Endianness endianness = 4;
|
|
51
|
+
|
|
52
|
+
// Data, stored in a flat array, see shape to reconstruct
|
|
53
|
+
// e.g. shape: [1, 3] would be:
|
|
54
|
+
// [10.0, 20.0, 30.0]
|
|
55
|
+
bytes data = 5;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// A sample of all of the channels at a specific timepoint
|
|
59
|
+
message BroadbandFrame {
|
|
60
|
+
// Monotonic timestamp when this frame was recorded based on the sampling rate
|
|
61
|
+
// At the start of a recording, the unix steady clock is recorded
|
|
62
|
+
// This timestamp is being calculated by
|
|
63
|
+
// start_timestamp_ns + (current_seq_num - start_seq_num) * 1e9 / sample_rate
|
|
64
|
+
uint64 timestamp_ns = 1;
|
|
65
|
+
|
|
66
|
+
// Monotonically increasing sequence number
|
|
67
|
+
// useful to detect missed or dropped frames
|
|
68
|
+
uint64 sequence_number = 2;
|
|
69
|
+
|
|
70
|
+
// The actual frame data, indexed by channel id
|
|
71
|
+
repeated sint32 frame_data = 3;
|
|
72
|
+
|
|
73
|
+
// Used for reconstructing multiple frames
|
|
74
|
+
uint32 sample_rate_hz = 4;
|
|
75
|
+
|
|
76
|
+
// When empty, all frame_data entries are electrode channels (legacy behavior).
|
|
77
|
+
// Describes contiguous ranges of channel types in frame_data, in order.
|
|
78
|
+
// Example:
|
|
79
|
+
// [{type: ELECTRODE}, count: 64, {type:GPIO, count:3, channel_ids:[0, 2, 5]}]
|
|
80
|
+
// This means frame_data[0..63] are electrodes, frame_data[64..66] are GPIO lines 0, 2, 5
|
|
81
|
+
repeated ChannelRange channel_ranges = 5;
|
|
82
|
+
|
|
83
|
+
// For legacy reasons, and syncing with other parts of the system, the current
|
|
84
|
+
// steady clock in unix time as reported by the system
|
|
85
|
+
// e.g. std::chrono::steady_clock::now().time_since_epoch()
|
|
86
|
+
uint64 unix_timestamp_ns = 6;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
message Timeseries {
|
|
90
|
+
// An identifier for the channel of data from which the timeseries was recorded.
|
|
91
|
+
uint32 id = 1;
|
|
92
|
+
|
|
93
|
+
// Represents a single sample of data at a specific timepoint
|
|
94
|
+
message Datapoint {
|
|
95
|
+
uint64 timestamp_ns = 1; // Timestamp of the recorded sample in ns since the unix epoch.
|
|
96
|
+
sint32 sample = 2; // The actual sample value.
|
|
97
|
+
}
|
|
98
|
+
repeated Datapoint datapoints = 2; // Collection of datapoints for this timeseries.
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// A tensor with associated metadata
|
|
102
|
+
message AnnotatedTensor {
|
|
103
|
+
// The tensor type
|
|
104
|
+
Tensor tensor = 1;
|
|
105
|
+
|
|
106
|
+
// Generic metadata associated with the tensor
|
|
107
|
+
// e.g. pipeline latencies
|
|
108
|
+
map<string, google.protobuf.Value> metadata = 2;
|
|
109
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package synapse;
|
|
4
|
+
|
|
5
|
+
import "api/node.proto";
|
|
6
|
+
import "api/status.proto";
|
|
7
|
+
import "api/time.proto";
|
|
8
|
+
|
|
9
|
+
message Peripheral {
|
|
10
|
+
enum Type {
|
|
11
|
+
kUnknown = 0;
|
|
12
|
+
kBroadbandSource = 1;
|
|
13
|
+
kElectricalStimulation = 2;
|
|
14
|
+
kOpticalStimulation = 3;
|
|
15
|
+
kSpikeSource = 4;
|
|
16
|
+
}
|
|
17
|
+
string name = 1;
|
|
18
|
+
string vendor = 2;
|
|
19
|
+
uint32 peripheral_id = 3;
|
|
20
|
+
Type type = 4;
|
|
21
|
+
string address = 5;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
message DeviceInfo {
|
|
25
|
+
string name = 1;
|
|
26
|
+
string serial = 2;
|
|
27
|
+
uint32 synapse_version = 3;
|
|
28
|
+
uint32 firmware_version = 4;
|
|
29
|
+
Status status = 5;
|
|
30
|
+
repeated Peripheral peripherals = 6;
|
|
31
|
+
DeviceConfiguration configuration = 7;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
message DeviceConfiguration {
|
|
35
|
+
repeated NodeConfig nodes = 1;
|
|
36
|
+
repeated NodeConnection connections = 2;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
// Device settings that are configurable by the user
|
|
41
|
+
message DeviceSettings {
|
|
42
|
+
string name = 1;
|
|
43
|
+
TimeSource time_source = 2;
|
|
44
|
+
|
|
45
|
+
// If configurable, the desired FPGA clock frequency in hz
|
|
46
|
+
uint32 fpga_clock_freq_hz = 3;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
message GetSettingsQuery {
|
|
50
|
+
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
message GetSettingsResponse {
|
|
54
|
+
DeviceSettings settings = 1;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
message UpdateDeviceSettingsRequest {
|
|
58
|
+
// If a field isn't populated, it will not be changed
|
|
59
|
+
DeviceSettings settings = 1;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
message UpdateDeviceSettingsResponse {
|
|
63
|
+
Status status = 1;
|
|
64
|
+
DeviceSettings updated_settings = 2;
|
|
65
|
+
}
|
|
@@ -2,54 +2,67 @@ syntax = "proto3";
|
|
|
2
2
|
|
|
3
3
|
package synapse;
|
|
4
4
|
|
|
5
|
-
import "api/datatype.proto";
|
|
6
5
|
import "api/nodes/broadband_source.proto";
|
|
7
6
|
import "api/nodes/electrical_stimulation.proto";
|
|
8
7
|
import "api/nodes/optical_stimulation.proto";
|
|
9
|
-
import "api/nodes/
|
|
8
|
+
import "api/nodes/spike_detector.proto";
|
|
10
9
|
import "api/nodes/spectral_filter.proto";
|
|
11
|
-
import "api/nodes/stream_out.proto";
|
|
12
|
-
import "api/nodes/stream_in.proto";
|
|
13
10
|
import "api/nodes/disk_writer.proto";
|
|
14
11
|
import "api/nodes/spike_source.proto";
|
|
12
|
+
import "api/nodes/spike_binner.proto";
|
|
13
|
+
import "api/nodes/application.proto";
|
|
15
14
|
|
|
16
15
|
enum NodeType {
|
|
17
16
|
kNodeTypeUnknown = 0;
|
|
18
|
-
kStreamIn = 1;
|
|
19
|
-
kStreamOut = 2;
|
|
17
|
+
// kStreamIn = 1;
|
|
18
|
+
// kStreamOut = 2;
|
|
19
|
+
reserved 1, 2;
|
|
20
|
+
|
|
20
21
|
kBroadbandSource = 3;
|
|
21
22
|
kElectricalStimulation = 4;
|
|
22
23
|
kOpticalStimulation = 5;
|
|
23
|
-
|
|
24
|
+
kSpikeDetector = 6;
|
|
24
25
|
kSpikeSource = 7;
|
|
25
26
|
kSpectralFilter = 8;
|
|
26
27
|
kDiskWriter = 9;
|
|
28
|
+
kSpikeBinner = 10;
|
|
29
|
+
kApplication = 11;
|
|
27
30
|
}
|
|
28
31
|
|
|
29
32
|
message NodeConfig {
|
|
30
33
|
NodeType type = 1;
|
|
31
34
|
uint32 id = 2;
|
|
35
|
+
|
|
36
|
+
// StreamOutConfig stream_out = 3;
|
|
37
|
+
// StreamInConfig stream_in = 4;
|
|
38
|
+
reserved 3, 4;
|
|
39
|
+
|
|
32
40
|
oneof config {
|
|
33
|
-
StreamOutConfig stream_out = 3;
|
|
34
|
-
StreamInConfig stream_in = 4;
|
|
35
41
|
BroadbandSourceConfig broadband_source = 5;
|
|
36
42
|
ElectricalStimulationConfig electrical_stimulation = 6;
|
|
37
43
|
OpticalStimulationConfig optical_stimulation = 8;
|
|
38
|
-
|
|
44
|
+
SpikeDetectorConfig spike_detector = 9;
|
|
39
45
|
SpectralFilterConfig spectral_filter = 10;
|
|
40
46
|
DiskWriterConfig disk_writer = 11;
|
|
41
47
|
SpikeSourceConfig spike_source = 12;
|
|
48
|
+
SpikeBinnerConfig spike_binner = 13;
|
|
49
|
+
ApplicationNodeConfig application = 14;
|
|
42
50
|
}
|
|
43
51
|
}
|
|
44
52
|
|
|
45
53
|
message NodeStatus {
|
|
46
54
|
NodeType type = 1;
|
|
47
55
|
uint32 id = 2;
|
|
56
|
+
|
|
57
|
+
// StreamOutStatus stream_out = 3;
|
|
58
|
+
// StreamInStatus stream_in = 5;
|
|
59
|
+
reserved 3, 5;
|
|
48
60
|
oneof status {
|
|
49
|
-
StreamOutStatus stream_out = 3;
|
|
50
61
|
BroadbandSourceStatus broadband_source = 4;
|
|
51
|
-
StreamInStatus stream_in = 5;
|
|
52
62
|
ElectricalStimulationStatus electrical_stimulation = 6;
|
|
63
|
+
ApplicationNodeStatus application = 7;
|
|
64
|
+
OpticalStimulationStatus optical_stimulation = 8;
|
|
65
|
+
DiskWriterStatus disk_writer = 10;
|
|
53
66
|
}
|
|
54
67
|
}
|
|
55
68
|
|
|
@@ -57,12 +70,3 @@ message NodeConnection {
|
|
|
57
70
|
uint32 src_node_id = 1;
|
|
58
71
|
uint32 dst_node_id = 2;
|
|
59
72
|
}
|
|
60
|
-
|
|
61
|
-
message NodeSocket {
|
|
62
|
-
uint32 node_id = 1;
|
|
63
|
-
string bind = 2;
|
|
64
|
-
DataType data_type = 3;
|
|
65
|
-
NodeType type = 4;
|
|
66
|
-
string label = 5;
|
|
67
|
-
repeated uint32 shape = 6;
|
|
68
|
-
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package synapse;
|
|
4
|
+
|
|
5
|
+
import "google/protobuf/struct.proto";
|
|
6
|
+
|
|
7
|
+
message ApplicationNodeConfig {
|
|
8
|
+
// Your application name, it should match what is deployed
|
|
9
|
+
string name = 1;
|
|
10
|
+
|
|
11
|
+
// Application specific configuration, will be loaded by
|
|
12
|
+
// the custom application during runtime
|
|
13
|
+
map<string, google.protobuf.Value> parameters = 2;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
message ApplicationNodeStatus {
|
|
17
|
+
string name = 1;
|
|
18
|
+
|
|
19
|
+
// Is the application started and running?
|
|
20
|
+
bool running = 2;
|
|
21
|
+
|
|
22
|
+
// If the application failed to start, what were the logs
|
|
23
|
+
string error_logs = 3;
|
|
24
|
+
}
|
|
@@ -5,3 +5,20 @@ package synapse;
|
|
|
5
5
|
message DiskWriterConfig {
|
|
6
6
|
string filename = 1;
|
|
7
7
|
}
|
|
8
|
+
|
|
9
|
+
message DiskWriterStatus {
|
|
10
|
+
// The output path of the file on the path of the sftp directory
|
|
11
|
+
string output_path = 1;
|
|
12
|
+
|
|
13
|
+
// How many bytes has been written for this file?
|
|
14
|
+
uint64 bytes_written = 2;
|
|
15
|
+
|
|
16
|
+
// Are we currently writing or are we stopped?
|
|
17
|
+
bool is_writing = 3;
|
|
18
|
+
|
|
19
|
+
// How many bytes are available for us to use
|
|
20
|
+
uint64 available_disk_space_bytes = 4;
|
|
21
|
+
|
|
22
|
+
// Current write performance for this node, megabits/sec
|
|
23
|
+
float current_bitrate_mbps = 5;
|
|
24
|
+
}
|
|
@@ -8,4 +8,33 @@ message OpticalStimulationConfig {
|
|
|
8
8
|
uint32 bit_width = 3;
|
|
9
9
|
uint32 frame_rate = 4;
|
|
10
10
|
float gain = 5;
|
|
11
|
+
|
|
12
|
+
// Instruct the FPGA to send out a 1xN vector
|
|
13
|
+
// where N is the number of LEDs with each Axon frame
|
|
14
|
+
bool send_receipts = 6;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// Core frame type for LED array optical stimulation
|
|
18
|
+
message OpticalStimFrame {
|
|
19
|
+
uint64 frame_id = 1;
|
|
20
|
+
uint64 sequence_number = 2;
|
|
21
|
+
uint64 timestamp_ns = 3;
|
|
22
|
+
|
|
23
|
+
// Frame dimensions
|
|
24
|
+
uint32 rows = 4;
|
|
25
|
+
uint32 columns = 5;
|
|
26
|
+
|
|
27
|
+
// Normalized pixel intensities (0.0 - 1.0)
|
|
28
|
+
// Row major ordering
|
|
29
|
+
// 0.0 is completely off, 1.0 is completely on
|
|
30
|
+
repeated float intensity = 6;
|
|
31
|
+
|
|
32
|
+
// For passive displays, this represents the row on time
|
|
33
|
+
// For active, this represents frame on time
|
|
34
|
+
uint64 duration_us = 7;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
message OpticalStimulationStatus {
|
|
38
|
+
// How many frames have we written?
|
|
39
|
+
uint64 frames_written = 1;
|
|
11
40
|
}
|