From 3ebd12cf4d3e241536612c32266e03ff92284cc4 Mon Sep 17 00:00:00 2001 From: Nabil Freij Date: Wed, 12 Mar 2025 10:18:47 -0700 Subject: [PATCH 1/8] Remove old template file --- .sunpy-template.yml | 12 ------------ 1 file changed, 12 deletions(-) delete mode 100644 .sunpy-template.yml diff --git a/.sunpy-template.yml b/.sunpy-template.yml deleted file mode 100644 index c3dc3187..00000000 --- a/.sunpy-template.yml +++ /dev/null @@ -1,12 +0,0 @@ -default_context: - package_name: sunkit-instruments - module_name: sunkit_instruments - short_description: A sunpy-affiliated package for solar instrument-specific tools. - author_name: The SunPy Developers - author_email: sunpy@googlegroups.com - license: BSD 3-Clause - project_url: https://sunpy.org - github_repo: sunpy/sunkit-instruments - minimum_python_version: 3.7 - use_compiled_extensions: n - include_example_code: n From ed61e85fd2f01d4c70f0330a882b2dafaf4b87f2 Mon Sep 17 00:00:00 2001 From: Nabil Freij Date: Wed, 12 Mar 2025 11:38:55 -0700 Subject: [PATCH 2/8] update for 313 testing --- .github/workflows/ci.yml | 14 +++++++------- .gitignore | 1 + LICENSE.rst | 2 +- tox.ini | 4 ++-- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7d494613..aeda8ec5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,7 +36,7 @@ jobs: toxdeps: tox-pypi-filter posargs: -n auto envs: | - - linux: py312 + - linux: py313 secrets: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} @@ -46,7 +46,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: - python-version: '3.12' + python-version: '3.13' - run: python -m pip install -U --user build - run: python -m build . --sdist - run: python -m pip install -U --user twine @@ -62,7 +62,7 @@ jobs: posargs: -n auto envs: | - windows: py311 - - macos: py310 + - macos: py312 - linux: py310-oldestdeps - linux: py313-devdeps @@ -73,7 +73,7 @@ jobs: needs: [core] uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@v1 with: - default_python: '3.12' + default_python: '3.13' submodules: false pytest: false toxdeps: tox-pypi-filter @@ -88,13 +88,13 @@ jobs: needs: [test] uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@v1 with: - default_python: '3.12' + default_python: '3.13' submodules: false coverage: codecov toxdeps: tox-pypi-filter posargs: -n auto --dist loadgroup envs: | - - linux: py312-online + - linux: py313-online secrets: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} @@ -110,7 +110,7 @@ jobs: needs: [test, docs] uses: OpenAstronomy/github-actions-workflows/.github/workflows/publish_pure_python.yml@v1 with: - python-version: '3.12' + python-version: '3.13' test_extras: 'tests' test_command: 'pytest -p no:warnings --doctest-rst --pyargs sunkit_instruments' submodules: false diff --git a/.gitignore b/.gitignore index 3b3f04db..c902c91a 100644 --- a/.gitignore +++ b/.gitignore @@ -233,6 +233,7 @@ sunkit_instruments/_version.py *.orig .tmp requirements-min.txt +.ruff_cache # Example files dr_suvi-l2-thmap_g16_s20220101T000000Z_e20220101T000400Z_v1-0-2.fits diff --git a/LICENSE.rst b/LICENSE.rst index 2da84989..14f2864b 100644 --- a/LICENSE.rst +++ b/LICENSE.rst @@ -1,4 +1,4 @@ -Copyright (c) 2020-2024, The SunPy Developers +Copyright (c) 2020-2025, The SunPy Developers All rights reserved. Redistribution and use in source and binary forms, with or without modification, diff --git a/tox.ini b/tox.ini index fc39cb3a..1c1bb8cd 100644 --- a/tox.ini +++ b/tox.ini @@ -3,8 +3,8 @@ min_version = 4.0 requires = tox-pypi-filter>=0.14 envlist = - py{310,311,312}{,-online} - py312-devdeps + py{310,311,312,313}{,-online} + py313-devdeps py310-oldestdeps codestyle build_docs From cbdd613ea491c085058542f73c2a4fd2eb91dcd2 Mon Sep 17 00:00:00 2001 From: Nabil Freij Date: Wed, 12 Mar 2025 11:39:46 -0700 Subject: [PATCH 3/8] Changelog --- CHANGELOG.rst | 47 ++++++++++++++++++++++++++++++++++++++ changelog/111.doc.rst | 1 - changelog/125.breaking.rst | 1 - changelog/126.breaking.rst | 1 - changelog/128.bugfix.rst | 5 ---- changelog/130.bugfix.rst | 1 - changelog/133.trivial.rst | 1 - changelog/143.breaking.rst | 2 -- changelog/143.bugfix.rst | 2 -- changelog/98.feature.1.rst | 2 -- changelog/98.feature.2.rst | 3 --- 11 files changed, 47 insertions(+), 19 deletions(-) delete mode 100644 changelog/111.doc.rst delete mode 100644 changelog/125.breaking.rst delete mode 100644 changelog/126.breaking.rst delete mode 100644 changelog/128.bugfix.rst delete mode 100644 changelog/130.bugfix.rst delete mode 100644 changelog/133.trivial.rst delete mode 100644 changelog/143.breaking.rst delete mode 100644 changelog/143.bugfix.rst delete mode 100644 changelog/98.feature.1.rst delete mode 100644 changelog/98.feature.2.rst diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 49fa9665..1221f517 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,3 +1,50 @@ +0.6.0 (2025-03-12) +================== + +Breaking Changes +---------------- + +- Increased minimum Python version to 3.10 (`#125 `__) +- Increased the minimum version of ``sunpy`` to 6.0.0. (`#126 `__) +- Update the hash of the CHIANTI data file retrieved by the data manager used in `sunkit_instruments.goes_xrs.calculate_temperature_em` + so that the latest version of the file is used. (`#143 `__) + + +New Features +------------ + +- Added `sunkit_instruments.response.SourceSpectra` to provide a container for + spectra as a function of temperature and wavelength needed for computing temperature + response functions. (`#98 `__) +- Added `sunkit_instruments.response.abstractions.AbstractChannel` to standardize an interface + for computing wavelength and temperature response functions. (`#98 `__) + + +Bug Fixes +--------- + +- In the ``fermi``, the function ``get_detector_sun_angles_for_time`` returns the angle with respect to the Sun of each Fermi/GBM detector. + However, these files contain gaps due to the South Atlantic Anomaly. + If the time requested falls in one of these gaps, the code will return the detector angles for the next available time. + This can be several minutes different from the time requested. + Now, a warning to the user will be raised if the time returned by the code is more than 1 minute different from the time requested (1 minute is the nominal cadence of the spacecraft weekly file), and explains that this is likely due to a South Atlantic Anomaly encounter. (`#128 `__) +- The function ``plot_detector_sun_angles`` was broken, due to the formatting of the time axis. (`#130 `__) +- Fixed a bug in `~sunkit-instruments.lyra.remove_lytaf_events_from_timeseries` where units were not being correctly passed + to new timeseries. (`#143 `__) + + +Documentation +------------- + +- Add a topic guide on a vocabulary for instrument response functions. (`#111 `__) + + +Internal Changes +---------------- + +- Re-templated the entire library to use the new sunpy template. (`#133 `__) + + 0.5.0 (2023-11-17) ================== diff --git a/changelog/111.doc.rst b/changelog/111.doc.rst deleted file mode 100644 index de306245..00000000 --- a/changelog/111.doc.rst +++ /dev/null @@ -1 +0,0 @@ -Add a topic guide on a vocabulary for instrument response functions. diff --git a/changelog/125.breaking.rst b/changelog/125.breaking.rst deleted file mode 100644 index a13b2aef..00000000 --- a/changelog/125.breaking.rst +++ /dev/null @@ -1 +0,0 @@ -Increased minimum Python version to 3.10 diff --git a/changelog/126.breaking.rst b/changelog/126.breaking.rst deleted file mode 100644 index 9a2016a7..00000000 --- a/changelog/126.breaking.rst +++ /dev/null @@ -1 +0,0 @@ -Increased the minimum version of ``sunpy`` to 6.0.0. diff --git a/changelog/128.bugfix.rst b/changelog/128.bugfix.rst deleted file mode 100644 index 82a41525..00000000 --- a/changelog/128.bugfix.rst +++ /dev/null @@ -1,5 +0,0 @@ -In the ``fermi``, the function ``get_detector_sun_angles_for_time`` returns the angle with respect to the Sun of each Fermi/GBM detector. -However, these files contain gaps due to the South Atlantic Anomaly. -If the time requested falls in one of these gaps, the code will return the detector angles for the next available time. -This can be several minutes different from the time requested. -Now, a warning to the user will be raised if the time returned by the code is more than 1 minute different from the time requested (1 minute is the nominal cadence of the spacecraft weekly file), and explains that this is likely due to a South Atlantic Anomaly encounter. diff --git a/changelog/130.bugfix.rst b/changelog/130.bugfix.rst deleted file mode 100644 index 337b63c8..00000000 --- a/changelog/130.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -The function ``plot_detector_sun_angles`` was broken, due to the formatting of the time axis. diff --git a/changelog/133.trivial.rst b/changelog/133.trivial.rst deleted file mode 100644 index 46ecac7d..00000000 --- a/changelog/133.trivial.rst +++ /dev/null @@ -1 +0,0 @@ -Re-templated the entire library to use the new sunpy template. diff --git a/changelog/143.breaking.rst b/changelog/143.breaking.rst deleted file mode 100644 index 7c634e01..00000000 --- a/changelog/143.breaking.rst +++ /dev/null @@ -1,2 +0,0 @@ -Update the hash of the CHIANTI data file retrieved by the data manager used in `sunkit_instruments.goes_xrs.calculate_temperature_em` -so that the latest version of the file is used. diff --git a/changelog/143.bugfix.rst b/changelog/143.bugfix.rst deleted file mode 100644 index bd91427a..00000000 --- a/changelog/143.bugfix.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fixed a bug in `~sunkit-instruments.lyra.remove_lytaf_events_from_timeseries` where units were not being correctly passed -to new timeseries. diff --git a/changelog/98.feature.1.rst b/changelog/98.feature.1.rst deleted file mode 100644 index 9e2c2db3..00000000 --- a/changelog/98.feature.1.rst +++ /dev/null @@ -1,2 +0,0 @@ -Added `sunkit_instruments.response.abstractions.AbstractChannel` to standardize an interface -for computing wavelength and temperature response functions. diff --git a/changelog/98.feature.2.rst b/changelog/98.feature.2.rst deleted file mode 100644 index 6d4fc81c..00000000 --- a/changelog/98.feature.2.rst +++ /dev/null @@ -1,3 +0,0 @@ -Added `sunkit_instruments.response.SourceSpectra` to provide a container for -spectra as a function of temperature and wavelength needed for computing temperature -response functions. From e74728cfcfa58192c2b39146a238967c31b866e9 Mon Sep 17 00:00:00 2001 From: Nabil Freij Date: Wed, 12 Mar 2025 13:19:26 -0700 Subject: [PATCH 4/8] Tweaks for CI --- sunkit_instruments/lyra/lyra.py | 7 ------- sunkit_instruments/lyra/tests/test_lyra.py | 4 +--- tox.ini | 22 ++++++++-------------- 3 files changed, 9 insertions(+), 24 deletions(-) diff --git a/sunkit_instruments/lyra/lyra.py b/sunkit_instruments/lyra/lyra.py index 6e10914e..df762191 100644 --- a/sunkit_instruments/lyra/lyra.py +++ b/sunkit_instruments/lyra/lyra.py @@ -129,7 +129,6 @@ def _remove_lytaf_events( channels=None, artifacts=None, return_artifacts=False, - filecolumns=None, force_use_local_lytaf=False, ): """ @@ -162,12 +161,6 @@ def _remove_lytaf_events( Set to True to return a numpy recarray containing the start time, end time and type of all artifacts removed. Default=False - filecolumns : `list` of strings - Gives names of columns of any output files produced. Although - initially set to None above, the default is in fact - ["time", "channel0", "channel1",..."channelN"] - where N is the number of irradiance arrays in the channels input - (assuming 0-indexed counting). force_use_local_lytaf : `bool` Ensures current local version of lytaf files are not replaced by up-to-date online versions even if current local lytaf files do not diff --git a/sunkit_instruments/lyra/tests/test_lyra.py b/sunkit_instruments/lyra/tests/test_lyra.py index e66a204b..0cdd84de 100644 --- a/sunkit_instruments/lyra/tests/test_lyra.py +++ b/sunkit_instruments/lyra/tests/test_lyra.py @@ -280,11 +280,11 @@ def test_remove_lytaf_events_1(local_cache): assert artifacts_status_test["not_found"] == artifacts_status_expected["not_found"] +@pytest.mark.filterwarnings("ignore:unclosed database") def test_remove_lytaf_events_2(local_cache): """ Test _remove_lytaf_events() with no user artifacts found. """ - # Run _remove_lytaf_events with pytest.warns(UserWarning, match="None of user supplied artifacts were found."): time_test, channels_test, artifacts_status_test = lyra._remove_lytaf_events( TIME, @@ -293,7 +293,6 @@ def test_remove_lytaf_events_2(local_cache): return_artifacts=True, force_use_local_lytaf=True, ) - # Generated expected result time_expected = TIME channels_expected = CHANNELS artifacts_status_expected = { @@ -302,7 +301,6 @@ def test_remove_lytaf_events_2(local_cache): "not_removed": LYTAF_TEST, "not_found": ["Offpoint"], } - # Assert test values are same as expected np.testing.assert_array_equal(time_test, time_expected) assert (channels_test[0]).all() == (channels_expected[0]).all() assert (channels_test[1]).all() == (channels_expected[1]).all() diff --git a/tox.ini b/tox.ini index 1c1bb8cd..712e5f6f 100644 --- a/tox.ini +++ b/tox.ini @@ -12,6 +12,7 @@ envlist = [testenv] pypi_filter = https://raw.githubusercontent.com/sunpy/sunpy/main/.test_package_pins.txt allowlist_externals = + /bin/sh minimum_dependencies # Run the tests in a temporary directory to make sure that we don't import # the package from the source tree @@ -19,19 +20,9 @@ change_dir = .tmp/{envname} description = run tests devdeps: with the latest developer version of key dependencies - online: that require remote data oldestdeps: with the oldest supported version of key dependencies -setenv = - COLUMNS = 180 - PYTEST_COMMAND = pytest -vvv -s -raR --durations=25 --pyargs sunkit_instruments --cov-report=xml --cov=sunkit_instruments --cov-config={toxinidir}/setup.cfg {toxinidir}/docs - SUNPY_SAMPLEDIR = {env:SUNPY_SAMPLEDIR:{toxinidir}/.tox/{envname}/sample_data/} - PARFIVE_HIDE_PROGRESS = True + online: that require remote data (as well as the offline ones) pass_env = - HOME - HTTP_PROXY - HTTPS_PROXY - NO_PROXY - CIRCLECI # A variable to tell tests we are on a CI system CI # Custom compiler locations (such as ccache) @@ -40,15 +31,17 @@ pass_env = LOCALE_ARCHIVE # If the user has set a LC override we should follow it LC_ALL -set_env = +setenv = MPLBACKEND = agg - devdeps: PIP_EXTRA_INDEX_URL = https://pypi.anaconda.org/astropy/simple https://pypi.anaconda.org/scientific-python-nightly-wheels/simple + SUNPY_SAMPLEDIR = {env:SUNPY_SAMPLEDIR:{toxinidir}/.tox/sample_data/} + devdeps,build_docs,online: HOME = {envtmpdir} + PARFIVE_HIDE_PROGRESS = True + devdeps: PIP_EXTRA_INDEX_URL = https://pypi.anaconda.org/astropy/simple https://pypi.anaconda.org/scientific-python-nightly-wheels/simple https://pypi.anaconda.org/liberfa/simple deps = devdeps: git+https://github.com/sunpy/sunpy # Handle minimum dependencies via minimum_dependencies oldestdeps: minimum_dependencies online: pytest-rerunfailures - online: pytest-timeout extras = all tests @@ -69,6 +62,7 @@ commands = --cov-config={toxinidir}/.coveragerc \ {toxinidir}/docs \ online: --remote-data=any \ + online: --reruns 2 --reruns-delay 15 \ {posargs} [testenv:codestyle] From fd66888250a10cc988315f5f3907cbac6a583125 Mon Sep 17 00:00:00 2001 From: Nabil Freij Date: Wed, 12 Mar 2025 13:28:07 -0700 Subject: [PATCH 5/8] Tweak online marks --- sunkit_instruments/suvi/tests/test_suvi.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sunkit_instruments/suvi/tests/test_suvi.py b/sunkit_instruments/suvi/tests/test_suvi.py index 23bed47d..9578eaf7 100644 --- a/sunkit_instruments/suvi/tests/test_suvi.py +++ b/sunkit_instruments/suvi/tests/test_suvi.py @@ -5,10 +5,8 @@ from sunkit_instruments import suvi -# Test files are all remote data. -pytestmark = pytest.mark.remote_data - +@pytest.mark.remote_data def test_suvi_despiking_fits(L1B_FITS): _, l1b_fits_data, _ = suvi.read_suvi( L1B_FITS, @@ -18,6 +16,7 @@ def test_suvi_despiking_fits(L1B_FITS): assert not np.array_equal(l1b_fits_data, despiked_l1b_fits_data) +@pytest.mark.remote_data def test_suvi_despiking_nc(L1B_NC): _, l1b_nc_data, _ = suvi.read_suvi(L1B_NC) despiked_l1b_nc_data = l1b_nc_data @@ -25,16 +24,19 @@ def test_suvi_despiking_nc(L1B_NC): assert not np.array_equal(l1b_nc_data, despiked_l1b_nc_data) +@pytest.mark.remote_data def test_get_response_nc(L1B_NC): l1b_nc_response = suvi.get_response(L1B_NC) assert l1b_nc_response["wavelength_channel"] == 171 +@pytest.mark.remote_data def test_get_response_fits(L1B_FITS): l1b_fits_response = suvi.get_response(L1B_FITS) assert l1b_fits_response["wavelength_channel"] == 171 +@pytest.mark.remote_data def test_get_response_wavelength(): response_195 = suvi.get_response(195) assert response_195["wavelength_channel"] == 195 From 0432cd7f4f9737e219916555e36743efde428e36 Mon Sep 17 00:00:00 2001 From: Nabil Freij Date: Wed, 12 Mar 2025 14:06:55 -0700 Subject: [PATCH 6/8] Release notes --- CHANGELOG.rst | 2 ++ changelog/168.breaking.rst | 1 - changelog/168.feature.rst | 1 - sunkit_instruments/suvi/tests/test_suvi.py | 1 + 4 files changed, 3 insertions(+), 2 deletions(-) delete mode 100644 changelog/168.breaking.rst delete mode 100644 changelog/168.feature.rst diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 1221f517..d7fff7ae 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -8,6 +8,7 @@ Breaking Changes - Increased the minimum version of ``sunpy`` to 6.0.0. (`#126 `__) - Update the hash of the CHIANTI data file retrieved by the data manager used in `sunkit_instruments.goes_xrs.calculate_temperature_em` so that the latest version of the file is used. (`#143 `__) +- Updated SUVI Flight Model files for FM1 (16) and FM2 (17). (`#168 `__) New Features @@ -18,6 +19,7 @@ New Features response functions. (`#98 `__) - Added `sunkit_instruments.response.abstractions.AbstractChannel` to standardize an interface for computing wavelength and temperature response functions. (`#98 `__) +- Added support for SUVI Flight Models FM3 (18) and FM4 (19). (`#168 `__) Bug Fixes diff --git a/changelog/168.breaking.rst b/changelog/168.breaking.rst deleted file mode 100644 index 46332e27..00000000 --- a/changelog/168.breaking.rst +++ /dev/null @@ -1 +0,0 @@ -Updated SUVI Flight Model files for FM1 (16) and FM2 (17). diff --git a/changelog/168.feature.rst b/changelog/168.feature.rst deleted file mode 100644 index d9b1b030..00000000 --- a/changelog/168.feature.rst +++ /dev/null @@ -1 +0,0 @@ -Added support for SUVI Flight Models FM3 (18) and FM4 (19). diff --git a/sunkit_instruments/suvi/tests/test_suvi.py b/sunkit_instruments/suvi/tests/test_suvi.py index 9578eaf7..a1746701 100644 --- a/sunkit_instruments/suvi/tests/test_suvi.py +++ b/sunkit_instruments/suvi/tests/test_suvi.py @@ -42,6 +42,7 @@ def test_get_response_wavelength(): assert response_195["wavelength_channel"] == 195 +@pytest.mark.remote_data @pytest.mark.parametrize("spacecraft", [16, 17, 18, 19]) def test_get_response_spacecraft_number(spacecraft): response_195 = suvi.get_response(195, spacecraft=spacecraft) From e68153f6b94a5da9677ae39a950fe36cf72b186d Mon Sep 17 00:00:00 2001 From: Nabil Freij Date: Wed, 12 Mar 2025 14:31:52 -0700 Subject: [PATCH 7/8] Tidy up index page --- docs/index.rst | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/docs/index.rst b/docs/index.rst index 5a5a20e7..0a33af97 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -35,20 +35,18 @@ Once you have that virtual environment, you will want to fork the repo and then .. _contributing guide: https://docs.sunpy.org/en/latest/dev_guide/contents/newcomers.html -``sunkit-instruments`` is organised into sub-modules for each instrument: - -.. toctree:: - :maxdepth: 2 - - code_ref/index - generated/gallery/index - topic_guide/index - whatsnew/index - - Note that the code in this package is **not** maintained by or necessarily contributed to by instrument teams. Some instruments have individual packages for analysis in Python, including: - `aiapy `__ - `eispac `__ - `xrtpy `__ + +.. toctree:: + :maxdepth: 1 + :hidden: + + code_ref/index + generated/gallery/index + topic_guide/index + whatsnew/index From e4726c965393712f5ab39d5e037be9aa2d265240 Mon Sep 17 00:00:00 2001 From: Nabil Freij Date: Wed, 12 Mar 2025 15:08:13 -0700 Subject: [PATCH 8/8] Nitpicky --- .gitignore | 1 + CHANGELOG.rst | 4 ++-- docs/conf.py | 18 +++++++++++++----- docs/nitpick-exceptions | 8 ++++++++ ...te_goes_temperature_and_emission_measure.py | 4 ++-- sunkit_instruments/fermi/fermi.py | 6 +++--- .../goes_xrs/goes_chianti_tem.py | 12 +++++++----- sunkit_instruments/goes_xrs/goes_xrs.py | 2 +- sunkit_instruments/lyra/lyra.py | 4 ++-- sunkit_instruments/response/thermal.py | 2 +- sunkit_instruments/rhessi/rhessi.py | 6 +++--- sunkit_instruments/suvi/suvi.py | 9 +++++---- 12 files changed, 48 insertions(+), 28 deletions(-) create mode 100644 docs/nitpick-exceptions diff --git a/.gitignore b/.gitignore index c902c91a..48806e2c 100644 --- a/.gitignore +++ b/.gitignore @@ -221,6 +221,7 @@ examples/**/*.csv figure_test_images* tags sunkit_instruments/_version.py +docs/sg_execution_times.rst ### Pycharm(?) .idea diff --git a/CHANGELOG.rst b/CHANGELOG.rst index d7fff7ae..8cce226a 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -31,7 +31,7 @@ Bug Fixes This can be several minutes different from the time requested. Now, a warning to the user will be raised if the time returned by the code is more than 1 minute different from the time requested (1 minute is the nominal cadence of the spacecraft weekly file), and explains that this is likely due to a South Atlantic Anomaly encounter. (`#128 `__) - The function ``plot_detector_sun_angles`` was broken, due to the formatting of the time axis. (`#130 `__) -- Fixed a bug in `~sunkit-instruments.lyra.remove_lytaf_events_from_timeseries` where units were not being correctly passed +- Fixed a bug in `~sunkit_instruments.lyra.remove_lytaf_events_from_timeseries` where units were not being correctly passed to new timeseries. (`#143 `__) @@ -66,7 +66,7 @@ Backwards Incompatible Changes - This removes the older version of `sunkit_instruments.goes_xrs.calculate_temperature_em` that no longer works for the re-processed netcdf files and new GOES-R data. - This also removes the `sunkit_instruments.goes_xrs.calculate_radiative_loss_rate` and `sunkit_instruments.goes_xrs.calculate_xray_luminosity` functions that also no longer work in their current form. + This also removes the ``sunkit_instruments.goes_xrs.calculate_radiative_loss_rate`` and ``sunkit_instruments.goes_xrs.calculate_xray_luminosity`` functions that also no longer work in their current form. The new `sunkit_instruments.goes_xrs.calculate_temperature_em` function now returns a new sunpy.timeseries.GenericTimeSeries with the temperature and emission measure rather than appending columns to the passed XRSTimeSeries. (`#81 `__) diff --git a/docs/conf.py b/docs/conf.py index 71d89278..4bd503a2 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -84,6 +84,17 @@ # Treat everything in single ` as a Python reference. default_role = "py:obj" +# Enable nitpicky mode, which forces links to be non-broken +nitpicky = True +# This is not used. See docs/nitpick-exceptions file for the actual listing. +nitpick_ignore = [] +for line in open('nitpick-exceptions'): + if line.strip() == "" or line.startswith("#"): + continue + dtype, target = line.split(None, 1) + target = target.strip() + nitpick_ignore.append((dtype, target)) + # -- Options for intersphinx extension ----------------------------------------- intersphinx_mapping = { @@ -100,13 +111,10 @@ (None, "http://www.astropy.org/astropy-data/intersphinx/scipy.inv"), ), "matplotlib": ( - "https://matplotlib.org/", + "https://matplotlib.org/stable/", (None, "http://www.astropy.org/astropy-data/intersphinx/matplotlib.inv"), ), - "sunpy": ( - "https://sunpy.org/", - (None, "https://docs.sunpy.org/en/stable/"), - ), + "sunpy": ("https://docs.sunpy.org/en/stable/", None), "astropy": ("https://docs.astropy.org/en/stable/", None), "sqlalchemy": ("https://docs.sqlalchemy.org/en/latest/", None), "pandas": ("https://pandas.pydata.org/pandas-docs/stable/", None), diff --git a/docs/nitpick-exceptions b/docs/nitpick-exceptions new file mode 100644 index 00000000..5f4d904c --- /dev/null +++ b/docs/nitpick-exceptions @@ -0,0 +1,8 @@ +# Prevents sphinx nitpicky mode picking up on optional +# (see https://github.com/sphinx-doc/sphinx/issues/6861) +# Even if it was "fixed", still broken +py:class optional +# See https://github.com/numpy/numpy/issues/10039 +py:obj numpy.datetime64 + +py:class Unit diff --git a/examples/calculate_goes_temperature_and_emission_measure.py b/examples/calculate_goes_temperature_and_emission_measure.py index c1558dda..75b03c08 100644 --- a/examples/calculate_goes_temperature_and_emission_measure.py +++ b/examples/calculate_goes_temperature_and_emission_measure.py @@ -32,8 +32,8 @@ ############################################################################## # Now let's calculate the temperature and emission measure estimates from # these channel fluxes. We can do this by using the function -# `sunkit_instruments.goes_xrs.calculate_temperature_emiss()` which -# takes a sunpy.timeseries.XRSTimeSeries and returns a new GenericTimeSeries +# `sunkit_instruments.goes_xrs.calculate_temperature_em` which +# takes a `sunpy.timeseries.sources.XRSTimeSeries` and returns a new timeseries # which contains both the respective temperature and emission measure values. goes_temp_em = goes_xrs.calculate_temperature_em(goes_flare) diff --git a/sunkit_instruments/fermi/fermi.py b/sunkit_instruments/fermi/fermi.py index 80b6f3a0..c5442a81 100644 --- a/sunkit_instruments/fermi/fermi.py +++ b/sunkit_instruments/fermi/fermi.py @@ -238,7 +238,7 @@ def plot_detector_sun_angles(angles): angles : `dict` A dictionary containing the Fermi/GBM detector angle information as a function of time. Obtained from the - `~sunkit_instruments.fermi.get_detector_separation_angles` function. + `~sunkit_instruments.fermi.get_detector_sun_angles_for_time` function. """ # Reformat the time array so we can plot it angle_times = [] @@ -310,8 +310,8 @@ def get_scx_scz_in_timerange(timerange, file): Parameters ---------- - timerange : `sunpy.time.TimeRange` - A SunPy `~sunpy.time.TimeRange`. + timerange : `~sunpy.time.TimeRange` + The time range to extract the pointing information for. file : `str` A filepath to a Fermi/LAT weekly pointing file (e.g. as obtained by the `~sunkit_instruments.fermi.download_weekly_pointing_file` function). diff --git a/sunkit_instruments/goes_xrs/goes_chianti_tem.py b/sunkit_instruments/goes_xrs/goes_chianti_tem.py index 6d887289..ddbb6c46 100644 --- a/sunkit_instruments/goes_xrs/goes_chianti_tem.py +++ b/sunkit_instruments/goes_xrs/goes_chianti_tem.py @@ -39,10 +39,11 @@ def calculate_temperature_em(goes_ts, abundance="coronal"): Parameters ---------- - goes_ts : `~sunpy.timeseries.XRSTimeSeries` + goes_ts : `~sunpy.timeseries.sources.XRSTimeSeries` The GOES/XRS timeseries containing the data of both the xrsa and xrsb channels (in units of W/m**2). - abundance: {"coronal", "photospheric"}, optional + abundance: str, optional Which abundances to use for the calculation, the default is "coronal". + Can be either "coronal" or "photospheric". Returns ------- @@ -62,7 +63,7 @@ def calculate_temperature_em(goes_ts, abundance="coronal"): ----- This function works with both the NOAA-provided netcdf files, for which the data is given in "true" fluxes and with the older FITS files provided by the SDAC, for which the data are scaled to be consistent with GOES-7. - The routine determines from the `sunpy.timeseries.XRSTimeSeries` metadata + The routine determines from the `sunpy.timeseries.sources.XRSTimeSeries` metadata whether the SWPC scaling factors need to be removed (which are present in the FITS data). See also: https://hesperia.gsfc.nasa.gov/goes/goes.html#Temperature/Emission%20Measure @@ -154,15 +155,16 @@ def _chianti_temp_emiss( Parameters ---------- - goes_ts : `~sunpy.timeseries.XRSTimeSeries` + goes_ts : `~sunpy.timeseries.sources.XRSTimeSeries` The GOES XRS timeseries containing the data of both the xrsa and xrsb channels (in units of W/m**2). sat : `int` GOES satellite number. secondary: `int`, optional Values 0, 1, 2, 3 indicate A1+B1, A2+B1, A1+B2, A2+B2 detector combos for GOES-R. Defaults to 0. - abundance: {"coronal", "photospheric"}, optional + abundance: str, optional Which abundances to use for the calculation, the default is "coronal". + Can be either "coronal" or "photospheric". remove_scaling: `bool`, optional Checks whether to remove the SWPC scaling factors. This is only an issue for the older FITS files for GOES 8-15 XRS. diff --git a/sunkit_instruments/goes_xrs/goes_xrs.py b/sunkit_instruments/goes_xrs/goes_xrs.py index a9374801..bdb7f52f 100644 --- a/sunkit_instruments/goes_xrs/goes_xrs.py +++ b/sunkit_instruments/goes_xrs/goes_xrs.py @@ -144,7 +144,7 @@ def flux_to_flareclass(goesflux: u.watt / u.m**2): References ---------- - `Solar Flare Classification `_ + `Solar Flare Classification `__ Examples -------- diff --git a/sunkit_instruments/lyra/lyra.py b/sunkit_instruments/lyra/lyra.py index df762191..531e51a5 100644 --- a/sunkit_instruments/lyra/lyra.py +++ b/sunkit_instruments/lyra/lyra.py @@ -44,7 +44,7 @@ def remove_lytaf_events_from_timeseries( Parameters ---------- - ts : `sunpy.timeseries.TimeSeries` + ts : `sunpy.timeseries.GenericTimeSeries` artifacts : `list` Sets the artifact types to be removed. For a list of artifact types see reference [1]. For example, if a user wants to remove only large @@ -62,7 +62,7 @@ def remove_lytaf_events_from_timeseries( Returns ------- - ts_new : `sunpy.timeseries.TimeSeries` + ts_new : `sunpy.timeseries.GenericTimeSeries` copy of input TimeSeries with periods corresponding to artifacts removed. artifact_status : `dict` diff --git a/sunkit_instruments/response/thermal.py b/sunkit_instruments/response/thermal.py index f24af50a..6dc6a89d 100644 --- a/sunkit_instruments/response/thermal.py +++ b/sunkit_instruments/response/thermal.py @@ -17,7 +17,7 @@ def get_temperature_response(channel, spectra, obstime=None): ---------- channel: `~sunkit_instruments.response.abstractions.AbstractChannel` spectra: `~sunkit_instruments.response.SourceSpectra` - obstime: any format parsed by `sunpy.time.parse_time`, optional + obstime: any format parsed by `sunpy.time.parse_time` , optional Returns ------- diff --git a/sunkit_instruments/rhessi/rhessi.py b/sunkit_instruments/rhessi/rhessi.py index c45e89e9..748e5fd3 100644 --- a/sunkit_instruments/rhessi/rhessi.py +++ b/sunkit_instruments/rhessi/rhessi.py @@ -185,7 +185,7 @@ def uncompress_countrate(compressed_countrate): Parameters ---------- - compressed_countrate : `byte` array + compressed_countrate : `bytes` array A compressed count rate returned from an observing summary file. References @@ -317,7 +317,7 @@ def backprojection( Returns ------- - `sunpy.map.sources.RHESSImap` + `sunpy.map.sources.RHESSIMap` A backprojection map. """ # import sunpy.map in here so that net and timeseries don't end up importing map @@ -417,7 +417,7 @@ def imagecube2map(rhessi_imagecube_file): Extracts single map images from a RHESSI flare image datacube. Currently assumes input to be 4D. - This function is analogous to the `hsi_fits2map.pro` functionality available in SSW. + This function is analogous to the ``hsi_fits2map.pro`` functionality available in SSW. Parameters ---------- diff --git a/sunkit_instruments/suvi/suvi.py b/sunkit_instruments/suvi/suvi.py index 521dbc7d..fae0a699 100644 --- a/sunkit_instruments/suvi/suvi.py +++ b/sunkit_instruments/suvi/suvi.py @@ -113,15 +113,16 @@ def get_response(request, spacecraft=16, ccd_temperature=-60.0, exposure_type="l Parameters ---------- - request: `str` or {94 | 131 | 171 | 195 | 284 | 304}. + request: `str` or `int`. Either an L1b filename (FITS or netCDF), or an integer specifying the wavelength channel. - spacecraft: `int`, optional. + Those are the valid wavelength channels: 94, 131, 171, 195, 284, 304 + spacecraft: `int`, optional Which GOES spacecraft, default is 16. - ccd_temperature: `float`, optional. + ccd_temperature: `float`, optional The CCD temperature, in degrees Celsius, default is -60. Needed for getting the correct gain number. - exposure_type: {"long" | "short" | "short_flare"}, optional. + exposure_type: `str`, optional The exposure type of the SUVI image. The exposure type is needed for the correct focal plane filter selection.