Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Sebastian Heimann
grond
Commits
7ce58940
Commit
7ce58940
authored
Jun 17, 2016
by
Sebastian Heimann
Browse files
remove old plot files before plotting
parent
3fb3edbf
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/plot.py
View file @
7ce58940
import
math
import
re
import
random
import
logging
import
os
import
os.path
as
op
import
numpy
as
num
from
scipy
import
signal
...
...
@@ -1418,6 +1420,19 @@ plot_dispatch = {
def
save_figs
(
figs
,
plot_dirname
,
plotname
,
formats
,
dpi
):
for
fmt
in
formats
:
if
fmt
not
in
[
'pdf'
,
'png'
]:
raise
core
.
GrondError
(
'unavailable output format: %s'
%
fmt
)
assert
re
.
match
(
r
'^[a-z_]+$'
,
plotname
)
# remove files from previous runs
pat
=
re
.
compile
(
r
'^%s-[0-9]+\.(%s)$'
%
(
plotname
,
'|'
.
join
(
formats
)))
if
op
.
exists
(
plot_dirname
):
for
entry
in
os
.
listdir
(
plot_dirname
):
if
pat
.
match
(
entry
):
os
.
unlink
(
op
.
join
(
plot_dirname
,
entry
))
fns
=
[]
for
ifig
,
fig
in
enumerate
(
figs
):
for
format
in
formats
:
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment