Skip to content
Snippets Groups Projects
Commit 5d4fce03 authored by Jan Müller's avatar Jan Müller
Browse files

Update API

parent 8dcf5d5a
No related branches found
No related tags found
1 merge request!4Feature/add arbor support
...@@ -3,7 +3,7 @@ Public access server providing a REST API for the in-situ pipeline. ...@@ -3,7 +3,7 @@ Public access server providing a REST API for the in-situ pipeline.
To generate execute this from the projects root dir: To generate execute this from the projects root dir:
``` ```
java -jar <path/to/swagger-codegen-cli.2.4.8.jar> generate -i access_node/swagger/swagger.yaml -l python-flask -c config.json java -jar swagger-codegen-cli-2.4.8.jar generate -i access_node/swagger/swagger.yaml -l python-flask -c config.json
``` ```
# Swagger generated server # Swagger generated server
......
import connexion import connexion
import six import six
from access_node.models.arbor_cell_properties import ArborCellProperties # noqa: E501
from access_node.models.arbor_measurement import ArborMeasurement # noqa: E501 from access_node.models.arbor_measurement import ArborMeasurement # noqa: E501
from access_node.models.arbor_neuron_properties import ArborNeuronProperties # noqa: E501
from access_node.models.simulation_time_info import SimulationTimeInfo # noqa: E501 from access_node.models.simulation_time_info import SimulationTimeInfo # noqa: E501
from access_node.models.spikes import Spikes # noqa: E501 from access_node.models.spikes import Spikes # noqa: E501
from access_node import util from access_node import util
def arbor_get_attributes(): # noqa: E501 def arbor_get_cell_ids(): # noqa: E501
"""Retrieves a list of measurable attributes """Retrieves the list of all cell ids.
# noqa: E501 # noqa: E501
:rtype: List[str] :rtype: List[int]
""" """
return 'do some magic!' return 'do some magic!'
def arbor_get_measurements(attribute, _from=None, to=None, neuron_ids=None, offset=None, limit=None): # noqa: E501 def arbor_get_cell_properties(neuron_ids=None): # noqa: E501
"""Retrieves the measurements for given attribute and neuron_ids (optional). """Retrieves the properties of the specified cells.
# noqa: E501
:param neuron_ids: A list of cell IDs queried for properties.
:type neuron_ids: List[int]
:rtype: List[ArborCellProperties]
"""
return 'do some magic!'
def arbor_get_measurements(attribute, measurement_point_id=None, _from=None, to=None, offset=None, limit=None): # noqa: E501
"""Retrieves the measurements for given measurement points (optional).
# noqa: E501 # noqa: E501
:param attribute: The attribute to query (e.g., &#39;V_m&#39; for the membrane potential) :param attribute: The attribute to query (e.g., &#39;V_m&#39; for the membrane potential)
:type attribute: str :type attribute: str
:param measurement_point_id: A list of measurement point ids queried for data.
:type measurement_point_id: List[int]
:param _from: The start time (including) to be queried. :param _from: The start time (including) to be queried.
:type _from: float :type _from: float
:param to: The end time (excluding) to be queried. :param to: The end time (excluding) to be queried.
:type to: float :type to: float
:param neuron_ids: A list of GIDs queried for spike data.
:type neuron_ids: List[int]
:param offset: The offset into the result. :param offset: The offset into the result.
:type offset: int :type offset: int
:param limit: The maximum of entries to be result. :param limit: The maximum of entries to be result.
...@@ -42,30 +55,6 @@ def arbor_get_measurements(attribute, _from=None, to=None, neuron_ids=None, offs ...@@ -42,30 +55,6 @@ def arbor_get_measurements(attribute, _from=None, to=None, neuron_ids=None, offs
return 'do some magic!' return 'do some magic!'
def arbor_get_neuron_ids(): # noqa: E501
"""Retrieves the list of all neuron ids.
# noqa: E501
:rtype: List[int]
"""
return 'do some magic!'
def arbor_get_neuron_properties(neuron_ids=None): # noqa: E501
"""Retrieves the properties of the specified neurons.
# noqa: E501
:param neuron_ids: A list of neuron IDs queried for properties.
:type neuron_ids: List[int]
:rtype: List[ArborNeuronProperties]
"""
return 'do some magic!'
def arbor_get_simulation_time_info(): # noqa: E501 def arbor_get_simulation_time_info(): # noqa: E501
"""Retrieves simulation time information. """Retrieves simulation time information.
...@@ -78,7 +67,7 @@ def arbor_get_simulation_time_info(): # noqa: E501 ...@@ -78,7 +67,7 @@ def arbor_get_simulation_time_info(): # noqa: E501
def arbor_get_spikes(_from=None, to=None, gids=None, offset=None, limit=None): # noqa: E501 def arbor_get_spikes(_from=None, to=None, gids=None, offset=None, limit=None): # noqa: E501
"""Retrieves the spikes for the given simulation steps (optional) and GIDS (optional). """Retrieves the spikes for the given simulation steps (optional) and cells (optional).
# noqa: E501 # noqa: E501
...@@ -86,7 +75,7 @@ def arbor_get_spikes(_from=None, to=None, gids=None, offset=None, limit=None): ...@@ -86,7 +75,7 @@ def arbor_get_spikes(_from=None, to=None, gids=None, offset=None, limit=None):
:type _from: float :type _from: float
:param to: The end time (excluding) to be queried. :param to: The end time (excluding) to be queried.
:type to: float :type to: float
:param gids: A list of GIDs queried for spike data. :param gids: A list of cells queried for spike data.
:type gids: List[int] :type gids: List[int]
:param offset: The offset into the result. :param offset: The offset into the result.
:type offset: int :type offset: int
......
...@@ -24,7 +24,7 @@ def nest_get_gids(): # noqa: E501 ...@@ -24,7 +24,7 @@ def nest_get_gids(): # noqa: E501
def nest_get_gids_in_population(population_id): # noqa: E501 def nest_get_gids_in_population(population_id): # noqa: E501
"""Retrieves the list of all neuron IDs. """Retrieves the list of all neuron IDs within the population.
# noqa: E501 # noqa: E501
...@@ -51,7 +51,7 @@ def nest_get_multimeter_info(): # noqa: E501 ...@@ -51,7 +51,7 @@ def nest_get_multimeter_info(): # noqa: E501
def nest_get_multimeter_measurements(multimeter_id, attribute, _from=None, to=None, gids=None, offset=None, limit=None): # noqa: E501 def nest_get_multimeter_measurements(multimeter_id, attribute, _from=None, to=None, gids=None, offset=None, limit=None): # noqa: E501
"""Retrieves the measurements for a multimeter (optional) and GIDS (optional). """Retrieves the measurements for a multimeter, attribute and GIDS (optional).
# noqa: E501 # noqa: E501
...@@ -101,14 +101,16 @@ def nest_get_multimeter_measurements(multimeter_id, attribute, _from=None, to=No ...@@ -101,14 +101,16 @@ def nest_get_multimeter_measurements(multimeter_id, attribute, _from=None, to=No
'http://'+node+'/multimeter_measurement', params={"multimeter_id": multimeter_id, "attribute": attribute, "_from": _from, "to": to, "gids": gids}).json() 'http://'+node+'/multimeter_measurement', params={"multimeter_id": multimeter_id, "attribute": attribute, "_from": _from, "to": to, "gids": gids}).json()
if init: if init:
sim_times = response['simulation_times'] sim_times = response['simulation_times']
measurement = MultimeterMeasurement(sim_times, gids, [None for x in range(0,(len(sim_times)*len(gids)))]) measurement = MultimeterMeasurement(
sim_times, gids, [None for x in range(0, (len(sim_times)*len(gids)))])
init = False init = False
for x in range(len(response['gids'])): for x in range(len(response['gids'])):
gid = response['gids'][x] gid = response['gids'][x]
index = measurement.gids.index(gid) index = measurement.gids.index(gid)
index_offset = index * len(sim_times) index_offset = index * len(sim_times)
for y in range(len(sim_times)): for y in range(len(sim_times)):
measurement.values[index_offset+y] = response['values'][x*len(sim_times)+y] measurement.values[index_offset +
y] = response['values'][x*len(sim_times)+y]
# offset and limit # offset and limit
if (offset is None): if (offset is None):
...@@ -116,7 +118,8 @@ def nest_get_multimeter_measurements(multimeter_id, attribute, _from=None, to=No ...@@ -116,7 +118,8 @@ def nest_get_multimeter_measurements(multimeter_id, attribute, _from=None, to=No
if (limit is None or (limit + offset) > len(measurement.gids)): if (limit is None or (limit + offset) > len(measurement.gids)):
limit = len(measurement.gids) - offset limit = len(measurement.gids) - offset
measurement.gids = measurement.gids[offset:offset+limit] measurement.gids = measurement.gids[offset:offset+limit]
measurement.values = measurement.values[offset*len(sim_times):(offset+limit)*len(sim_times)] measurement.values = measurement.values[offset *
len(sim_times):(offset+limit)*len(sim_times)]
return measurement return measurement
......
...@@ -3,8 +3,9 @@ ...@@ -3,8 +3,9 @@
# flake8: noqa # flake8: noqa
from __future__ import absolute_import from __future__ import absolute_import
# import models into model package # import models into model package
from access_node.models.arbor_cell_properties import ArborCellProperties
from access_node.models.arbor_measurement import ArborMeasurement from access_node.models.arbor_measurement import ArborMeasurement
from access_node.models.arbor_neuron_properties import ArborNeuronProperties from access_node.models.measurement_point import MeasurementPoint
from access_node.models.multimeter_info import MultimeterInfo from access_node.models.multimeter_info import MultimeterInfo
from access_node.models.multimeter_info_inner import MultimeterInfoInner from access_node.models.multimeter_info_inner import MultimeterInfoInner
from access_node.models.multimeter_measurement import MultimeterMeasurement from access_node.models.multimeter_measurement import MultimeterMeasurement
......
...@@ -15,7 +15,7 @@ paths: ...@@ -15,7 +15,7 @@ paths:
tags: tags:
- "arbor" - "arbor"
summary: "Retrieves the spikes for the given simulation steps (optional) and\ summary: "Retrieves the spikes for the given simulation steps (optional) and\
\ GIDS (optional)." \ cells (optional)."
operationId: "arbor_get_spikes" operationId: "arbor_get_spikes"
consumes: consumes:
- "application/json" - "application/json"
...@@ -36,7 +36,7 @@ paths: ...@@ -36,7 +36,7 @@ paths:
format: "double" format: "double"
- name: "gids" - name: "gids"
in: "query" in: "query"
description: "A list of GIDs queried for spike data." description: "A list of cells queried for spike data."
required: false required: false
type: "array" type: "array"
items: items:
...@@ -65,12 +65,12 @@ paths: ...@@ -65,12 +65,12 @@ paths:
type: "string" type: "string"
example: "Error message" example: "Error message"
x-swagger-router-controller: "access_node.controllers.arbor_controller" x-swagger-router-controller: "access_node.controllers.arbor_controller"
/arbor/neuron_ids: /arbor/cell_ids:
get: get:
tags: tags:
- "arbor" - "arbor"
summary: "Retrieves the list of all neuron ids." summary: "Retrieves the list of all cell ids."
operationId: "arbor_get_neuron_ids" operationId: "arbor_get_cell_ids"
produces: produces:
- "application/json" - "application/json"
parameters: [] parameters: []
...@@ -92,7 +92,7 @@ paths: ...@@ -92,7 +92,7 @@ paths:
get: get:
tags: tags:
- "arbor" - "arbor"
summary: "Retrieves the measurements for given attribute and neuron_ids (optional)." summary: "Retrieves the measurements for given measurement points (optional)."
operationId: "arbor_get_measurements" operationId: "arbor_get_measurements"
consumes: consumes:
- "application/json" - "application/json"
...@@ -104,6 +104,14 @@ paths: ...@@ -104,6 +104,14 @@ paths:
description: "The attribute to query (e.g., 'V_m' for the membrane potential)" description: "The attribute to query (e.g., 'V_m' for the membrane potential)"
required: true required: true
type: "string" type: "string"
- name: "measurement_point_id"
in: "query"
description: "A list of measurement point ids queried for data."
required: false
type: "array"
items:
type: "integer"
format: "uint64"
- name: "from" - name: "from"
in: "query" in: "query"
description: "The start time (including) to be queried." description: "The start time (including) to be queried."
...@@ -116,14 +124,6 @@ paths: ...@@ -116,14 +124,6 @@ paths:
required: false required: false
type: "number" type: "number"
format: "double" format: "double"
- name: "neuron_ids"
in: "query"
description: "A list of GIDs queried for spike data."
required: false
type: "array"
items:
type: "integer"
format: "uint64"
- name: "offset" - name: "offset"
in: "query" in: "query"
description: "The offset into the result." description: "The offset into the result."
...@@ -167,18 +167,18 @@ paths: ...@@ -167,18 +167,18 @@ paths:
type: "string" type: "string"
example: "Error message" example: "Error message"
x-swagger-router-controller: "access_node.controllers.arbor_controller" x-swagger-router-controller: "access_node.controllers.arbor_controller"
/arbor/neuron_properties: /arbor/cell_properties:
get: get:
tags: tags:
- "arbor" - "arbor"
summary: "Retrieves the properties of the specified neurons." summary: "Retrieves the properties of the specified cells."
operationId: "arbor_get_neuron_properties" operationId: "arbor_get_cell_properties"
produces: produces:
- "application/json" - "application/json"
parameters: parameters:
- name: "neuron_ids" - name: "neuron_ids"
in: "query" in: "query"
description: "A list of neuron IDs queried for properties." description: "A list of cell IDs queried for properties."
required: false required: false
type: "array" type: "array"
items: items:
...@@ -190,32 +190,7 @@ paths: ...@@ -190,32 +190,7 @@ paths:
schema: schema:
type: "array" type: "array"
items: items:
$ref: "#/definitions/ArborNeuronProperties" $ref: "#/definitions/ArborCellProperties"
400:
description: "Operation failed."
schema:
type: "string"
example: "Error message"
x-swagger-router-controller: "access_node.controllers.arbor_controller"
/arbor/attributes:
get:
tags:
- "arbor"
summary: "Retrieves a list of measurable attributes"
operationId: "arbor_get_attributes"
produces:
- "application/json"
parameters: []
responses:
200:
description: "Operation successful."
schema:
type: "array"
items:
type: "string"
example:
- "Voltage"
- "Resistance"
400: 400:
description: "Operation failed." description: "Operation failed."
schema: schema:
...@@ -430,7 +405,7 @@ paths: ...@@ -430,7 +405,7 @@ paths:
get: get:
tags: tags:
- "nest" - "nest"
summary: "Retrieves the measurements for a multimeter (optional) and GIDS (optional)." summary: "Retreives the available multimeters and their properties."
operationId: "nest_get_multimeter_info" operationId: "nest_get_multimeter_info"
consumes: consumes:
- "application/json" - "application/json"
...@@ -452,7 +427,7 @@ paths: ...@@ -452,7 +427,7 @@ paths:
get: get:
tags: tags:
- "nest" - "nest"
summary: "Retrieves the measurements for a multimeter (optional) and GIDS (optional)." summary: "Retrieves the measurements for a multimeter, attribute and GIDS (optional)."
operationId: "nest_get_multimeter_measurements" operationId: "nest_get_multimeter_measurements"
consumes: consumes:
- "application/json" - "application/json"
...@@ -517,7 +492,7 @@ paths: ...@@ -517,7 +492,7 @@ paths:
get: get:
tags: tags:
- "nest" - "nest"
summary: "Retrieves the list of all neuron IDs." summary: "Retrieves the list of all neuron IDs within the population."
operationId: "nest_get_gids_in_population" operationId: "nest_get_gids_in_population"
produces: produces:
- "application/json" - "application/json"
...@@ -644,7 +619,19 @@ definitions: ...@@ -644,7 +619,19 @@ definitions:
- 0.123 - 0.123
- 0.123 - 0.123
- 0.123 - 0.123
ArborNeuronProperties: MeasurementPoint:
type: "object"
properties:
id:
type: "integer"
format: "uint64"
cell_id:
type: "integer"
format: "uint64"
position:
type: "number"
format: "double"
ArborCellProperties:
type: "object" type: "object"
properties: properties:
neuron_id: neuron_id:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment