Skip to content

Commit ca2f68d

Browse files
committed
testing for latex installation
1 parent 13e6247 commit ca2f68d

File tree

5 files changed

+30
-16
lines changed

5 files changed

+30
-16
lines changed

.github/workflows/ci_pipeline.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ jobs:
1818
- name: Add packages
1919
run: |
2020
sudo apt-get update
21-
sudo apt-get --yes install texlive-latex-recommended texlive-fonts-recommended texlive-latex-extra cm-super dvipng nodejs
21+
sudo apt-get --yes install nodejs
22+
# sudo apt-get --yes install texlive-latex-recommended texlive-fonts-recommended texlive-latex-extra cm-super dvipng nodejs
2223

2324
- name: Cache conda
2425
uses: actions/cache@v2
@@ -55,12 +56,10 @@ jobs:
5556
5657
- name: Lint with flake8
5758
run: |
58-
conda install --yes -c conda-forge flake8 flake8-comprehensions flake8-bugbear
5959
flake8 pySDC
6060
6161
- name: Run pytest
6262
run: |
63-
conda install --yes -c conda-forge pytest-cov
6463
pytest -v --cov=pySDC --cov-config=.coveragerc --cov-report=html --cov-report=term --durations=0 pySDC/tests
6564
6665
- name: Build documentation

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Features
1414
- 8 tutorials: from setting up a first collocation problem to SDC, PFASST and advanced topics
1515
- Projects: many documented projects with defined and tested outcomes
1616
- Many different examples, collocation types, data types already implemented
17-
- Works with `PETSc <http://www.mcs.anl.gov/petsc/>`_ through `petsc4py <https://bitbucket.org/petsc/petsc4py>`_ , `FEniCS <https://fenicsproject.org/>`_ and `mpi4py-fft <https://mpi4py-fft.readthedocs.io/en/latest/>`_
17+
- Works with `PETSc <http://www.mcs.anl.gov/petsc/>`_ through `petsc4py <https://bitbucket.org/petsc/petsc4py>`_, `FEniCS <https://fenicsproject.org/>`_ and `mpi4py-fft <https://mpi4py-fft.readthedocs.io/en/latest/>`_
1818
- Continuous integration via `Github Actions <https://github.com/Parallel-in-Time/pySDC/actions>`__
1919
- Fully compatible with Python 3.6 - 3.9
2020

pySDC/helpers/plot_helper.py

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import matplotlib as mpl
2-
mpl.use('pgf')
32
import matplotlib.pyplot as plt
3+
from distutils.spawn import find_executable
44

55

66
def figsize(textwidth, scale, ratio):
@@ -14,9 +14,7 @@ def figsize(textwidth, scale, ratio):
1414

1515
def setup_mpl(font_size=8):
1616
# Set up plotting parameters
17-
pgf_with_latex = { # setup matplotlib to use latex for output
18-
"pgf.texsystem": "pdflatex", # change this if using xetex or lautex
19-
"text.usetex": True, # use LaTeX to write all text
17+
style_options = { # setup matplotlib to use latex for output
2018
"font.family": "serif",
2119
"font.serif": [], # blank entries should cause plots to inherit fonts from the document
2220
"font.sans-serif": [],
@@ -39,12 +37,26 @@ def setup_mpl(font_size=8):
3937
"grid.alpha": 0.25,
4038
"figure.subplot.hspace": 0.0,
4139
"savefig.pad_inches": 0.01,
42-
"pgf.preamble": r"\usepackage[utf8x]{inputenc}"
43-
r"\usepackage[T1]{fontenc}"
44-
r"\usepackage{underscore}"
45-
r"\usepackage{amsmath,amssymb,marvosym}"
4640
}
47-
mpl.rcParams.update(pgf_with_latex)
41+
42+
mpl.rcParams.update(style_options)
43+
44+
if find_executable('latex'):
45+
46+
latex_support = {
47+
"pgf.texsystem": "pdflatex", # change this if using xetex or lautex
48+
"text.usetex": True, # use LaTeX to write all text
49+
"pgf.preamble": r"\usepackage[utf8x]{inputenc}"
50+
r"\usepackage[T1]{fontenc}"
51+
r"\usepackage{underscore}"
52+
r"\usepackage{amsmath,amssymb,marvosym}"
53+
}
54+
else:
55+
latex_support = {
56+
"text.usetex": False, # use LaTeX to write all text
57+
}
58+
59+
mpl.rcParams.update(latex_support)
4860

4961

5062
def newfig(textwidth, scale, ratio=0.6180339887):
@@ -54,7 +66,7 @@ def newfig(textwidth, scale, ratio=0.6180339887):
5466

5567

5668
def savefig(filename, save_pdf=True, save_pgf=True, save_png=True):
57-
if save_pgf:
69+
if save_pgf and find_executable('latex'):
5870
plt.savefig('{}.pgf'.format(filename), bbox_inches='tight')
5971
if save_pdf:
6072
plt.savefig('{}.pdf'.format(filename), bbox_inches='tight')

pySDC/projects/AllenCahn_Bayreuth/run_simple_forcing_verification.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ def visualize_radii():
249249

250250
# test if all went well
251251
assert glob.glob(f'{f}.pdf'), 'ERROR: plotting did not create PDF file'
252-
assert glob.glob(f'{f}.pgf'), 'ERROR: plotting did not create PGF file'
252+
# assert glob.glob(f'{f}.pgf'), 'ERROR: plotting did not create PGF file'
253253
assert glob.glob(f'{f}.png'), 'ERROR: plotting did not create PNG file'
254254

255255
# set up plot for volumes
@@ -274,7 +274,7 @@ def visualize_radii():
274274

275275
# test if all went well
276276
assert glob.glob(f'{f}.pdf'), 'ERROR: plotting did not create PDF file'
277-
assert glob.glob(f'{f}.pgf'), 'ERROR: plotting did not create PGF file'
277+
# assert glob.glob(f'{f}.pgf'), 'ERROR: plotting did not create PGF file'
278278
assert glob.glob(f'{f}.png'), 'ERROR: plotting did not create PNG file'
279279

280280

requirements.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ fenics>=2019.1.0
1313
mpi4py-fft>=2.0.2
1414
# These packages are used for CI/CD and can be ignored
1515
pip
16+
flake8
17+
flake8-comprehensions
18+
flake8-bugbear
1619
pytest
1720
pytest-cov
1821
sphinx

0 commit comments

Comments
 (0)