Open felker opened 5 years ago
Bump it up. Travis CI test failed by this file.
I found that this file does not pass python lint with flake8.
I tested with the existing .travis.yml, but the build failed. Here is the error:
Skipping the before_install step, as specified in the configuration.
Skipping the install step, as specified in the configuration.
before_script.1
0.02s$ if [ "$TRAVIS_OS_NAME" == "linux" ]; then pyenv global 3.6; fi
before_script.2
2.42s$ python3 -m pip install --upgrade --user pip
before_script.3
0.35s$ python3 --version; pip3 --version
before_script.4
12.24s$ pip3 install --user --only-binary=:all: --no-binary=termcolor numpy flake8 h5py scipy colorama termcolor matplotlib || true
3.42s$ python3 -m flake8 --exclude=cpplint.py,openmpi-* && echo "Finished linting Python files with flake8"
./vis/python/plot_mesh.py:43:19: E275 missing whitespace after keyword
The command "python3 -m flake8 --exclude=cpplint.py,openmpi-* && echo "Finished linting Python files with flake8"" exited with 1.
cache.2
store build cache
This error is caused by this statement on line 43
# append zero if 2D
if(len(numbers_str) > 2):
z.append(float(numbers_str[2]))
else:
The lint fails because there is no space after if
Summary of issue
vis/python/plot_mesh.py
was first added to the repository by @jmstone in 0a10fa8a53e115032013a2dc5d2e4775b89d998c on 2016-04-14 and later generalized to accept-i
,-o
flags by @c-white in 8b0d5f5423284d9a4e470c753e8aa113e1012dd7 on 2017-11-03.The only page in the Wiki that mentions it is the Tutorial page SMR and AMR. Even there, it only tangentially appears in the example output of the
./athena -m 1
command, while the actual tutorial text instructs the user to use gnuplot to view the SMR mesh structure.At a minimum, I feel like it should be documented in Plotting Scripts like
plot_lines.py, plot_slice.py, plot_spherical.py
. And/or it should be removed from being mentioned in the stdout output ofMesh::OutputMeshStructure(int dim)
: https://github.com/PrincetonUniversity/athena/blob/1da278d86e7a959331ee7eb05a290800aca0f1d1/src/mesh/mesh.cpp#L1013-L1021 (this also assumes the default directory hierarchy, e.g. that the user ran Athena++ inbin/
subdirectory of the root repository directory)When I was testing the SMR checks in #200, I tried to use
plot_mesh.py
to visualize the spherical-polar refined meshes, but I believe the script assumes that themesh_structure.dat
data was generated using the Cartesian coordinate system. This should be explicitly noted, perhaps in the script name.Also, the script would only work with
-o [file]
, see below.Steps to reproduce
With either Python 2 or 3 on my macOS system, the last command causes the
plt.show()
function to return immediately without displaying the image. I believe this is platform-specific behavior depending on the interactivity of the matplotlib backend (toggled withplt.ioff()
andplt.ion()
), but do the othervis/python/plot*
scripts behave this way? It very much appeared like a bug in the script.Adding
-o test.png
to the final command produces the correct image in the file.To-do
plot_mesh.py
usage and limitations in Plotting Scriptsplot_mesh.py
-m
outputvis/python/utils/
and moveuniform.py
,spherical_refinement.py
,athena_read.py
there since none of these files directly visualize anything unlike the 4xplot_*.py
scripts.