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
Félix Hartmann
XyDyS
Commits
bdefba2f
Commit
bdefba2f
authored
Jul 17, 2018
by
Félix Hartmann
Browse files
Updated scripts for making videos.
parent
8800e9bf
Changes
3
Hide whitespace changes
Inline
Side-by-side
create_snapshots.py
View file @
bdefba2f
...
...
@@ -6,21 +6,23 @@ from __future__ import (unicode_literals, absolute_import, division,
import
sys
import
bisect
import
numpy
as
np
def
number_of_digits
(
a
):
if
a
==
0
:
a
=
1
return
int
(
np
.
log10
(
a
))
+
1
from
traits.etsconfig.api
import
ETSConfig
ETSConfig
.
toolkit
=
'qt
4
'
ETSConfig
.
toolkit
=
'qt'
import
matplotlib
as
mpl
mpl
.
rcParams
[
'backend.qt4'
]
=
'PySide'
# We want matplotlib to use a QT backend
mpl
.
use
(
'Qt4Agg'
)
from
controlpanel
import
ControlPanel
,
time_units
from
plotutils
import
draw_cell_file
settings_file
,
target_dir
=
sys
.
argv
[
1
:
3
]
base_name
=
target_dir
+
"/
snapshot
"
base_name
=
target_dir
+
"/"
try
:
interval
=
int
(
sys
.
argv
[
3
])
...
...
@@ -38,27 +40,37 @@ cp.growth()
total_time
=
(
cp
.
stop_time
-
cp
.
start_time
)
*
time_units
[
"day"
]
total_hours
=
int
(
total_time
/
time_units
[
"hour"
])
total_snapshot_time
=
int
(
total_time
/
cp
.
snapshot_time_step
)
nb_digits_max
=
number_of_digits
(
total_snapshot_time
)
cf
=
cp
.
cell_file
xlim
=
(
0
,
1.01
*
cf
.
length
())
reframing_times
=
[
total_hours
//
3
,
(
2
*
total_hours
)
//
3
]
total_length
=
cf
.
length
()
length_list
=
[
total_length
/
3
,
2
*
total_length
/
3
]
xlim_list
=
[(
0
,
1.01
*
length
)
for
length
in
length_list
]
xlim_list
+=
[(
0
,
1.01
*
total_length
)]
print
(
length_list
)
print
(
xlim_list
)
xlim_list
=
[(
0
,
1.01
*
cf
.
length
(
t
))
for
t
in
reframing_times
]
xlim_list
+=
[(
0
,
1.01
*
cf
.
length
(
-
1
))]
ylim
=
(
0
,
15
)
print
(
total_hours
,
interval
)
for
hour
in
range
(
0
,
total_hours
,
interval
):
framing_index
=
bisect
.
bisect
(
reframing_times
,
hour
)
time
=
int
(
hour
*
time_units
[
"hour"
]
/
cp
.
snapshot_time_step
)
length
=
cf
.
length
(
time
)
framing_index
=
bisect
.
bisect
(
length_list
,
length
)
xlim
=
xlim_list
[
framing_index
]
nb_digits
=
number_of_digits
(
time
)
padding_0
=
nb_digits_max
-
nb_digits
draw_cell_file
(
cf
,
hour
,
time
,
colored_zones
=
colors
,
show_transport_polarity
=
None
,
xlim
=
xlim
,
ylim
=
ylim
,
figsize
=
(
8
,
4
),
fontsize
=
14
,
save
=
True
,
base_name
=
base_name
)
base_name
=
base_name
+
padding_0
*
"0"
)
# cf.draw(time=hour,
# signal=False,
...
...
@@ -66,4 +78,3 @@ for hour in range(0, total_hours, interval):
# xlim=xlim,
# date=False,
# save=True,
# base_name=base_name)
make_video.sh
100644 → 100755
View file @
bdefba2f
File mode changed from 100644 to 100755
plotutils.py
View file @
bdefba2f
...
...
@@ -502,7 +502,7 @@ def draw_cell_file(
)
figure
.
tight_layout
()
if
save
:
figure
.
savefig
(
"{0}
_t_{1:04d
}.png"
.
format
(
base_name
,
time
))
figure
.
savefig
(
"{0}
{1
}.png"
.
format
(
base_name
,
time
))
plt
.
close
(
figure
)
else
:
return
figure
,
axis
...
...
Write
Preview
Markdown
is supported
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