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
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
f440dde3
Commit
f440dde3
authored
4 years ago
by
Simon Oehrl
Browse files
Options
Downloads
Patches
Plain Diff
Adapt changes for simulation time
parent
324c548b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
access_node/controllers/nest_controller.py
+30
-7
30 additions, 7 deletions
access_node/controllers/nest_controller.py
with
30 additions
and
7 deletions
access_node/controllers/nest_controller.py
+
30
−
7
View file @
f440dde3
...
...
@@ -233,13 +233,13 @@ def nest_get_simulation_time_info(): # noqa: E501
:rtype: SimulationTimeInfo
"""
con
=
connect_to_database
()
cur
=
con
.
cursor
()
cur
.
execute
(
"
SELECT MIN(current_simulation_time) FROM nest_simulation_node
"
)
current_time
=
cur
.
fetchall
()[
0
][
0
]
con
.
close
()
current_time
=
float
(
'
inf
'
)
print
(
"
Hello
"
)
for
node
in
nodes
.
nest_simulation_nodes
:
response
=
requests
.
get
(
node
+
'
/current_simulation_time
'
).
json
()
current_time
=
min
(
current_time
,
response
)
# TODO Add Start and End time when available
time_info
=
SimulationTimeInfo
(
current
=
current_time
)
...
...
@@ -310,7 +310,7 @@ def nest_get_spikes_by_population(population_id, _from=None, to=None, offset=Non
spikes
=
Spikes
([],
[])
for
node
in
nodes
.
nest_simulation_nodes
:
response
=
requests
.
get
(
node
+
'
/
population/$
'
+
str
(
population_id
)
+
'
/
spikes
'
,
params
=
{
"
from
"
:
_from
,
"
to
"
:
to
}).
json
()
node
+
'
/spikes
'
,
params
=
{
"
from
"
:
_from
,
"
to
"
:
to
}).
json
()
for
x
in
range
(
len
(
response
[
'
simulation_times
'
])):
spikes
.
simulation_times
.
append
(
response
[
'
simulation_times
'
][
x
])
spikes
.
gids
.
append
(
response
[
'
gids
'
][
x
])
...
...
@@ -330,4 +330,27 @@ def nest_get_spikes_by_population(population_id, _from=None, to=None, offset=Non
spikes
.
simulation_times
=
spikes
.
simulation_times
[
offset
:
offset
+
limit
]
return
spikes
# spikes = Spikes([], [])
# for node in nodes.nest_simulation_nodes:
# response = requests.get(
# node+'/population/$'+str(population_id)+'/spikes', params={"from": _from, "to": to}).json()
# for x in range(len(response['simulation_times'])):
# spikes.simulation_times.append(response['simulation_times'][x])
# spikes.gids.append(response['gids'][x])
# # sort
# sorted_ids = [x for _, x in sorted(
# zip(spikes.simulation_times, spikes.gids))]
# spikes.gids = sorted_ids
# spikes.simulation_times.sort()
# # offset and limit
# if (offset is None):
# offset = 0
# if (limit is None or (limit + offset) > len(spikes.gids)):
# limit = len(spikes.gids) - offset
# spikes.gids = spikes.gids[offset:offset+limit]
# spikes.simulation_times = spikes.simulation_times[offset:offset+limit]
# return spikes
\ No newline at end of file
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