Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MNT: Infrastructure and other updates #202

Merged
merged 3 commits into from
Dec 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[flake8]
max-line-length = 100
59 changes: 21 additions & 38 deletions .github/workflows/cron-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,48 +5,31 @@
name: Weekly Tests

on:
pull_request:
# We also want this workflow triggered if the 'Extra CI' label is added
# or present when PR is updated
types:
- synchronize
- labeled
schedule:
# run every Monday at 6am UTC
- cron: '0 6 * * 1'

env:
TOXARGS: '-v'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
# Set up matrix to run tox tests across lists of os, python version, and tox environment
matrix_tests:
runs-on: ${{ matrix.os }}
strategy:
matrix:
# Github actions supports ubuntu, windows, and macos virtual environments:
# https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners
#
# Only run on ubuntu by default, but can add other os's to the test matrix here.
# For example -- os: [ubuntu-latest, macos-latest, windows-latest]
include:
- os: ubuntu-latest
python: '3.11'
tox_env: 'linkcheck'
- os: ubuntu-latest
python: '3.12'
tox_env: 'py312-test-devdeps'
- os: ubuntu-latest
python: '3.12'
tox_env: 'py312-test-predeps'
tests:
if: (github.repository == 'astropy/specreduce' && (github.event_name == 'schedule' || github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'Extra CI')))
uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@v1
with:
submodules: false
coverage: ''
envs: |
- name: Check URLs in docs
linux: linkcheck

steps:
- name: Check out repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up python ${{ matrix.python }} with tox environment ${{ matrix.tox_env }} on ${{ matrix.os }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python }}
- name: Install base dependencies
run: |
python -m pip install --upgrade pip
python -m pip install tox
- name: Test with tox
run: |
tox -e ${{ matrix.tox_env }}
- name: Python 3.12 on Linux with pre-releases
linux: py312-test-alldeps-predeps
toxargs: -v
88 changes: 34 additions & 54 deletions .github/workflows/tox-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,64 +11,44 @@ on:
tags:
- '*'
pull_request:
schedule:
# run every Monday at 6am UTC
- cron: '0 6 * * 1'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
TOXARGS: '-v'

jobs:
# Set up matrix to run tox tests across lists of os, python version, and tox environment
matrix_tests:
runs-on: ${{ matrix.os }}
strategy:
matrix:
# Github actions supports ubuntu, windows, and macos virtual environments:
# https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners
#
# Only run on ubuntu by default, but can add other os's to the test matrix here.
# For example -- os: [ubuntu-latest, macos-latest, windows-latest]
include:
- os: ubuntu-latest
python: '3.10'
tox_env: 'py310-test-cov'
- os: ubuntu-latest
python: '3.11'
tox_env: 'py311-test'
- os: ubuntu-latest
python: '3.12'
tox_env: 'py312-test'
- os: macos-latest
python: '3.12'
tox_env: 'py312-test-devdeps'
- os: ubuntu-latest
python: '3.12'
tox_env: 'codestyle'
- os: ubuntu-latest
python: '3.10'
tox_env: 'py310-test-oldestdeps'
tests:
uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@v1
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV }}
with:
submodules: false
coverage: ''
envs: |
- name: Codestyle
linux: codestyle

- name: Python 3.8 on Linux with oldest supported dependencies
linux: py38-test-alldeps-oldestdeps
toxargs: -v

- name: Python 3.9 on Windows with minimal dependencies
windows: py39-test
toxargs: -v
tepickering marked this conversation as resolved.
Show resolved Hide resolved

- name: Python 3.10 on OSX with minimal dependencies
macos: py310-test
toxargs: -v

- name: Python 3.11 on Linux with all dependencies, remote data, and coverage
linux: py311-test-alldeps-cov
coverage: codecov
toxargs: -v
posargs: --remote-data=any

steps:
- name: Check out repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up python ${{ matrix.python }} with tox environment ${{ matrix.tox_env }} on ${{ matrix.os }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python }}
- name: Install base dependencies
run: |
python -m pip install --upgrade pip
python -m pip install tox
- name: Test with tox
run: |
tox -e ${{ matrix.tox_env }}
- name: Upload coverage to codecov
if: "contains(matrix.tox_env, '-cov')"
uses: codecov/codecov-action@v3
with:
file: ./coverage.xml
verbose: true
- name: (Allowed Failure) Python 3.12 on Linux with dev dependencies
linux: py312-test-devdeps
toxargs: -v
4 changes: 2 additions & 2 deletions .readthedocs.yml → .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
version: 2

build:
os: ubuntu-20.04
os: ubuntu-22.04
apt_packages:
- graphviz
tools:
python: "3.10"
python: "3.11"

sphinx:
builder: html
Expand Down
31 changes: 19 additions & 12 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,37 @@ New Features
^^^^^^^^^^^^

- Added 'interpolated_profile' option for HorneExtract. If The ``interpolated_profile`` option
is used, the image will be sampled in various wavelength bins (set by
``n_bins_interpolated_profile``), averaged in those bins, and samples are then
interpolated between (linear by default, interpolation degree can be set with
the ``interp_degree_interpolated_profile`` parameter) to generate a continuously varying
spatial profile that can be evaluated at any wavelength.[ #173]
is used, the image will be sampled in various wavelength bins (set by
``n_bins_interpolated_profile``), averaged in those bins, and samples are then
interpolated between (linear by default, interpolation degree can be set with
the ``interp_degree_interpolated_profile`` parameter) to generate a continuously varying
spatial profile that can be evaluated at any wavelength. [#173]

API Changes
^^^^^^^^^^^

- Fit residuals exposed for wavelength calibration in WavelengthCalibration1D.fit_residuals. [#446]
- Fit residuals exposed for wavelength calibration in ``WavelengthCalibration1D.fit_residuals``. [#446]

Bug Fixes
^^^^^^^^^

- Output 1D spectra from Background no longer include NaNs. Output 1D
spectra from BoxcarExtract no longer include NaNs when none are present
in the extraction window. NaNs in the window will still propagate to
BoxcarExtract's extracted 1D spectrum. [#159]
spectra from BoxcarExtract no longer include NaNs when none are present
in the extraction window. NaNs in the window will still propagate to
BoxcarExtract's extracted 1D spectrum. [#159]

- Backgrounds using median statistic properly ignore zero-weighted pixels
[#159]
- Backgrounds using median statistic properly ignore zero-weighted pixels.
[#159]

- HorneExtract now accepts 'None' as a vaild option for bkgrd_prof [#171]
- HorneExtract now accepts 'None' as a vaild option for ``bkgrd_prof``. [#171]

Other changes
^^^^^^^^^^^^^

- The following packages are now optional dependencies because they are not
required for core functionality: ``matplotlib``, ``photutils``, ``synphot``.
To install them anyway, use the ``[all]`` specifier when you install specreduce; e.g.:
``pip install specreduce[all]`` [#202]

1.3.0 (2022-12-05)
------------------
Expand Down
7 changes: 1 addition & 6 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
include README.rst
include CHANGES.rst
include setup.cfg
include LICENSE.rst
include pyproject.toml

recursive-include specreduce *.pyx *.c *.pxd
recursive-include docs *
recursive-include licenses *
recursive-include scripts *

prune notebook_sandbox
prune build
prune docs/_build
prune docs/api

global-exclude *.pyc *.o
21 changes: 13 additions & 8 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,22 +1,27 @@
Specreduce
==========

.. image:: https://github.com/astropy/specreduce/workflows/Python%20Tests/badge.svg
:target: https://github.com/astropy/specreduce/actions
.. image:: https://github.com/astropy/specreduce/actions/workflows/tox-tests.yml/badge.svg?branch=main
:target: https://github.com/astropy/specreduce/actions/workflows/tox-tests.yml
:alt: CI Status

.. image:: https://codecov.io/gh/astropy/specreduce/graph/badge.svg?token=3fLGjZ2Pe0
:target: https://codecov.io/gh/astropy/specreduce
:alt: Coverage

.. image:: https://readthedocs.org/projects/specreduce/badge/?version=latest
:target: http://specreduce.readthedocs.io/en/latest/?badge=latest
:target: http://specreduce.readthedocs.io/en/latest/
:alt: Documentation Status

.. image:: https://zenodo.org/badge/DOI/10.5281/zenodo.6608788.svg
:target: https://doi.org/10.5281/zenodo.6608788
:alt: Zenodo DOI 10.5281/zenodo.6608788
.. image:: https://zenodo.org/badge/DOI/10.5281/zenodo.6608787.svg
:target: https://zenodo.org/doi/10.5281/zenodo.6608787
:alt: Zenodo DOI 10.5281/zenodo.6608787

.. image:: http://img.shields.io/badge/powered%20by-AstroPy-orange.svg?style=flat
:target: http://www.astropy.org/
:target: http://www.astropy.org/
:alt: Powered by Astropy

Specreduce is an Astropy affiliated package with the goal of providing a shared
Specreduce is an Astropy coordinated package with the goal of providing a shared
set of Python utilities that can be used to reduce and calibrate spectroscopic data.

License
Expand Down
26 changes: 26 additions & 0 deletions conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
"""Need to repeat the astropy header config here for tox."""

try:
from pytest_astropy_header.display import PYTEST_HEADER_MODULES, TESTED_VERSIONS
ASTROPY_HEADER = True
except ImportError:
ASTROPY_HEADER = False


def pytest_configure(config):

if ASTROPY_HEADER:

config.option.astropy_header = True

# Customize the following lines to add/remove entries from the list of
# packages for which version numbers are displayed when running the tests.
PYTEST_HEADER_MODULES.pop('Pandas', None)
PYTEST_HEADER_MODULES.pop('h5py', None)
PYTEST_HEADER_MODULES['astropy'] = 'astropy'
PYTEST_HEADER_MODULES['specutils'] = 'specutils'
PYTEST_HEADER_MODULES['photutils'] = 'photutils'
PYTEST_HEADER_MODULES['synphot'] = 'synphot'

from specreduce import __version__
TESTED_VERSIONS["specreduce"] = __version__
Binary file added docs/_static/logo_icon.ico
Binary file not shown.
Binary file added docs/_static/logo_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions docs/_static/specreduce.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
@import url("bootstrap-astropy.css");

div.topbar a.brand {
background: transparent url("logo_icon.png") no-repeat 8px 3px;
background-image: url("logo_icon.png"), none;
background-size: 32px 32px;
}

#logotext1 {
color: #519EA8;
}

#logotext2 {
color: #FF5000;
}
Loading