Skip to content

Commit e634aee

Browse files
authored
Merge pull request #275 from hpparvi/documentation_facelift
Documentation facelift
2 parents 5a58333 + 3e0af09 commit e634aee

24 files changed

+1759
-411
lines changed

CHANGES.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
1.7.1 (2025-11-2x)
2+
------------------
3+
4+
Other changes
5+
^^^^^^^^^^^^^
6+
7+
- Changed to use ``sphinx_astropy.conf.v2`` and revised the documentation.
8+
19
1.7.0 (2025-11-13)
210
------------------
311

docs/_static/specreduce.css

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +0,0 @@
1-
@import url("bootstrap-astropy.css");
2-
3-
div.topbar a.brand {
4-
background: transparent url("logo_icon.png") no-repeat 8px 3px;
5-
background-image: url("logo_icon.png"), none;
6-
background-size: 32px 32px;
7-
}
8-
9-
#logotext1 {
10-
color: #519EA8;
11-
}
12-
13-
#logotext2 {
14-
color: #FF5000;
15-
}

docs/api.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.. _api_index:
22

3-
API Index
4-
=========
3+
API Reference
4+
=============
55

66
.. automodapi:: specreduce
77
:no-inheritance-diagram:

docs/background.rst

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
Background correction
2+
=====================
3+
4+
The `specreduce.background` module generates and subtracts a background image from
5+
the input 2D spectral image. The `~specreduce.background.Background` object is
6+
defined by one or more windows, where each window is a region parallel to a
7+
`~specreduce.tracing.Trace`, offset from that `~specreduce.tracing.Trace` by a
8+
specified separation in the cross-dispersion direction, and extending over a
9+
specified width (also measured along the cross-dispersion axis) in pixels. The
10+
object can be generated with:
11+
12+
* `~specreduce.background.Background`
13+
* `Background.one_sided <specreduce.background.Background.one_sided>`
14+
* `Background.two_sided <specreduce.background.Background.two_sided>`
15+
16+
The center of the window can either be passed as a float/integer or as a
17+
`~specreduce.tracing.Trace`.
18+
19+
.. code-block:: python
20+
21+
bg = specreduce.background.Background.one_sided(image, trace, separation=5, width=2)
22+
23+
or, equivalently
24+
25+
.. code-block:: python
26+
27+
bg = specreduce.background.Background.one_sided(image, 15, separation=5, width=2)
28+
29+
The background image can be accessed via `~specreduce.background.Background.bkg_image`
30+
and the background-subtracted image via `~specreduce.background.Background.sub_image`
31+
(or ``image - bg``).
32+
33+
The background and trace steps can be done iteratively, to refine an automated
34+
trace using the background-subtracted image as input.

docs/conf.py

Lines changed: 64 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -27,116 +27,126 @@
2727

2828
import sys
2929
import datetime
30-
3130
import sphinx
3231

3332
from specreduce import __version__
3433

3534
try:
36-
from sphinx_astropy.conf.v1 import * # noqa
35+
from sphinx_astropy.conf.v2 import * # noqa
36+
from sphinx_astropy.conf.v2 import extensions # noqa
3737
except ImportError:
38-
print('ERROR: the documentation requires the sphinx-astropy package to be installed')
38+
print("ERROR: the documentation requires the sphinx-astropy package to be installed")
3939
sys.exit(1)
4040

4141
# xref: https://github.com/sphinx-doc/sphinx/issues/13232#issuecomment-2608708175
4242
if sys.version_info[:2] >= (3, 13) and sphinx.version_info[:2] < (8, 2):
4343
import pathlib
44-
4544
from sphinx.util.typing import _INVALID_BUILTIN_CLASSES
4645

4746
_INVALID_BUILTIN_CLASSES[pathlib.Path] = "pathlib.Path"
4847

4948
# -- General configuration ----------------------------------------------------
5049

5150
# By default, highlight as Python 3.
52-
highlight_language = 'python3'
51+
highlight_language = "python3"
5352

5453
# If your documentation needs a minimal Sphinx version, state it here.
55-
#needs_sphinx = '1.2'
54+
needs_sphinx = "3.0"
5655

5756
# To perform a Sphinx version check that needs to be more specific than
5857
# major.minor, call `check_sphinx_version("x.y.z")` here.
5958
# check_sphinx_version("1.2.1")
6059

6160
# List of patterns, relative to source directory, that match files and
6261
# directories to ignore when looking for source files.
63-
exclude_patterns.append('_templates')
62+
exclude_patterns.append("_templates")
6463

6564
# This is added to the end of RST files - a good place to put substitutions to
6665
# be used globally.
67-
rst_epilog += """
68-
"""
66+
#rst_epilog += """
67+
#.. _Astropy: https://www.astropy.org/
68+
#"""
69+
70+
extensions.extend(
71+
[
72+
"sphinx_design",
73+
"nbsphinx",
74+
]
75+
)
6976

7077
# -- Project information ------------------------------------------------------
7178

7279
# This does not *have* to match the package name, but typically does
7380
project = "specreduce"
7481
author = "Astropy Specreduce contributors"
75-
copyright = '{0}, {1}'.format(
76-
datetime.datetime.now().year, author)
82+
copyright = "{0}, {1}".format(datetime.datetime.now().year, author)
7783

7884
# The version info for the project you're documenting, acts as replacement for
7985
# |version| and |release|, also used in various other places throughout the
8086
# built documents.
8187

8288
# The short X.Y version.
83-
version = __version__.split('-', 1)[0]
89+
version = __version__.split("-", 1)[0]
8490
# The full version, including alpha/beta/rc tags.
8591
release = __version__
8692

8793

8894
# -- Options for HTML output --------------------------------------------------
8995

90-
# A NOTE ON HTML THEMES
91-
# The global astropy configuration uses a custom theme, 'bootstrap-astropy',
92-
# which is installed along with astropy. A different theme can be used or
93-
# the options for this theme can be modified by overriding some of the
94-
# variables set in the global configuration. The variables set in the
95-
# global configuration are listed below, commented out.
96-
97-
98-
# Add any paths that contain custom themes here, relative to this directory.
99-
# To use a different custom theme, add the directory containing the theme.
100-
#html_theme_path = []
101-
102-
# The theme to use for HTML and HTML Help pages. See the documentation for
103-
# a list of builtin themes. To override the custom theme, set this to the
104-
# name of a builtin theme or the name of a custom theme in html_theme_path.
105-
#html_theme = None
106-
html_static_path = ['_static'] # html_theme = None
107-
html_style = 'specreduce.css'
96+
html_static_path = ["_static"] # html_theme = None
97+
html_style = "specreduce.css"
10898

109-
110-
html_theme_options = {
111-
'logotext1': 'spec', # white, semi-bold
112-
'logotext2': 'reduce', # orange, light
113-
'logotext3': ':docs' # white, light
99+
html_theme_options.update(
100+
{
101+
"github_url": "https://github.com/astropy/specreduce",
102+
"use_edit_page_button": False,
103+
"navigation_with_keys": False,
104+
"logo": {
105+
"text": f"{project}",
106+
"image_light": "_static/logo_icon.png",
107+
"image_dark": "_static/logo_icon.png",
108+
},
109+
"secondary_sidebar_items": {"**": ["page-toc"], "index": []},
114110
}
111+
)
112+
113+
html_context = {
114+
"default_mode": "light",
115+
"version_slug": os.environ.get("READTHEDOCS_VERSION") or "",
116+
"to_be_indexed": ["stable", "latest"],
117+
"github_user": "astropy",
118+
"github_repo": "specreduce",
119+
"github_version": "main",
120+
"doc_path": "docs",
121+
"edit_page_url_template": "{{ astropy_custom_edit_url(github_user, github_repo, github_version, doc_path, file_name, default_edit_page_url_template) }}",
122+
"default_edit_page_url_template": "https://github.com/{github_user}/{github_repo}/edit/{github_version}/{doc_path}{file_name}",
123+
# Tell Jinja2 templates the build is running on Read the Docs
124+
"READTHEDOCS": os.environ.get("READTHEDOCS", "") == "True",
125+
}
115126

116127
# Custom sidebar templates, maps document names to template names.
117-
#html_sidebars = {}
118-
html_sidebars['**'] = ['localtoc.html']
119-
html_sidebars['index'] = ['globaltoc.html', 'localtoc.html']
128+
html_sidebars = {}
129+
html_sidebars['index'] = []
130+
html_sidebars["contributing"] = []
120131

121-
# The name of an image file (relative to this directory) to place at the top
122-
# of the sidebar.
123-
#html_logo = ''
132+
# html_sidebars['**'] = ['localtoc.html']
133+
# html_sidebars['index'] = [] #['globaltoc.html', 'localtoc.html']
124134

125135
# The name of an image file (within the static path) to use as favicon of the
126136
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
127137
# pixels large.
128-
html_favicon = '_static/logo_icon.ico'
138+
html_favicon = "_static/logo_icon.ico"
129139

130140
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
131141
# using the given strftime format.
132-
#html_last_updated_fmt = ''
142+
# html_last_updated_fmt = ''
133143

134144
# The name for this set of Sphinx documents. If None, it defaults to
135145
# "<project> v<release> documentation".
136-
html_title = '{0} v{1}'.format(project, release)
146+
html_title = "{0} v{1}".format(project, release)
137147

138148
# Output file base name for HTML help builder.
139-
htmlhelp_basename = project + 'doc'
149+
htmlhelp_basename = project + "doc"
140150

141151
# Prefixes that are ignored for sorting the Python module index
142152
modindex_common_prefix = ["specreduce."]
@@ -145,18 +155,18 @@
145155

146156
# Grouping the document tree into LaTeX files. List of tuples
147157
# (source start file, target name, title, author, documentclass [howto/manual]).
148-
latex_documents = [('index', project + '.tex', project + u' Documentation',
149-
author, 'manual')]
158+
latex_documents = [("index", project + ".tex", project + " Documentation", author, "manual")]
150159

151160

152161
# -- Options for manual page output -------------------------------------------
153162

154163
# One entry per manual page. List of tuples
155164
# (source start file, name, description, authors, manual section).
156-
man_pages = [('index', project.lower(), project + u' Documentation',
157-
[author], 1)]
165+
man_pages = [("index", project.lower(), project + " Documentation", [author], 1)]
166+
167+
# -- Options for numpydoc extension -------------------------------------------
168+
numpydoc_xref_param_type = False
158169

159-
extensions.append('nbsphinx')
160170

161171
# -- Options for the edit_on_github extension ---------------------------------
162172

@@ -165,10 +175,10 @@
165175
nitpicky = True
166176
intersphinx_mapping.update(
167177
{
168-
'astropy': ('https://docs.astropy.org/en/stable/', None),
169-
'ccdproc': ('https://ccdproc.readthedocs.io/en/stable/', None),
170-
'specutils': ('https://specutils.readthedocs.io/en/stable/', None),
171-
'gwcs': ('https://gwcs.readthedocs.io/en/stable/', None)
178+
"astropy": ("https://docs.astropy.org/en/stable/", None),
179+
"ccdproc": ("https://ccdproc.readthedocs.io/en/stable/", None),
180+
"specutils": ("https://specutils.readthedocs.io/en/stable/", None),
181+
"gwcs": ("https://gwcs.readthedocs.io/en/stable/", None),
172182
}
173183
)
174184
#

docs/contributing.rst

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
.. _contributors_guide:
2+
3+
Contributing
4+
============
5+
6+
As with all `Astropy <https://www.astropy.org>`_ coordinated packages, **Specreduce** is
7+
developed *by* the astrophysics community, *for* the astrophysics community. We warmly welcome
8+
contributions of all kinds, whether it’s sharing feedback, reporting bugs, suggesting new
9+
features, or improving code and documentation. Every contribution, big or small, helps make
10+
Specreduce more useful and reliable for everyone.
11+
12+
Specreduce follows the `Astropy development and contribution guidelines
13+
<https://docs.astropy.org/en/latest/index_dev.html>`_ and the
14+
`Astropy Community Code of Conduct <https://www.astropy.org/code_of_conduct.html>`_.
15+
By contributing, you agree to uphold these community standards, which help ensure that the
16+
project remains a welcoming and inclusive space for all contributors.
17+
18+
Getting Started
19+
---------------
20+
21+
If you’re new to open-source development or to the Astropy ecosystem, do not worry. The best place
22+
to start is by visiting the
23+
`Specreduce GitHub repository <https://github.com/astropy/specreduce>`_,
24+
where you can find current issues, pull requests, and the latest development activity.
25+
26+
Before you begin contributing code, you may want to:
27+
28+
* Read through the Astropy developer documentation linked above.
29+
* Explore the existing documentation and tutorials to get a sense of how Specreduce works.
30+
* Comment on an issue to let others know you’d like to work on it — or open a new issue to
31+
discuss an idea or feature you’d like to propose.
32+
33+
Roadmap
34+
-------
35+
36+
.. image::
37+
roadmap.png
38+
:align: center
39+
:width: 100%
40+
41+
Contribute feedback
42+
-------------------
43+
44+
The Specreduce team values feedback from all users. If something doesn’t work as expected,
45+
if you encounter a bug, or if you have an idea for an improvement, please let us know by opening
46+
a new issue on the
47+
`Specreduce GitHub issue tracker <https://github.com/astropy/specreduce/issues>`_.
48+
49+
For bug reports, please include:
50+
51+
* A short description of the problem.
52+
* The version of Specreduce and Python you are using.
53+
* A minimal example (if possible) that reproduces the issue.
54+
55+
For feature requests or usability feedback, describe your idea clearly and explain how it would
56+
improve the user experience. Even short notes are valuable and help guide development priorities.
57+
58+
59+
Contribute Code or Documentation
60+
--------------------------------
61+
62+
If you see an open issue you’d like to work on, or if you’ve spotted an error or missing detail
63+
in the documentation, you can submit your own improvements through GitHub.
64+
To get started:
65+
66+
1. Fork the Specreduce repository and create a new branch for your changes.
67+
2. Make your edits or additions, whether it’s a bug fix, a new feature, or a documentation update.
68+
3. Commit your changes with a clear message describing what you did.
69+
4. Open a pull request to the main repository.
70+
71+
Contribute Tutorials and Examples
72+
---------------------------------
73+
74+
Tutorials and worked examples are among the most valuable contributions. They help other users
75+
learn from real data and see how different tools fit together in practice.
76+
77+
While the main steps of spectroscopic reduction (for example, tracing, extraction, and wavelength
78+
calibration) are similar across most instruments, the best workflow can still depend on the
79+
setup and science goals. In the long term, we aim to build a library of example reduction recipes
80+
for different instruments that users can adapt for their own observations.
81+
82+
If you have a reduction example, a notebook, or a teaching resource that might help others,
83+
please share it, either by opening a pull request or by discussing it in an issue first.
84+
We’re happy to help with formatting and integration into the documentation.
85+
86+
Staying in Touch
87+
----------------
88+
89+
Development discussions happen mainly on GitHub, but you can also connect with the wider Astropy
90+
community through the `Astropy Discussion Forum <https://community.openastronomy.org/c/astropy/>`_,
91+
where you can ask questions, share ideas, and get advice from other developers and users.
92+
93+
Your contributions help make Specreduce and the Astropy ecosystem stronger and more sustainable.
94+
Whether you fix a typo, improve a function, or share a new example, you are helping build a tool
95+
that benefits the entire astrophysics community. Thank you for being part of it!
96+
97+
.. toctree::
98+
:maxdepth: 1
99+
:hidden:
100+
101+
process/index
102+
terms

0 commit comments

Comments
 (0)