Skip to content

Conversation

@hpparvi
Copy link
Contributor

@hpparvi hpparvi commented Jun 25, 2025

This PR modernizes the documentation by adopting sphinx_astropy.conf.v2 with the pydata-sphinx-theme. It also updates and reorganizes several existing sections and introduces new documentation covering 1D wavelength calibration.

@codecov
Copy link

codecov bot commented Jun 25, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.57%. Comparing base (5a58333) to head (3e0af09).
⚠️ Report is 43 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #275      +/-   ##
==========================================
+ Coverage   89.52%   89.57%   +0.04%     
==========================================
  Files          17       17              
  Lines        1795     1803       +8     
==========================================
+ Hits         1607     1615       +8     
  Misses        188      188              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@tepickering
Copy link
Contributor

not sure if it fits in this PR or a future one, but we have a lot of example docs implemented within docstrings in various parts of the code (i am one of the guilty parties). as part of a fuller refactor, we should decide whether to leave that as-is, migrate it to specific .rst files, or refactor all examples into notebooks or something notebook-based. i think the last option is the most useful going forward, but the most work up-front.

@hpparvi hpparvi force-pushed the documentation_facelift branch from 7ee2d16 to c7344e7 Compare October 21, 2025 21:25
@hpparvi hpparvi marked this pull request as ready for review October 28, 2025 20:13
@hpparvi
Copy link
Contributor Author

hpparvi commented Oct 28, 2025

The documentation update is coming together! Please take a look at the rendered docs at
https://specreduce--275.org.readthedocs.build/en/275/index.html and let me know your thoughts.

No need to worry about the large number of commits and changed files. This PR builds on the 1D wavelength calibration PR, which should be merged first.

hpparvi and others added 20 commits November 15, 2025 19:42
- Added `sphinx-copybutton` and `sphinx-design` to documentation dependencies in `pyproject.toml`.
- Improved content structure by renaming and reorganizing documentation files.
- Expanded "Contributing" and "Index" sections.
…action examples; updated `conf.py` with formatting adjustments and extended Sphinx documentation settings.
- Corrected typos and clarified text.
- Renamed `common.py` to `quickstart.py`.
- Updated function and variable names for consistency.
- Streamlined background subtraction and wavelength calibration workflows.
@hpparvi hpparvi force-pushed the documentation_facelift branch from c6a96b5 to d4d0c76 Compare November 15, 2025 18:43
* `Background.one_sided <specreduce.background.Background.one_sided>`
* `Background.two_sided <specreduce.background.Background.two_sided>`

The center of the window can either be passed as a float/integer or as a trace
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

specify that trace is a ~specreduce.tracing.Trace

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.


The `specreduce.background` module generates and subtracts a background image from
the input 2D spectral image. The `~specreduce.background.Background` object is
defined by one or more windows, and can be generated with:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you clarify what 'windows' means in this context (maybe using trace, separation and width in the description)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

3. Commit your changes with a clear message describing what you did.
4. Open a pull request to the main repository.

.. If you’re unsure how to start, you can look for issues labeled
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

uncomment this section

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I decided to remove it completely for now. I still need to organise the issue labels better.


Example Workflow
================
'n_bins_interpolated_profile': 20)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing closing brace

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great catch! Fixed.

from specreduce.background import Background
from specreduce.extract import BoxcarExtract
interp_profile_extraction = extract(spatial_profile={'name': 'interpolated_profile',
'interp_degree_interpolated_profile': 3)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing closing brace

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is why my personal style is to put one parameter per line and indent. helps make it clearer what ) or } belongs to what ( or { and when one is missing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True. These two examples are now formatted more neatly.

docs/index.rst Outdated
**Contributor's Guide**
^^^^^^^^^^^^^^^^^^^^^^^

Want to contribute to specreduce? Found a bug? The contributing guidelines will
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

capitalize 'specreduce'

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

docs/index.rst Outdated
process/index
terms

.. * :ref:`genindex`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

uncomment/remove

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed.

@@ -0,0 +1,166 @@
Tracing
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this need a reference at the top as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

docs/trace.rst Outdated
the 2D spectral image as input, along with trace-specific parameters that control how the trace
is determined.

Flat trace
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FlatTrace, for consistency with other section headings

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

docs/trace.rst Outdated

.. code-block:: python
trace = specreduce.tracing.ArrayTrace(image, positions)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you define positions in a line of code, or explain what it is above

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I modified the text a bit to make it clear.

Copy link
Contributor

@tepickering tepickering left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me! i mostly agree with the comments @cshanahan1 left and added a few more, but think they're all pretty minor. the new style looks SOOO much better! there's some more work to do to better organize some parts, but this sets up a much better, more usable foundation for that.

from specreduce.background import Background
from specreduce.extract import BoxcarExtract
interp_profile_extraction = extract(spatial_profile={'name': 'interpolated_profile',
'interp_degree_interpolated_profile': 3)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is why my personal style is to put one parameter per line and indent. helps make it clearer what ) or } belongs to what ( or { and when one is missing.

conda install conda-forge::specreduce
or by cloning the repository from `GitHub <https://github.com/astropy/specreduce>`_
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is cloning from the repo something we want normal users to do? my feeling is that's more for a developer install.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like to remind users that this is an option. It's useful to have it clearly documented for anyone who wants to have the option to examine the code if something doesn't work as expected or as they'd like.

from specreduce.utils.synth_data import make_2d_arc_image, make_2d_trace_image


def make_2d_spec_image(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a reason this function was lifted from synth_data and not just updated there?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The main reason for this was to make minor modifications to the mock spectrum without altering how the original function in synth_data works (this would've been more work, and I didn't feel this sort of change belonged in a documentation update PR).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's fair. i like the addition of the ability to add an airglow spectrum. i'll have a think about how to make the synth data utilities more easily composable.

@hpparvi
Copy link
Contributor Author

hpparvi commented Nov 19, 2025

Thanks @cshanahan1 and @tepickering! The PR is now merged :)

@hpparvi hpparvi merged commit e634aee into astropy:main Nov 19, 2025
12 checks passed
hpparvi added a commit to hpparvi/astropy-project that referenced this pull request Nov 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants