diff --git a/.codecov.yml b/.codecov.yml deleted file mode 100644 index 2d100a2..0000000 --- a/.codecov.yml +++ /dev/null @@ -1,2 +0,0 @@ -codecov: - token: 67c7c9c2-876c-4780-9c93-eea8a134e0ab diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..8ac6b8c --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,6 @@ +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "monthly" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..99ae02b --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,103 @@ +name: CI + +on: + push: + branches: + - 'main' + - '*.*' + - '!*backport*' + tags: + - 'v*' + - '!*dev*' + - '!*pre*' + - '!*post*' + pull_request: + # Allow manual runs through the web UI + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + core: + uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@main + with: + submodules: false + coverage: codecov + toxdeps: tox-pypi-filter + posargs: -n auto + envs: | + - linux: py311 + secrets: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + + test: + needs: [core] + uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@main + with: + submodules: false + coverage: codecov + toxdeps: tox-pypi-filter + posargs: -n auto + envs: | + - windows: py310 + - macos: py39 + secrets: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + + docs: + needs: [core] + uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@main + with: + default_python: '3.9' + submodules: false + pytest: false + toxdeps: tox-pypi-filter + cache-path: | + docs/_build/ + docs/generated/ + .tox/sample_data/ + libraries: | + apt: + - graphviz + envs: | + - linux: build_docs + + online: + if: "!startsWith(github.event.ref, 'refs/tags/v')" + needs: [docs] + uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@main + with: + default_python: '3.9' + submodules: false + coverage: codecov + toxdeps: tox-pypi-filter + posargs: -n auto --dist loadgroup + envs: | + - linux: py39-online + secrets: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + + publish: + # Build wheels when pushing to any branch except main + # publish.yml will only publish if tagged ^v.* + if: | + ( + github.event_name != 'pull_request' && ( + github.ref_name != 'main' || + github.event_name == 'workflow_dispatch' + ) + ) || ( + github.event_name == 'pull_request' && + contains(github.event.pull_request.labels.*.name, 'Run publish') + ) + needs: [test] + uses: OpenAstronomy/github-actions-workflows/.github/workflows/publish_pure_python.yml@main + with: + python-version: "3.10" + test_extras: 'all,tests' + test_command: 'pytest -p no:warnings --doctest-rst -m "not mpl_image_compare" --pyargs sunpy' + submodules: false + secrets: + pypi_token: ${{ secrets.pypi_token }} diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index 5c15e70..0000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,71 +0,0 @@ -image: python:3.10 - -before_script: - - pip install "tox<4.0" tox-pypi-filter - -stages: - - Base - - Extras - - Release - -codestyle: - stage: Base - script: - - tox -e codestyle - -py310: - stage: Base - script: - - tox -e py310 - -py310-online: - stage: Extras - script: - - tox -e py310-online - - pip install --upgrade codecov - - codecov - -py38: - stage: Extras - image: python:3.8 - script: - - tox -e py38 - -py311-devdeps: - allow_failure: true - stage: Extras - image: python:3.11 - before_script: - # Need graphviz binary for generating inheritance diagrams - - apt-get update -qq && apt-get install -y -qq libhdf5-dev - - pip install "tox<4.0" tox-pypi-filter - script: - - tox -e py311-devdeps - -#py310-rc-online: -# stage: Extras -# image: python:3.10 -# script: -# - tox -e py310-rc-online - -build_docs: - stage: Extras - before_script: - # Need graphviz binary for generating inheritance diagrams - - apt-get update -qq && apt-get install -y -qq graphviz - - pip install "tox<4.0" tox-pypi-filter - script: - - tox -e build_docs - -pypi_upload: - stage: Release - rules: - - if: '$CI_COMMIT_TAG =~ /^v\d+\.\d+\.\d+/' # A specific tag with 'vX.Y.Z' pattern is created - before_script: - - pip install --upgrade twine pep517 - script: - - python -m pep517.build --source --out-dir dist . - - twine upload dist/aiapy*.tar.gz - -.common: - interruptible: true diff --git a/.rtd-environment.yml b/.rtd-environment.yml index a27c7b7..309e230 100644 --- a/.rtd-environment.yml +++ b/.rtd-environment.yml @@ -2,6 +2,6 @@ name: rtd_aiapy channels: - conda-forge dependencies: - - python=3.10 + - python=3.11 - pip - graphviz!=2.42.*,!=2.43.* diff --git a/.sunpy-template.yml b/.sunpy-template.yml deleted file mode 100644 index 0326416..0000000 --- a/.sunpy-template.yml +++ /dev/null @@ -1,13 +0,0 @@ -default_context: - package_name: aiapy - module_name: aiapy - short_description: Python package for AIA analysis. - author_name: AIA Instrument Team - author_email: cheung@lmsal.com - license: BSD 3-Clause - project_url: https://gitlab.com/LMSAL_HUB/aia_hub/aiapy - github_repo: sunpy/aiapy - minimum_python_version: 3.7 - use_compiled_extensions: n - include_example_code: n - _sphinx_theme: sphinx_rtd_theme diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index 12a56f0..d32e6c8 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -1,18 +1,18 @@ -# Contributor Covenant Code of Conduct +# Contributor Covenant Code of Conduct # -## Our Pledge +## Our Pledge ## We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, -nationality, personal appearance, race, caste, color, religion, or sexual identity -and orientation. +nationality, personal appearance, race, caste, color, religion, or sexual +identity and orientation. We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community. -## Our Standards +## Our Standards ## Examples of behavior that contributes to a positive environment for our community include: @@ -22,21 +22,21 @@ community include: * Giving and gracefully accepting constructive feedback * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience -* Focusing on what is best not just for us as individuals, but for the - overall community +* Focusing on what is best not just for us as individuals, but for the overall + community Examples of unacceptable behavior include: -* The use of sexualized language or imagery, and sexual attention or - advances of any kind +* The use of sexualized language or imagery, and sexual attention or advances of + any kind * Trolling, insulting or derogatory comments, and personal or political attacks * Public or private harassment -* Publishing others' private information, such as a physical or email - address, without their explicit permission +* Publishing others' private information, such as a physical or email address, + without their explicit permission * Other conduct which could reasonably be considered inappropriate in a professional setting -## Enforcement Responsibilities +## Enforcement Responsibilities ## Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in @@ -48,7 +48,7 @@ comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate. -## Scope +## Scope ## This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. @@ -56,7 +56,62 @@ Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. -## Attribution +## Enforcement ## + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported to the community leaders responsible for enforcement at +All complaints will be reviewed and investigated promptly and fairly. + +All community leaders are obligated to respect the privacy and security of the +reporter of any incident. + +## Enforcement Guidelines ## + +Community leaders will follow these Community Impact Guidelines in determining +the consequences for any action they deem in violation of this Code of Conduct: + +### 1. Correction ## + +**Community Impact**: Use of inappropriate language or other behavior deemed +unprofessional or unwelcome in the community. + +**Consequence**: A private, written warning from community leaders, providing +clarity around the nature of the violation and an explanation of why the +behavior was inappropriate. A public apology may be requested. + +### 2. Warning ## + +**Community Impact**: A violation through a single incident or series of +actions. + +**Consequence**: A warning with consequences for continued behavior. No +interaction with the people involved, including unsolicited interaction with +those enforcing the Code of Conduct, for a specified period of time. This +includes avoiding interactions in community spaces as well as external channels +like social media. Violating these terms may lead to a temporary or permanent +ban. + +### 3. Temporary Ban ## + +**Community Impact**: A serious violation of community standards, including +sustained inappropriate behavior. + +**Consequence**: A temporary ban from any sort of interaction or public +communication with the community for a specified period of time. No public or +private interaction with the people involved, including unsolicited interaction +with those enforcing the Code of Conduct, is allowed during this period. +Violating these terms may lead to a permanent ban. + +### 4. Permanent Ban ## + +**Community Impact**: Demonstrating a pattern of violation of community +standards, including sustained inappropriate behavior, harassment of an +individual, or aggression toward or disparagement of classes of individuals. + +**Consequence**: A permanent ban from any sort of public interaction within the +community. + +## Attribution ## This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.1, available at @@ -66,8 +121,8 @@ Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder][Mozilla CoC]. For answers to common questions about this code of conduct, see the FAQ at -[https://www.contributor-covenant.org/faq][FAQ]. Translations are available -at [https://www.contributor-covenant.org/translations][translations]. +[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at +[https://www.contributor-covenant.org/translations][translations]. [homepage]: https://www.contributor-covenant.org [v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html diff --git a/LICENSE.rst b/LICENSE.rst index fb3c530..27ff4a7 100644 --- a/LICENSE.rst +++ b/LICENSE.rst @@ -1,4 +1,4 @@ -Copyright (c) 2020-2021, AIA Instrument Team +Copyright (c) 2020-2023, AIA Instrument Team All rights reserved. Redistribution and use in source and binary forms, with or without modification, diff --git a/MANIFEST.in b/MANIFEST.in index ec68830..97120c9 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,2 +1 @@ -prune joss prune aiapy/_dev diff --git a/aiapy/__init__.py b/aiapy/__init__.py index b2aa681..1eb0a5c 100644 --- a/aiapy/__init__.py +++ b/aiapy/__init__.py @@ -1,8 +1,8 @@ from pathlib import Path -from .version import version as __version__ - from itertools import compress +from .version import version as __version__ + _SSW_MIRROR = "https://sohoftp.nascom.nasa.gov/solarsoft/" diff --git a/aiapy/calibrate/meta.py b/aiapy/calibrate/meta.py index 8b5167e..67a3f05 100644 --- a/aiapy/calibrate/meta.py +++ b/aiapy/calibrate/meta.py @@ -4,10 +4,9 @@ import copy import warnings -import numpy as np - import astropy.time import astropy.units as u +import numpy as np from astropy.coordinates import CartesianRepresentation, HeliocentricMeanEcliptic, SkyCoord from sunpy.map import contains_full_disk @@ -52,7 +51,7 @@ def fix_observer_location(smap): return smap._new_instance(smap.data, new_meta, plot_settings=smap.plot_settings, mask=smap.mask) -def update_pointing(smap, pointing_table=None): +def update_pointing(smap, *, pointing_table=None): """ Update pointing information in the `smap` header. diff --git a/aiapy/calibrate/prep.py b/aiapy/calibrate/prep.py index 8079484..4745cdd 100644 --- a/aiapy/calibrate/prep.py +++ b/aiapy/calibrate/prep.py @@ -3,9 +3,8 @@ """ import warnings -import numpy as np - import astropy.units as u +import numpy as np from sunpy.map import contains_full_disk from sunpy.map.sources.sdo import AIAMap, HMIMap from sunpy.util.decorators import add_common_docstring @@ -19,7 +18,7 @@ @add_common_docstring(rotation_function_names=_rotation_function_names) -def register(smap, missing=None, order=3, method="scipy"): +def register(smap, *, missing=None, order=3, method="scipy"): """ Processes a full-disk level 1 `~sunpy.map.sources.sdo.AIAMap` into a level 1.5 `~sunpy.map.sources.sdo.AIAMap`. @@ -37,7 +36,8 @@ def register(smap, missing=None, order=3, method="scipy"): update header: crpix1 and crpix2 by the difference divided by 2 in size along that axis. Then create a new map. - If you do not like this, please open an issue on the aiapy GitLab page. + Please open an issue on the `aiapy GitHub page `__ + if you would like to see this changed. .. note:: @@ -110,7 +110,7 @@ def register(smap, missing=None, order=3, method="scipy"): return newmap -def correct_degradation(smap, correction_table=None, calibration_version=None): +def correct_degradation(smap, *, correction_table=None, calibration_version=None): """ Apply time-dependent degradation correction to an AIA map. @@ -158,6 +158,7 @@ def correct_degradation(smap, correction_table=None, calibration_version=None): def degradation( channel: u.angstrom, obstime, + *, correction_table=None, calibration_version=None, ) -> u.dimensionless_unscaled: diff --git a/aiapy/calibrate/spikes.py b/aiapy/calibrate/spikes.py index 058f476..1ee40f6 100644 --- a/aiapy/calibrate/spikes.py +++ b/aiapy/calibrate/spikes.py @@ -1,10 +1,9 @@ import copy import warnings +import astropy.units as u import drms import numpy as np - -import astropy.units as u from astropy.io import fits from astropy.wcs.utils import pixel_to_pixel from sunpy.map.mapbase import PixelPair @@ -15,7 +14,7 @@ __all__ = ["respike", "fetch_spikes"] -def respike(smap, spikes=None): +def respike(smap, *, spikes=None): """ Re-insert "spikes" or "hot pixels" into level 1 AIA images. @@ -110,7 +109,7 @@ def respike(smap, spikes=None): ) -def fetch_spikes(smap, as_coords=False): +def fetch_spikes(smap, *, as_coords=False): """ Returns coordinates and values of removed spikes. diff --git a/aiapy/calibrate/tests/test_meta.py b/aiapy/calibrate/tests/test_meta.py index ba30611..d6ffb43 100644 --- a/aiapy/calibrate/tests/test_meta.py +++ b/aiapy/calibrate/tests/test_meta.py @@ -1,7 +1,6 @@ +import astropy.units as u import numpy as np import pytest - -import astropy.units as u from astropy.coordinates.sky_coordinate import SkyCoord from astropy.table import QTable from astropy.time import Time, TimeDelta diff --git a/aiapy/calibrate/tests/test_prep.py b/aiapy/calibrate/tests/test_prep.py index 2874fdb..297eacb 100644 --- a/aiapy/calibrate/tests/test_prep.py +++ b/aiapy/calibrate/tests/test_prep.py @@ -1,11 +1,10 @@ import copy import tempfile -import numpy as np -import pytest - import astropy.time import astropy.units as u +import numpy as np +import pytest import sunpy.data.test from astropy.io.fits.verify import VerifyWarning from sunpy.map import Map @@ -104,7 +103,7 @@ def test_register_level_15(lvl_15_map): [ pytest.param(None, None, marks=pytest.mark.remote_data), ( - get_correction_table(get_test_filepath("aia_V8_20171210_050627_response_table.txt")), + get_correction_table(correction_table=get_test_filepath("aia_V8_20171210_050627_response_table.txt")), 8, ), ], @@ -121,7 +120,8 @@ def test_correct_degradation(aia_171_map, correction_table, version): correction_table=correction_table, calibration_version=version, ) - uncorrected_over_corrected = aia_171_map.data / original_corrected.data + with np.errstate(divide="ignore", invalid="ignore"): + uncorrected_over_corrected = aia_171_map.data / original_corrected.data # If intensity is zero, ratio will be NaN/infinite i_valid = aia_171_map.data > 0.0 assert np.allclose(uncorrected_over_corrected[i_valid], d) @@ -160,6 +160,7 @@ def test_correct_degradation(aia_171_map, correction_table, version): ), ], ) +@pytest.mark.filterwarnings("ignore:Multiple valid epochs for") def test_degradation(correction_table, version, time_correction_truth): # NOTE: this just tests an expected result from aiapy, not necessarily an # absolutely correct result. It was calculated for the above time and @@ -222,6 +223,7 @@ def test_degradation(correction_table, version, time_correction_truth): ), ], ) +@pytest.mark.filterwarnings("ignore:Multiple valid epochs for") def test_degradation_all_wavelengths(wavelength, result): obstime = astropy.time.Time("2015-01-01T00:00:00", scale="utc") time_correction = degradation( diff --git a/aiapy/calibrate/tests/test_spikes.py b/aiapy/calibrate/tests/test_spikes.py index dc30941..d95205c 100644 --- a/aiapy/calibrate/tests/test_spikes.py +++ b/aiapy/calibrate/tests/test_spikes.py @@ -1,9 +1,8 @@ import copy +import astropy.units as u import numpy as np import pytest - -import astropy.units as u import sunpy.map from astropy.coordinates import SkyCoord from sunpy.map.mapbase import PixelPair diff --git a/aiapy/calibrate/tests/test_uncertainty.py b/aiapy/calibrate/tests/test_uncertainty.py index 5762784..0643d21 100644 --- a/aiapy/calibrate/tests/test_uncertainty.py +++ b/aiapy/calibrate/tests/test_uncertainty.py @@ -1,12 +1,11 @@ from pathlib import Path from contextlib import nullcontext +import astropy.units as u import numpy as np import pytest from numpy.random import default_rng -import astropy.units as u - from aiapy.calibrate import estimate_error from aiapy.calibrate.util import get_error_table from aiapy.tests.data import get_test_filepath diff --git a/aiapy/calibrate/tests/test_util.py b/aiapy/calibrate/tests/test_util.py index 0a0d889..77ecd86 100644 --- a/aiapy/calibrate/tests/test_util.py +++ b/aiapy/calibrate/tests/test_util.py @@ -1,8 +1,7 @@ -import pytest - import astropy.table import astropy.time import astropy.units as u +import pytest from aiapy.calibrate.util import ( _select_epoch_from_correction_table, diff --git a/aiapy/calibrate/uncertainty.py b/aiapy/calibrate/uncertainty.py index bdafa13..42e4c08 100644 --- a/aiapy/calibrate/uncertainty.py +++ b/aiapy/calibrate/uncertainty.py @@ -1,12 +1,12 @@ """ Estimate uncertainty on intensities. """ -import numpy as np - import astropy.units as u +import numpy as np from aiapy.util import telescope_number from aiapy.util.decorators import validate_channel + from .util import get_error_table __all__ = ["estimate_error"] @@ -17,6 +17,7 @@ def estimate_error( counts: u.ct / u.pix, channel: u.angstrom, + *, n_sample=1, include_preflight=False, include_eve=False, @@ -33,7 +34,7 @@ def estimate_error( contributions from the photometric calibration and errors in the atomic data. .. note:: This function is adapted directly from the - `aia_bp_corrections.pro `_ + `aia_bp_corrections.pro `_ routine in SolarSoft. Parameters diff --git a/aiapy/calibrate/util.py b/aiapy/calibrate/util.py index 676c66c..aed96e8 100644 --- a/aiapy/calibrate/util.py +++ b/aiapy/calibrate/util.py @@ -6,10 +6,9 @@ import warnings from urllib.parse import urljoin -import numpy as np - import astropy.io.ascii import astropy.units as u +import numpy as np from astropy.table import QTable from astropy.time import Time from sunpy.data import manager @@ -43,7 +42,7 @@ } -def get_correction_table(correction_table=None): +def get_correction_table(*, correction_table=None): """ Return table of degradation correction factors. @@ -111,7 +110,7 @@ def get_correction_table(correction_table=None): @u.quantity_input @validate_channel("channel") -def _select_epoch_from_correction_table(channel: u.angstrom, obstime, table, version=None): +def _select_epoch_from_correction_table(channel: u.angstrom, obstime, table, *, version=None): """ Return correction table with only the first epoch and the epoch in which `obstime` falls and for only one given calibration version. @@ -197,7 +196,7 @@ def get_pointing_table(start, end): if len(table.columns) == 0: # If there's no pointing information available between these times, # JSOC will raise a cryptic KeyError - # (see https://gitlab.com/LMSAL_HUB/aia_hub/aiapy/-/issues/84) + # (see https://github.com/LM-SAL/aiapy/issues/71) raise RuntimeError(f"Could not find any pointing information between {start} and {end}") table["T_START"] = Time(table["T_START"], scale="utc") table["T_STOP"] = Time(table["T_STOP"], scale="utc") @@ -219,6 +218,7 @@ def get_pointing_table(start, end): def get_error_table(error_table=None): if error_table is None: # This is to work around a parfive bug + # https://github.com/Cadair/parfive/issues/121 os.environ["PARFIVE_DISABLE_RANGE"] = "1" error_table = fetch_error_table() os.environ.pop("PARFIVE_DISABLE_RANGE") diff --git a/aiapy/conftest.py b/aiapy/conftest.py index f5c6a38..492fa45 100644 --- a/aiapy/conftest.py +++ b/aiapy/conftest.py @@ -1,6 +1,5 @@ -import pytest - import astropy.units as u +import pytest import sunpy.data.test import sunpy.map diff --git a/aiapy/data/_sample.py b/aiapy/data/_sample.py index bd4c47d..5b1a300 100644 --- a/aiapy/data/_sample.py +++ b/aiapy/data/_sample.py @@ -2,7 +2,6 @@ from urllib.parse import urljoin from parfive import SessionConfig - from sunpy import log from sunpy.util.config import get_and_create_sample_dir from sunpy.util.parfive_helpers import Downloader @@ -66,7 +65,7 @@ def _handle_final_errors(results): log.error(f"Failed to download {_SAMPLE_FILES[file_name]} from all mirrors," "the file will not be available.") -def download_sample_data(overwrite=False): +def download_sample_data(*, overwrite=False): """ Download all sample data at once. This will overwrite any existing files. diff --git a/aiapy/psf/deconvolve.py b/aiapy/psf/deconvolve.py index a825073..c1abf07 100644 --- a/aiapy/psf/deconvolve.py +++ b/aiapy/psf/deconvolve.py @@ -5,7 +5,6 @@ import warnings import numpy as np - from sunpy import log try: @@ -16,12 +15,13 @@ HAS_CUPY = False from aiapy.util import AiapyUserWarning + from .psf import psf as calculate_psf __all__ = ["deconvolve"] -def deconvolve(smap, psf=None, iterations=25, clip_negative=True, use_gpu=True): +def deconvolve(smap, *, psf=None, iterations=25, clip_negative=True, use_gpu=True): """ Deconvolve an AIA image with the point spread function. diff --git a/aiapy/psf/psf.py b/aiapy/psf/psf.py index a856eb2..c7e75d9 100644 --- a/aiapy/psf/psf.py +++ b/aiapy/psf/psf.py @@ -1,9 +1,8 @@ """ Calculate the point spread function (PSF) for the AIA telescopes. """ -import numpy as np - import astropy.units as u +import numpy as np from sunpy import log from aiapy.util.decorators import validate_channel @@ -18,7 +17,7 @@ __all__ = ["psf", "filter_mesh_parameters", "_psf"] -def filter_mesh_parameters(use_preflightcore=False): +def filter_mesh_parameters(*, use_preflightcore=False): """ Geometric parameters for meshes in AIA filters used to calculate the point spread function. @@ -179,7 +178,7 @@ def filter_mesh_parameters(use_preflightcore=False): @u.quantity_input @validate_channel("channel", valid_channels=[94, 131, 171, 193, 211, 304, 335] * u.angstrom) -def psf(channel: u.angstrom, use_preflightcore=False, diffraction_orders=None, use_gpu=True): +def psf(channel: u.angstrom, *, use_preflightcore=False, diffraction_orders=None, use_gpu=True): r""" Calculate the composite PSF for a given channel, including diffraction and core effects. @@ -300,7 +299,7 @@ def psf(channel: u.angstrom, use_preflightcore=False, diffraction_orders=None, u return psf -def _psf(meshinfo, angles, diffraction_orders, focal_plane=False, use_gpu=True): +def _psf(meshinfo, angles, diffraction_orders, *, focal_plane=False, use_gpu=True): psf = np.zeros((4096, 4096), dtype=float) if use_gpu and not HAS_CUPY: log.info("cupy not installed or working, falling back to CPU") diff --git a/aiapy/psf/tests/conftest.py b/aiapy/psf/tests/conftest.py index ba01b06..1677ab7 100644 --- a/aiapy/psf/tests/conftest.py +++ b/aiapy/psf/tests/conftest.py @@ -1,9 +1,8 @@ """ Shared fixtures for PSF tests. """ -import pytest - import astropy.units as u +import pytest import aiapy.psf diff --git a/aiapy/psf/tests/test_deconvolve.py b/aiapy/psf/tests/test_deconvolve.py index a0448d4..eeefedc 100644 --- a/aiapy/psf/tests/test_deconvolve.py +++ b/aiapy/psf/tests/test_deconvolve.py @@ -1,6 +1,5 @@ import numpy as np import pytest - import sunpy.data.test import sunpy.map diff --git a/aiapy/response/channel.py b/aiapy/response/channel.py index 88bb021..2aced04 100644 --- a/aiapy/response/channel.py +++ b/aiapy/response/channel.py @@ -4,10 +4,9 @@ import collections from urllib.parse import urljoin -import numpy as np - import astropy.constants as const import astropy.units as u +import numpy as np from sunpy.data import manager from sunpy.io.special import read_genx from sunpy.util.metadata import MetaDict @@ -75,7 +74,7 @@ class Channel: @u.quantity_input @validate_channel("channel") - def __init__(self, channel: u.angstrom, instrument_file=None): + def __init__(self, channel: u.angstrom, *, instrument_file=None): self._channel = channel self._instrument_data = self._get_instrument_data(instrument_file) @@ -373,6 +372,7 @@ def gain( @u.quantity_input def wavelength_response( self, + *, obstime=None, include_eve_correction=False, include_crosstalk=True, diff --git a/aiapy/response/tests/test_channel.py b/aiapy/response/tests/test_channel.py index b86e939..f533c5b 100644 --- a/aiapy/response/tests/test_channel.py +++ b/aiapy/response/tests/test_channel.py @@ -1,10 +1,9 @@ import collections from pathlib import Path -import pytest - import astropy.time import astropy.units as u +import pytest from sunpy.util.metadata import MetaDict from aiapy.calibrate.util import get_correction_table @@ -130,7 +129,7 @@ def test_effective_area(channel): 1.0140386988603103 * u.dimensionless_unscaled, ), ( - get_correction_table(get_test_filepath("aia_V8_20171210_050627_response_table.txt")), + get_correction_table(correction_table=get_test_filepath("aia_V8_20171210_050627_response_table.txt")), 8, 1.0140386988603103 * u.dimensionless_unscaled, ), diff --git a/aiapy/util/decorators.py b/aiapy/util/decorators.py index 26312ff..8a09246 100644 --- a/aiapy/util/decorators.py +++ b/aiapy/util/decorators.py @@ -17,7 +17,7 @@ ] -def validate_channel(argument, valid_channels="all"): +def validate_channel(argument, *, valid_channels="all"): """ Parameters ---------- diff --git a/aiapy/util/tests/test_util.py b/aiapy/util/tests/test_util.py index 03477e7..82fb573 100644 --- a/aiapy/util/tests/test_util.py +++ b/aiapy/util/tests/test_util.py @@ -1,5 +1,4 @@ import pytest - from astropy.tests.helper import assert_quantity_allclose import aiapy.util diff --git a/aiapy/util/util.py b/aiapy/util/util.py index 1d68e10..304f8b2 100644 --- a/aiapy/util/util.py +++ b/aiapy/util/util.py @@ -1,10 +1,9 @@ """ Miscellaneous utility functions. """ +import astropy.units as u import drms import numpy as np - -import astropy.units as u from astropy.coordinates import SkyCoord from astropy.time import Time from sunpy.time import parse_time diff --git a/changelog/313.breaking.1.rst b/changelog/313.breaking.1.rst new file mode 100644 index 0000000..7c06beb --- /dev/null +++ b/changelog/313.breaking.1.rst @@ -0,0 +1,2 @@ +All the functions in aiapy, that took keywords have been made to only accept them as keyword arguments. +This means that you can no longer pass them as positional arguments. diff --git a/changelog/313.breaking.2.rst b/changelog/313.breaking.2.rst new file mode 100644 index 0000000..fc51e88 --- /dev/null +++ b/changelog/313.breaking.2.rst @@ -0,0 +1 @@ +Removed ``setup.cfg`` and ``setup.py`` files, this means you will need to use a modern version of pip (23.0 or above) to install this package now. diff --git a/changelog/313.breaking.rst b/changelog/313.breaking.rst new file mode 100644 index 0000000..ba45935 --- /dev/null +++ b/changelog/313.breaking.rst @@ -0,0 +1 @@ +Increased the minimum version of Python to 3.9 diff --git a/examples/calculate_response_function.py b/examples/calculate_response_function.py index 3de8bc2..f69da19 100644 --- a/examples/calculate_response_function.py +++ b/examples/calculate_response_function.py @@ -8,10 +8,9 @@ well as explore the different properties of the telescope channels. """ -import matplotlib.pyplot as plt - import astropy.time import astropy.units as u +import matplotlib.pyplot as plt from aiapy.response import Channel diff --git a/examples/download_specific_data.py b/examples/download_specific_data.py index 9ba44d7..8ff121c 100644 --- a/examples/download_specific_data.py +++ b/examples/download_specific_data.py @@ -14,10 +14,9 @@ import os from pathlib import Path +import astropy.units as u import drms import matplotlib.pyplot as plt - -import astropy.units as u import sunpy.map from aiapy.calibrate import correct_degradation, register, update_pointing diff --git a/examples/instrument_degradation.py b/examples/instrument_degradation.py index 7b38e85..d7d5ea6 100644 --- a/examples/instrument_degradation.py +++ b/examples/instrument_degradation.py @@ -8,11 +8,10 @@ lifetime of the instrument. """ -import matplotlib.pyplot as plt -import numpy as np - import astropy.time import astropy.units as u +import matplotlib.pyplot as plt +import numpy as np from astropy.visualization import time_support from aiapy.calibrate import degradation diff --git a/examples/replace_hot_pixels.py b/examples/replace_hot_pixels.py index 01bb79b..c61ea9a 100644 --- a/examples/replace_hot_pixels.py +++ b/examples/replace_hot_pixels.py @@ -6,9 +6,8 @@ This example demonstrates how to "re-spike" AIA level 1 images """ -import matplotlib.pyplot as plt - import astropy.units as u +import matplotlib.pyplot as plt import sunpy.map from astropy.coordinates import SkyCoord @@ -99,7 +98,7 @@ lon, lat = ax.coords lon.set_axislabel("HPC Longitude") lat.set_axislabel(" ") -lat.set_ticklabel_visible(False) +lat.set_ticklabel_visible(visible=False) plt.show() ########################################################### diff --git a/examples/skip_correct_degradation.py b/examples/skip_correct_degradation.py index b6ba371..2c57e0e 100644 --- a/examples/skip_correct_degradation.py +++ b/examples/skip_correct_degradation.py @@ -6,10 +6,9 @@ This example demonstrates the degradation of the filters on AIA over time. """ -import matplotlib.pyplot as plt - import astropy.time import astropy.units as u +import matplotlib.pyplot as plt from astropy.visualization import quantity_support, time_support from sunpy.net import Fido from sunpy.net import attrs as a diff --git a/examples/skip_psf_deconvolution.py b/examples/skip_psf_deconvolution.py index 22dcd4f..455b9f4 100644 --- a/examples/skip_psf_deconvolution.py +++ b/examples/skip_psf_deconvolution.py @@ -6,9 +6,8 @@ This example demonstrates how to deconvolve an AIA image with the instrument point spread function (PSF). """ -import matplotlib.pyplot as plt - import astropy.units as u +import matplotlib.pyplot as plt import sunpy.map from astropy.coordinates import SkyCoord from astropy.visualization import AsinhStretch, ImageNormalize, LogStretch @@ -84,7 +83,7 @@ m_deconvolved.plot(axes=ax, annotate=False, norm=norm) ax.coords[0].set_axislabel(" ") ax.coords[1].set_axislabel(" ") -ax.coords[1].set_ticklabel_visible(False) +ax.coords[1].set_ticklabel_visible(visible=False) plt.show() ################################################# @@ -107,5 +106,5 @@ m_deconvolved_sub.plot(axes=ax, annotate=False, norm=norm) ax.coords[0].set_axislabel(" ") ax.coords[1].set_axislabel(" ") -ax.coords[1].set_ticklabel_visible(False) +ax.coords[1].set_ticklabel_visible(visible=False) plt.show() diff --git a/joss/aia_V10_20201023_180000_response_table.txt b/joss/aia_V10_20201023_180000_response_table.txt deleted file mode 100644 index 18736fb..0000000 --- a/joss/aia_V10_20201023_180000_response_table.txt +++ /dev/null @@ -1,65 +0,0 @@ - DATE T_START T_STOP VER_NUM WAVE_STR WAVELNTH EPERDN DNPERPHT EFF_AREA EFF_WVLN EFFA_P1 EFFA_P2 EFFA_P3 RMSE - 2020-10-26T00:14:21.733 2010-03-24T00:00:00.000 2011-01-27T15:00:00.000 10 94_THIN 94 18.30 1.97671 0.29808 93.90 0.000636 0.000000 0.000000 0.050000 - 2020-10-26T00:14:21.733 2011-01-27T15:00:00.000 2011-04-13T18:00:00.000 10 94_THIN 94 18.30 1.97671 0.35289 93.90 -0.001326 0.000000 0.000000 0.050000 - 2020-10-26T00:14:21.733 2011-04-13T18:00:00.000 2011-05-20T18:00:00.000 10 94_THIN 94 18.30 1.97671 0.31681 93.90 -0.001575 0.000000 0.000000 0.050000 - 2020-10-26T00:14:21.733 2011-05-20T18:00:00.000 2011-10-06T12:00:00.000 10 94_THIN 94 18.30 1.97671 0.28736 93.90 0.000484 0.000000 0.000000 0.050000 - 2020-10-26T00:14:21.733 2011-10-06T12:00:00.000 2012-04-10T12:00:00.000 10 94_THIN 94 18.30 1.97671 0.30448 93.90 -0.000144 0.000000 0.000000 0.050000 - 2020-10-26T00:14:21.733 2012-04-10T12:00:00.000 2013-02-15T12:00:00.000 10 94_THIN 94 18.30 1.97671 0.29629 93.90 -0.000184 0.000000 0.000000 0.050000 - 2020-10-26T00:14:21.733 2013-02-15T12:00:00.000 2014-05-25T12:00:00.000 10 94_THIN 94 18.30 1.97671 0.27933 93.90 -0.000078 0.000000 0.000000 0.050000 - 2020-10-26T00:14:21.733 2014-05-25T12:00:00.000 2015-05-01T12:00:00.000 10 94_THIN 94 18.30 1.97671 0.26922 93.90 0.000000 0.000000 0.000000 0.050000 - 2020-10-26T00:14:21.733 2015-05-01T12:00:00.000 2018-06-18T18:00:00.000 10 94_THIN 94 18.30 1.97671 0.26922 93.90 0.000000 0.000000 0.000000 0.050000 - 2020-10-26T00:14:21.733 2018-06-18T18:00:00.000 2020-06-01T12:00:00.000 10 94_THIN 94 18.30 1.97671 0.26922 93.90 0.000000 0.000000 0.000000 0.050000 - 2020-10-26T00:14:21.733 2020-06-01T12:00:00.000 2030-05-01T00:00:00.000 10 94_THIN 94 18.30 1.97671 0.26922 93.90 0.000000 0.000000 0.000000 0.050000 - 2020-10-26T00:14:21.733 2010-03-24T00:00:00.000 2011-02-24T19:00:00.000 10 131_THIN 131 17.60 1.47100 1.22350 131.20 -0.000383 0.000000 0.000000 0.050000 - 2020-10-26T00:14:21.733 2011-02-24T19:00:00.000 2012-04-10T12:00:00.000 10 131_THIN 131 17.60 1.47100 1.08703 131.20 -0.000236 0.000000 0.000000 0.050000 - 2020-10-26T00:14:21.733 2012-04-10T12:00:00.000 2013-02-15T12:00:00.000 10 131_THIN 131 17.60 1.47100 1.03331 131.20 -0.000232 0.000000 0.000000 0.050000 - 2020-10-26T00:14:21.733 2013-02-15T12:00:00.000 2014-05-25T12:00:00.000 10 131_THIN 131 17.60 1.47100 0.95862 131.20 -0.000124 0.000000 0.000000 0.050000 - 2020-10-26T00:14:21.733 2014-05-25T12:00:00.000 2015-05-01T12:00:00.000 10 131_THIN 131 17.60 1.47100 0.90339 131.20 -0.000373 0.000000 0.000000 0.050000 - 2020-10-26T00:14:21.733 2015-05-01T12:00:00.000 2018-06-18T18:00:00.000 10 131_THIN 131 17.60 1.47100 0.78864 131.20 -0.000172 0.000000 0.000000 0.050000 - 2020-10-26T00:14:21.733 2018-06-18T18:00:00.000 2020-06-01T12:00:00.000 10 131_THIN 131 17.60 1.47100 0.63342 131.20 -0.000028 0.000000 0.000000 0.050000 - 2020-10-26T00:14:21.733 2020-06-01T12:00:00.000 2030-05-01T00:00:00.000 10 131_THIN 131 17.60 1.47100 0.62055 131.20 0.000000 0.000000 0.000000 0.050000 - 2020-10-26T00:14:21.733 2010-03-24T00:00:00.000 2011-01-27T15:00:00.000 10 171_THIN 171 17.70 1.12159 2.78926 171.10 -0.000020 0.000000 0.000000 0.050000 - 2020-10-26T00:14:21.733 2011-01-27T15:00:00.000 2012-04-10T12:00:00.000 10 171_THIN 171 17.70 1.12159 2.77160 171.10 -0.000054 0.000000 0.000000 0.050000 - 2020-10-26T00:14:21.733 2012-04-10T12:00:00.000 2013-02-15T12:00:00.000 10 171_THIN 171 17.70 1.12159 2.70570 171.10 -0.000282 0.000000 0.000000 0.050000 - 2020-10-26T00:14:21.733 2013-02-15T12:00:00.000 2014-05-25T12:00:00.000 10 171_THIN 171 17.70 1.12159 2.46826 171.10 -0.000030 0.000000 0.000000 0.050000 - 2020-10-26T00:14:21.733 2014-05-25T12:00:00.000 2015-05-01T12:00:00.000 10 171_THIN 171 17.70 1.12159 2.43424 171.10 -0.000446 0.000000 0.000000 0.050000 - 2020-10-26T00:14:21.733 2015-05-01T12:00:00.000 2018-06-18T18:00:00.000 10 171_THIN 171 17.70 1.12159 2.06386 171.10 0.000000 0.000000 0.000000 0.050000 - 2020-10-26T00:14:21.733 2018-06-18T18:00:00.000 2020-06-01T12:00:00.000 10 171_THIN 171 17.70 1.12159 2.06386 171.10 0.000000 0.000000 0.000000 0.050000 - 2020-10-26T00:14:21.733 2020-06-01T12:00:00.000 2030-05-01T00:00:00.000 10 171_THIN 171 17.70 1.12159 2.06386 171.10 0.000000 0.000000 0.000000 0.050000 - 2020-10-26T00:14:21.733 2010-03-24T00:00:00.000 2011-01-27T15:00:00.000 10 193_THIN 193 18.30 0.95137 1.43232 195.10 -0.000060 0.000000 0.000000 0.050000 - 2020-10-26T00:14:21.733 2011-01-27T15:00:00.000 2012-04-10T12:00:00.000 10 193_THIN 193 18.30 0.95137 1.41911 195.10 -0.000146 0.000000 0.000000 0.050000 - 2020-10-26T00:14:21.733 2012-04-10T12:00:00.000 2013-02-15T12:00:00.000 10 193_THIN 193 18.30 0.95137 1.37233 195.10 -0.000083 0.000000 0.000000 0.050000 - 2020-10-26T00:14:21.733 2013-02-15T12:00:00.000 2014-05-25T12:00:00.000 10 193_THIN 193 18.30 0.95137 1.33028 195.10 -0.000140 0.000000 0.000000 0.050000 - 2020-10-26T00:14:21.733 2014-05-25T12:00:00.000 2015-05-01T12:00:00.000 10 193_THIN 193 18.30 0.95137 1.24372 195.10 -0.000034 0.000000 0.000000 0.050000 - 2020-10-26T00:14:21.733 2015-05-01T12:00:00.000 2018-06-18T18:00:00.000 10 193_THIN 193 18.30 0.95137 1.22925 195.10 -0.000219 0.000000 0.000000 0.050000 - 2020-10-26T00:14:21.733 2018-06-18T18:00:00.000 2020-06-01T12:00:00.000 10 193_THIN 193 18.30 0.95137 0.92133 195.10 -0.000327 0.000000 0.000000 0.050000 - 2020-10-26T00:14:21.733 2020-06-01T12:00:00.000 2030-05-01T00:00:00.000 10 193_THIN 193 18.30 0.95137 0.70620 195.10 0.000000 0.000000 0.000000 0.050000 - 2020-10-26T00:14:21.733 2010-03-24T00:00:00.000 2011-01-27T15:00:00.000 10 211_THIN 211 18.30 0.87843 1.30673 211.30 -0.000132 0.000000 0.000000 0.050000 - 2020-10-26T00:14:21.733 2011-01-27T15:00:00.000 2012-04-10T12:00:00.000 10 211_THIN 211 18.30 0.87843 1.29028 211.30 -0.000277 0.000000 0.000000 0.050000 - 2020-10-26T00:14:21.733 2012-04-10T12:00:00.000 2013-02-15T12:00:00.000 10 211_THIN 211 18.30 0.87843 1.18173 211.30 -0.000165 0.000000 0.000000 0.050000 - 2020-10-26T00:14:21.733 2013-02-15T12:00:00.000 2014-05-25T12:00:00.000 10 211_THIN 211 18.30 0.87843 1.06385 211.30 0.000042 0.000000 0.000000 0.050000 - 2020-10-26T00:14:21.733 2014-05-25T12:00:00.000 2015-05-01T12:00:00.000 10 211_THIN 211 18.30 0.87843 1.08457 211.30 0.000000 0.000000 0.000000 0.050000 - 2020-10-26T00:14:21.733 2015-05-01T12:00:00.000 2018-06-18T18:00:00.000 10 211_THIN 211 18.30 0.87843 1.08457 211.30 -0.000231 0.000000 0.000000 0.050000 - 2020-10-26T00:14:21.733 2018-06-18T18:00:00.000 2020-06-01T12:00:00.000 10 211_THIN 211 18.30 0.87843 0.79850 211.30 -0.000479 0.000000 0.000000 0.050000 - 2020-10-26T00:14:21.733 2020-06-01T12:00:00.000 2030-05-01T00:00:00.000 10 211_THIN 211 18.30 0.87843 0.52561 211.30 0.000000 0.000000 0.000000 0.050000 - 2020-10-26T00:14:21.733 2010-03-24T00:00:00.000 2011-01-27T15:00:00.000 10 304_THIN 304 18.30 0.61097 0.10250 303.80 -0.001566 0.000000 0.000000 0.050000 - 2020-10-26T00:14:21.733 2011-01-27T15:00:00.000 2011-04-13T18:00:00.000 10 304_THIN 304 18.30 0.61097 0.06487 303.80 -0.003126 0.000000 0.000000 0.050000 - 2020-10-26T00:14:21.733 2011-04-13T18:00:00.000 2011-05-20T18:00:00.000 10 304_THIN 304 18.30 0.61097 0.05215 303.80 -0.002991 0.000000 0.000000 0.050000 - 2020-10-26T00:14:21.733 2011-05-20T18:00:00.000 2011-10-06T12:00:00.000 10 304_THIN 304 18.30 0.61097 0.04615 303.80 -0.002552 0.000000 0.000000 0.050000 - 2020-10-26T00:14:21.733 2011-10-06T12:00:00.000 2012-04-10T12:00:00.000 10 304_THIN 304 18.30 0.61097 0.03122 303.80 0.000182 0.000000 0.000000 0.050000 - 2020-10-26T00:14:21.733 2012-04-10T12:00:00.000 2012-10-01T12:00:00.000 10 304_THIN 304 18.30 0.61097 0.03228 303.80 0.001041 0.000000 0.000000 0.050000 - 2020-10-26T00:14:21.733 2012-10-01T12:00:00.000 2013-02-15T12:00:00.000 10 304_THIN 304 18.30 0.61097 0.03813 303.80 -0.000122 0.000000 0.000000 0.050000 - 2020-10-26T00:14:21.733 2013-02-15T12:00:00.000 2014-05-25T12:00:00.000 10 304_THIN 304 18.30 0.61097 0.03749 303.80 -0.000812 0.000000 0.000000 0.050000 - 2020-10-26T00:14:21.733 2014-05-25T12:00:00.000 2015-05-01T12:00:00.000 10 304_THIN 304 18.30 0.61097 0.02336 303.80 -0.001565 0.000000 0.000000 0.050000 - 2020-10-26T00:14:21.733 2015-05-01T12:00:00.000 2018-06-18T18:00:00.000 10 304_THIN 304 18.30 0.61097 0.01090 303.80 -0.000418 0.000000 0.000000 0.050000 - 2020-10-26T00:14:21.733 2018-06-18T18:00:00.000 2020-06-01T12:00:00.000 10 304_THIN 304 18.30 0.61097 0.00569 303.80 0.000000 0.000000 0.000000 0.050000 - 2020-10-26T00:14:21.733 2020-06-01T12:00:00.000 2030-05-01T00:00:00.000 10 304_THIN 304 18.30 0.61097 0.00569 303.80 0.000000 0.000000 0.000000 0.050000 - 2020-10-26T00:14:21.733 2010-03-24T00:00:00.000 2011-02-24T19:00:00.000 10 335_THIN 335 17.60 0.57542 0.05684 335.40 -0.000753 0.000000 0.000000 0.050000 - 2020-10-26T00:14:21.733 2011-02-24T19:00:00.000 2012-04-10T12:00:00.000 10 335_THIN 335 17.60 0.57542 0.06111 335.40 -0.000913 0.000000 0.000000 0.050000 - 2020-10-26T00:14:21.733 2012-04-10T12:00:00.000 2012-10-01T12:00:00.000 10 335_THIN 335 17.60 0.57542 0.04594 335.40 -0.001170 0.000000 0.000000 0.050000 - 2020-10-26T00:14:21.733 2012-10-01T12:00:00.000 2013-02-15T12:00:00.000 10 335_THIN 335 17.60 0.57542 0.03659 335.40 -0.000930 0.000000 0.000000 0.050000 - 2020-10-26T00:14:21.733 2013-02-15T12:00:00.000 2014-05-25T12:00:00.000 10 335_THIN 335 17.60 0.57542 0.03193 335.40 -0.000659 0.000000 0.000000 0.050000 - 2020-10-26T00:14:21.733 2014-05-25T12:00:00.000 2015-05-01T12:00:00.000 10 335_THIN 335 17.60 0.57542 0.02216 335.40 -0.000733 0.000000 0.000000 0.050000 - 2020-10-26T00:14:21.733 2015-05-01T12:00:00.000 2018-06-18T18:00:00.000 10 335_THIN 335 17.60 0.57542 0.01662 335.40 -0.000287 0.000000 0.000000 0.050000 - 2020-10-26T00:14:21.733 2018-06-18T18:00:00.000 2020-06-01T12:00:00.000 10 335_THIN 335 17.60 0.57542 0.01116 335.40 -0.000172 0.000000 0.000000 0.050000 - 2020-10-26T00:14:21.733 2020-06-01T12:00:00.000 2030-05-01T00:00:00.000 10 335_THIN 335 17.60 0.57542 0.00979 335.40 0.000000 0.000000 0.000000 0.050000 diff --git a/joss/figure-1.pdf b/joss/figure-1.pdf deleted file mode 100644 index 9797e3e..0000000 Binary files a/joss/figure-1.pdf and /dev/null differ diff --git a/joss/make_figure.py b/joss/make_figure.py deleted file mode 100644 index 30c1665..0000000 --- a/joss/make_figure.py +++ /dev/null @@ -1,99 +0,0 @@ -""" -Make the figure for the JOSS paper. -""" - -import matplotlib.pyplot as plt -import numpy as np - -import astropy.time -import astropy.units as u -import sunpy.map -from astropy.coordinates import SkyCoord -from astropy.visualization import AsinhStretch, ImageNormalize, time_support -from sunpy.net import Fido, attrs - -from aiapy.calibrate import degradation -from aiapy.psf import deconvolve -from aiapy.response import Channel - -channels = [94, 131, 171, 193, 211, 304, 335] * u.angstrom - -# Query data, deconvolve, and crop -q = Fido.search( - attrs.Time("2011-06-07T06:52:00", "2011-06-07T06:52:10"), - attrs.Instrument("AIA"), - attrs.Wavelength(wavemin=171 * u.angstrom, wavemax=171 * u.angstrom), -) -f = Fido.fetch(q) -m = sunpy.map.Map(f) -# NOTE: this is slow without a GPU -m_decon = deconvolve(m) -left_corner = 500 * u.arcsec, -600 * u.arcsec -right_corner = 1000 * u.arcsec, -100 * u.arcsec -m_sub = m.submap( - SkyCoord(*left_corner, frame=m.coordinate_frame), - top_right=SkyCoord(*right_corner, frame=m.coordinate_frame), -) -m_decon_sub = m_sub.submap( - SkyCoord(*left_corner, frame=m_decon.coordinate_frame), - top_right=SkyCoord(*right_corner, frame=m_decon.coordinate_frame), -) - -# Wavelength response -wave_response = {} -for c in channels: - chan = Channel(c) - wave_response[c] = (chan.wavelength, chan.wavelength_response()) - -# Degradation -time_0 = astropy.time.Time("2010-03-25T00:00:00", scale="utc") -now = astropy.time.Time.now() -time = time_0 + np.arange(0, (now - time_0).to(u.day).value, 7) * u.day -degrad = { - c: degradation( - c, - time, - calibration_version=10, - correction_table="./aia_V10_20201023_180000_response_table.txt", - ) - for c in channels -} - -fig = plt.figure(figsize=(8, 8)) -norm = ImageNormalize(vmin=0, vmax=1.5e4, stretch=AsinhStretch(0.01)) -# Image before deconvolution -ax = fig.add_subplot(221, projection=m_sub) -m_sub.plot(axes=ax, title=r"171 $\mathrm{\AA}$ Level 1", norm=norm) -ax.grid(alpha=0) -# Image after deconvolution -ax = fig.add_subplot(222, projection=m_decon_sub) -m_decon_sub.plot(axes=ax, title=r"171 $\mathrm{\AA}$ Level 1, Deconvolved", norm=norm) -ax.grid(alpha=0) -lon, lat = ax.coords -lat.set_axislabel(" ") -lat.set_ticklabel_visible(False) -# Degradation Curve -ax = fig.add_subplot(223) -with time_support(format="jyear"): - for c in channels: - ax.plot( - time, - degrad[c], - ) - ax.set_xlim(time[[0, -1]]) -ax.set_xlabel("Date") -ax.set_ylabel("Degradation") -# Wavelength response -ax = fig.add_subplot(224) -for _i, c in enumerate(channels): - w, r = wave_response[c] - ax.plot(w, r, label=f'{c.value:.0f} {c.unit.to_string(format="latex")}') -ax.set_yscale("log") -ax.set_xlim(80, 360) -ax.set_ylim(1e-3, 5) -ax.legend(frameon=False) -ax.set_xlabel(f'Wavelength [{w.unit.to_string(format="latex")}]') -ax.set_ylabel(f'Response [{r.unit.to_string(format="latex")}]') -# Save figure -plt.subplots_adjust(wspace=0.22) -plt.savefig("figure-1.pdf") diff --git a/joss/matplotlibrc b/joss/matplotlibrc deleted file mode 100644 index 7fb0936..0000000 --- a/joss/matplotlibrc +++ /dev/null @@ -1,17 +0,0 @@ -font.family : serif -font.serif : Computer Modern -text.usetex : True -axes.titlesize : 10 -axes.labelsize : 10 -legend.fontsize : 8 -xtick.labelsize : 8 -ytick.labelsize : 8 -xtick.major.pad : 3 -xtick.minor.pad : 3 -ytick.major.pad : 3 -ytick.minor.pad : 3 -xtick.direction : in -ytick.direction : in -savefig.dpi : 200 -savefig.format : pdf -savefig.bbox : tight diff --git a/joss/paper.bib b/joss/paper.bib deleted file mode 100644 index 19e0096..0000000 --- a/joss/paper.bib +++ /dev/null @@ -1,158 +0,0 @@ -@article{lemen_atmospheric_2012, - title = {The {{Atmospheric Imaging Assembly}} ({{AIA}}) on the {{Solar Dynamics Observatory}} ({{SDO}})}, - author = {Lemen, James R. and Title, Alan M. and Akin, David J. and Boerner, Paul F. and Chou, Catherine and Drake, Jerry F. and Duncan, Dexter W. and Edwards, Christopher G. and Friedlaender, Frank M. and Heyman, Gary F. and Hurlburt, Neal E. and Katz, Noah L. and Kushner, Gary D. and Levay, Michael and Lindgren, Russell W. and Mathur, Dnyanesh P. and McFeaters, Edward L. and Mitchell, Sarah and Rehse, Roger A. and Schrijver, Carolus J. and Springer, Larry A. and Stern, Robert A. and Tarbell, Theodore D. and Wuelser, Jean-Pierre and Wolfson, C. Jacob and Yanari, Carl and Bookbinder, Jay A. and Cheimets, Peter N. and Caldwell, David and Deluca, Edward E. and Gates, Richard and Golub, Leon and Park, Sang and Podgorski, William A. and Bush, Rock I. and Scherrer, Philip H. and Gummin, Mark A. and Smith, Peter and Auker, Gary and Jerram, Paul and Pool, Peter and Soufli, Regina and Windt, David L. and Beardsley, Sarah and Clapp, Matthew and Lang, James and Waltham, Nicholas}, - year = {2012}, - month = jan, - volume = {275}, - pages = {17--40}, - issn = {0038-0938, 1573-093X}, - doi = {10.1007/s11207-011-9776-8}, - journal = {Solar Physics}, - language = {en}, - number = {1-2} -} - -@article{pesnell_solar_2012, - title = {The {{Solar Dynamics Observatory}} ({{SDO}})}, - author = {Pesnell, W. Dean and Thompson, B. J. and Chamberlin, P. C.}, - year = {2012}, - month = jan, - volume = {275}, - pages = {3--15}, - issn = {0038-0938}, - doi = {10.1007/s11207-011-9841-3}, - journal = {Solar Physics} -} - -@article{boerner_initial_2012, - title = {Initial {{Calibration}} of the {{Atmospheric Imaging Assembly}} ({{AIA}}) on the {{Solar Dynamics Observatory}} ({{SDO}})}, - author = {Boerner, Paul and Edwards, Christopher and Lemen, James and Rausch, Adam and Schrijver, Carolus and Shine, Richard and Shing, Lawrence and Stern, Robert and Tarbell, Theodore and Title, Alan and Wolfson, C. Jacob and Soufli, Regina and Spiller, Eberhard and Gullikson, Eric and McKenzie, David and Windt, David and Golub, Leon and Podgorski, William and Testa, Paola and Weber, Mark}, - year = {2012}, - month = jan, - volume = {275}, - pages = {41--66}, - issn = {0038-0938, 1573-093X}, - doi = {10.1007/s11207-011-9804-8}, - journal = {Solar Physics}, - language = {en}, - number = {1-2} -} - -@article{schou_design_2012, - title = {Design and {{Ground Calibration}} of the {{Helioseismic}} and {{Magnetic Imager}} ({{HMI}}) {{Instrument}} on the {{Solar Dynamics Observatory}} ({{SDO}})}, - author = {Schou, J. and Scherrer, P. H. and Bush, R. I. and Wachter, R. and Couvidat, S. and {Rabello-Soares}, M. C. and Bogart, R. S. and Hoeksema, J. T. and Liu, Y. and Duvall, T. L. and Akin, D. J. and Allard, B. A. and Miles, J. W. and Rairden, R. and Shine, R. A. and Tarbell, T. D. and Title, A. M. and Wolfson, C. J. and Elmore, D. F. and Norton, A. A. and Tomczyk, S.}, - year = {2012}, - month = jan, - volume = {275}, - pages = {229--259}, - issn = {1573-093X}, - doi = {10.1007/s11207-011-9842-2}, - journal = {Solar Physics}, - language = {en}, - number = {1} -} - -@article{woods_extreme_2012, - title = {Extreme {{Ultraviolet Variability Experiment}} ({{EVE}}) on the {{Solar Dynamics Observatory}} ({{SDO}}): {{Overview}} of {{Science Objectives}}, {{Instrument Design}}, {{Data Products}}, and {{Model Developments}}}, - shorttitle = {Extreme {{Ultraviolet Variability Experiment}} ({{EVE}}) on the {{Solar Dynamics Observatory}} ({{SDO}})}, - author = {Woods, T. N. and Eparvier, F. G. and Hock, R. and Jones, A. R. and Woodraska, D. and Judge, D. and Didkovsky, L. and Lean, J. and Mariska, J. and Warren, H. and McMullin, D. and Chamberlin, P. and Berthiaume, G. and Bailey, S. and {Fuller-Rowell}, T. and Sojka, J. and Tobiska, W. K. and Viereck, R.}, - year = {2012}, - month = jan, - volume = {275}, - pages = {115--143}, - doi = {10.1007/s11207-009-9487-6}, - journal = {Solar Physics} -} - -@article{sunpy_project_sunpy_2020, - title = {The {{SunPy Project}}: {{Open Source Development}} and {{Status}} of the {{Version}} 1.0 {{Core Package}}}, - shorttitle = {The {{SunPy Project}}}, - author = {{SunPy Project} and Barnes, Will T. and Bobra, Monica G. and Christe, Steven D. and Freij, Nabil and Hayes, Laura A. and Ireland, Jack and Mumford, Stuart and {Perez-Suarez}, David and Ryan, Daniel F. and Shih, Albert Y. and Chanda, Prateek and Glogowski, Kolja and Hewett, Russell and Hughitt, V. Keith and Hill, Andrew and Hiware, Kaustubh and Inglis, Andrew and Kirk, Michael S. F. and Konge, Sudarshan and Mason, James Paul and Maloney, Shane Anthony and Murray, Sophie A. and Panda, Asish and Park, Jongyeob and Pereira, Tiago M. D. and Reardon, Kevin and Savage, Sabrina and Sip{\H o}cz, Brigitta M. and Stansby, David and Jain, Yash and Taylor, Garrison and Yadav, Tannmay and {Rajul} and Dang, Trung Kien}, - year = {2020}, - month = feb, - volume = {890}, - pages = {68}, - doi = {10.3847/1538-4357/ab4f7a}, - journal = {The Astrophysical Journal} -} - -@article{the_astropy_collaboration_astropy_2018, - title = {The {{Astropy Project}}: {{Building}} an {{Open}}-Science {{Project}} and {{Status}} of the v2.0 {{Core Package}}}, - shorttitle = {The {{Astropy Project}}}, - author = {{The Astropy Collaboration} and {Price-Whelan}, A. M. and Sip{\H o}cz, B. M. and G{\"u}nther, H. M. and Lim, P. L. and Crawford, S. M. and Conseil, S. and Shupe, D. L. and Craig, M. W. and Dencheva, N. and Ginsburg, A. and VanderPlas, J. T. and Bradley, L. D. and {P{\'e}rez-Su{\'a}rez}, D. and {de Val-Borro}, M. and Paper Contributors, (Primary and Aldcroft, T. L. and Cruz, K. L. and Robitaille, T. P. and Tollerud, E. J. and Coordination Committee, (Astropy and Ardelean, C. and Babej, T. and Bach, Y. P. and Bachetti, M. and Bakanov, A. V. and Bamford, S. P. and Barentsen, G. and Barmby, P. and Baumbach, A. and Berry, K. L. and Biscani, F. and Boquien, M. and Bostroem, K. A. and Bouma, L. G. and Brammer, G. B. and Bray, E. M. and Breytenbach, H. and Buddelmeijer, H. and Burke, D. J. and Calderone, G. and Cano Rodr{\'i}guez, J. L. and Cara, M. and Cardoso, J. V. M. and Cheedella, S. and Copin, Y. and Corrales, L. and Crichton, D. and D'Avella, D. and Deil, C. and Depagne, {\'E}. and Dietrich, J. P. and Donath, A. and Droettboom, M. and Earl, N. and Erben, T. and Fabbro, S. and Ferreira, L. A. and Finethy, T. and Fox, R. T. and Garrison, L. H. and Gibbons, S. L. J. and Goldstein, D. A. and Gommers, R. and Greco, J. P. and Greenfield, P. and Groener, A. M. and Grollier, F. and Hagen, A. and Hirst, P. and Homeier, D. and Horton, A. J. and Hosseinzadeh, G. and Hu, L. and Hunkeler, J. S. and Ivezi{\'c}, {\v Z}. and Jain, A. and Jenness, T. and Kanarek, G. and Kendrew, S. and Kern, N. S. and Kerzendorf, W. E. and Khvalko, A. and King, J. and Kirkby, D. and Kulkarni, A. M. and Kumar, A. and Lee, A. and Lenz, D. and Littlefair, S. P. and Ma, Z. and Macleod, D. M. and Mastropietro, M. and McCully, C. and Montagnac, S. and Morris, B. M. and Mueller, M. and Mumford, S. J. and Muna, D. and Murphy, N. A. and Nelson, S. and Nguyen, G. H. and Ninan, J. P. and N{\"o}the, M. and Ogaz, S. and Oh, S. and Parejko, J. K. and Parley, N. and Pascual, S. and Patil, R. and Patil, A. A. and Plunkett, A. L. and Prochaska, J. X. and Rastogi, T. and Reddy Janga, V. and Sabater, J. and Sakurikar, P. and Seifert, M. and Sherbert, L. E. and {Sherwood-Taylor}, H. and Shih, A. Y. and Sick, J. and Silbiger, M. T. and Singanamalla, S. and Singer, L. P. and Sladen, P. H. and Sooley, K. A. and Sornarajah, S. and Streicher, O. and Teuben, P. and Thomas, S. W. and Tremblay, G. R. and Turner, J. E. H. and Terr{\'o}n, V. and {van Kerkwijk}, M. H. and {de la Vega}, A. and Watkins, L. L. and Weaver, B. A. and Whitmore, J. B. and Woillez, J. and Zabalza, V. and Contributors, (Astropy}, - year = {2018}, - month = sep, - volume = {156}, - pages = {123}, - issn = {0004-6256}, - doi = {10.3847/1538-3881/aabc4f}, - journal = {The Astronomical Journal} -} - -@article{wells_fits_1981, - title = {{{FITS}} - a {{Flexible Image Transport System}}}, - author = {Wells, D. C. and Greisen, E. W. and Harten, R. H.}, - year = {1981}, - month = jun, - volume = {44}, - pages = {363}, - issn = {0365-0138}, - journal = {Astronomy and Astrophysics Supplement Series} -} - -@article{glogowski_drms_2019, - title = {Drms: {{A Python}} Package for Accessing {{HMI}} and {{AIA}} Data}, - author = {Glogowski, Kolja and Bobra, Monica and Choudhary, Nitin and Amezcua, Arthur and Mumford, Stuart}, - year = {2019}, - month = aug, - volume = {4}, - pages = {1614}, - issn = {2475-9066}, - doi = {10.21105/joss.01614}, - journal = {Journal of Open Source Software}, - number = {40} -} - -@article{bobra_survey_2020, - title = {A {{Survey}} of {{Computational Tools}} in {{Solar Physics}}}, - author = {Bobra, Monica G. and Mumford, Stuart J. and Hewett, Russell J. and Christe, Steven D. and Reardon, Kevin and Savage, Sabrina and Ireland, Jack and Pereira, Tiago M. D. and Chen, Bin and {P{\'e}rez-Su{\'a}rez}, David}, - year = {2020}, - month = apr, - volume = {295}, - pages = {57}, - issn = {1573-093X}, - doi = {10.1007/s11207-020-01622-2}, - journal = {Solar Physics}, - language = {en}, - number = {4} -} - -@inproceedings{cupy_learningsys2017, - title = {{{CuPy}}: {{A NumPy}}-{{Compatible}} Library for {{NVIDIA GPU}} Calculations}, - booktitle = {Proceedings of Workshop on Machine Learning Systems ({{LearningSys}}) in the Thirty-First Annual Conference on Neural Information Processing Systems ({{NIPS}})}, - author = {Okuta, Ryosuke and Unno, Yuya and Nishino, Daisuke and Hido, Shohei and Loomis, Crissman}, - year = {2017} -} - -@article{freeland_data_1998, - title = {Data {{Analysis}} with the {{SolarSoft System}}}, - author = {Freeland, S. L. and Handy, B. N.}, - year = {1998}, - month = oct, - volume = {182}, - pages = {497--500}, - issn = {0038-0938}, - doi = {10.1023/A:1005038224881}, - journal = {Solar Physics} -} - -@article{dere_chianti_1997, - title = {{{CHIANTI}} - an Atomic Database for Emission Lines - {{I}}. {{Wavelengths}} Greater than 50 {{\AA}}}, - author = {Dere, K. P. and Landi, E. and Mason, H. E. and Fossi, B. C. Monsignori and Young, P. R.}, - year = {1997}, - volume = {125}, - pages = {25}, - doi = {10.1051/aas:1997368}, - journal = {Astronomy and Astrophysics Supplement Series}, - number = {1} -} diff --git a/joss/paper.md b/joss/paper.md deleted file mode 100644 index 664cca4..0000000 --- a/joss/paper.md +++ /dev/null @@ -1,134 +0,0 @@ ---- -title: "aiapy: A Python Package for Analyzing Solar EUV Image Data from AIA" -tags: -- Python -- Astronomy -- Solar Physics -authors: -- name: Will T. Barnes^[Other than the first two authors, the author list in this paper is sorted alphabetically.] - orcid: 0000-0001-9642-6089 - affiliation: "1, 2" -- name: Mark C. M. Cheung - orcid: 0000-0003-2110-9753 - affiliation: 2 -- name: Monica G. Bobra - orcid: 0000-0002-5662-9604 - affiliation: 3 -- name: Paul F. Boerner - affiliation: 2 - orcid: 0000-0002-4490-9860 -- name: Georgios Chintzoglou - orcid: 0000-0002-1253-8882 - affiliation: "2, 4" -- name: Drew Leonard - orcid: 0000-0001-5270-7487 - affiliation: 5 -- name: Stuart J. Mumford - orcid: 0000-0003-4217-4642 - affiliation: 6 -- name: Nicholas Padmanabhan - affiliation: "2, 7" - orcid: 0000-0001-8067-6788 -- name: Albert Y. Shih - orcid: 0000-0001-6874-2594 - affiliation: 8 -- name: Nina Shirman - affiliation: 2 - orcid: 0000-0001-7136-8628 -- name: David Stansby - affiliation: 9 - orcid: 0000-0002-1365-1908 -- name: Paul J. Wright - orcid: 0000-0001-9021-611X - affiliation: 3 - -affiliations: -- name: National Research Council Postdoctoral Research Associate residing at the Naval Research Laboratory, Washington, D.C. 20375, USA - index: 1 -- name: Lockheed Martin Solar and Astrophysics Laboratory, Palo Alto, CA 94304, USA - index: 2 -- name: W. W. Hansen Experimental Physics Laboratory, Stanford University, Stanford, CA 94305, USA - index: 3 -- name: University Corporation for Atmospheric Research, Boulder, CO 80301, USA - index: 4 -- name: Aperio Software Ltd, Leeds LS6 3HN, UK - index: 5 -- name: School of Mathematics and Statistics, The University of Sheffield, Sheffield S3 7RH, UK - index: 6 -- name: Princeton University, Princeton, NJ 08544, USA - index: 7 -- name: NASA Goddard Space Flight Center, Greenbelt, MD 20771, USA - index: 8 -- name: Mullard Space Science Laboratory, University College London, Holmbury St. Mary, Surrey RH5 6NT, UK - index: 9 - -date: 7 October 2020 -bibliography: paper.bib ---- - -# Summary - -The Atmospheric Imaging Assembly [AIA; @lemen_atmospheric_2012] instrument onboard the NASA *Solar Dynamics Observatory* [SDO; @pesnell_solar_2012] spacecraft has observed the full-disk of the Sun, nearly continuously, for the last ten years. -It is one of three instruments on SDO, along with the Helioseismic and Magnetic Imager [HMI; @schou_design_2012] and the Extreme Ultraviolet Variability Experiment [EVE; @woods_extreme_2012]. -With its high spatial ($0.6''$ per pixel) and temporal (up to 12 seconds for most channels) resolution, AIA has greatly enhanced our understanding of our closest star in a number of different areas, including the initiation of flares and coronal mass ejections as well as the quiescent heating of the corona, the outermost layer of the Sun's atmosphere. -AIA is a narrowband imaging instrument comprised of four separate telescopes that collectively observe the full-disk of the Sun at ten different wavelengths: seven extreme ultraviolet (EUV) wavelengths, two far UV wavelengths, and one visible wavelength. -It produces nearly 60,000 images per day with a new 4K-by-4K image produced by each EUV channel every 12 seconds. -The image data are provided to the community by the [Joint Science Operations Center (JSOC)](http://jsoc.stanford.edu/) at Stanford University in the Flexible Image Transport System [FITS; @wells_fits_1981] format. - -# Statement of Need - -`aiapy` is a Python package for analyzing calibrated (level 1) EUV imaging data from AIA. -It includes capabilities for aligning images between channels, deconvolving images with the instrument point-spread function (PSF), computing channel sensitivity as a function of wavelength, and correcting images for telescope degradation, among others. -Historically, most data analysis in solar physics has been done using the Interactive Data Language (IDL), a proprietary interpreted language commonly used throughout astronomy. -The AIA instrument team has developed and continues to maintain a comprehensive set of IDL tools for querying, calibrating, and analyzing AIA data that has been widely used for nearly a decade. -A full description of this software can be found in the [SDO Data Analysis Guide](https://www.lmsal.com/sdodocs/doc/dcur/SDOD0060.zip/zip/entry/index.html). - -As the solar physics community, and the astronomy community as a whole, began transitioning to Python, some of this functionality was absorbed into `sunpy`, the core Python package for solar data analysis [@sunpy_project_sunpy_2020]. -As the `sunpy` package grew and Python adoption amongst solar physicists increased [see @bobra_survey_2020], the need for instrument-specific packages maintained by instrument teams has become apparent. -As such, the aim of `aiapy` is to provide instrument-specific functionality while being fully interoperable with both the SunPy and broader Astropy [@the_astropy_collaboration_astropy_2018] ecosystems. - -![Some examples of the capabilities of the `aiapy` package. The top row shows a cutout of an AIA 171 Å image before (top left) and after (top right) being convolved with the instrument point spread function (PSF). The bottom left panel shows the degradation as a function of time for all seven EUV channels since the launch of SDO. The bottom right panel shows the wavelength response functions for all seven EUV channels.\label{fig:figure1}](figure-1.pdf) - -# Package Structure - -`aiapy` has three primary subpackages. -\autoref{fig:figure1} shows several examples of the functionality included in these subpackages. -The `aiapy.calibrate` subpackage contains functions for correcting images for telescope degradation, normalizing to the exposure time, and replacing "hot" pixels removed during earlier calibration procedures. -Additionally, this subpackage also contains the `register` function for removing the roll angle, aligning the center of the image with the center of the Sun, and scaling the image to a common resolution across channels. -An image that has been rotated, aligned, and rescaled in this manner is a level 1.5 image. -This function, combined with the ability to update the image metadata that describes the satellite pointing provided by the `update_pointing` function, replicates the commonly-used `aiaprep.pro` IDL procedure, provided in the SolarSoftware ecosystem [@freeland_data_1998], used to align images across channels. - -The `aiapy.psf` subpackage includes functions for calculating the instrument point spread function (PSF) for each EUV channel and deconvolving images with the PSF via Richardson-Lucy deconvolution. -Because computing the PSF and performing the deconvolution is computationally expensive for a full-frame AIA image, `aiapy.psf` also includes optional GPU acceleration via `cupy` [@cupy_learningsys2017]. -The top row of \autoref{fig:figure1} shows an example of a 171 Å image that has been deconvolved with the PSF. - -Finally, the `aiapy.response` subpackage provides the `Channel` class for computing the wavelength response functions for each channel as a function of wavelength. -Optional corrections to the response functions for instrument degradation and channel crosstalk are also provided. -Additionally, individual components of the wavelength response, including the primary and secondary reflectance of each telescope as well as the efficiency of the secondary and focal plane filters, are accessible via the `Channel` class. -The AIA wavelength response functions are described in detail in @boerner_initial_2012. -Combined with atomic data from the CHIANTI atomic database [@dere_chianti_1997], these wavelength response functions can be used to compute the temperature sensitivity of each EUV channel. -The lower right panel of \autoref{fig:figure1} shows the seven EUV wavelength response functions as a function of wavelength. - -# Development and Infrastructure - -Version `0.3.0` of `aiapy` was released on 6 October 2020 and is available through the [Python Package Index](https://pypi.org/project/aiapy/) via `pip`. -`aiapy` is compatible with Python 3.6+ and is built on top of `sunpy` and `astropy` and utilizes the `drms` package [@glogowski_drms_2019] for retrieving metadata information from the JSOC. -`aiapy` is also part of the SunPy ecosystem and is [a SunPy-affiliated package](https://sunpy.org/project/affiliated#sunpy-affiliated-packages) [See Section 6 of @sunpy_project_sunpy_2020]. -As such, it is reviewed on an annual basis to ensure it meets certain established criteria in the categories of functionality, documentation, testing, and community engagement, among others. -Additionally, the code is developed openly [on GitLab](https://gitlab.com/LMSAL_HUB/aia_hub/aiapy) and the documentation is hosted online on [Read the Docs](https://aiapy.readthedocs.io/en/stable/). -`aiapy` includes a comprehensive test suite built on top of the [`pytest` testing framework](https://pytest.org). -The full test suite, including tests for all supported versions of Python, online tests, documentation builds, and code style checks, is run on every single code contribution using the built-in continuous integration pipelines in GitLab and test coverage is monitored and reported using [Codecov](https://codecov.io/). -This test suite is also run weekly to monitor any failures that may occur due to upstream changes in package dependencies. - -# Acknowledgements - -The authors acknowledge support from NASA's SDO/AIA contract (NNG04EA00C) to the Lockheed Martin Solar and Astrophysics Laboratory. -AIA is an instrument onboard the *Solar Dynamics Observatory*, a mission for NASA's Living With a Star program. -WTB was supported by NASA’s *Hinode* program. -*Hinode* is a Japanese mission developed and launched by ISAS/JAXA with NAOJ as a domestic partner and NASA and STFC (UK) as international partners. -It is operated by these agencies in cooperation with ESA and NSC (Norway). -GC acknowledges support by NASA HSR grant 80NSSC19K0855. -DS is supported by STFC grant ST/S000240/1. -PJW acknowledges support from NASA Contract NAS5-02139 (HMI) to Stanford University. - -# References diff --git a/pyproject.toml b/pyproject.toml index 871122c..c2312a6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,33 +1,138 @@ [build-system] +requires = [ + "setuptools", + "setuptools_scm[toml]", + "wheel", +] +build-backend = 'setuptools.build_meta' -requires = ["setuptools", - "setuptools_scm", - "wheel"] +[project] +name = "aiapy" +dynamic = ["version"] +description = "Python library for AIA data analysis." +readme = "README.rst" +requires-python = ">=3.9" +license = {file = "LICENSE.txt"} +keywords = [ + "solar physics", + "solar", + "science", + "NASA", + "SDO", + "AIA", + "solar dynamics observatory", + "atmospheric imaging assembly", +] +authors = [ + {email = "freij@baeri.org"}, + {name = "AIA Instrument Team"} +] +classifiers = [ + "Development Status :: 4 - Beta", + "Intended Audience :: Science/Research", + "License :: OSI Approved :: BSD License", + "Natural Language :: English", + "Operating System :: OS Independent", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Topic :: Scientific/Engineering :: Astronomy", +] +dependencies = [ + 'sunpy[net,image,map]>=5.0', +] -build-backend = 'setuptools.build_meta' +[project.urls] +homepage = "https://aia.lmsal.com/" +documentation = "https://aiapy.readthedocs.io/en/stable/" +repository = "https://github.com/LM-SAL/aiapy" +changelog = "https://aiapy.readthedocs.io/en/stable/changelog.html" + +[project.optional-dependencies] +cupy = [ + 'cupy', +] +tests = [ + "hissw", + "pytest", + "pytest-astropy", +] +docs = [ + "sphinx", + "sphinx-automodapi", + "sphinx-changelog", + "sphinx-copybutton", + "sphinx-design", + "sphinx-gallery", + "sphinx-hoverxref", + "sphinxext-opengraph", + "sunpy-sphinx-theme", + # Remove next line when fixed in towncrier; see https://github.com/twisted/towncrier/issues/528 + "importlib-resources<6", +] +dev = ["aiapy[all,tests,docs]"] + +[tool.setuptools] +packages = ["aiapy"] + +[tool.setuptools_scm] +write_to = "aiapy/_version.py" + +[tool.setuptools.exclude-package-data] +aiapy = ["aiapy._dev"] + +[tool.pytest.ini_options] +testpaths = [ + "aiapy", + "docs", +] +norecursedirs = [ + ".tox", + "build", + '''docs[\/]_build''', + '''docs[\/]generated''', + "*.egg-info", + "examples", + '''aiapy[/\]_dev''', + ".jupyter", + ".history", +] +doctest_plus = "enabled" +doctest_optionflags = "NORMALIZE_WHITESPACE FLOAT_CMP ELLIPSIS" +addopts = "--doctest-rst --doctest-ignore-import-errors -p no:unraisableexception -p no:threadexception" +markers = [ + "remote_data: marks this test function as needing remote data.", +] +remote_data_strict = "True" +filterwarnings = [ + "error", + "always::pytest.PytestConfigWarning", + "ignore:.*deprecated and slated for removal in Python 3.13", + "ignore:numpy.ufunc size changed:RuntimeWarning", + "ignore:numpy.ndarray size changed:RuntimeWarning", + "ignore:.*unitfix.*", + "ignore::erfa.core.ErfaWarning", + "ignore:invalid value encountered in sqrt", +] [tool.black] line-length = 120 target-version = ['py39'] -exclude = ''' -( - /( - \.eggs - | \.git - | \.mypy_cache - | \.tox - | \.venv - | _build - | build - | dist - | docs - | .history - )/ -) -''' + +[tool.isort] +profile = "black" +line_length = 120 +length_sort = "False" +length_sort_sections = "stdlib" [tool.ruff] -fix = true +# Allow unused variables when underscore-prefixed. +dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$" +target-version = "py39" +line-length = 120 exclude = [ ".eggs", ".git", @@ -41,16 +146,7 @@ exclude = [ "dist", "node_modules", "venv", - "joss", ] - -# Same as Black. -line-length = 120 -target-version = "py39" - -# Allow unused variables when underscore-prefixed. -dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$" -ignore = ["E501"] select = [ "E", "F", @@ -74,49 +170,17 @@ select = [ "RSE", "ERA", ] -fixable = [ - "E", - "F", - "W", - "UP", - "PT", - "RET", - "TID", - "PLE", - "NPY", - "RUF", - "PGH", - "PTH", - "BLE", - "FBT", - "B", - "A", - "COM", - "C4", - "T20", - "RSE", - "ERA", -] +ignore = ["E501"] extend-ignore = [ - # pytest (PT) - "PT001", # Always use pytest.fixture() - "PT004", # Fixtures which don't return anything should have leading _ - "PT023", # Always use () on pytest decorators - # General "PGH004", # NOQA IS THE BEST OF ALL TIME - "FBT003", # Boolean positional value in function call - "FBT002", # Boolean default value in function definition ] [tool.ruff.per-file-ignores] "examples/*.py" = [ "T201", # We need print in our examples ] -"setup.py" = ["INP001"] # Part of configuration, not a package. -"conftest.py" = ["INP001"] # Part of configuration, not a package. "docs/*.py" = [ "INP001", # implicit-namespace-package. The examples are not a package. - "F405", # `html_theme_options` may be undefined, or defined from star imports: `sunpy_sphinx_theme.conf` "A001", # Variable `copyright` is shadowing a python builtin ] "aiapy/data/sample.py" = [ @@ -124,11 +188,18 @@ extend-ignore = [ "PLE0604", # Invalid object in `__all__`, must contain only strings ] +[tool.ruff.pydocstyle] +convention = "numpy" + +[tool.codespell] +ignore-words-list = "emiss" + [tool.towncrier] package = "aiapy" filename = "CHANGELOG.rst" directory = "changelog/" - issue_format = "`#{issue} `__" + issue_format = "`#{issue} `__" + title_format = "{version} ({project_date})" [[tool.towncrier.type]] directory = "breaking" diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 72ba3b8..0000000 --- a/setup.cfg +++ /dev/null @@ -1,145 +0,0 @@ -[metadata] -name = aiapy -author = AIA Instrument Team -author_email = cheung@lmsal.com -license = BSD 3-Clause -license_files = LICENSE.rst -url = https://gitlab.com/LMSAL_HUB/aia_hub/aiapy -gitlab_project = 'LMSAL_HUB/aia_hub/aiapy' -keywords = solar physics, solar, science, sun, sdo, aia, solar dynamics observatory, atmospheric imaging assembly -classifiers = - Development Status :: 4 - Beta - Intended Audience :: Science/Research - License :: OSI Approved :: BSD License - Programming Language :: Python - Programming Language :: Python :: 3 - Programming Language :: Python :: 3.8 - Programming Language :: Python :: 3.9 - Programming Language :: Python :: 3.10 - Programming Language :: Python :: 3.11 - Topic :: Scientific/Engineering :: Astronomy -description = Python package for AIA analysis. -long_description = file: README.rst - -[options] -zip_safe = False -packages = find: -python_requires = >=3.8 -setup_requires = setuptools_scm -install_requires = - sunpy[net,image,map]>=4.0.4 - -[options.extras_require] -test = - hissw - pytest - pytest-astropy -docs = - packaging - sphinx - sphinx-automodapi - sphinx-changelog - sphinx-copybutton - sphinx-design - sphinx-gallery - sphinx-hoverxref - sphinxext-opengraph - sunpy-sphinx-theme - # Not a direct dependency, but we need to pin this until sphinx-changelog is updated (see #6668) - towncrier<22.12.0 - -[options.package_data] -aiapy = CITATION.rst, data/* -aiapy.tests = data/* - -[tool:pytest] -testpaths = "aiapy" "docs" -norecursedirs = ".tox" "build" "docs[\/]_build" "docs[\/]generated" "*.egg-info" "examples" ".jupyter" ".history" "tools" "joss" -doctest_plus = enabled -text_file_format = rst -addopts = --doctest-rst --doctest-ignore-import-errors -p no:unraisableexception -p no:threadexception -remote_data_strict = True -filterwarnings = - error - # Do not fail on pytest config issues (i.e. missing plugins) but do show them - always::pytest.PytestConfigWarning - # - # A list of warnings to ignore follows. If you add to this list, you MUST - # add a comment or ideally a link to an issue that explains why the warning - # is being ignored - # - # - ignore:distutils Version classes are deprecated - ignore:The distutils.sysconfig module is deprecated, use sysconfig instead - # This is due to dependencies building with a numpy version different from - # the local installed numpy version, but should be fine - # See https://github.com/numpy/numpy/issues/15748#issuecomment-598584838 - ignore:numpy.ufunc size changed:RuntimeWarning - ignore:numpy.ndarray size changed:RuntimeWarning - # Not sure if this is a problem - ignore:invalid value encountered in divide - # Some tests use data that have dates in the future and ERFA does not like. - ignore:ERFA function "d2dtf"* - ignore:ERFA function "dtf2d"* - ignore:ERFA function "utctai"* - ignore:ERFA function "taiutc"* - # test_degradation[None-10-time_correction_truth0] raises this: - ignore:Multiple valid epochs for .*. Using the most recent one - # From Zeep - ignore:'cgi' is deprecated and slated for removal in Python 3.13:DeprecationWarning - -[pycodestyle] -max_line_length = 110 - -[flake8] -max-line-length = 110 -exclude = - .git, - __pycache__, - docs/conf.py, - build, - aiapy/__init__.py, -rst-directives = - plot - -[isort] -balanced_wrapping = True -skip=docs/conf.py,aiapy/__init__.py -default_section = THIRDPARTY -include_trailing_comma = True -known_astropy = astropy, asdf, sunpy -known_first_party = aiapy -length_sort = False -length_sort_sections=stdlib -line_length = 110 -multi_line_output = 3 -no_lines_before = LOCALFOLDER -sections = STDLIB, THIRDPARTY, ASTROPY, FIRSTPARTY, LOCALFOLDER - -[coverage:run] -omit = - aiapy/conftest.py - aiapy/tests/* - aiapy/*/tests/* - aiapy/extern/* - aiapy/*version* - */aiapy/conftest.py - */aiapy/tests/* - */aiapy/*/tests/* - */aiapy/*version* - -[coverage:report] -exclude_lines = - # Have to re-enable the standard pragma - pragma: no cover - # Don't complain about packages we have installed - except ImportError - # Don't complain if tests don't hit assertions - raise AssertionError - raise NotImplementedError - # Don't complain about script hooks - def main\(.*\): - # Ignore branches that don't pertain to this version of Python - pragma: py{ignore_python_version} - # Don't complain about IPython completion helper - def _ipython_key_completions_ diff --git a/setup.py b/setup.py deleted file mode 100755 index de596f7..0000000 --- a/setup.py +++ /dev/null @@ -1,30 +0,0 @@ -#!/usr/bin/env python -from setuptools import setup # isort:skip -from pathlib import Path -from itertools import chain - -try: - # Recommended for setuptools 61.0.0+ - # (though may disappear in the future) - from setuptools.config.setupcfg import read_configuration -except ImportError: - from setuptools.config import read_configuration - -################################################################################ -# Programmatically generate some extras combos. -################################################################################ -extras = read_configuration("setup.cfg")["options"]["extras_require"] - -# Dev is everything -extras["dev"] = list(chain(*extras.values())) - -# All is everything but tests and docs -exclude_keys = ("tests", "docs", "dev") -ex_extras = dict(filter(lambda i: i[0] not in exclude_keys, extras.items())) -# Concatenate all the values together for 'all' -extras["all"] = list(chain.from_iterable(ex_extras.values())) - -setup( - extras_require=extras, - use_scm_version={"write_to": Path("aiapy") / Path("_version.py")}, -) diff --git a/tox.ini b/tox.ini index d57a68c..e8f545b 100644 --- a/tox.ini +++ b/tox.ini @@ -1,62 +1,58 @@ [tox] +minversion = 4.0 envlist = - py{38,39,310,311}{,-online,-devdeps,-rc} + py{39,310,311}{,-online,-devdeps,-rc} build_docs codestyle -isolated_build = true -requires = - setuptools - pip - tox-pypi-filter [testenv] -# The following option combined with the use of the tox-pypi-filter above allows -# project-wide pinning of dependencies, e.g. if new versions of pytest do not -# work correctly with pytest-astropy plugins. Most of the time the pinnings file -# should be empty. pypi_filter_requirements = https://raw.githubusercontent.com/sunpy/sunpy/main/.test_package_pins.txt -# Pass through the following environemnt variables which may be needed for the CI -passenv = HOME WINDIR LC_ALL LC_CTYPE CC CI TRAVIS +allowlist_externals= + /bin/bash + /usr/bin/bash setenv = - build_docs: HIDE_PARFIVE_PROGESS = True -# Run the tests in a temporary directory to make sure that we don't import -# the package from the source tree + MPLBACKEND = agg + SUNPY_SAMPLEDIR = {env:SUNPY_SAMPLEDIR:{toxinidir}/.tox/sample_data/} + PYTEST_COMMAND = pytest -vvv -r as --pyargs aiapy --cov-report=xml --cov=aiapy {toxinidir}/docs + 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 changedir = .tmp/{envname} -# tox environments are constructued with so-called 'factors' (or terms) -# separated by hyphens, e.g. test-devdeps-cov. Lines below starting with factor: -# will only take effect if that factor is included in the environment name. To -# see a list of example environments that can be run, along with a description, -# run: -# -# tox -l -v -# description = run tests - deps = - devdeps: git+https://github.com/sunpy/sunpy.git devdeps: git+https://github.com/astropy/astropy.git + devdeps: git+https://github.com/sunpy/sunpy.git + online: pytest-rerunfailures + online: pytest-timeout rc: sunpy>=0.0.dev0 pytest-cov -# The following indicates which extras_require from setup.cfg will be installed + pytest-xdist extras = - test + all + tests commands = - !online: pytest --pyargs aiapy {toxinidir}/docs --remote-data=none --cov aiapy --cov-report=xml --cov-config={toxinidir}/setup.cfg {posargs} - online: pytest --pyargs aiapy {toxinidir}/docs --remote-data=any --cov aiapy --cov-report=xml --cov-config={toxinidir}/setup.cfg {posargs} + pip freeze --all --no-input + !online: {env:PYTEST_COMMAND} {posargs} + online: {env:PYTEST_COMMAND} --reruns 2 --reruns-delay 15 --timeout=30 --remote-data=any {posargs} [testenv:build_docs] changedir = docs -description = invoke sphinx-build to build the HTML docs -extras = docs +description = Invoke sphinx-build to build the HTML docs +extras = + all + docs commands = - sphinx-build -W -b html . _build/html {posargs} + pip freeze --all --no-input + sphinx-build -j auto --color -W --keep-going -b html -d _build/.doctrees . _build/html {posargs} + python -c 'import pathlib; print("Documentation available under file://\{0\}".format(pathlib.Path(r"{toxinidir}") / "docs" / "_build" / "index.html"))' [testenv:codestyle] +pypi_filter = skip_install = true description = Run all style and file checks with pre-commit deps = pre-commit commands = pre-commit install-hooks - pre-commit run --all-files + pre-commit run --color always --all-files --show-diff-on-failure