Skip to content

Commit

Permalink
Undo it again
Browse files Browse the repository at this point in the history
  • Loading branch information
nabobalis committed Mar 16, 2023
1 parent a314dfb commit a8be873
Show file tree
Hide file tree
Showing 15 changed files with 58 additions and 61 deletions.
1 change: 0 additions & 1 deletion .readthedocs.yaml
Expand Up @@ -7,7 +7,6 @@ build:
apt_packages:
- xvfb
- libgl1-mesa-dev
- mesa-utils

conda:
environment: .rtd-environment.yml
Expand Down
31 changes: 27 additions & 4 deletions docs/conf.py
Expand Up @@ -30,6 +30,7 @@
"sphinx_automodapi.automodapi",
"sphinx_automodapi.smart_resolver",
"sphinx_changelog",
"sphinx_gallery.gen_gallery",
"sphinx.ext.autodoc",
"sphinx.ext.coverage",
"sphinx.ext.doctest",
Expand All @@ -39,7 +40,6 @@
"sphinx.ext.napoleon",
"sphinx.ext.todo",
"sphinx.ext.viewcode",
"jupyter_sphinx",
]

# List of patterns, relative to source directory, that match files and
Expand Down Expand Up @@ -87,8 +87,31 @@
# -- pyvista configuration ---------------------------------------------------
import pyvista

pyvista.OFF_SCREEN = True
# Preferred plotting style for documentation
pyvista.set_plot_theme("document")
pyvista.global_theme.window_size = [512, 512]
if on_rtd:
pyvista.start_xvfb()
pyvista.global_theme.font.size = 18
pyvista.global_theme.font.label_size = 18
pyvista.global_theme.font.title_size = 18
pyvista.global_theme.return_cpos = False
# Necessary when building the sphinx gallery
pyvista.OFF_SCREEN = True
pyvista.BUILDING_GALLERY = True
pyvista.set_jupyter_backend(None)

# -- Sphinx Gallery ------------------------------------------------------------
sphinx_gallery_conf = {
"backreferences_dir": os.path.join("generated", "modules"),
"filename_pattern": "^((?!skip_).)*$",
"examples_dirs": os.path.join("..", "examples"),
"gallery_dirs": os.path.join("generated", "gallery"),
"matplotlib_animations": True,
# Comes from the theme.
"default_thumb_file": png_icon, # NOQA
"abort_on_example_error": False,
"plot_gallery": "True",
"remove_config_comments": True,
"doc_module": ("sunpy"),
"only_warn_on_example_error": True,
"image_scrapers": ("matplotlib", "pyvista"),
}
8 changes: 0 additions & 8 deletions docs/examples/3d_functionality.rst

This file was deleted.

13 changes: 0 additions & 13 deletions docs/examples/_readme.txt

This file was deleted.

8 changes: 0 additions & 8 deletions docs/examples/assume_spherical.rst

This file was deleted.

8 changes: 0 additions & 8 deletions docs/examples/field_lines.rst

This file was deleted.

10 changes: 0 additions & 10 deletions docs/examples/index.rst

This file was deleted.

3 changes: 0 additions & 3 deletions docs/examples/setup.py

This file was deleted.

2 changes: 1 addition & 1 deletion docs/index.rst
Expand Up @@ -10,6 +10,6 @@ It is built on top of the `pyvista` package, which itself is built as a Python i

installing
getting_started
examples/index
generated/gallery/index
api
changelog
1 change: 1 addition & 0 deletions examples/3d_functionality.py
Expand Up @@ -48,6 +48,7 @@
plotter.plot_quadrangle(
bottom_left=bottom_left, width=20 * u.deg, height=60 * u.deg, color="blue"
)

# Set the camera coordinate to view the plot correctly
camera_coord = SkyCoord(
30 * u.deg,
Expand Down
3 changes: 2 additions & 1 deletion examples/README.txt
Expand Up @@ -5,4 +5,5 @@ Example Gallery
The gallery contains examples of how to use ``sunkit-pyvista``.
Each example is a short and self contained how-to guide for performing a specific task.

These files are executed by the documentation build process and the output is embedded.
Unfortunately, the gallery is not interactive on readthedocs.
If you run these locally, you can interact with the plots.
15 changes: 14 additions & 1 deletion examples/assume_spherical.py
Expand Up @@ -6,13 +6,16 @@
How to not plot off-limb pixels.
By default sunkit-pyvista plots all pixels in a map, using
:meth:`sunpy.coordinates.Helioprojective.assume_spherical_screen` to
:meth:`~sunpy.coordinates.Helioprojective.assume_spherical_screen` to
project off-limb pixels on to a spherical screen.
This example shows how off-limb pixels can be ignored altogether.
"""

import astropy.units as u
from astropy.constants import R_sun
from astropy.coordinates import SkyCoord
from sunpy.coordinates import frames

from sunkit_pyvista import SunpyPlotter
from sunkit_pyvista.sample import LOW_RES_AIA_193
Expand All @@ -27,4 +30,14 @@
LOW_RES_AIA_193, clip_interval=[1, 99] * u.percent, assume_spherical_screen=False
)

# Set the camera coordinate to view the plot correctly
camera_coord = SkyCoord(
0 * u.deg,
0 * u.deg,
6 * R_sun,
frame=frames.HeliographicStonyhurst,
obstime=LOW_RES_AIA_193.date,
)
plotter.set_camera_coordinate(camera_coord)

plotter.show()
11 changes: 11 additions & 0 deletions examples/field_lines.py
Expand Up @@ -20,6 +20,7 @@
import sunpy.map
from astropy.constants import R_sun
from astropy.coordinates import SkyCoord
from sunpy.coordinates import frames

from sunkit_pyvista import SunpyPlotter
from sunkit_pyvista.sample import LOW_RES_AIA_193
Expand Down Expand Up @@ -75,4 +76,14 @@ def my_fline_color_func(field_line):
plotter.plot_field_lines(field_lines, color_func=my_fline_color_func)
plotter.plotter.add_mesh(pv.Sphere(radius=1))

# Set the camera coordinate to view the plot correctly
camera_coord = SkyCoord(
0 * u.deg,
0 * u.deg,
6 * R_sun,
frame=frames.HeliographicStonyhurst,
obstime=LOW_RES_AIA_193.date,
)
plotter.set_camera_coordinate(camera_coord)

plotter.show()
3 changes: 1 addition & 2 deletions setup.cfg
Expand Up @@ -45,14 +45,13 @@ tests =
pytest-doctestplus
scikit-image
docs =
jupyter-sphinx
ipython
sphinx
sphinx-automodapi
sphinx-changelog
sphinx-gallery
streamtracer
sunpy-sphinx-theme
trame

[options.package_data]
sunkit_pyvista = data/*
Expand Down
2 changes: 1 addition & 1 deletion sunkit_pyvista/tests/conftest.py
Expand Up @@ -10,7 +10,7 @@
try:
pyvista.start_xvfb()
except Exception as e:
print("Could not start xvfb server:")
print("Could not start xvfb server:\n")
print(e)


Expand Down

0 comments on commit a8be873

Please sign in to comment.