Skip to content

Commit 0f048df

Browse files
authored
Merge pull request #563 from bmorris3/docs-theme
Docs improvements, new theme
2 parents 2e6c766 + c28284f commit 0f048df

File tree

8 files changed

+57
-57
lines changed

8 files changed

+57
-57
lines changed

CHANGES.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
- Fix ``Observer`` not having longtitude, latitude, and elevation parameters
88
as class attributes. They are now properties calculated from the ``location``.
99

10+
- Documentation revisions and theme update [#563]
11+
1012
0.8 (2021-01-26)
1113
----------------
1214

astroplan/plots/sky.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
# Licensed under a 3-clause BSD style license - see LICENSE.rst
2-
from __future__ import (absolute_import, division, print_function,
3-
unicode_literals)
4-
52
import numpy as np
63
import astropy.units as u
74
from astropy.time import Time
@@ -120,7 +117,9 @@ def plot_sky(target, observer, time, ax=None, style_kwargs=None,
120117
if isinstance(plt.gca(), plt.PolarAxes):
121118
ax = plt.gca()
122119
else:
123-
ax = plt.axes(polar=True)
120+
plt.close()
121+
fig = plt.gcf()
122+
ax = fig.add_subplot(projection='polar')
124123

125124
if style_kwargs is None:
126125
style_kwargs = {}

astroplan/plots/time_dependent.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,11 @@ def plot_airmass(targets, observer, time, ax=None, style_kwargs=None,
152152
if style_kwargs is None:
153153
style_kwargs = {}
154154
style_kwargs = dict(style_kwargs)
155-
style_kwargs.setdefault('linewidth', 1.5)
156-
style_kwargs.setdefault('fmt', '-')
155+
156+
if 'lw' not in style_kwargs:
157+
style_kwargs.setdefault('linewidth', 1.5)
158+
if 'ls' not in style_kwargs and 'linestyle' not in style_kwargs:
159+
style_kwargs.setdefault('fmt', '-')
157160

158161
if hasattr(time, 'utcoffset') and use_local_tz:
159162
tzoffset = time.utcoffset()
@@ -366,9 +369,10 @@ def plot_altitude(targets, observer, time, ax=None, style_kwargs=None,
366369
if style_kwargs is None:
367370
style_kwargs = {}
368371
style_kwargs = dict(style_kwargs)
369-
style_kwargs.setdefault('linestyle', '-')
370-
style_kwargs.setdefault('linewidth', 1.5)
371-
style_kwargs.setdefault('fmt', '-')
372+
if 'ls' not in style_kwargs and 'fmt' not in style_kwargs:
373+
style_kwargs.setdefault('linestyle', '-')
374+
if 'lw' not in style_kwargs:
375+
style_kwargs.setdefault('linewidth', 1.5)
372376

373377
# Populate time window if needed.
374378
time = Time(time)
@@ -591,8 +595,9 @@ def plot_parallactic(target, observer, time, ax=None, style_kwargs=None,
591595
if style_kwargs is None:
592596
style_kwargs = {}
593597
style_kwargs = dict(style_kwargs)
594-
style_kwargs.setdefault('linestyle', '-')
595598
style_kwargs.setdefault('fmt', '-')
599+
if 'ls' not in style_kwargs and 'fmt' not in style_kwargs:
600+
style_kwargs.setdefault('linestyle', '-')
596601

597602
# Populate time window if needed.
598603
time = Time(time)

docs/conf.py

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212
# See astropy.sphinx.conf for which values are set there.
1313

1414
from configparser import ConfigParser
15-
import os
15+
from astroplan import __version__
1616
import sys
1717
import datetime
1818

1919
try:
20-
from sphinx_astropy.conf.v1 import * # noqa
20+
from sphinx_astropy.conf.v2 import * # noqa
2121
except ImportError:
2222
print('ERROR: the documentation requires the sphinx-astropy package to '
2323
'be installed')
@@ -34,7 +34,7 @@
3434
highlight_language = 'python3'
3535

3636
# If your documentation needs a minimal Sphinx version, state it here.
37-
needs_sphinx = '1.7'
37+
# needs_sphinx = '1.7'
3838

3939
# Extend astropy intersphinx_mapping with packages we use here
4040
intersphinx_mapping['astroquery'] = ('http://astroquery.readthedocs.io/en/latest/', None)
@@ -85,12 +85,6 @@
8585
# variables set in the global configuration. The variables set in the
8686
# global configuration are listed below, commented out.
8787

88-
html_theme_options = {
89-
'logotext1': 'astro', # white, semi-bold
90-
'logotext2': 'plan', # orange, light
91-
'logotext3': ':docs' # white, light
92-
}
93-
9488
# Add any paths that contain custom themes here, relative to this directory.
9589
# To use a different custom theme, add the directory containing the theme.
9690
#html_theme_path = []
@@ -179,6 +173,31 @@
179173
# -- Turn on nitpicky mode for sphinx (to warn about references not found) ----
180174
nitpicky = True
181175

176+
release = __version__
177+
dev = "dev" in release
178+
179+
html_copy_source = False
180+
181+
html_theme_options.update( # noqa: F405
182+
{
183+
"github_url": "https://github.com/astropy/astroplan",
184+
"external_links": [
185+
{"name": "astropy docs", "url": "https://docs.astropy.org/en/stable/"},
186+
],
187+
"use_edit_page_button": True,
188+
}
189+
)
190+
191+
html_context = {
192+
"default_mode": "light",
193+
"to_be_indexed": ["stable", "latest"],
194+
"is_development": dev,
195+
"github_user": "astropy",
196+
"github_repo": "astroplan",
197+
"github_version": "main",
198+
"doc_path": "docs",
199+
}
200+
182201
#
183202
# Some warnings are impossible to suppress, and you can list specific references
184203
# that should be ignored in a nitpick-exceptions file which should be inside

docs/getting_started.rst

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Getting Started
77
General Guidelines
88
==================
99

10-
`astroplan` is based on `Astropy <https://astropy.org>`__ and was built around the creation of Python
10+
`astroplan` is based on `astropy <https://astropy.org>`__ and was built around the creation of Python
1111
objects that contain all the information needed to perform certain tasks. You,
1212
the user, will create and manipulate these objects to plan your observation. For
1313
instance, an `~astroplan.Target` object contains information associated with
@@ -57,7 +57,7 @@ Or you can specify your own location parameters::
5757
timezone=timezone('US/Hawaii'),
5858
description="Subaru Telescope on Maunakea, Hawaii")
5959

60-
`astroplan` makes heavy use of certain `Astropy <https://astropy.org>`__ machinery, including the
60+
`astroplan` makes heavy use of certain `astropy <https://astropy.org>`__ machinery, including the
6161
`~astropy.coordinates` objects and transformations and
6262
`~astropy.units`. Most importantly for basic use of `astroplan` is the
6363
representation of dates/times as `~astropy.time.Time` objects (note that
@@ -66,10 +66,6 @@ these are in the UTC timezone by default)::
6666
from astropy.time import Time
6767
time = Time(['2015-06-16 06:00:00'])
6868

69-
Since `astroplan` objects are Python objects, manipulating them or accessing
70-
attributes follows Python syntax and conventions. See Python documentation on
71-
`objects <https://docs.python.org/2/tutorial/classes.html#instance-objects>`_
72-
for more information.
7369

7470
Doing More
7571
==========

docs/index.rst

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,6 @@
22

33
.. _astroplan:
44

5-
**********************************
6-
Observation Planning (`astroplan`)
7-
**********************************
8-
9-
What is astroplan?
10-
==================
11-
125
**astroplan** is an open source Python package to help astronomers plan
136
observations.
147

@@ -17,7 +10,6 @@ scheduling. When complete, the goal is to be easy for Python beginners and new
1710
observers to to pick up, but powerful enough for observatories preparing nightly
1811
and long-term schedules.
1912

20-
2113
Features:
2214

2315
* Calculate rise/set/meridian transit times, alt/az positions for targets at
@@ -26,7 +18,7 @@ Features:
2618
plots (airmass, parallactic angle, sky maps).
2719
* Determining observability of sets of targets given an arbitrary set of
2820
constraints (i.e., altitude, airmass, moon separation/illumination, etc.).
29-
* `Astropy <https://astropy.org>`__ powered!
21+
* `astropy <https://astropy.org>`__ powered!
3022

3123
Links
3224
=====

docs/installation.rst

Lines changed: 9 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,9 @@ Requirements
1010
============
1111

1212
**astroplan** works on Linux, Mac OS X and Windows.
13-
It requires Python 2.7 or 3.5+ (2.6 and 3.2 or earlier are not
14-
supported, 3.3 and 3.4 may work) as well as the following packages:
15-
16-
* `Numpy`_ (1.10 or later)
17-
* `Astropy <https://astropy.org>`__ (v1.3 or later)
18-
* `pytz`_
19-
20-
Optional packages:
21-
22-
* `Matplotlib`_
23-
* `astroquery`_
24-
25-
For testing:
26-
27-
* `pytest-astropy`_
13+
It requires Python 3.7+ as well as numpy, astropy, pytz, and six.
14+
Additional features are available when you install `Matplotlib`_
15+
and `astroquery`_.
2816

2917
First-time Python users may want to consider an all-in-one Python installation
3018
package, such as the `Anaconda Python Distribution
@@ -49,29 +37,28 @@ cloning the git repository::
4937
...then installing the package with::
5038

5139
cd astroplan
52-
python setup.py install
40+
pip install .
5341

5442
Testing
5543
=======
5644

5745
If you want to check that all the tests are running correctly with your Python
58-
configuration, start up python, and type::
46+
configuration, run the following from the command line::
5947

60-
import astroplan
61-
astroplan.test()
48+
tox -e test
6249

6350
If there are no errors, you are good to go!
6451

6552
.. note::
6653
If you want to run the tests that access the internet, you'll need to
67-
replace the last line above with ``astroplan.test(remote_data=True)`` and
54+
replace the last line above with ``tox -e test -- --remote-data`` and
6855
have an active connection to the internet. Also, if you want the tests
6956
that check plotting to work, you need `Matplotlib`_ and `pytest-mpl`_.
7057

7158
More
7259
====
7360

74-
astroplan follows `Astropy <https://astropy.org>`__'s guidelines for affiliated packages--installation
75-
and testing for the two are quite similar! Please see Astropy's
61+
astroplan follows `astropy <https://astropy.org>`__'s guidelines for affiliated packages--installation
62+
and testing for the two are quite similar! Please see astropy's
7663
`installation page <http://astropy.readthedocs.io/en/latest/install.html>`_
7764
for more information.

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ test =
3030
pytest-astropy
3131
pytest-mpl
3232
docs =
33-
sphinx-astropy
33+
sphinx-astropy[confv2]
3434
sphinx-rtd-theme
3535
matplotlib>=1.4
3636
astroquery

0 commit comments

Comments
 (0)