Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
aliby-mirror
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Swain Lab
aliby
aliby-mirror
Commits
27b9c3f6
Commit
27b9c3f6
authored
2 years ago
by
Alán Muñoz
Browse files
Options
Downloads
Patches
Plain Diff
fix(signal): fringe cases transition at edges
parent
b206c48a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/agora/io/signal.py
+24
-4
24 additions, 4 deletions
src/agora/io/signal.py
src/postprocessor/chainer.py
+1
-1
1 addition, 1 deletion
src/postprocessor/chainer.py
with
25 additions
and
5 deletions
src/agora/io/signal.py
+
24
−
4
View file @
27b9c3f6
...
@@ -381,31 +381,51 @@ class Signal(BridgeH5):
...
@@ -381,31 +381,51 @@ class Signal(BridgeH5):
"""
"""
flowrate_name
=
"
pumpinit/flowrate
"
flowrate_name
=
"
pumpinit/flowrate
"
pumprate_name
=
"
pumprate
"
pumprate_name
=
"
pumprate
"
switchtimes_name
=
"
switchtimes
"
main_pump_id
=
np
.
concatenate
(
main_pump_id
=
np
.
concatenate
(
(
(
(
np
.
argmax
(
self
.
meta_h5
[
flowrate_name
]),),
(
np
.
argmax
(
self
.
meta_h5
[
flowrate_name
]),),
np
.
argmax
(
self
.
meta_h5
[
pumprate_name
],
axis
=
0
),
np
.
argmax
(
self
.
meta_h5
[
pumprate_name
],
axis
=
0
),
)
)
)
)
if
not
self
.
meta_h5
[
switchtimes_name
][
0
]:
# Cover for t0 switches
main_pump_id
=
main_pump_id
[
1
:]
return
[
self
.
meta_h5
[
"
pumpinit/contents
"
][
i
]
for
i
in
main_pump_id
]
return
[
self
.
meta_h5
[
"
pumpinit/contents
"
][
i
]
for
i
in
main_pump_id
]
@property
@property
def
nstages
(
self
)
->
int
:
def
nstages
(
self
)
->
int
:
switchtimes_name
=
"
switchtimes
"
return
len
(
self
.
switch_times
)
+
1
return
self
.
meta_h5
[
switchtimes_name
]
+
1
@property
@property
def
max_span
(
self
)
->
int
:
def
max_span
(
self
)
->
int
:
return
int
(
self
.
tinterval
*
self
.
ntps
/
60
)
return
int
(
self
.
tinterval
*
self
.
ntps
/
60
)
@property
def
switch_frames
(
self
)
->
t
.
List
[
int
]:
switchtimes_name
=
"
switchtimes
"
switch_frames
=
self
.
meta_h5
[
switchtimes_name
]
return
[
tp
for
tp
in
switch_frames
if
tp
and
tp
<
self
.
max_span
]
# Cover for t0 switches
@property
@property
def
stages_span
(
self
)
->
t
.
Tuple
[
t
.
Tuple
[
str
,
int
],
...]:
def
stages_span
(
self
)
->
t
.
Tuple
[
t
.
Tuple
[
str
,
int
],
...]:
# Return consecutive stages and their corresponding number of time-points
# Return consecutive stages and their corresponding number of time-points
switchtimes_name
=
"
switchtimes
"
transition_tps
=
(
0
,
*
self
.
switch_frames
,
self
.
max_span
)
transition_tps
=
(
0
,
*
self
.
meta_h5
[
switchtimes_name
])
spans
=
[
spans
=
[
end
-
start
end
-
start
for
start
,
end
in
zip
(
transition_tps
[:
-
1
],
transition_tps
[
1
:])
for
start
,
end
in
zip
(
transition_tps
[:
-
1
],
transition_tps
[
1
:])
if
end
<=
self
.
max_span
if
end
<=
self
.
max_span
]
]
return
tuple
((
stage
,
ntps
)
for
stage
,
ntps
in
zip
(
self
.
stages
,
spans
))
return
tuple
((
stage
,
ntps
)
for
stage
,
ntps
in
zip
(
self
.
stages
,
spans
))
@property
def
stages_span_tp
(
self
)
->
t
.
Tuple
[
t
.
Tuple
[
str
,
int
],
...]:
return
tuple
(
[
(
name
,
t_min
//
self
.
tinterval
*
60
)
for
name
,
t_min
in
self
.
stages_span
]
)
This diff is collapsed.
Click to expand it.
src/postprocessor/chainer.py
+
1
−
1
View file @
27b9c3f6
...
@@ -80,7 +80,7 @@ class Chainer(Signal):
...
@@ -80,7 +80,7 @@ class Chainer(Signal):
stages_index
=
[
stages_index
=
[
x
x
for
i
,
(
name
,
span
)
in
enumerate
(
self
.
stages_span
)
for
i
,
(
name
,
span
)
in
enumerate
(
self
.
stages_span
_tp
)
for
x
in
(
f
"
{
i
}
{
name
}
"
,)
*
span
for
x
in
(
f
"
{
i
}
{
name
}
"
,)
*
span
]
]
data
.
columns
=
pd
.
MultiIndex
.
from_tuples
(
data
.
columns
=
pd
.
MultiIndex
.
from_tuples
(
...
...
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