Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
access-node
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
LuFG VR VIS
VR-Group
In Situ Pipeline
access-node
Commits
6c92f8dd
Commit
6c92f8dd
authored
5 years ago
by
Jan Müller
Browse files
Options
Downloads
Patches
Plain Diff
Refactor
parent
eeb57bb7
No related branches found
No related tags found
1 merge request
!4
Feature/add arbor support
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
access_node/__main__.py
+14
-8
14 additions, 8 deletions
access_node/__main__.py
access_node/controllers/nest_controller.py
+23
-17
23 additions, 17 deletions
access_node/controllers/nest_controller.py
with
37 additions
and
25 deletions
access_node/__main__.py
+
14
−
8
View file @
6c92f8dd
...
...
@@ -57,33 +57,39 @@ def SetupArborTables(postgres_username, postgres_password, port):
cur
=
con
.
cursor
()
cur
.
execute
(
"
DROP TABLE IF EXISTS PROBES CASCADE
"
)
cur
.
execute
(
"
DROP TABLE IF EXISTS CELLS CASCADE
"
)
cur
.
execute
(
"
DROP TABLE IF EXISTS SIMULATION_NODES CASCADE
"
)
cur
.
execute
(
"
DROP TABLE IF EXISTS
ARBOR_
SIMULATION_NODES CASCADE
"
)
cur
.
execute
(
"
DROP TABLE IF EXISTS ATTRIBUTES CASCADE
"
)
cur
.
execute
(
'''
CREATE TABLE SIMULATION_NODES (
cur
.
execute
(
'''
CREATE TABLE ARBOR_SIMULATION_NODES (
NODE_ID INT PRIMARY KEY NOT NULL UNIQUE,
ADDRESS VARCHAR(25),
CURRENT_SIM_TIME FLOAT);
'''
)
cur
.
execute
(
'''
CREATE TABLE CELLS (
CELL_ID INT PRIMARY KEY NOT NULL UNIQUE
);
'''
)
cur
.
execute
(
'''
CREATE TABLE CELL_PROPERTIES (
CELL_ID INT NOT NULL,
PROPERTY VARCHAR(50),
PROPERTY VARCHAR(50)
NOT NULL
,
PRIMARY KEY (CELL_ID, PROPERTY),
FOREIGN KEY (CELL_ID) REFERENCES CELLS (CELL_ID),
);
'''
)
cur
.
execute
(
'''
CREATE TABLE PROBES (
PROBE_ID INT PRIMARY KEY NOT NULL UNIQUE,
CELL_ID INT,
SEGMENT_ID INT,
CELL_ID INT
NOT NULL
,
SEGMENT_ID INT
NOT NULL
,
POSITION FLOAT,
NODE_ID INT,
FOREIGN KEY (NODE_ID) REFERENCES SIMULATION_NODES (NODE_ID),
FOREIGN KEY (NODE_ID) REFERENCES
ARBOR_
SIMULATION_NODES (NODE_ID),
FOREIGN KEY (CELL_ID) REFERENCES CELLS (CELL_ID));
'''
)
cur
.
execute
(
'''
CREATE TABLE ATTRIBUTES (
ATTRIBUTE_ID INT PRIMARY KEY NOT NULL UNIQUE,
NAME
INT
NOT NULL,
NAME
VARCHAR(50)
NOT NULL,
);
'''
)
con
.
commit
()
con
.
close
()
print
(
"
Arbor tables created successfully!
\n
"
)
...
...
This diff is collapsed.
Click to expand it.
access_node/controllers/nest_controller.py
+
23
−
17
View file @
6c92f8dd
...
...
@@ -13,6 +13,12 @@ import requests
import
psycopg2
import
numpy
as
np
def
connect_to_database
():
return
psycopg2
.
connect
(
database
=
"
postgres
"
,
user
=
"
postgres
"
,
password
=
"
docker
"
,
host
=
"
database
"
,
port
=
"
5432
"
)
def
nest_get_gids
():
# noqa: E501
"""
Retrieves the list of all GID.
...
...
@@ -21,12 +27,12 @@ def nest_get_gids(): # noqa: E501
:rtype: List[int]
"""
con
=
psycopg2
.
connect
(
database
=
"
postgres
"
,
user
=
"
postgres
"
,
password
=
"
docker
"
,
host
=
"
database
"
,
port
=
"
5432
"
)
con
=
connect_to_database
()
cur
=
con
.
cursor
()
cur
.
execute
(
"
SELECT GID FROM GIDS
"
)
gids
=
[
i
[
0
]
for
i
in
cur
.
fetchall
()]
con
.
close
()
return
gids
...
...
@@ -41,12 +47,12 @@ def nest_get_gids_in_population(population_id): # noqa: E501
:rtype: List[int]
"""
con
=
psycopg2
.
connect
(
database
=
"
postgres
"
,
user
=
"
postgres
"
,
password
=
"
docker
"
,
host
=
"
database
"
,
port
=
"
5432
"
)
con
=
connect_to_database
()
cur
=
con
.
cursor
()
cur
.
execute
(
"
SELECT GID FROM GIDS WHERE GIDS.POPULATION_ID =
"
+
str
(
population_id
))
gids
=
[
i
[
0
]
for
i
in
cur
.
fetchall
()]
con
.
close
()
return
gids
...
...
@@ -59,8 +65,7 @@ def nest_get_multimeter_info(): # noqa: E501
:rtype: MultimeterInfo
"""
con
=
psycopg2
.
connect
(
database
=
"
postgres
"
,
user
=
"
postgres
"
,
password
=
"
docker
"
,
host
=
"
database
"
,
port
=
"
5432
"
)
con
=
connect_to_database
()
cur
=
con
.
cursor
()
cur
.
execute
(
"
SELECT MULTIMETER_ID FROM MULTIMETERS
"
)
...
...
@@ -80,8 +85,8 @@ def nest_get_multimeter_info(): # noqa: E501
"
attributes
"
:
attributes
[
i
][
0
],
"
gids
"
:
gids
[
i
]})
con
.
close
()
con
.
close
()
return
mult_info
...
...
@@ -169,9 +174,7 @@ def nest_get_neuron_properties(gids=None): # noqa: E501
:rtype: List[NestNeuronProperties]
"""
con
=
psycopg2
.
connect
(
database
=
"
postgres
"
,
user
=
"
postgres
"
,
password
=
"
docker
"
,
host
=
"
database
"
,
port
=
"
5432
"
)
con
=
connect_to_database
()
cur
=
con
.
cursor
()
cur
.
execute
(
"
Select * FROM GIDS LIMIT 0
"
)
...
...
@@ -183,6 +186,7 @@ def nest_get_neuron_properties(gids=None): # noqa: E501
cur
.
execute
(
"
Select * FROM GIDS
"
)
else
:
cur
.
execute
(
"
Select * FROM GIDS WHERE GID IN %s
"
,
(
tuple
(
gids
),))
con
.
close
()
properties
=
np
.
array
(
cur
.
fetchall
())
...
...
@@ -207,12 +211,13 @@ def nest_get_populations(): # noqa: E501
:rtype: List[int]
"""
con
=
psycopg2
.
connect
(
database
=
"
postgres
"
,
user
=
"
postgres
"
,
password
=
"
docker
"
,
host
=
"
database
"
,
port
=
"
5432
"
)
con
=
connect_to_database
()
cur
=
con
.
cursor
()
cur
.
execute
(
"
SELECT DISTINCT (POPULATION_ID) FROM GIDS
"
)
populations
=
[
i
[
0
]
for
i
in
cur
.
fetchall
()]
con
.
close
()
return
populations
...
...
@@ -224,13 +229,14 @@ def nest_get_simulation_time_info(): # noqa: E501
:rtype: SimulationTimeInfo
"""
con
=
psycopg2
.
connect
(
database
=
"
postgres
"
,
user
=
"
postgres
"
,
password
=
"
docker
"
,
host
=
"
database
"
,
port
=
"
5432
"
)
con
=
connect_to_database
()
cur
=
con
.
cursor
()
cur
.
execute
(
"
SELECT MIN(CURRENT_SIM_TIME) FROM SIMULATION_NODES
"
)
current_time
=
cur
.
fetchall
()[
0
][
0
]
con
.
close
()
# TODO Add Start and End time when available
time_info
=
SimulationTimeInfo
(
current
=
current_time
)
return
time_info
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment