Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
LARN
X-Lap
Commits
a42b07f4
Commit
a42b07f4
authored
Apr 17, 2018
by
Andreas Schmidt
Browse files
Drop jitter.prep. Add xlim to box.
parent
42530eef
Changes
2
Hide whitespace changes
Inline
Side-by-side
xlap/analyse/jitter.py
View file @
a42b07f4
...
...
@@ -28,21 +28,17 @@ def jitter_causes(df, durations, export=False, file_name=None):
print
(
"Outliers:"
,
len
(
outliers
),
";"
,
"Threshold[us]:"
,
threshold
)
def
trace_jitter
(
data_frame
,
threshold
=
None
,
export
=
False
,
file_name
=
None
):
def
trace_jitter
(
data_frame
,
config
=
None
,
threshold
=
None
,
export
=
False
,
file_name
=
None
):
"""
Displays (and saves) a stacked boxplot of durations.
"""
data_frame
=
data_frame
[[
x
+
"_D"
for
x
in
extract_durations
(
config
)]]
if
threshold
is
None
:
threshold
=
get_outlier_threshold
(
data_frame
[
"EndToEnd_D"
].
describe
())
df_no_outliers
=
data_frame
[
data_frame
[
"EndToEnd_D"
]
<=
threshold
]
box
(
df_no_outliers
,
export
,
file_name
)
box
(
df_no_outliers
,
(
0
,
threshold
),
export
,
file_name
)
print
(
"{} / {} are no outliers."
.
format
(
len
(
df_no_outliers
),
len
(
data_frame
)))
fig
=
plt
.
gcf
()
fig
.
canvas
.
set_window_title
(
'Jitter Analysis'
)
plt
.
show
()
def
prep
(
df
,
config
):
res
=
df
[[
x
+
"_D"
for
x
in
extract_durations
(
config
)]]
res
.
name
=
df
.
name
return
res
xlap/analyse/util.py
View file @
a42b07f4
...
...
@@ -40,7 +40,7 @@ def extract_durations(config):
return
[
"EndToEnd"
,
"Sender"
]
+
durations_send
+
[
"Receiver"
]
+
durations_recv
def
box
(
data_frame
,
export
=
False
,
file_name
=
None
):
def
box
(
data_frame
,
xlim
=
None
,
export
=
False
,
file_name
=
None
):
"""
Display a boxplot for the durations contained in data_frame.
:param data_frame:
...
...
@@ -52,6 +52,8 @@ def box(data_frame, export=False, file_name=None):
fig
=
ax
.
get_figure
()
ax
.
set_yticklabels
(
list
(
map
(
lambda
x
:
x
.
get_text
().
replace
(
"_D"
,
""
),
ax
.
get_yticklabels
())))
plt
.
xlabel
(
"Time [us]"
)
if
xlim
is
not
None
:
plt
.
xlim
(
xlim
)
fig
.
set_size_inches
(
8
,
4.5
,
forward
=
True
)
if
export
and
file_name
is
not
None
:
fig
.
savefig
(
file_name
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment