Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
HRV_MEG
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container 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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Ryan Christopher Godwin
HRV_MEG
Commits
0c82090d
Commit
0c82090d
authored
2 years ago
by
Ryan Godwin
Browse files
Options
Downloads
Patches
Plain Diff
Updates to the plotter class to get the png saved since html isn't working well in mlflow
parent
c3f4b10b
No related branches found
Branches containing commit
No related tags found
1 merge request
!1
Progress toward getting the evaluation integrated
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/config/run_id.txt
+1
-1
1 addition, 1 deletion
src/config/run_id.txt
src/hrvmeg/plotter.py
+24
-27
24 additions, 27 deletions
src/hrvmeg/plotter.py
with
25 additions
and
28 deletions
src/config/run_id.txt
+
1
−
1
View file @
0c82090d
a46b9fdd3ebb4c11a77d4ecc5444ad56
\ No newline at end of file
e1362b03b8ed47648bddee1af72ce30c
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/hrvmeg/plotter.py
+
24
−
27
View file @
0c82090d
...
...
@@ -10,6 +10,8 @@ class Plotter(object):
self
.
_y
=
y_values
self
.
_output_file
=
output_file
self
.
_fig_size
=
fig_size
plt
.
close
()
def
__call__
(
self
):
pass
...
...
@@ -18,47 +20,42 @@ class Plotter(object):
# save figure as HTML file
html_str
=
mpld3
.
fig_to_html
(
fig
)
output_html
=
self
.
_output_file
.
rename
(
self
.
_output_file
.
with_suffix
(
"
.html
"
))
HTML_file
=
open
(
output_html
,
"
w
"
)
HTML_file
=
open
(
output_html
,
"
w
"
,
encoding
=
"
utf8
"
)
HTML_file
.
write
(
html_str
)
HTML_file
.
close
()
return
output_html
class
PlotCardiacIC
(
Plotter
):
def
__init__
(
self
,
output_file
:
Path
()
,
x_values
,
y_values
,
fig_size
=
(
12
,
5
)):
def
__init__
(
self
,
output_file
,
x_values
,
y_values
,
fig_size
=
(
12
,
5
)):
super
().
__init__
(
output_file
,
x_values
,
y_values
,
fig_size
)
def
__call__
(
self
):
fig
,
ax
=
plt
.
subplots
(
1
,
1
,
figsize
=
(
12
,
5
))
plt
.
plot
(
self
.
_x
,
self
.
_y
,
linewidth
=
0.2
)
plt
.
xlabel
=
"
Time (s)
"
plt
.
ylabel
=
"
Cardiac Component
"
plt
.
title
=
"
Selected Cardiac Component
"
fig
=
plt
.
gcf
()
plt
.
savefig
(
self
.
_output_file
)
output_html
=
super
().
make_html
(
fig
)
return
output_html
plt
.
plot
(
self
.
_x
,
self
.
_y
,
linewidth
=
0.3
)
plt
.
xlabel
(
"
Time (s)
"
)
plt
.
ylabel
(
"
Cardiac Component
"
)
plt
.
title
(
"
Selected Cardiac Component
"
)
plt
.
savefig
(
Path
(
self
.
_output_file
),
dpi
=
330
)
#TODO- pull off the IC # and add to title
print
(
'
outfile -
'
,
Path
(
self
.
_output_file
))
#output_html = super().make_html(plt.gcf())
return
self
.
_output_file
class
PlotECG
(
Plotter
):
def
__init__
(
self
,
output_file
:
Path
()
,
x_values
,
y_values
,
fig_size
=
(
12
,
5
)):
def
__init__
(
self
,
output_file
,
x_values
,
y_values
,
fig_size
=
(
12
,
5
)):
super
().
__init__
(
output_file
,
x_values
,
y_values
,
fig_size
)
def
__call__
(
self
):
fig
,
ax
=
plt
.
subplots
(
1
,
1
,
figsize
=
(
12
,
5
))
plt
.
subplots
(
1
,
1
,
figsize
=
(
12
,
5
))
plt
.
plot
(
self
.
_x
,
self
.
_y
,
linewidth
=
0.2
)
plt
.
xlabel
=
"
Time (s)
"
plt
.
ylabel
=
"
ECG Signal
"
plt
.
title
=
"
Scaled Signal
"
fig
=
plt
.
gcf
()
plt
.
savefig
(
self
.
_output_file
)
# save figure as HTML file
html_str
=
mpld3
.
fig_to_html
(
fig
)
output_html
=
self
.
_output_file
.
rename
(
self
.
_output_file
.
with_suffix
(
"
.html
"
))
HTML_file
=
open
(
output_html
,
"
w
"
)
HTML_file
.
write
(
html_str
)
HTML_file
.
close
()
plt
.
xlabel
(
"
Time (s)
"
)
plt
.
ylabel
(
"
ECG Signal
"
)
plt
.
title
(
"
Scaled Signal
"
)
plt
.
savefig
(
str
(
self
.
_output_file
),
dpi
=
330
)
output_html
=
super
().
make_html
(
plt
.
gcf
())
return
output_html
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