Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Jigyasa Watwani
/
growth-pattern-control
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
d0adf500
authored
Jul 21, 2023
by
Jigyasa Watwani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rewritten with only stress and density, substituted velocity in terms of stress
parent
588ce712
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
96 additions
and
152 deletions
basic_model_only_density/tissue_maxwell.py
basic_model_only_density/viz_tissue_maxwell.py
basic_model_only_density/tissue_maxwell.py
View file @
d0adf500
import
numpy
as
np
z
import
numpy
as
np
import
dolfin
as
df
import
dolfin
as
df
import
progressbar
import
progressbar
import
os
import
os
...
@@ -25,114 +25,69 @@ class Tissue(object):
...
@@ -25,114 +25,69 @@ class Tissue(object):
scalar_element
=
df
.
FiniteElement
(
'P'
,
self
.
mesh
.
ufl_cell
(),
1
)
scalar_element
=
df
.
FiniteElement
(
'P'
,
self
.
mesh
.
ufl_cell
(),
1
)
# v, rho, stress
# stress, rho
mixed_element
=
df
.
MixedElement
([
scalar_element
,
mixed_element
=
df
.
MixedElement
([
scalar_element
,
scalar_element
])
scalar_element
,
scalar_element
])
# define function space with this mixed element
# define function space with this mixed element
self
.
function_space
=
df
.
FunctionSpace
(
self
.
mesh
,
mixed_element
)
if
self
.
zero_rho_boundary
:
self
.
function_space
=
df
.
FunctionSpace
(
self
.
mesh
,
mixed_element
)
self
.
rho_boundary
=
0.0
else
:
self
.
rho_boundary
=
self
.
average_rho
self
.
bc
=
df
.
DirichletBC
(
self
.
function_space
.
sub
(
1
),
bc1
=
df
.
DirichletBC
(
self
.
function_space
.
sub
(
0
),
df
.
Constant
(
0.0
),
'on_boundary'
)
df
.
Constant
(
self
.
rho_boundary
),
bc2
=
df
.
DirichletBC
(
self
.
function_space
.
sub
(
1
),
df
.
Constant
(
0.0
),
'on_boundary'
)
'on_boundary'
)
self
.
bc
=
([
bc1
,
bc2
]
)
self
.
function0
=
df
.
Function
(
self
.
function_space
)
self
.
function0
=
df
.
Function
(
self
.
function_space
)
self
.
function
=
df
.
Function
(
self
.
function_space
)
self
.
function
=
df
.
Function
(
self
.
function_space
)
def
active_stress
(
self
,
rho
):
if
self
.
active_death
:
return
(
-
self
.
lamda
*
rho
*
(
rho
-
self
.
active_stress_setpoint
)
/
(
rho
+
self
.
saturation_rho
)
)
else
:
return
(
-
self
.
lamda
*
rho
/
(
rho
+
self
.
saturation_rho
)
)
def
fluid_stress
(
self
,
v
):
return
self
.
viscosity
*
v
.
dx
(
0
)
def
diffusion_reaction_rho
(
self
,
rho
,
trho
):
return
(
self
.
diffusion_rho
*
df
.
inner
(
rho
.
dx
(
0
),
trho
.
dx
(
0
))
-
self
.
turnover_rho
*
df
.
inner
(
rho
*
(
1
-
rho
/
self
.
average_rho
),
trho
)
)
def
setup_initial_conditions
(
self
):
def
setup_initial_conditions
(
self
):
# ic for rho
# ic for stress
if
self
.
zero_rho_boundary
:
stress0
=
df
.
interpolate
(
df
.
Expression
(
base_rho
=
0.0
'cos(PI*x[0]/L)*cos(PI*x[0]/L)'
,
else
:
L
=
self
.
system_size
,
base_rho
=
self
.
average_rho
PI
=
np
.
pi
,
degree
=
1
),
self
.
function_space
.
sub
(
0
)
.
collapse
())
rho0
=
df
.
interpolate
(
df
.
Expression
(
rho0
=
df
.
interpolate
(
df
.
Expression
(
'
base_rho +
cos(PI*x[0]/L)*cos(PI*x[0]/L)'
,
'cos(PI*x[0]/L)*cos(PI*x[0]/L)'
,
L
=
self
.
system_size
,
L
=
self
.
system_size
,
base_rho
=
base_rho
,
PI
=
np
.
pi
,
degree
=
1
),
degree
=
1
,
PI
=
np
.
pi
),
self
.
function_space
.
sub
(
1
)
.
collapse
()
self
.
function_space
.
sub
(
1
)
.
collapse
())
)
df
.
assign
(
self
.
function0
,
[
stress0
,
rho0
])
# ic for stress
stress0
=
df
.
Constant
(
0.0
)
stress0
=
df
.
interpolate
(
stress0
,
self
.
function_space
.
sub
(
2
)
.
collapse
())
# add noise
noise_rho
=
(
self
.
noise_level
*
(
2
*
np
.
random
.
random
(
rho0
.
vector
()
.
size
())
-
1
))
noise_stress
=
(
self
.
noise_level
*
(
2
*
np
.
random
.
random
(
stress0
.
vector
()
.
size
())
-
1
))
rho0
.
vector
()[:]
=
rho0
.
vector
()[:]
+
noise_rho
stress0
.
vector
()[:]
=
stress0
.
vector
()[:]
+
noise_stress
# find velocity
VFS
=
self
.
function_space
.
sub
(
0
)
.
collapse
()
v0
=
df
.
Function
(
VFS
)
tv0
=
df
.
TestFunction
(
VFS
)
v0form
=
(
self
.
friction
*
df
.
inner
(
v0
,
tv0
)
+
df
.
inner
(
stress0
,
tv0
.
dx
(
0
))
)
*
df
.
dx
df
.
solve
(
v0form
==
0
,
v0
)
def
active_stress
(
self
,
rho
):
df
.
assign
(
self
.
function0
,
[
v0
,
rho0
,
stress0
]
)
return
-
self
.
lamda
*
rho
/
(
rho
+
self
.
saturation_rho
)
def
setup_weak_forms
(
self
):
def
setup_weak_forms
(
self
):
v0
,
rho0
,
stress0
=
df
.
split
(
self
.
function0
)
stress0
,
rho0
=
df
.
split
(
self
.
function0
)
v
,
rho
,
stress
=
df
.
split
(
self
.
function
)
stress
,
rho
=
df
.
split
(
self
.
function
)
tv
,
trho
,
tstress
=
df
.
TestFunctions
(
self
.
function_space
)
tstress
,
trho
=
df
.
TestFunctions
(
self
.
function_space
)
vform
=
(
self
.
friction
*
df
.
inner
(
v
,
tv
)
+
df
.
inner
(
stress
,
tv
.
dx
(
0
))
stressform
=
(
df
.
inner
(
stress
-
self
.
active_stress
(
rho
),
tstress
)
+
(
self
.
viscosity
/
self
.
elasticity
)
*
df
.
inner
((
1
/
self
.
timestep
)
*
(
stress
-
stress0
-
self
.
active_stress
(
rho
)
+
self
.
active_stress
(
rho0
)),
tstress
)
+
(
self
.
viscosity
/
(
self
.
elasticity
*
self
.
friction
))
*
df
.
inner
(
stress0
.
dx
(
0
)
*
(
stress0
.
dx
(
0
)
-
self
.
active_stress
(
rho0
)
.
dx
(
0
)),
tstress
)
+
(
self
.
viscosity
/
self
.
friction
)
*
df
.
inner
(
stress
.
dx
(
0
),
tstress
.
dx
(
0
))
)
)
rhoform
=
(
df
.
inner
((
rho
-
rho0
)
/
self
.
timestep
,
trho
)
rhoform
=
(
df
.
inner
((
rho
-
rho0
)
/
self
.
timestep
,
trho
)
+
df
.
inner
((
v0
*
rho0
)
.
dx
(
0
),
trho
)
+
(
1
/
self
.
friction
)
*
df
.
inner
((
rho0
*
stress0
.
dx
(
0
))
.
dx
(
0
),
trho
)
+
self
.
diffusion_reaction_rho
(
rho
,
trho
)
+
self
.
diffusion_rho
*
df
.
inner
(
rho
.
dx
(
0
),
trho
.
dx
(
0
))
)
-
self
.
turnover_rho
*
df
.
inner
(
rho
*
(
1
-
rho
/
self
.
average_rho
),
trho
)
stressform
=
(
(
self
.
viscosity
/
self
.
elasticity
)
*
(
df
.
inner
((
stress
-
self
.
active_stress
(
rho
)
-
stress0
+
self
.
active_stress
(
rho0
))
/
self
.
timestep
,
tstress
)
+
df
.
inner
(
v0
*
(
stress0
-
self
.
active_stress
(
rho0
))
.
dx
(
0
),
tstress
)
)
+
df
.
inner
(
stress
-
self
.
active_stress
(
rho
),
tstress
)
-
df
.
inner
(
self
.
fluid_stress
(
v
),
tstress
)
)
)
self
.
form
=
(
vform
+
rhoform
+
stressform
)
*
df
.
dx
self
.
form
=
(
stressform
+
rhoform
)
*
df
.
dx
def
solve
(
self
,
DIR
=
''
):
def
solve
(
self
,
DIR
=
''
):
self
.
vFile
=
df
.
XDMFFile
(
os
.
path
.
join
(
DIR
,
'
%
s_velocity.xdmf'
%
self
.
timestamp
))
self
.
rhoFile
=
df
.
XDMFFile
(
os
.
path
.
join
(
DIR
,
'
%
s_density.xdmf'
%
self
.
timestamp
))
self
.
stressFile
=
df
.
XDMFFile
(
os
.
path
.
join
(
DIR
,
self
.
stressFile
=
df
.
XDMFFile
(
os
.
path
.
join
(
DIR
,
'
%
s_stress.xdmf'
%
self
.
timestamp
))
'
%
s_stress.xdmf'
%
self
.
timestamp
))
self
.
rhoFile
=
df
.
XDMFFile
(
os
.
path
.
join
(
DIR
,
'
%
s_density.xdmf'
%
self
.
timestamp
))
self
.
setup_initial_conditions
()
self
.
setup_initial_conditions
()
...
@@ -142,31 +97,26 @@ class Tissue(object):
...
@@ -142,31 +97,26 @@ class Tissue(object):
self
.
time
=
0.0
self
.
time
=
0.0
savesteps
=
int
(
self
.
savetime
/
self
.
timestep
)
savesteps
=
int
(
self
.
savetime
/
self
.
timestep
)
maxsteps
=
int
(
self
.
maxtime
/
self
.
timestep
)
maxsteps
=
int
(
self
.
maxtime
/
self
.
timestep
)
v
,
rho
,
stress
=
self
.
function0
.
split
(
deepcopy
=
True
)
stress
,
rho
=
self
.
function0
.
split
(
deepcopy
=
True
)
self
.
vFile
.
write_checkpoint
(
v
,
'velocity'
,
self
.
time
)
self
.
rhoFile
.
write_checkpoint
(
rho
,
'density'
,
self
.
time
)
self
.
stressFile
.
write_checkpoint
(
stress
,
'stress'
,
self
.
time
)
self
.
stressFile
.
write_checkpoint
(
stress
,
'stress'
,
self
.
time
)
self
.
rhoFile
.
write_checkpoint
(
rho
,
'density'
,
self
.
time
)
for
steps
in
progressbar
.
progressbar
(
range
(
1
,
maxsteps
+
1
)):
for
steps
in
progressbar
.
progressbar
(
range
(
1
,
maxsteps
+
1
)):
df
.
solve
(
self
.
form
==
0
,
self
.
function
,
self
.
bc
)
df
.
solve
(
self
.
form
==
0
,
self
.
function
,
self
.
bc
)
self
.
function0
.
assign
(
self
.
function
)
self
.
function0
.
assign
(
self
.
function
)
self
.
time
+=
self
.
timestep
self
.
time
+=
self
.
timestep
v
,
rho
,
stress
=
self
.
function0
.
split
(
deepcopy
=
True
)
stress
,
rho
=
self
.
function0
.
split
(
deepcopy
=
True
)
if
steps
%
savesteps
==
0
:
if
steps
%
savesteps
==
0
:
self
.
vFile
.
write_checkpoint
(
v
,
'velocity
'
,
self
.
stressFile
.
write_checkpoint
(
stress
,
'stress
'
,
self
.
time
,
append
=
True
)
self
.
time
,
append
=
True
)
self
.
rhoFile
.
write_checkpoint
(
rho
,
'density'
,
self
.
rhoFile
.
write_checkpoint
(
rho
,
'density'
,
self
.
time
,
append
=
True
)
self
.
time
,
append
=
True
)
self
.
stressFile
.
write_checkpoint
(
stress
,
'stress'
,
self
.
time
,
append
=
True
)
# move mesh
# move mesh
dr
=
df
.
project
(
v
*
self
.
timestep
,
self
.
function_space
.
sub
(
0
)
.
collapse
())
dr
=
df
.
project
(
(
1
/
self
.
friction
)
*
(
stress
.
dx
(
0
))
*
self
.
timestep
,
self
.
function_space
.
sub
(
0
)
.
collapse
())
df
.
ALE
.
move
(
self
.
mesh
,
dr
)
df
.
ALE
.
move
(
self
.
mesh
,
dr
)
self
.
vFile
.
close
()
self
.
rhoFile
.
close
()
self
.
stressFile
.
close
()
self
.
stressFile
.
close
()
self
.
rhoFile
.
close
()
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
import
json
,
datetime
import
json
,
datetime
...
...
basic_model_only_density/viz_tissue_maxwell.py
View file @
d0adf500
...
@@ -30,12 +30,9 @@ def visualize(params, DIR=''):
...
@@ -30,12 +30,9 @@ def visualize(params, DIR=''):
params
[
'system_size'
]
/
2
)
params
[
'system_size'
]
/
2
)
# Read data
# Read data
v
=
np
.
zeros
((
len
(
times
),
mesh
.
num_vertices
()))
rho
=
np
.
zeros
((
len
(
times
),
mesh
.
num_vertices
()))
rho
=
np
.
zeros
((
len
(
times
),
mesh
.
num_vertices
()))
stress
=
np
.
zeros_like
(
v
)
stress
=
np
.
zeros_like
(
rho
)
vFile
=
df
.
XDMFFile
(
os
.
path
.
join
(
DIR
,
'
%
s_velocity.xdmf'
%
params
[
'timestamp'
]))
rhoFile
=
df
.
XDMFFile
(
os
.
path
.
join
(
DIR
,
rhoFile
=
df
.
XDMFFile
(
os
.
path
.
join
(
DIR
,
'
%
s_density.xdmf'
%
params
[
'timestamp'
]))
'
%
s_density.xdmf'
%
params
[
'timestamp'
]))
stressFile
=
df
.
XDMFFile
(
os
.
path
.
join
(
DIR
,
stressFile
=
df
.
XDMFFile
(
os
.
path
.
join
(
DIR
,
...
@@ -47,17 +44,14 @@ def visualize(params, DIR=''):
...
@@ -47,17 +44,14 @@ def visualize(params, DIR=''):
for
steps
in
progressbar
.
progressbar
(
range
(
savesteps
+
1
)):
for
steps
in
progressbar
.
progressbar
(
range
(
savesteps
+
1
)):
mesh
.
coordinates
()[:]
=
geometry
[
steps
]
mesh
.
coordinates
()[:]
=
geometry
[
steps
]
SFS
=
df
.
FunctionSpace
(
mesh
,
'P'
,
1
)
SFS
=
df
.
FunctionSpace
(
mesh
,
'P'
,
1
)
vi
,
rhoi
,
stressi
=
df
.
Function
(
SFS
),
df
.
Function
(
SFS
),
df
.
Function
(
SFS
)
rhoi
,
stressi
=
df
.
Function
(
SFS
),
df
.
Function
(
SFS
)
vFile
.
read_checkpoint
(
vi
,
'velocity'
,
steps
)
rhoFile
.
read_checkpoint
(
rhoi
,
'density'
,
steps
)
rhoFile
.
read_checkpoint
(
rhoi
,
'density'
,
steps
)
stressFile
.
read_checkpoint
(
stressi
,
'stress'
,
steps
)
stressFile
.
read_checkpoint
(
stressi
,
'stress'
,
steps
)
v
[
steps
]
=
vi
.
compute_vertex_values
(
mesh
)
rho
[
steps
]
=
rhoi
.
compute_vertex_values
(
mesh
)
rho
[
steps
]
=
rhoi
.
compute_vertex_values
(
mesh
)
stress
[
steps
]
=
stressi
.
compute_vertex_values
(
mesh
)
stress
[
steps
]
=
stressi
.
compute_vertex_values
(
mesh
)
vFile
.
close
()
rhoFile
.
close
()
rhoFile
.
close
()
stressFile
.
close
()
stressFile
.
close
()
...
@@ -68,19 +62,19 @@ def visualize(params, DIR=''):
...
@@ -68,19 +62,19 @@ def visualize(params, DIR=''):
fig
,
axes
=
plt
.
subplots
(
2
,
1
,
sharex
=
True
,
figsize
=
(
8
,
8
))
fig
,
axes
=
plt
.
subplots
(
2
,
1
,
sharex
=
True
,
figsize
=
(
8
,
8
))
axes
[
-
1
]
.
set_xlabel
(
r'$x$'
)
axes
[
-
1
]
.
set_xlabel
(
r'$x$'
)
axes
[
0
]
.
set_ylabel
(
r'$\rho/\rho_0$'
)
axes
[
0
]
.
set_ylabel
(
r'$\rho/\rho_0$'
)
axes
[
1
]
.
set_ylabel
(
r'$v/v_0$
'
)
axes
[
1
]
.
set_ylabel
(
'stress
'
)
axes
[
0
]
.
set_xlim
(
np
.
min
(
geometry
),
np
.
max
(
geometry
))
axes
[
0
]
.
set_xlim
(
np
.
min
(
geometry
),
np
.
max
(
geometry
))
axes
[
0
]
.
set_ylim
(
0
,
np
.
max
(
rho
)
+
0.05
)
axes
[
0
]
.
set_ylim
(
0
,
np
.
max
(
rho
)
+
0.05
)
axes
[
1
]
.
set_ylim
(
np
.
min
(
v
)
-
0.05
,
np
.
max
(
v
)
+
0.05
)
axes
[
1
]
.
set_ylim
(
np
.
min
(
stress
)
-
0.05
,
np
.
max
(
stress
)
+
0.05
)
rhoplot
,
=
axes
[
0
]
.
plot
(
geometry
[
0
],
rho
[
0
],
'g-'
,
ms
=
3
)
rhoplot
,
=
axes
[
0
]
.
plot
(
geometry
[
0
],
rho
[
0
],
'g-'
,
ms
=
3
)
velplot
,
=
axes
[
1
]
.
plot
(
geometry
[
0
],
v
[
0
],
'r-'
,
ms
=
3
)
velplot
,
=
axes
[
1
]
.
plot
(
geometry
[
0
],
stress
[
0
],
'r-'
,
ms
=
3
)
def
update
(
value
):
def
update
(
value
):
ti
=
np
.
abs
(
times
-
value
)
.
argmin
()
ti
=
np
.
abs
(
times
-
value
)
.
argmin
()
rhoplot
.
set_ydata
(
rho
[
ti
])
rhoplot
.
set_ydata
(
rho
[
ti
])
rhoplot
.
set_xdata
(
geometry
[
ti
])
rhoplot
.
set_xdata
(
geometry
[
ti
])
velplot
.
set_ydata
(
v
[
ti
])
velplot
.
set_ydata
(
stress
[
ti
])
velplot
.
set_xdata
(
geometry
[
ti
])
velplot
.
set_xdata
(
geometry
[
ti
])
plt
.
draw
()
plt
.
draw
()
...
@@ -91,23 +85,23 @@ def visualize(params, DIR=''):
...
@@ -91,23 +85,23 @@ def visualize(params, DIR=''):
slider
.
drawon
=
False
slider
.
drawon
=
False
slider
.
on_changed
(
update
)
slider
.
on_changed
(
update
)
#
plt.show()
plt
.
show
()
print
(
'Saving movie-...'
)
#
print('Saving movie-...')
FPS
=
100
#
FPS = 100
movFile
=
os
.
path
.
join
(
DIR
,
'
%
s_fields.mov'
%
params
[
'timestamp'
])
#
movFile = os.path.join(DIR, '%s_fields.mov' % params['timestamp'])
fps
=
float
(
FPS
)
#
fps = float(FPS)
command
=
"ffmpeg -y -r"
#
command = "ffmpeg -y -r"
options
=
"-b:v 3600k -qscale:v 4 -vcodec mpeg4"
#
options = "-b:v 3600k -qscale:v 4 -vcodec mpeg4"
tmp_dir
=
TemporaryDirectory
()
#
tmp_dir = TemporaryDirectory()
get_filename
=
lambda
x
:
os
.
path
.
join
(
tmp_dir
.
name
,
x
)
#
get_filename = lambda x: os.path.join(tmp_dir.name, x)
for
tt
in
progressbar
.
progressbar
(
range
(
len
(
times
))):
#
for tt in progressbar.progressbar(range(len(times))):
slider
.
set_val
(
times
[
tt
])
#
slider.set_val(times[tt])
fr
=
get_filename
(
"
%03
d.png"
%
tt
)
#
fr = get_filename("%03d.png" % tt)
fig
.
savefig
(
fr
,
facecolor
=
fig
.
get_facecolor
(),
dpi
=
100
)
#
fig.savefig(fr, facecolor=fig.get_facecolor(), dpi=100)
os
.
system
(
command
+
" "
+
str
(
fps
)
#
os.system(command + " " + str(fps)
+
" -i "
+
tmp_dir
.
name
+
os
.
sep
#
+ " -i " + tmp_dir.name + os.sep
+
"
%03
d.png "
+
options
+
" "
+
movFile
)
#
+ "%03d.png " + options + " " + movFile)
tmp_dir
.
cleanup
()
#
tmp_dir.cleanup()
# plotting the stresses
# plotting the stresses
active_stress
=
-
params
[
'lamda'
]
*
rho
/
(
rho
+
params
[
'saturation_rho'
])
active_stress
=
-
params
[
'lamda'
]
*
rho
/
(
rho
+
params
[
'saturation_rho'
])
...
@@ -139,39 +133,39 @@ def visualize(params, DIR=''):
...
@@ -139,39 +133,39 @@ def visualize(params, DIR=''):
fc
=
'#999999'
)
fc
=
'#999999'
)
slider
.
drawon
=
False
slider
.
drawon
=
False
slider
.
on_changed
(
update_2
)
slider
.
on_changed
(
update_2
)
#
plt.show()
plt
.
show
()
# make movie
# make movie
print
(
'Saving movie-...'
)
#
print('Saving movie-...')
FPS
=
50
#
FPS = 50
movFile
=
os
.
path
.
join
(
DIR
,
'
%
s_stresses.mov'
%
params
[
'timestamp'
])
#
movFile = os.path.join(DIR, '%s_stresses.mov' % params['timestamp'])
fps
=
float
(
FPS
)
#
fps = float(FPS)
command
=
"ffmpeg -y -r"
#
command = "ffmpeg -y -r"
options
=
"-b:v 3600k -qscale:v 4 -vcodec mpeg4"
#
options = "-b:v 3600k -qscale:v 4 -vcodec mpeg4"
tmp_dir
=
TemporaryDirectory
()
#
tmp_dir = TemporaryDirectory()
get_filename
=
lambda
x
:
os
.
path
.
join
(
tmp_dir
.
name
,
x
)
#
get_filename = lambda x: os.path.join(tmp_dir.name, x)
for
tt
in
progressbar
.
progressbar
(
range
(
len
(
times
))):
#
for tt in progressbar.progressbar(range(len(times))):
slider
.
set_val
(
times
[
tt
])
#
slider.set_val(times[tt])
fr
=
get_filename
(
"
%03
d.png"
%
tt
)
#
fr = get_filename("%03d.png" % tt)
fig1
.
savefig
(
fr
,
facecolor
=
fig1
.
get_facecolor
(),
dpi
=
100
)
#
fig1.savefig(fr, facecolor=fig1.get_facecolor(), dpi=100)
os
.
system
(
command
+
" "
+
str
(
fps
)
#
os.system(command + " " + str(fps)
+
" -i "
+
tmp_dir
.
name
+
os
.
sep
#
+ " -i " + tmp_dir.name + os.sep
+
"
%03
d.png "
+
options
+
" "
+
movFile
)
#
+ "%03d.png " + options + " " + movFile)
tmp_dir
.
cleanup
()
#
tmp_dir.cleanup()
# L(t) vs t
# L(t) vs t
length
=
geometry
[:,
-
1
,
0
]
-
geometry
[:,
0
,
0
]
#
length = geometry[:,-1,0]-geometry[:,0,0]
fig2
,
ax2
=
plt
.
subplots
(
1
,
1
,
figsize
=
(
8
,
8
))
#
fig2, ax2 = plt.subplots(1, 1, figsize=(8, 8))
ax2
.
set_xlabel
(
'$t$'
)
#
ax2.set_xlabel('$t$')
ax2
.
set_ylabel
(
'$L(t)$'
)
#
ax2.set_ylabel('$L(t)$')
ax2
.
set_xlim
(
np
.
min
(
times
),
np
.
max
(
times
))
#
ax2.set_xlim(np.min(times), np.max(times))
ax2
.
set_ylim
(
np
.
min
(
length
)
-
0.05
,
np
.
max
(
length
)
+
0.05
)
#
ax2.set_ylim(np.min(length)-0.05, np.max(length)+0.05)
ax2
.
plot
(
times
,
length
)
#
ax2.plot(times, length)
plt
.
savefig
(
"
%
s.png"
%
params
[
'timestamp'
])
#
plt.savefig("%s.png" %params['timestamp'])
# plt.show()
#
#
plt.show()
np
.
save
(
'
%
s_length.npy'
%
params
[
'timestamp'
],
length
)
#
np.save('%s_length.npy' %params['timestamp'], length)
print
(
length
[
-
1
])
#
print(length[-1])
print
(
length
[
-
1
]
-
length
[
-
3
])
#
print(length[-1]-length[-3])
# fig3, ax3 = plt.subplots(1, 1, figsize=(8, 8))
# fig3, ax3 = plt.subplots(1, 1, figsize=(8, 8))
# ax3.set_xlabel('$\log t$')
# ax3.set_xlabel('$\log t$')
...
...
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