From 018c8140a4e0b14bdb07f9d95117a3c580051806 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 4 Jun 2026 16:53:35 +0100 Subject: [PATCH 1/8] Updates from the package template (#221) * Automatic package template update * Fix conflicts Co-authored-by: Shane Maloney --- .coveragerc | 2 ++ .cruft.json | 4 ++-- .github/dependabot.yml | 4 ++++ .github/workflows/sub_package_update.yml | 2 +- .pre-commit-config.yaml | 4 ++-- MANIFEST.in | 15 ++++++++++++--- 6 files changed, 23 insertions(+), 8 deletions(-) diff --git a/.coveragerc b/.coveragerc index 25f05266..0dcd9dab 100644 --- a/.coveragerc +++ b/.coveragerc @@ -4,6 +4,8 @@ omit = stixpy/*setup_package* stixpy/extern/* stixpy/version* + stixpy/_dev/* + */stixpy/_dev/* */stixpy/conftest.py */stixpy/*setup_package* */stixpy/extern/* diff --git a/.cruft.json b/.cruft.json index 66b76d56..09a6b14b 100644 --- a/.cruft.json +++ b/.cruft.json @@ -1,6 +1,6 @@ { "template": "https://github.com/sunpy/package-template", - "commit": "6436220cebd96b3638682023e7149eb78e012fdc", + "commit": "cc15a3492324a0415ea444c5f52b1913323ad3ba", "checkout": null, "context": { "cookiecutter": { @@ -33,7 +33,7 @@ ".github/workflows/sub_package_update.yml" ], "_template": "https://github.com/sunpy/package-template", - "_commit": "6436220cebd96b3638682023e7149eb78e012fdc" + "_commit": "cc15a3492324a0415ea444c5f52b1913323ad3ba" } }, "directory": null diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 177b067f..e8eb01ec 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -6,3 +6,7 @@ updates: interval: "monthly" cooldown: default-days: 7 + groups: + actions: + patterns: + - "*" diff --git a/.github/workflows/sub_package_update.yml b/.github/workflows/sub_package_update.yml index 74d158a1..bfb213a8 100644 --- a/.github/workflows/sub_package_update.yml +++ b/.github/workflows/sub_package_update.yml @@ -104,7 +104,7 @@ jobs: issues: write steps: - name: Open an issue if workflow fails - uses: actions/github-script@v8 # zizmor: ignore[unpinned-uses] + uses: actions/github-script@v9 # zizmor: ignore[unpinned-uses] with: github-token: ${{ github.token }} # This script is adapted from https://github.com/scientific-python/issue-from-pytest-log-action diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 442f44f1..69c21df6 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,11 +1,11 @@ repos: - repo: https://github.com/zizmorcore/zizmor-pre-commit - rev: v1.23.1 + rev: v1.24.1 hooks: - id: zizmor # This should be before any formatting hooks like isort - repo: https://github.com/astral-sh/ruff-pre-commit - rev: "v0.15.9" + rev: "v0.15.12" hooks: - id: ruff-check args: ["--fix"] diff --git a/MANIFEST.in b/MANIFEST.in index 6978217f..6211b14e 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,11 +1,20 @@ # Exclude specific files # All files which are tracked by git and not explicitly excluded here are included by setuptools_scm +exclude .codecov.yaml +exclude .coveragerc +exclude .cruft.json +exclude .gitignore +exclude .isort.cfg +exclude .pre-commit-config.yaml +exclude .readthedocs.yaml +exclude .rtd-environment.yml +exclude .ruff.toml + # Prune folders +prune .github prune build -prune docs/_build -prune docs/api +prune changelog global-exclude *.pyc *.o - # This subpackage is only used in development checkouts # and should not be included in built tarballs prune stixpy/_dev From c813f168faa77e02c2a21042d4616ea1745d01f8 Mon Sep 17 00:00:00 2001 From: Shane Maloney Date: Fri, 5 Jun 2026 13:37:27 +0100 Subject: [PATCH 2/8] Prepare for 0.3.0 release (#228) * Render Change log for v0.3.0 * Add citation file, update mailmap and zenodo --- .mailmap | 4 + .zenodo.json | 31 ++++--- CHANGELOG.rst | 158 +++++++++++++++++++++++++++++++++ CITATION.cff | 71 +++++++++++++++ CITATION.rst | 1 + README.rst | 12 ++- changelog/177.trivial.rst | 1 - changelog/196.breaking.rst | 1 - changelog/196.feature.rst | 4 - changelog/196.removal.rst | 1 - changelog/209.bugfix.rst | 1 - changelog/212.breaking.rst | 6 -- changelog/216.bugfix.rst | 1 - changelog/219.trivial.rst | 1 - docs/citation.rst | 1 + docs/index.rst | 1 + docs/whatsnew/0.1.2.rst | 41 --------- docs/whatsnew/0.1.3.rst | 8 -- docs/whatsnew/index.rst | 3 - stixpy/CITATION.rst | 78 ++++++++++++++++ stixpy/__init__.py | 31 ++++++- stixpy/timeseries/quicklook.py | 3 +- 22 files changed, 377 insertions(+), 82 deletions(-) create mode 100644 CITATION.cff create mode 100644 CITATION.rst delete mode 100644 changelog/177.trivial.rst delete mode 100644 changelog/196.breaking.rst delete mode 100644 changelog/196.feature.rst delete mode 100644 changelog/196.removal.rst delete mode 100644 changelog/209.bugfix.rst delete mode 100644 changelog/212.breaking.rst delete mode 100644 changelog/216.bugfix.rst delete mode 100644 changelog/219.trivial.rst create mode 100644 docs/citation.rst delete mode 100644 docs/whatsnew/0.1.2.rst delete mode 100644 docs/whatsnew/0.1.3.rst create mode 100644 stixpy/CITATION.rst diff --git a/.mailmap b/.mailmap index 6d431ddc..b8d05314 100644 --- a/.mailmap +++ b/.mailmap @@ -4,3 +4,7 @@ Shane Maloney Shane Maloney Laura Hayes hayesla Daniel F. Ryan Dan Ryan Daniel F. Ryan DanRyanIrish +Thomas Long tlong491 +Hannah Collier Hannah Collier <76849369+hannahc243@users.noreply.github.com> +Hannah Collier <76849369+hannahc243@users.noreply.github.com> hannahc243 <76849369+hannahc243@users.noreply.github.com> +Rachel Hubbard rh2082 diff --git a/.zenodo.json b/.zenodo.json index ff23980c..9197832b 100644 --- a/.zenodo.json +++ b/.zenodo.json @@ -24,6 +24,11 @@ "orcid": "0000-0001-8661-3825", "affiliation": "University College London, Mullard Space Science Laboratory (UCL/MSSL)" }, + { + "name": "Nicky Hochmuth", + "orcid": "", + "affiliation": "Ateleris>" + }, { "name": "Paolo Massa", "orcid": "0000-0002-0993-1974", @@ -31,24 +36,30 @@ }, { "name": "Alasdair Wilson", - "orcid": "", - "affiliation": "" + "orcid": "0000-0003-0820-8159", + "affiliation": "Oxford Research Software Engineering Team, University of Oxford" }, { - "name": "Nicky Hochmuth", - "orcid": "", - "affiliation": "" + "name": "Hannah Collier", + "orcid": "0000-0001-5592-8023", + "affiliation": "University of Applied Sciences and Arts Northwestern Switzerland (FHNW)" + }, + { + "name": "MHerrmann06" + }, + { + "name": "Mashhoor Ahdal" + }, + { + "name": "Rachel Hubbard", + "orcid": "0009-0003-8548-5691", + "affiliation": "University College London, Mullard Space Science Laboratory (UCL/MSSL)" }, { "name": "Steven Christe", "orcid": "0000-0001-6127-795X", "affiliation": "NASA Goddard Space Flight Center" }, - { - "name": "Hannah Collier", - "orcid": "0000-0001-5592-8023", - "affiliation": "University of Applied Sciences and Arts Northwestern Switzerland (FHNW)" - }, { "name": "Thomas Long", "orcid": "", diff --git a/CHANGELOG.rst b/CHANGELOG.rst index e69de29b..5e0831ca 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -0,0 +1,158 @@ +0.3.0 (2026-06-05) +================== + +Breaking Changes +---------------- + +- The `~stixpy.product.sources.science.ScienceData` method :meth:`~stixpy.product.sources.science.ScienceData.get_data` is now keyword only. (`#196 `__) +- Increased minimum versions for these dependencies: + + - Python >= 3.12 + - astropy >= 6.1.0 + - matplotlib >= 3.8.0 + - sunpy >= 7.0 + - xrayvisim >= 0.2.1 (`#212 `__) + + +Removals +-------- + +- Remove deprecated ``stixpy.science`` module use `stixpy.product.Product` instead. (`#196 `__) + + +New Features +------------ + +- Add ability to control the data normalisation to `~stixpy.product.sources.science.ScienceData.get_data` via the `vtype` keyword: + + - 'c' - count [c] + - 'cr' - count rate [c/s] + - 'dcr' - differential count rate [c/(s keV)] (`#196 `__) + + +Bug Fixes +--------- + +- Fixed version attributes not being exported in stixpy.net.attrs module. All version attributes (Version, VersionU, MinVersion, MinVersionU, MaxVersion, MaxVersionU) are now properly included in the module's ``__all__`` list and can be imported directly from ``stixpy.net.attrs``. (`#209 `__) +- Fix :ref:`sphx_glr_generated_gallery_imaging_demo.py` to correctly use center of STIX field of view for initial grid correction and flare position estimation. (`#216 `__) + + +Internal Changes +---------------- + +- Update `~stixpy.net.client.STIXClient` Fido client to use format keyword and ``parse`` syntax, internal changes only. (`#177 `__) +- Update package with sunpy template and enable updates. (`#219 `__) + + +Stixpy 0.2.1 (2026-03-10) +========================= + +Bug Fixes +--------- + +- Update sunpy dependency to <7.0 as code not updated for new Fido client API. (`#211 `__) + + +Stixpy 0.2.0 (2026-01-18) +========================= + +Backwards Incompatible Changes +------------------------------ + +- Update minimum dependencies of Python 3.11 and sunpy to 6.0.0 inline with `SPEC 0 `_. (`#174 `__) + + +Features +-------- + +- Update `Fido` client to optionally take root path or url. Also add attributes to enable searching for specific versions for example latest version available. (`#143 `__) +- Enable `stixpy.calibration.visibility.create_meta_pixels` to include only top or bottom row of big pixels. (`#148 `__) +- Update `Fido` client for change in aspect/ephemeris file name and path. (`#153 `__) +- Add the pixel area normalisation from `~stixpy.calibration.visibility.create_meta_pixels` to dictionary returned. (`#162 `__) +- Add new timeseries source for STIX ANC aspect data `~stixpy.timeseries.anc.ANCAspect`. (`#169 `__) +- Add a instrument configuration constant `~stixpy.config.instrument.STIX_INSTRUMENT` to bundle instrument constants like grid configurations, pixel sizes .... (`#171 `__) +- Update imaging demo to use Sun center as location for making initial full disk back projection to determine flare location. (`#173 `__) +- Add enhanced pixel plot ~`stixpy.product.sources.science.PixelPlotMixin` improved layout now shows detector quadrant and labels. Pixel plots now support three options a normal bar plot an error bar plot and configuration plot. (`#178 `__) +- Created new `stixpy.visualisation.plotters.PixelPlotter` class to create pixel plots by moving and refactored code from current mixin so current API is maintained. This new approach simplifies the `~stixpy.product.sources.science` module and programmatic access to the plot controls enabling animations. (`#181 `__) + + +Bug Fixes +--------- + +- Fixed a bug in stixpy.calibration.visibility.create_meta_pixels to correctly determine which time bins to include in the sum based on their overlap with the specified time range. (`#138 `__) +- Fix bug in orientation of grids for internal shadowing. (`#146 `__) +- Fix bug where pointing information could be improperly interpolated in `~stixpy.coordinates.transforms.get_hpc_info`. (`#152 `__) +- Fix typo in `~stixpy.calibration.visibility.create_meta_pixels` which cased error if grid shadow correction was enabled. Also update grid calculations to use `Skycoord` objects. (`#156 `__) +- Fix error in `~stixpy.net.client.StixQueryResponse.filter_for_latest_version` if the result table was empty. (`#160 `__) +- Fix bug in STIX Fido client which caused data that spanned midnight to be missed. (`#176 `__) +- Fix apparent bug in `~stixpy.calibration.visibility.create_meta_pixels` by improving naming and docstrings. (`#194 `__) +- Fix incomplete conversion of `~stixpy.calibration.visibility.calibrate_visibility` to use `~astropy.coordinates.SkyCoord`. (`#194 `__) +- Fix ELUT reader `~stixpy.io.readers.read_elut` for column name change in upstream files. (`#194 `__) +- Restore mistakenly dropped updateds to the energies used in `~stixpy.calibration.transmission.generate_transmission_tables`.: (`#197 `__) +- Fix bug in `~stixpy.product.sources.science.ScienceData.get_data` when specifying `pixel_indices` with data containing less than 12 pixels. (`#200 `__) + + +Improved Documentation +---------------------- + +- Convert reconstructions to proper sunpy maps in ref`:ref:`sphx_glr_generated_gallery_imaging_demo.py`. (`#141 `__) +- Added instructions for initializing and updating git submodules and fixed broken links. (`#157 `__) + + +Trivial/Internal Changes +------------------------ + +- Update project configuration move to `project.toml` and individual config files for each tool (isort, ruff, pytest, etc) and add zenodo config file and mailmap. (`#158 `__) + + +Stixpy 0.1.2 (2024-07-16) +================================================== + +Features +-------- + +- Add a custom coordinate frame :class:`stixpy.coordinate.frames.STIXImaging` and the associated transformations (`~stixpy.coordinates.transforms.stixim_to_hpc`, `~stixpy.coordinates.transforms.hpc_to_stixim`) to and from `~sunpy.coordinates.frames.Helioprojective`. + Also add a `stixpy.map.stix.STIXMap` for `~sunpy.map.Map` source which properly displays the :class:`stixpy.coordinate.frames.STIXImaging` coordinate frame. (`#90 `__) +- Merged `stixpy.calibration.get_visibility_info_giordano` and `stixpy.calibration.get_visibility_info` into `stixpy.calibration.get_uv_points_data` and removed `stixpy.calibration.correct_phase_projection`. (`#98 `__) +- Update livetime correction parameter `eta`, `tau` and add code to calculate pileup 'beta' :func:`stixpy.calibration.livetime.pileup_correction_factor`. (`#100 `__) +- Add background subtraction step to imaging demo, update `EnergyEdgeMasks`. (`#106 `__) +- Update imaging demo to use images and construct `~sunpy.map.Map` using `~stixpy.coordinates.frames.STIXImaging` and `~sunpy.map.header_helper.make_fitswcs_header`. (`#107 `__) +- Update :func:`~stixpy.coordinates.transforms.get_hpc_info` to use mean or interpolate pointing and location data based on number of data points in given timerange. Add function cache for aux data frequenly needed during coordinate transforms. (`#111 `__) +- Make the imaging demo compatible with :class:`~xrayvision.visibility.Visibilities` (`#123 `__) +- Update code and examples to use new :class:`~xrayvision.visibility.Visibilities`, tidy API of `~stixpy.imaging.em.em`. (`#124 `__) +- Add missing QL products `~stixpy.product.sources.quicklook.QLVariance`, `~stixpy.product.sources.quicklook.QLFlareFlag`, and `~stixpy.product.sources.quicklook.QLTMStatusFlareList` to Product. Also added some useful properties to the for status words. (`#125 `__) + + +Bug Fixes +--------- + +- Fix ELUT correction when the requested data has less then than 32 energy channels. (`#106 `__) +- Update `~stixpy.calibration.energy.get_elut` to use correct science energy channels for given date. (`#107 `__) +- Fix a bug where the incorrect unit was set on :class:`~stixpy.timeseries.quicklook.QLLightCurve`, :class:`~stixpy.timeseries.quicklook.QLBackground` and :class:`~stixpy.timeseries.quicklook.QLVariance`. (`#118 `__) +- Fix bug where coordinate transforms did not support arrays of coordinates or times. To so support both integrated (e.g. images) and instantaneous (e.g. coarse flare flag) a new property `obstime_end` was added to `~stixpy.coordinates.frames.STIXImaging` when set if possible mean pointing and position information are use for transformations other wise they are interpolated between the two nearest data points. (`#128 `__) +- Fix typo in `~stixpy.product.sources.science.ScienceData` 'durtaion' -> 'duration'. (`#132 `__) +- Fix some inconsistencies on the data units in plots, also return handle to the image from `~stixpy.product.sources.science.SpectrogramPlotMixin.plot_spectrogram`. (`#134 `__) + + +Improved Documentation +---------------------- + +- Update README, fix graphviz RTD configuration, configure theme logo text. (`#89 `__) +- Correct calculation of the HPC coordinate of the center of the STIX pointing in the imaging demo. (`#112 `__) +- Update imaging demo for latest changes in `xrayvision `_. (`#115 `__) + + +Trivial/Internal Changes +------------------------ + +- Format code with ruff and turn on ruff format in pre-commit. (`#116 `__) + + +Stixpy 0.1.3 (2024-07-16) +================================================== + +Bug Fixes +--------- + +- Fix some inconsistencies on the data units in plots, also return handle to the image from `~stixpy.product.sources.science.SpectrogramPlotMixin.plot_spectrogram`. (`#134 `__) +- Fix bug reintroduce by last fix in `~stixpy.imaging.em.em`, update code in `~stixpy.calibration.visibility.calibrate_visibility` and imaging demo to use Tx, Ty rather than Ty, Tx as before. (`#137 `__) diff --git a/CITATION.cff b/CITATION.cff new file mode 100644 index 00000000..e020b82c --- /dev/null +++ b/CITATION.cff @@ -0,0 +1,71 @@ +cff-version: 1.2.0 +message: >- + If you use this software, please cite it using the + metadata from this file. + +# Project information +title: STIXpy +abstract: >- + An open-source Python analysis library for the Spectrometer + Telescope for Imaging X-rays (STIX) instrument on Solar Orbiter. +authors: + - family-names: Maloney + given-names: Shane + orcid: https://orcid.org/0000-0002-4715-1805 + affiliation: Dublin Institute for Advanced Studies + - family-names: Clarke + given-names: Brendan + affiliation: >- + Trinity College Dublin / Dublin Institute for Advanced Studies + - family-names: Hayes + given-names: Laura + orcid: https://orcid.org/0000-0002-6835-2390 + affiliation: Dublin Institute for Advanced Studies + - family-names: Ryan + given-names: Daniel F. + orcid: https://orcid.org/0000-0001-8661-3825 + affiliation: >- + University College London, Mullard Space Science Laboratory + (UCL/MSSL) + - family-names: Massa + given-names: Paolo + orcid: https://orcid.org/0000-0002-0993-1974 + affiliation: >- + University of Applied Sciences and Arts Northwestern Switzerland + (FHNW) + - family-names: Wilson + given-names: Alasdair + - family-names: Hochmuth + given-names: Nicky + - family-names: Christe + given-names: Steven + orcid: https://orcid.org/0000-0001-6127-795X + affiliation: NASA Goddard Space Flight Center + - family-names: Collier + given-names: Hannah + orcid: https://orcid.org/0000-0001-5592-8023 + affiliation: >- + University of Applied Sciences and Arts Northwestern Switzerland + (FHNW) + - family-names: Long + given-names: Thomas + +repository-code: https://github.com/TCDSolar/stixpy +url: https://stixpy.readthedocs.io +license: BSD-3-Clause + +identifiers: + - type: doi + description: Zenodo concept DOI (all versions) + value: "10.5281/zenodo.8086101" + - type: url + description: PyPI package + value: https://pypi.org/project/stixpy/ + +keywords: + - solar physics + - x-ray astronomy + - Solar Orbiter + - STIX + - Python + - astronomy diff --git a/CITATION.rst b/CITATION.rst new file mode 100644 index 00000000..f2c3bfac --- /dev/null +++ b/CITATION.rst @@ -0,0 +1 @@ +stixpy/CITATION.rst diff --git a/README.rst b/README.rst index ceaf36ba..c503e15d 100644 --- a/README.rst +++ b/README.rst @@ -1,7 +1,7 @@ ``STIXpy`` ========== -|Powered By| |Build Status| |Doc Status| |Python Versions| +|Powered By| |Build Status| |Doc Status| |Python Versions| |Zenodo| .. |Powered By| image:: https://img.shields.io/badge/powered%20by-SunPy-orange.svg?style=flat :target: http://www.sunpy.org @@ -19,6 +19,10 @@ :target: https://pypi.python.org/pypi/stixpy :alt: Python Versions +.. |Zenodo| image:: https://zenodo.org/badge/DOI/10.5281/zenodo.8086101.svg + :target: https://doi.org/10.5281/zenodo.8086101 + :alt: DOI:10.5281/zenodo.8086101 + An open-source Python analysis library for the Spectrometer Telescope for Imaging X-rays (STIX) instrument on Solar Obriter. Installation @@ -41,6 +45,12 @@ We expect authentic engagement in our community. If you use generative AI tools as an aid in developing code or documentation changes, ensure that you fully understand the proposed changes and can explain why they are the correct approach and an improvement to the current state. For more information see our documentation on fair and appropriate `AI usage `__. +Acknowledging or Citing ``STIXpy`` +---------------------------------- + +If you use ``STIXpy`` in your scientific work, we would appreciate your `citing it in your publications `__. +The continued growth and development of ``STIXPy`` is dependent on the community being aware of ``STIXpy``. + Contributing ------------ diff --git a/changelog/177.trivial.rst b/changelog/177.trivial.rst deleted file mode 100644 index 0dd7698d..00000000 --- a/changelog/177.trivial.rst +++ /dev/null @@ -1 +0,0 @@ -Update `~stixpy.net.client.STIXClient` Fido client to use format keyword and ``parse`` syntax, internal changes only. diff --git a/changelog/196.breaking.rst b/changelog/196.breaking.rst deleted file mode 100644 index 69b27f84..00000000 --- a/changelog/196.breaking.rst +++ /dev/null @@ -1 +0,0 @@ -The `~stixpy.product.sources.science.ScienceData` method :meth:`~stixpy.product.sources.science.ScienceData.get_data` is now keyword only. diff --git a/changelog/196.feature.rst b/changelog/196.feature.rst deleted file mode 100644 index 9bd7c7e5..00000000 --- a/changelog/196.feature.rst +++ /dev/null @@ -1,4 +0,0 @@ -Add ability to control the data normalisation to `~stixpy.product.sources.science.ScienceData.get_data` via the `vtype` keyword: - * 'c' - count [c] - * 'cr' - count rate [c/s] - * 'dcr' - differential count rate [c/(s keV)] diff --git a/changelog/196.removal.rst b/changelog/196.removal.rst deleted file mode 100644 index e815de52..00000000 --- a/changelog/196.removal.rst +++ /dev/null @@ -1 +0,0 @@ -Remove deprecated ``stixpy.science`` module use `stixpy.product.Product` instead. diff --git a/changelog/209.bugfix.rst b/changelog/209.bugfix.rst deleted file mode 100644 index d919a201..00000000 --- a/changelog/209.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Fixed version attributes not being exported in stixpy.net.attrs module. All version attributes (Version, VersionU, MinVersion, MinVersionU, MaxVersion, MaxVersionU) are now properly included in the module's ``__all__`` list and can be imported directly from ``stixpy.net.attrs``. diff --git a/changelog/212.breaking.rst b/changelog/212.breaking.rst deleted file mode 100644 index 0276f73f..00000000 --- a/changelog/212.breaking.rst +++ /dev/null @@ -1,6 +0,0 @@ -Increased minimum versions for these dependencies: -* Python >= 3.12 -* astropy >= 6.1.0 -* matplotlib >= 3.8.0 -* sunpy >= 7.0 -* xrayvisim >= 0.2.1 diff --git a/changelog/216.bugfix.rst b/changelog/216.bugfix.rst deleted file mode 100644 index a7a85016..00000000 --- a/changelog/216.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Fix :ref:`sphx_glr_generated_gallery_imaging_demo.py` to correctly use center of STIX field of view for initial grid correction and flare position estimation. diff --git a/changelog/219.trivial.rst b/changelog/219.trivial.rst deleted file mode 100644 index 5e9613a1..00000000 --- a/changelog/219.trivial.rst +++ /dev/null @@ -1 +0,0 @@ -Update package with sunpy template and enable updates. diff --git a/docs/citation.rst b/docs/citation.rst new file mode 100644 index 00000000..bcdc542e --- /dev/null +++ b/docs/citation.rst @@ -0,0 +1 @@ +.. include:: ../stixpy/CITATION.rst diff --git a/docs/index.rst b/docs/index.rst index 6b7271a6..8decd45a 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -55,6 +55,7 @@ The documentation is broken down into four keys areas. .. toctree:: :maxdepth: 1 + citation Indices and tables ================== diff --git a/docs/whatsnew/0.1.2.rst b/docs/whatsnew/0.1.2.rst deleted file mode 100644 index 7dc7da63..00000000 --- a/docs/whatsnew/0.1.2.rst +++ /dev/null @@ -1,41 +0,0 @@ -Stixpy 0.1.2 (2024-07-16) -================================================== - -Features --------- - -- Add a custom coordinate frame :class:`stixpy.coordinate.frames.STIXImaging` and the associated transformations (`~stixpy.coordinates.transforms.stixim_to_hpc`, `~stixpy.coordinates.transforms.hpc_to_stixim`) to and from `~sunpy.coordinates.frames.Helioprojective`. - Also add a `stixpy.map.stix.STIXMap` for `~sunpy.map.Map` source which properly displays the :class:`stixpy.coordinate.frames.STIXImaging` coordinate frame. (`#90 `__) -- Merged `stixpy.calibration.get_visibility_info_giordano` and `stixpy.calibration.get_visibility_info` into `stixpy.calibration.get_uv_points_data` and removed `stixpy.calibration.correct_phase_projection`. (`#98 `__) -- Update livetime correction parameter `eta`, `tau` and add code to calculate pileup 'beta' :func:`stixpy.calibration.livetime.pileup_correction_factor`. (`#100 `__) -- Add background subtraction step to imaging demo, update `EnergyEdgeMasks`. (`#106 `__) -- Update imaging demo to use images and construct `~sunpy.map.Map` using `~stixpy.coordinates.frames.STIXImaging` and `~sunpy.map.header_helper.make_fitswcs_header`. (`#107 `__) -- Update :func:`~stixpy.coordinates.transforms.get_hpc_info` to use mean or interpolate pointing and location data based on number of data points in given timerange. Add function cache for aux data frequenly needed during coordinate transforms. (`#111 `__) -- Make the imaging demo compatible with :class:`~xrayvision.visibility.Visibilities` (`#123 `__) -- Update code and examples to use new :class:`~xrayvision.visibility.Visibilities`, tidy API of `~stixpy.imaging.em.em`. (`#124 `__) -- Add missing QL products `~stixpy.product.sources.quicklook.QLVariance`, `~stixpy.product.sources.quicklook.QLFlareFlag`, and `~stixpy.product.sources.quicklook.QLTMStatusFlareList` to Product. Also added some useful properties to the for status words. (`#125 `__) - - -Bug Fixes ---------- - -- Fix ELUT correction when the requested data has less then than 32 energy channels. (`#106 `__) -- Update `~stixpy.calibration.energy.get_elut` to use correct science energy channels for given date. (`#107 `__) -- Fix a bug where the incorrect unit was set on :class:`~stixpy.timeseries.quicklook.QLLightCurve`, :class:`~stixpy.timeseries.quicklook.QLBackground` and :class:`~stixpy.timeseries.quicklook.QLVariance`. (`#118 `__) -- Fix bug where coordinate transforms did not support arrays of coordinates or times. To so support both integrated (e.g. images) and instantaneous (e.g. coarse flare flag) a new property `obstime_end` was added to `~stixpy.coordinates.frames.STIXImaging` when set if possible mean pointing and position information are use for transformations other wise they are interpolated between the two nearest data points. (`#128 `__) -- Fix typo in `~stixpy.product.sources.science.ScienceData` 'durtaion' -> 'duration'. (`#132 `__) -- Fix some inconsistencies on the data units in plots, also return handle to the image from `~stixpy.product.sources.science.SpectrogramPlotMixin.plot_spectrogram`. (`#134 `__) - - -Improved Documentation ----------------------- - -- Update README, fix graphviz RTD configuration, configure theme logo text. (`#89 `__) -- Correct calculation of the HPC coordinate of the center of the STIX pointing in the imaging demo. (`#112 `__) -- Update imaging demo for latest changes in `xrayvision `_. (`#115 `__) - - -Trivial/Internal Changes ------------------------- - -- Format code with ruff and turn on ruff format in pre-commit. (`#116 `__) diff --git a/docs/whatsnew/0.1.3.rst b/docs/whatsnew/0.1.3.rst deleted file mode 100644 index 605ba579..00000000 --- a/docs/whatsnew/0.1.3.rst +++ /dev/null @@ -1,8 +0,0 @@ -Stixpy 0.1.3 (2024-07-16) -================================================== - -Bug Fixes ---------- - -- Fix some inconsistencies on the data units in plots, also return handle to the image from `~stixpy.product.sources.science.SpectrogramPlotMixin.plot_spectrogram`. (`#134 `__) -- Fix bug reintroduce by last fix in `~stixpy.imaging.em.em`, update code in `~stixpy.calibration.visibility.calibrate_visibility` and imaging demo to use Tx, Ty rather than Ty, Tx as before. (`#137 `__) diff --git a/docs/whatsnew/index.rst b/docs/whatsnew/index.rst index 553cb315..2c195843 100644 --- a/docs/whatsnew/index.rst +++ b/docs/whatsnew/index.rst @@ -10,6 +10,3 @@ This page documents the releases for STIXpy :maxdepth: 1 changelog - - 0.1.3 - 0.1.2 diff --git a/stixpy/CITATION.rst b/stixpy/CITATION.rst new file mode 100644 index 00000000..3d062c86 --- /dev/null +++ b/stixpy/CITATION.rst @@ -0,0 +1,78 @@ +.. _citing: + +***************** +Citing ``STIXpy`` +***************** + +If you use ``STIXpy`` in your scientific work please citing it in +your publications. The continued growth and development of ``STIXpy`` is dependent +on the community being aware of the software. + +Citing ``STIXpy`` in Publications +================================= + +Please add a line such as the following within your methods, conclusion, or +acknowledgements section: + + *This research used version X.Y.Z (software citation) of the STIXpy + open-source Python package (Maloney et al.).* + +The **software citation** should be the Zenodo DOI for the specific version +you used. You can find the DOI for each release on the +`STIXpy Zenodo page `_. +The concept DOI (covering all versions) is: + +.. code-block:: none + + https://doi.org/10.5281/zenodo.8086101 + +BibTeX Entry +============ + +Use the following BibTeX entry, updating the ``year``, ``version``, and +``doi`` fields to match the release you used: + +.. code:: bibtex + + @software{stixpy, + author = {Maloney, Shane and + Clarke, Brendan and + Hayes, Laura and + Ryan, Daniel F. and + Massa, Paolo and + Wilson, Alasdair and + Hochmuth, Nicky and + Christe, Steven and + Collier, Hannah and + Long, Thomas}, + title = {STIXpy}, + abstract = {An open-source Python analysis library for the Spectrometer Telescope for Imaging X-rays (STIX) instrument on Solar Obriter.}, + year = {2026}, + publisher = {Zenodo}, + doi = {10.5281/zenodo.8086101}, + url = {https://github.com/TCDSolar/stixpy}, + license = {BSD-3-Clause} + } + +You can also retrieve the citation string programmatically:: + + import stixpy + print(stixpy.__citation__) + +.. note:: + + If a peer-reviewed paper describing STIXpy is published, this page will be + updated to include it as a preferred citation. + +Acknowledging Dependencies +========================== + +``STIXpy`` is built on a number of open-source packages. Where appropriate, please +also consider citing: + +- `SunPy `_ — solar data + analysis framework that STIXpy builds on. +- `Astropy `_ — core astronomy + Python library. +- `Solar Orbiter / STIX instrument `_ + — the Krucker et al. (2020) instrument paper. diff --git a/stixpy/__init__.py b/stixpy/__init__.py index 3b7e27a5..9194b611 100644 --- a/stixpy/__init__.py +++ b/stixpy/__init__.py @@ -1,3 +1,32 @@ -# Licensed under a 3-clause BSD style license - see LICENSE.rst +""" +``STIXpy`` +========= + +An open-source Python analysis library for the Spectrometer Telescope for Imaging X-rays (STIX) instrument on Solar Obriter. + +* Homepage: https://sunpy.org +* Documentation: https://docs.sunpy.org/en/stable/ +""" from .version import version as __version__ + + +def _get_bibtex(): + import os + import textwrap + + # Set the bibtex entry to the article referenced in CITATION.rst + citation_file = os.path.join(os.path.dirname(__file__), "CITATION.rst") + + # Explicitly specify UTF-8 encoding in case the system's default encoding is problematic + with open(citation_file, encoding="utf-8") as citation: + # Extract the first bibtex block: + ref = citation.read().partition(".. code:: bibtex\n\n")[2] + lines = ref.split("\n") + # Only read the lines which are indented + lines = lines[: [line.startswith(" ") for line in lines].index(False)] + ref = textwrap.dedent("\n".join(lines)) + return ref + + +__citation__ = __bibtex__ = _get_bibtex() diff --git a/stixpy/timeseries/quicklook.py b/stixpy/timeseries/quicklook.py index def69b73..58cf1ee5 100644 --- a/stixpy/timeseries/quicklook.py +++ b/stixpy/timeseries/quicklook.py @@ -199,8 +199,7 @@ class QLBackground(GenericTimeSeries): >>> from stixpy.data import test >>> from sunpy.timeseries import TimeSeries >>> from stixpy.timeseries.quicklook import QLLightCurve - >>> ql_bg = TimeSeries("https://pub099.cs.technik.fhnw.ch/fits/L1/2020/05/06/QL/" - ... "solo_L1_stix-ql-background_20200506_V02.fits") # doctest: +REMOTE_DATA + >>> ql_bg = TimeSeries("https://pub099.cs.technik.fhnw.ch/fits/L1/2020/05/06/QL/solo_L1_stix-ql-background_20200506_V02.fits") # doctest: +REMOTE_DATA >>> ql_bg # doctest: +SKIP Date: Mon, 8 Jun 2026 09:50:00 +0100 Subject: [PATCH 3/8] Update circleci config to include submodules for doc build (#229) --- .circleci/config.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 7a543d51..559669a6 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -18,6 +18,10 @@ merge-check: &merge-check git checkout -qf pr/$CIRCLE_PR_NUMBER/merge fi +submodules: &submodules + name: Update submodules + command: git submodule update --init --recursive + apt-run: &apt-install name: Install apt packages command: | From 993bf1b482a83cac2f0155ca2f10b4876a79c4a2 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 8 Jun 2026 11:24:58 +0100 Subject: [PATCH 4/8] Automatic package template update (#230) Co-authored-by: samaloney <24570854+samaloney@users.noreply.github.com> --- .cruft.json | 4 ++-- .pre-commit-config.yaml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.cruft.json b/.cruft.json index 09a6b14b..32ce7ccc 100644 --- a/.cruft.json +++ b/.cruft.json @@ -1,6 +1,6 @@ { "template": "https://github.com/sunpy/package-template", - "commit": "cc15a3492324a0415ea444c5f52b1913323ad3ba", + "commit": "0c0f34c2ccd536ba8320fcda29c4d8e0f8f9adc5", "checkout": null, "context": { "cookiecutter": { @@ -33,7 +33,7 @@ ".github/workflows/sub_package_update.yml" ], "_template": "https://github.com/sunpy/package-template", - "_commit": "cc15a3492324a0415ea444c5f52b1913323ad3ba" + "_commit": "0c0f34c2ccd536ba8320fcda29c4d8e0f8f9adc5" } }, "directory": null diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 69c21df6..475df6b3 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,11 +1,11 @@ repos: - repo: https://github.com/zizmorcore/zizmor-pre-commit - rev: v1.24.1 + rev: v1.25.2 hooks: - id: zizmor # This should be before any formatting hooks like isort - repo: https://github.com/astral-sh/ruff-pre-commit - rev: "v0.15.12" + rev: "v0.15.15" hooks: - id: ruff-check args: ["--fix"] From f95352cb8775b9d1144c757ebd379bf385603bb6 Mon Sep 17 00:00:00 2001 From: Shane Maloney Date: Mon, 8 Jun 2026 11:29:15 +0100 Subject: [PATCH 5/8] Add submodule task to doc job (#231) --- .circleci/config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 559669a6..98cf2856 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -51,6 +51,7 @@ jobs: - run: *no-backports - run: *skip-check - run: *merge-check + - run: *submodules - run: *apt-install - run: pip install -U tox - run: tox -e build_docs From 5e22ce99d567d594a203dd47d08dea06cf50431b Mon Sep 17 00:00:00 2001 From: Shane Maloney Date: Mon, 8 Jun 2026 12:29:05 +0100 Subject: [PATCH 6/8] Add submodule task to doc job (#232) --- .circleci/config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 98cf2856..d66bce62 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -55,6 +55,7 @@ jobs: - run: *apt-install - run: pip install -U tox - run: tox -e build_docs + no_output_timeout: 30m - run: name: Prepare for upload command: | From 5275652e577c93df341c083e9a4491578c6b3957 Mon Sep 17 00:00:00 2001 From: Shane Maloney Date: Mon, 8 Jun 2026 14:12:44 +0100 Subject: [PATCH 7/8] Docs fix circleci (#233) * Add submodule task to doc job * Ok one more time --- .circleci/config.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index d66bce62..e8bedc41 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -54,8 +54,10 @@ jobs: - run: *submodules - run: *apt-install - run: pip install -U tox - - run: tox -e build_docs - no_output_timeout: 30m + - run: + name: Build docs + command: tox -e build_docs + no_output_timeout: 30m - run: name: Prepare for upload command: | From 589ed1fd4b6cb4712c5e9274f8191db6f2b5b5ec Mon Sep 17 00:00:00 2001 From: DanRyanIrish Date: Wed, 29 Jul 2026 14:37:14 +0100 Subject: [PATCH 8/8] Add fix to ensure rcr is always an int when calculating an SRM. --- stixpy/product/sources/science.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/stixpy/product/sources/science.py b/stixpy/product/sources/science.py index 913d0cd2..ed0a1f10 100644 --- a/stixpy/product/sources/science.py +++ b/stixpy/product/sources/science.py @@ -1505,6 +1505,15 @@ def _get_sunkit_spex_spectrum(product, detector_indices_srm, pixel_indices_srm = ScienceData._srm_det_pix_indices_format(detector_indices, pixel_indices, case) + # An SRM can only be calculated if the attenutator does not move. + # Therefore ensure that rcr_unique is an int. + if len(rcr_unique) > 2: + raise ValueError( + "Calculating an SRM over a change in a STIX RCR state is not supported." + ) + elif len(rcr_unique) == 1: + rcr_unique = rcr_unique[0] + rcr_unique = int(rcr_unique) srm_dict = product.get_masked_srm(flare_location=flare_location_stx, detector_indices_input=detector_indices_srm, pixel_indices_input=pixel_indices_srm, @@ -2515,6 +2524,8 @@ def get_masked_srm(self, flare_location, detector_indices_input, pixel_indices_i total collecting area. pixel_indices_input : list or numpy.ndarray Pixel indices to include when computing the total collecting area. + rcr : `int` + The attenuator state in the range 0--7 inclusive. Returns ------- @@ -2525,6 +2536,8 @@ def get_masked_srm(self, flare_location, detector_indices_input, pixel_indices_i - "geo_area": the total geometric area (cm^2) for the selected detectors and pixels. """ + # Ensure rcr is an int. + rcr = int(rcr) HERE = Path(__file__).parent ROOT = HERE.parent.parent @@ -2595,7 +2608,7 @@ def get_masked_srm(self, flare_location, detector_indices_input, pixel_indices_i rcr_state_all = np.array([0.8096, 0.80961, 0.4048, 0.2024, 0.1012, 0.0396, 0.0198, 0.0099]) pixel_indices_input_rcr = np.arange(0,12,1) - rcr_state = rcr_state_all[int(rcr)] + rcr_state = rcr_state_all[rcr] rcr_factor = rcr_state / np.sum(pixel_areas_full[pixel_indices_input_rcr].value) attenuation = np.zeros(len(tot_trans["det-1"]))