From c424996143e95d4341d0d5137266d308ac68aa03 Mon Sep 17 00:00:00 2001 From: Cadair <1391051+Cadair@users.noreply.github.com> Date: Wed, 19 Aug 2026 16:57:43 +0000 Subject: [PATCH 1/8] Run cruft update from package template --- .cruft.json | 4 ++-- .pre-commit-config.yaml | 3 +++ .ruff.toml | 29 ++++++++++++++++++++++++++++- 3 files changed, 33 insertions(+), 3 deletions(-) diff --git a/.cruft.json b/.cruft.json index a57e5d42..9a593a1e 100644 --- a/.cruft.json +++ b/.cruft.json @@ -1,6 +1,6 @@ { "template": "https://github.com/sunpy/package-template", - "commit": "2a6434a5c749ecde69d00b937a3fef27ecbad656", + "commit": "c7bfa729646a7e17ae0e7c50c331e5c489f98fe2", "checkout": null, "context": { "cookiecutter": { @@ -36,7 +36,7 @@ ".github/workflows/zizmor.yml" ], "_template": "https://github.com/sunpy/package-template", - "_commit": "2a6434a5c749ecde69d00b937a3fef27ecbad656" + "_commit": "c7bfa729646a7e17ae0e7c50c331e5c489f98fe2" } }, "directory": null diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4313e7c7..142bed32 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -8,6 +8,7 @@ repos: types: [python] # Define here once and then reference using YAML anchor exclude: &exclude_dirs ^sunkit_spex/(data|extern)/ +<<<<<<< - id: ruff-format types: [python] exclude: *exclude_dirs @@ -17,6 +18,8 @@ repos: - id: isort types: [python] exclude: *exclude_dirs +======= +>>>>>>> - repo: https://github.com/pre-commit/pre-commit-hooks rev: v6.0.0 hooks: diff --git a/.ruff.toml b/.ruff.toml index 418fa32f..055674e7 100644 --- a/.ruff.toml +++ b/.ruff.toml @@ -16,6 +16,7 @@ select = [ "W", "UP", "PT", + "I", "BLE", "A", "C4", @@ -63,7 +64,8 @@ extend-ignore = [ "INP001", # File is part of an implicit namespace package. ] "docs/conf.py" = [ - "E402" # Module imports not at top of file + "E402", # Module imports not at top of file + "I", # isort ] "docs/*.py" = [ "INP001", # File is part of an implicit namespace package. @@ -77,6 +79,7 @@ extend-ignore = [ "F401", # Unused import "F403", # from {name} import * used; unable to detect undefined names "F405", # {name} may be undefined, or defined from star imports + "I", # isort ] "test_*.py" = [ "E402", # Module level import not at top of cell @@ -94,6 +97,30 @@ parametrize-names-type = "csv" [format] exclude = [ +<<<<<<< "sunkit_spex/_dev/scm_version.py", "docs/conf.py", ] +======= + +[lint.pydocstyle] +convention = "numpy" + +[lint.isort] +default-section = "third-party" +section-order = [ + "future", + "standard-library", + "third-party", + "astropy", + "sunpy", + "first-party", + "local-folder", +] +known-first-party = ["sunkit_spex"] +no-lines-before = ["local-folder"] + +[lint.isort.sections] +"astropy" = ["astropy", "asdf", "gwcs", "reproject"] +"sunpy" = ["sunpy"] +>>>>>>> From 3869b61f56a2e7724c89244674eaa5cdd2f1dde9 Mon Sep 17 00:00:00 2001 From: SunPyBot Date: Thu, 20 Aug 2026 06:53:34 +0000 Subject: [PATCH 2/8] Run cruft update from package template --- .cruft.json | 4 ++-- .pre-commit-config.yaml | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.cruft.json b/.cruft.json index 9a593a1e..89db9c2e 100644 --- a/.cruft.json +++ b/.cruft.json @@ -1,6 +1,6 @@ { "template": "https://github.com/sunpy/package-template", - "commit": "c7bfa729646a7e17ae0e7c50c331e5c489f98fe2", + "commit": "632ed04aee0058dd88dc6b7972ca8f8061fbd6da", "checkout": null, "context": { "cookiecutter": { @@ -36,7 +36,7 @@ ".github/workflows/zizmor.yml" ], "_template": "https://github.com/sunpy/package-template", - "_commit": "c7bfa729646a7e17ae0e7c50c331e5c489f98fe2" + "_commit": "632ed04aee0058dd88dc6b7972ca8f8061fbd6da" } }, "directory": null diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 142bed32..53a263d3 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -53,6 +53,12 @@ repos: args: [ "--write-changes" ] types_or: [python, rst] exclude: *exclude_dirs + - repo: https://github.com/sphinx-contrib/sphinx-lint + rev: v1.0.2 + hooks: + - id: sphinx-lint + types_or: [python, rst] + exclude: *exclude_dirs ci: autofix_prs: false autoupdate_schedule: "quarterly" From 01c177846836b270a9c2546c528fd268c7424225 Mon Sep 17 00:00:00 2001 From: Stuart Mumford Date: Thu, 20 Aug 2026 08:24:49 +0100 Subject: [PATCH 3/8] Update .pre-commit-config.yaml --- .pre-commit-config.yaml | 9 --------- 1 file changed, 9 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 53a263d3..107ca197 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -8,18 +8,9 @@ repos: types: [python] # Define here once and then reference using YAML anchor exclude: &exclude_dirs ^sunkit_spex/(data|extern)/ -<<<<<<< - id: ruff-format types: [python] exclude: *exclude_dirs - - repo: https://github.com/PyCQA/isort - rev: 9.0.0a3 - hooks: - - id: isort - types: [python] - exclude: *exclude_dirs -======= ->>>>>>> - repo: https://github.com/pre-commit/pre-commit-hooks rev: v6.0.0 hooks: From 8ff1a85a41502e2f16eade96ea03191d3ec3de59 Mon Sep 17 00:00:00 2001 From: Stuart Mumford Date: Thu, 20 Aug 2026 08:25:51 +0100 Subject: [PATCH 4/8] Update .ruff.toml --- .ruff.toml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.ruff.toml b/.ruff.toml index 055674e7..faf4f27b 100644 --- a/.ruff.toml +++ b/.ruff.toml @@ -97,11 +97,9 @@ parametrize-names-type = "csv" [format] exclude = [ -<<<<<<< "sunkit_spex/_dev/scm_version.py", "docs/conf.py", ] -======= [lint.pydocstyle] convention = "numpy" @@ -123,4 +121,3 @@ no-lines-before = ["local-folder"] [lint.isort.sections] "astropy" = ["astropy", "asdf", "gwcs", "reproject"] "sunpy" = ["sunpy"] ->>>>>>> From 6363da65c08b80a3611e6a7a63baba63bffb0f6b Mon Sep 17 00:00:00 2001 From: Shane Maloney Date: Thu, 20 Aug 2026 09:00:13 +0100 Subject: [PATCH 5/8] Remove duplicate pydocstyle entry. Remove duplicate pydocstyle entry --- .ruff.toml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.ruff.toml b/.ruff.toml index faf4f27b..902d0246 100644 --- a/.ruff.toml +++ b/.ruff.toml @@ -89,9 +89,6 @@ extend-ignore = [ "PT011", # `pytest.raises(ValueError)` is too broad ] -[lint.pydocstyle] -convention = "numpy" - [lint.flake8-pytest-style] parametrize-names-type = "csv" From 6c4ad7e5090f15c27a09c349dee00e81d04d2bb5 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 20 Aug 2026 08:02:43 +0000 Subject: [PATCH 6/8] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- sunkit_spex/spectrum/spectrum.py | 4 ++-- sunkit_spex/spectrum/tests/test_spectrum.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sunkit_spex/spectrum/spectrum.py b/sunkit_spex/spectrum/spectrum.py index 839ba710..2a1a5c5d 100644 --- a/sunkit_spex/spectrum/spectrum.py +++ b/sunkit_spex/spectrum/spectrum.py @@ -2,8 +2,6 @@ from copy import deepcopy import numpy as np -from gwcs import WCS as GWCS -from gwcs import coordinate_frames as cf from ndcube import NDCube import astropy.units as u @@ -12,6 +10,8 @@ from astropy.modeling.tabular import Tabular1D from astropy.utils import lazyproperty from astropy.wcs.wcsapi import sanitize_slices +from gwcs import WCS as GWCS +from gwcs import coordinate_frames as cf __all__ = ["SpectralAxis", "Spectrum", "gwcs_from_array"] diff --git a/sunkit_spex/spectrum/tests/test_spectrum.py b/sunkit_spex/spectrum/tests/test_spectrum.py index a5e76865..54b8b012 100644 --- a/sunkit_spex/spectrum/tests/test_spectrum.py +++ b/sunkit_spex/spectrum/tests/test_spectrum.py @@ -2,7 +2,6 @@ import numpy as np import pytest -from gwcs import coordinate_frames as cf from ndcube import NDCube from ndcube.extra_coords import QuantityTableCoordinate, TimeTableCoordinate from ndcube.wcs.wrappers import CompoundLowLevelWCS @@ -14,6 +13,7 @@ from astropy.tests.helper import assert_quantity_allclose from astropy.time import Time from astropy.wcs import WCS +from gwcs import coordinate_frames as cf from sunkit_spex.spectrum.spectrum import SpectralAxis, SpectralGWCS, Spectrum, gwcs_from_array From 9a364271a1e268f99e47a2c1c109b93d29999f17 Mon Sep 17 00:00:00 2001 From: Shane Maloney Date: Thu, 20 Aug 2026 09:28:06 +0100 Subject: [PATCH 7/8] Fix doc errors picked up by sphinx-lint --- CHANGELOG.rst | 4 ++-- docs/tutorials/installation.rst | 16 +++++++++------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 3e984a00..753fc75a 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -47,7 +47,7 @@ New Features - Allow automatic loading of the correct STIX SRM in `~sunkit_spex.extern.stix.STIXLoader` based on attenuation state within the selected time for spectral fitting. (`#193 `__) - Add two Astropy model classes, :class:`sunkit_spex.models.physical.nonthermal.ThickTarget` and :class:`sunkit_spex.models.physical.nonthermal.ThinTarget`. This provides the capability to fit using the Astropy fitting framework. (`#194 `__) - Add new two new Astropy model classes, :class:`sunkit_spex.models.scaling.DistanceScale` and :class:`sunkit_spex.models.scaling.Constant`. These classes can be used with physical models to scale the flux either by observer distance or by a constant multiplicative factor respectively. (`#195 `__) -- Adds functionality to enable class:`StraightLineModel` and class:`GaussianModel` to be evaluated at energy edges and return an output at energy centers. (`#202 `__) +- Adds functionality to enable :class:`StraightLineModel` and :class:`GaussianModel` to be evaluated at energy edges and return an output at energy centers. (`#202 `__) - Add the possibility to perform albedo correction within the legacy code. The alebdo matrix is generated with :func:`sunkit_spex.legacy.fitting.albedo.get_albedo_matrix` and the albedo correction is performed in :class:`sunkit_spex.legacy.fitting.fitter.Fitter`. (`#206 `__) - Adds an example notebook for fitting a single STIX spectrum and a joint fit with STIX imaging and background detectors when an attenuator is used. (`#217 `__) - Add a new `sunkit_spex.spectrum.spectrum.Spectrum` object to hold spectral data. `~sunkit_spex.spectrum.spectrum.Spectrum` is based on `NDCube` and butils on it coordinate aware methods and metadata handling. (`#239 `__) @@ -68,7 +68,7 @@ Bug Fixes - Fixes fitting by removing input_unit_equivalencies from thermal classes, class:ThermalEmission , class:ContinuumEmission and class:LineEmission . This allows compound emission to function. (`#210 `__) - Fix bug introduced in refactoring of `~sunkit_spex.models.physical.albedo.Albedo` model. Internally the angle theta given in degrees wasn't converted to radians before use. (`#212 `__) -- Fixes bug in count_rate calculation in class:`StraightLineModel`. We now calculate the mean of count rates for a given time range rather than the sum. (`#214 `__) +- Fixes bug in count_rate calculation in :class:`StraightLineModel`. We now calculate the mean of count rates for a given time range rather than the sum. (`#214 `__) - Ensure that the module-level abundance tables don't change in the legacy and release thermal modules. (`#231 `__) - Fix time selection bugs in `~sunkit_spex.extern.stix.STIXLoader` (`#241 `__) diff --git a/docs/tutorials/installation.rst b/docs/tutorials/installation.rst index 223d5fcc..8818c623 100644 --- a/docs/tutorials/installation.rst +++ b/docs/tutorials/installation.rst @@ -6,27 +6,29 @@ Installing sunkit-spex Installing the development version ---------------------------------- -Sunkit-spex is still under development, and no stable version has been released. However, users can install the the development version. +Sunkit-spex is still under development, and no stable version has been released. However, users can install the development version. Detailed instructions for setting up a development environment, as well as a discussion on how to contribute code to any SunPy package, can be found in the `Developer's Guide `__. We highly encourage users to read this, especially if considering contributing to sunkit-spex (which we welcome enthusiastically!) For brevity though, the key installation steps are as follows. First, open a terminal and navigate to the directory where you want the sunkit-spex repo to live on your computer. -Then, clone the sunkit-spex repo: +Then, clone the sunkit-spex repository: .. code-block:: console - $ git clone https://github.com/sunpy/sunkit-spex.git + $ git clone https://github.com/sunpy/sunkit-spex.git -Change into the sunkit-spex repo, then install sunkit-spex: +Change into the sunkit-spex repository, then install sunkit-spex: .. code-block:: console - $ cd sunkit-spex - $ pip install -e . + $ cd sunkit-spex + $ pip install -e . or to install the legacy dependencies - $ pip install -e .[legacy] +.. code-block:: console + + $ pip install -e .[legacy] This will install the development version of sunkit-spex. Please see the :ref:`sunpy-tutorial-installing` guide. From 94d83e4509f2a6bb520c1970c97b5306edec4078 Mon Sep 17 00:00:00 2001 From: Shane Maloney Date: Thu, 20 Aug 2026 09:39:12 +0100 Subject: [PATCH 8/8] Update install guide --- changelog/307.doc.rst | 1 + docs/tutorials/installation.rst | 15 +++++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 changelog/307.doc.rst diff --git a/changelog/307.doc.rst b/changelog/307.doc.rst new file mode 100644 index 00000000..f5131bb7 --- /dev/null +++ b/changelog/307.doc.rst @@ -0,0 +1 @@ +Add instructions for installing the latest stable release from PyPI to the :ref:`installation` guide. \ No newline at end of file diff --git a/docs/tutorials/installation.rst b/docs/tutorials/installation.rst index 8818c623..7552dff4 100644 --- a/docs/tutorials/installation.rst +++ b/docs/tutorials/installation.rst @@ -4,6 +4,21 @@ Installing sunkit-spex ********************** +Installing the latest stable release +------------------------------------- +The latest stable release of sunkit-spex can be installed from PyPI using pip: + +.. code-block:: console + + $ pip install sunkit-spex + +This will install the latest stable release of sunkit-spex and its required dependencies. +To additionally install the legacy dependencies, use: + +.. code-block:: console + + $ pip install sunkit-spex[legacy] + Installing the development version ---------------------------------- Sunkit-spex is still under development, and no stable version has been released. However, users can install the development version.