Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
fluiddyn
fluidsim
Commits
a7f967c7c78e
Commit
cad93758
authored
Apr 03, 2021
by
Pierre Augier
Browse files
Fix animate phys_fields: labels
parent
9929ed42d316
Pipeline
#20240
passed with stage
in 17 minutes and 14 seconds
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
fluidsim/base/output/phys_fields3d.py
View file @
a7f967c7
...
...
@@ -21,8 +21,32 @@ from fluiddyn.util import mpi
from
.phys_fields2d
import
MoviesBasePhysFields2D
,
PhysFieldsBase2D
def
_get_xylabels_from_equation
(
equation
):
if
equation
.
startswith
(
"iz="
)
or
equation
.
startswith
(
"z="
):
xlabel
=
"x"
ylabel
=
"y"
elif
equation
.
startswith
(
"iy="
)
or
equation
.
startswith
(
"y="
):
xlabel
=
"x"
ylabel
=
"z"
elif
equation
.
startswith
(
"ix="
)
or
equation
.
startswith
(
"x="
):
xlabel
=
"y"
ylabel
=
"z"
else
:
raise
NotImplementedError
return
xlabel
,
ylabel
class
MoviesBasePhysFields3D
(
MoviesBasePhysFields2D
):
pass
def
_init_labels
(
self
,
xlabel
=
None
,
ylabel
=
None
):
"""Initialize the labels."""
if
xlabel
is
None
or
ylabel
is
None
:
_xlabel
,
_ylabel
=
_get_xylabels_from_equation
(
self
.
_equation
)
if
xlabel
is
None
:
xlabel
=
_xlabel
if
ylabel
is
None
:
ylabel
=
_ylabel
self
.
ax
.
set_xlabel
(
xlabel
,
fontdict
=
self
.
font
)
self
.
ax
.
set_ylabel
(
ylabel
,
fontdict
=
self
.
font
)
class
PhysFieldsBase3D
(
PhysFieldsBase2D
):
...
...
@@ -128,17 +152,7 @@ class PhysFieldsBase3D(PhysFieldsBase2D):
assert
key_field
is
not
None
if
equation
.
startswith
(
"iz="
)
or
equation
.
startswith
(
"z="
):
xlabel
=
"x"
ylabel
=
"y"
elif
equation
.
startswith
(
"iy="
)
or
equation
.
startswith
(
"y="
):
xlabel
=
"x"
ylabel
=
"z"
elif
equation
.
startswith
(
"ix="
)
or
equation
.
startswith
(
"x="
):
xlabel
=
"y"
ylabel
=
"z"
else
:
raise
NotImplementedError
xlabel
,
ylabel
=
_get_xylabels_from_equation
(
equation
)
vecx
=
vector
+
xlabel
vecy
=
vector
+
ylabel
...
...
@@ -318,17 +332,7 @@ class PhysFieldsBase3D(PhysFieldsBase2D):
assert
key_field
is
not
None
if
equation
.
startswith
(
"iz="
)
or
equation
.
startswith
(
"z="
):
xlabel
=
"x"
ylabel
=
"y"
elif
equation
.
startswith
(
"iy="
)
or
equation
.
startswith
(
"y="
):
xlabel
=
"x"
ylabel
=
"z"
elif
equation
.
startswith
(
"ix="
)
or
equation
.
startswith
(
"x="
):
xlabel
=
"y"
ylabel
=
"z"
else
:
raise
NotImplementedError
xlabel
,
ylabel
=
_get_xylabels_from_equation
(
equation
)
vecx
=
vector
+
xlabel
vecy
=
vector
+
ylabel
...
...
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