Skip to content

Commit

Permalink
Merge pull request #92 from sunpy/release
Browse files Browse the repository at this point in the history
  • Loading branch information
nabobalis authored Aug 5, 2022
2 parents b0aa38d + 827ed74 commit 602e92e
Show file tree
Hide file tree
Showing 36 changed files with 363 additions and 296 deletions.
66 changes: 23 additions & 43 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,59 +1,39 @@
repos:
# The warnings/errors we check for here are:
# E901 - SyntaxError or IndentationError
# E902 - IOError
# F822 - undefined name in __all__
# F823 - local variable name referenced before assignment
# Others are taken care of by autopep8
- repo: https://github.com/PyCQA/flake8
rev: 5.0.2
- repo: https://github.com/myint/docformatter
rev: v1.4
hooks:
- id: flake8
args:
[
"--count",
"--select",
"E901,E902,F822,F823",
]
exclude: ".*(.fits|.fts|.fit|.header|.txt|tca.*|extern.*|.rst|.md|cm/__init__.py|sunpy/extern|sunpy/visualization/colormaps/color_tables.py)$"
- id: docformatter
args: [--in-place, --pre-summary-newline, --make-summary-multi]
- repo: https://github.com/myint/autoflake
rev: v1.4
hooks:
- id: autoflake
args:
[
"--in-place",
"--remove-all-unused-imports",
"--remove-unused-variable",
]
exclude: ".*(.fits|.fts|.fit|.header|.txt|tca.*|extern.*|.rst|.md|__init__.py|sunpy/extern|docs/conf.py)$"
- repo: https://github.com/PyCQA/isort
rev: 5.10.1
hooks:
args: ['--in-place', '--remove-all-unused-imports', '--remove-unused-variable']
exclude: ".*(.fits|.fts|.fit|.txt|tca.*|extern.*|.rst|.md|__init__.py|docs/conf.py)$"
- repo: https://github.com/psf/black
rev: 22.6.0
hooks:
- id: black
exclude: ".*(.fits|.fts|.fit|.txt|.csv)$"
- repo: https://github.com/timothycrosley/isort
rev: 5.10.1
hooks:
- id: isort
args: ["--sp", "setup.cfg"]
exclude: ".*(.fits|.fts|.fit|.header|.txt|tca.*|extern.*|.rst|.md|cm/__init__.py|sunpy/extern|docs/conf.py)$"
- repo: https://github.com/pre-commit/mirrors-autopep8
rev: v1.6.0
hooks:
- id: autopep8
args: ["--in-place","--max-line-length", "200"]
exclude: ".*(.fits|.fts|.fit|.header|.txt|tca.*|extern.*|.rst|.md|cm/__init__.py|sunpy/extern|sunpy/visualization/colormaps/color_tables.py)$"
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
hooks:
exclude: ".*(.fits|.fts|.fit|.txt|.csv)$"
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
hooks:
- id: check-ast
- id: check-case-conflict
- id: trailing-whitespace
exclude: ".*(.fits|.fts|.fit|.header|.txt)$"
exclude: ".*(.fits|.fts|.fit|.txt|.csv)$"
- id: mixed-line-ending
exclude: ".*(.fits|.fts|.fit|.txt|.csv)$"
- id: end-of-file-fixer
exclude: ".*(.fits|.fts|.fit|.txt|.csv)$"
- id: check-yaml
- id: debug-statements
- id: check-added-large-files
args: ['--enforce-all','--maxkb=1054']
- id: end-of-file-fixer
exclude: ".*(.fits|.fts|.fit|.header|.txt|tca.*)$"
- id: mixed-line-ending
exclude: ".*(.fits|.fts|.fit|.header|.txt|tca.*)$"

ci:
autofix_prs: false
41 changes: 41 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
0.1.0 (2022-08-04)
==================

Features
--------

- Creation of :class:`~sunkit_pyvista.plotter.SunpyPlotter` class which allows for plotting of a :class:`~sunpy.map.GenericMap` through pyvista. (`#4 <https://github.com/sunpy/sunkit-pyvista/pull/4>`__)
- Adds :meth:`~sunkit_pyvista.plotter.SunpyPlotter.set_camera_coordinate` which allows for specifying the initial camera coordinates. (`#10 <https://github.com/sunpy/sunkit-pyvista/pull/10>`__)
- Added :meth:`~sunkit_pyvista.plotter.SunpyPlotter.plot_field_lines` method which allows for plotting of magnetic field lines from `pfsspy` through pyvista. (`#12 <https://github.com/sunpy/sunkit-pyvista/pull/12>`__)
- Adds :meth:`~sunkit_pyvista.plotter.SunpyPlotter.set_view_angle` which allows for setting of the camera's width/view angle. (`#16 <https://github.com/sunpy/sunkit-pyvista/pull/16>`__)
- Adds :meth:`~sunkit_pyvista.plotter.SunpyPlotter.plot_quadrangle` which allows for drawing a quadrangle defined
by coordinates passed to it. (`#17 <https://github.com/sunpy/sunkit-pyvista/pull/17>`__)
- Adds :meth:`~sunkit_pyvista.plotter.SunpyPlotter._add_mesh_to_dict` stores each mesh in a dictionary for later access. (`#24 <https://github.com/sunpy/sunkit-pyvista/pull/24>`__)
- :meth:`~sunkit_pyvista.plotter.SunpyPlotter.plot_map` accepts the keyword ``clip_interval`` as argument, which clips the data
according to the percentile interval bounded by the two numbers. (`#26 <https://github.com/sunpy/sunkit-pyvista/pull/26>`__)
- ``plot_line()`` is renamed to :meth:`~sunkit_pyvista.plotter.SunpyPlotter.plot_coordinates`
which also allows for a sphere with given ``radius`` to be plotted if a single coordinate is passed to it. (`#29 <https://github.com/sunpy/sunkit-pyvista/pull/29>`__)
- Added :meth:`~sunkit_pyvista.plotter.SunpyPlotter.save` method which allows for saving of plots to a vtm file. (`#37 <https://github.com/sunpy/sunkit-pyvista/pull/37>`__)
- Allows for figure tests to be performed with `pytest`. (`#38 <https://github.com/sunpy/sunkit-pyvista/pull/38>`__)
- Adds :meth:`~sunkit_pyvista.plotter.SunpyPlotter.plot_limb` which allows for drawing a limb as seen by the map's observer. (`#59 <https://github.com/sunpy/sunkit-pyvista/pull/59>`__)
- Allows user to specify color via a color function to :meth:`~sunkit_pyvista.plotter.SunpyPlotter.plot_field_lines`. (`#70 <https://github.com/sunpy/sunkit-pyvista/pull/70>`__)
- Added narrative documentation for sunkit-pyvista. (`#84 <https://github.com/sunpy/sunkit-pyvista/pull/84>`__)


Bug Fixes
---------

- Adds parenthesis to fix check in :meth:`~sunkit_pyvista.plotter.SunpyPlotter.set_view_angle`. (`#34 <https://github.com/sunpy/sunkit-pyvista/pull/34>`__)
- Fixes error while loading color map in :meth:`~sunkit_pyvista.plotter.SunpyPlotter.load`. (`#55 <https://github.com/sunpy/sunkit-pyvista/pull/55>`__)


Internal Changes
----------------

- Increases test converage for :class:`~sunkit_pyvista.plotter.SunpyPlotter`. (`#23 <https://github.com/sunpy/sunkit-pyvista/pull/23>`__)
- Rearranged existing examples and added an example brightest pixel with :meth:`~sunkit_pyvista.plotter.SunpyPlotter.plot_coordinates`. (`#30 <https://github.com/sunpy/sunkit-pyvista/pull/30>`__)
- :meth:`~sunkit_pyvista.plotter.SunpyPlotter.plot_quadrangle` uses a :meth`~pyvista.utilities.Spline` for combining the individual points. (`#52 <https://github.com/sunpy/sunkit-pyvista/pull/52>`__)
- Adds an example using :meth:`~sunpy.coordinates.frames.Helioprojective.assume_spherical_screen`. (`#69 <https://github.com/sunpy/sunkit-pyvista/pull/69>`__)
- Changed the manner that colors or colormaps are saved.
Changed default of meshes to be white. (`#73 <https://github.com/sunpy/sunkit-pyvista/pull/73>`__)
- Removes colorbars when displaying plots. (`#79 <https://github.com/sunpy/sunkit-pyvista/pull/79>`__)
1 change: 0 additions & 1 deletion changelog/10.feature.rst

This file was deleted.

1 change: 0 additions & 1 deletion changelog/12.feature.rst

This file was deleted.

1 change: 0 additions & 1 deletion changelog/16.feature.rst

This file was deleted.

2 changes: 0 additions & 2 deletions changelog/17.feature.rst

This file was deleted.

1 change: 0 additions & 1 deletion changelog/23.trivial.rst

This file was deleted.

1 change: 0 additions & 1 deletion changelog/24.feature.rst

This file was deleted.

2 changes: 0 additions & 2 deletions changelog/26.feature.rst

This file was deleted.

2 changes: 0 additions & 2 deletions changelog/29.feature.rst

This file was deleted.

1 change: 0 additions & 1 deletion changelog/30.trivial.rst

This file was deleted.

1 change: 0 additions & 1 deletion changelog/34.bugfix.rst

This file was deleted.

1 change: 0 additions & 1 deletion changelog/37.feature.rst

This file was deleted.

1 change: 0 additions & 1 deletion changelog/38.feature.rst

This file was deleted.

1 change: 0 additions & 1 deletion changelog/4.feature.rst

This file was deleted.

1 change: 0 additions & 1 deletion changelog/52.trivial.rst

This file was deleted.

1 change: 0 additions & 1 deletion changelog/55.bugfix.rst

This file was deleted.

1 change: 0 additions & 1 deletion changelog/59.feature.rst

This file was deleted.

1 change: 0 additions & 1 deletion changelog/69.trivial.rst

This file was deleted.

1 change: 0 additions & 1 deletion changelog/70.feature.rst

This file was deleted.

2 changes: 0 additions & 2 deletions changelog/73.trivial.rst

This file was deleted.

1 change: 0 additions & 1 deletion changelog/79.trivial.rst

This file was deleted.

1 change: 0 additions & 1 deletion changelog/84.feature.rst

This file was deleted.

81 changes: 42 additions & 39 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import warnings
import numpy as np
import pyvista

# Use the sunpy theme
from sunpy_sphinx_theme.conf import *
from packaging.version import Version
Expand All @@ -12,71 +13,73 @@
from datetime import datetime

# -- Project information -----------------------------------------------------
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
os.environ['HIDE_PARFIVE_PROGESS'] = 'True'
project = 'sunkit-pyvista'
author = 'SunPy Community'
copyright = '{}, {}'.format(datetime.now().year, author)
on_rtd = os.environ.get("READTHEDOCS", None) == "True"
os.environ["HIDE_PARFIVE_PROGESS"] = "True"
project = "sunkit-pyvista"
author = "SunPy Community"
copyright = "{}, {}".format(datetime.now().year, author)

# The full version, including alpha/beta/rc tags
release = __version__
sunkit_pyvista_version = Version(__version__)
is_release = not(sunkit_pyvista_version.is_prerelease or sunkit_pyvista_version.is_devrelease)
is_release = not (
sunkit_pyvista_version.is_prerelease or sunkit_pyvista_version.is_devrelease
)

# -- General configuration ---------------------------------------------------
extensions = [
'sphinx_automodapi.automodapi',
'sphinx_automodapi.smart_resolver',
'sphinx_changelog',
'sphinx.ext.autodoc',
'sphinx.ext.coverage',
'sphinx.ext.doctest',
'sphinx.ext.inheritance_diagram',
'sphinx.ext.intersphinx',
'sphinx.ext.mathjax',
'sphinx.ext.napoleon',
'sphinx.ext.todo',
'sphinx.ext.viewcode',
"sphinx_automodapi.automodapi",
"sphinx_automodapi.smart_resolver",
"sphinx_changelog",
"sphinx.ext.autodoc",
"sphinx.ext.coverage",
"sphinx.ext.doctest",
"sphinx.ext.inheritance_diagram",
"sphinx.ext.intersphinx",
"sphinx.ext.mathjax",
"sphinx.ext.napoleon",
"sphinx.ext.todo",
"sphinx.ext.viewcode",
"jupyter_sphinx",
]

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]

# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
source_suffix = '.rst'
source_suffix = ".rst"

# The master toctree document.
master_doc = 'index'
master_doc = "index"

# Enable nitpicky mode, which forces links to be non-broken
nitpicky = True
nitpick_ignore = [
# Prevents sphinx nitpicky mode picking up on optional
# (see https://github.com/sphinx-doc/sphinx/issues/6861)
('py:class', 'optional'),
("py:class", "optional"),
# See https://github.com/numpy/numpy/issues/10039
('py:obj', 'numpy.datetime64'),
("py:obj", "numpy.datetime64"),
# There's no specific file or function classes to link to
('py:class', 'file object'),
('py:class', 'function'),
('py:obj', 'function'),
('py:class', 'any type'),
('py:class', "Unit('pix')"),
('py:class', "Unit('deg')"),
('py:class', "Unit('arcsec')"),
('py:class', "Unit('%')"),
('py:class', "Unit('s')"),
('py:class', "Unit('Angstrom')"),
('py:class', "Unit('arcsec / pix')"),
('py:class', "Unit('W / m2')"),
('py:class', 'array-like'),
('py:obj', 'parfive'),
('py:class', 'string'),
('py:class', 'floats'),
("py:class", "file object"),
("py:class", "function"),
("py:obj", "function"),
("py:class", "any type"),
("py:class", "Unit('pix')"),
("py:class", "Unit('deg')"),
("py:class", "Unit('arcsec')"),
("py:class", "Unit('%')"),
("py:class", "Unit('s')"),
("py:class", "Unit('Angstrom')"),
("py:class", "Unit('arcsec / pix')"),
("py:class", "Unit('W / m2')"),
("py:class", "array-like"),
("py:obj", "parfive"),
("py:class", "string"),
("py:class", "floats"),
]

# -- Options for intersphinx extension ---------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions docs/examples/setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import pyvista

pyvista.global_theme.background = 'white'
pyvista.global_theme.background = "white"
pyvista.global_theme.window_size = [600, 600]
pyvista.global_theme.antialiasing = True
pyvista.global_theme.jupyter_backend = 'pythreejs'
pyvista.global_theme.jupyter_backend = "pythreejs"
28 changes: 18 additions & 10 deletions examples/3d_functionality.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
# Start by creating a plotter
plotter = SunpyPlotter()
# Plot a map
plotter.plot_map(low_res_aia_193, clip_interval=(1, 99.9)*u.percent)
plotter.plot_map(low_res_aia_193, clip_interval=(1, 99.9) * u.percent)
# Add an arrow to show the solar rotation axis
plotter.plot_solar_axis()

Expand All @@ -34,18 +34,26 @@

pixel_pos = np.argwhere(low_res_aia_193.data == low_res_aia_193.data.max()) * u.pixel
hpc_max = low_res_aia_193.pixel_to_world(pixel_pos[:, 1], pixel_pos[:, 0])
plotter.plot_coordinates(hpc_max, color='blue')
plotter.plot_coordinates(hpc_max, color="blue")

# Plot a quadrangle with width of 20 degrees and a height of 60 degrees
bottom_left = SkyCoord(30*u.deg, -10*u.deg,
frame=frames.HeliographicStonyhurst,
obstime=low_res_aia_193.date)
plotter.plot_quadrangle(bottom_left=bottom_left, width=20*u.deg,
height=60*u.deg, color='blue')
bottom_left = SkyCoord(
30 * u.deg,
-10 * u.deg,
frame=frames.HeliographicStonyhurst,
obstime=low_res_aia_193.date,
)
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, -10*u.deg, 6*R_sun,
frame=frames.HeliographicStonyhurst,
obstime=low_res_aia_193.date)
camera_coord = SkyCoord(
30 * u.deg,
-10 * 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 examples/assume_spherical.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@
plotter = SunpyPlotter()
# Plot a map setting the `assume_spherical_screen` to False
plotter.plot_map(
low_res_aia_193, clip_interval=[1, 99] * u.percent,
assume_spherical_screen=False
low_res_aia_193, clip_interval=[1, 99] * u.percent, assume_spherical_screen=False
)

plotter.show()
7 changes: 3 additions & 4 deletions examples/field_lines.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,15 @@
# Create 5 points spaced between long={0, 180} degrees
lon = np.linspace(0, 2 * np.pi, 16, endpoint=False)
# Make a 2D grid from these 1D points
lat, lon = np.meshgrid(lat, lon, indexing='ij')
lat, lon = np.meshgrid(lat, lon, indexing="ij")
# Create lon, lat and radial coordinate values by using a pfsspy
# and trace them using tracer
lat, lon = lat.ravel() * u.rad, lon.ravel() * u.rad
radius = rss
tracer = tracing.FortranTracer()
input_ = pfsspy.Input(gong_map, nrho, rss)
output_ = pfsspy.pfss(input_)
seeds = SkyCoord(lon, lat, radius*R_sun,
frame=gong_map.coordinate_frame)
seeds = SkyCoord(lon, lat, radius * R_sun, frame=gong_map.coordinate_frame)
field_lines = tracer.trace(seeds, output_)

# We can also specify a color function while plotting the field lines.
Expand All @@ -68,7 +67,7 @@

def my_fline_color_func(field_line):
norm = colors.LogNorm(vmin=1, vmax=1000)
cmap = plt.get_cmap('viridis')
cmap = plt.get_cmap("viridis")
return cmap(norm(np.abs(field_line.expansion_factor)))


Expand Down
Loading

0 comments on commit 602e92e

Please sign in to comment.