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

Release 0.5.4 #628

Merged
merged 34 commits into from
Sep 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
791f9d8
BLD: Set astropy latest supported version to 5.0 (#504)
rrjbca Nov 30, 2021
d2c6638
BLD: Set python latest supported version to 3.10 (#505)
rrjbca Jan 3, 2022
6e47276
BLD: Set numpy latest supported version to 1.22 (#506)
rrjbca Jan 3, 2022
a5e9d82
BLD: Set python oldest supported version to 3.7 (#507)
rrjbca Jan 11, 2022
9f84601
BLD: Set scipy latest supported version to 1.8 (#510)
rrjbca Feb 28, 2022
4b8d13c
BLD: Set astropy latest supported version to 5.1 (#547)
rrjbca May 25, 2022
da18035
BLD: Set numpy latest supported version to 1.23 (#552)
rrjbca Jun 28, 2022
70ffe69
MAINT: flake8 E275 fixes (#572)
itrharrison Aug 26, 2022
23f6e1f
BLD: Set scipy latest supported version to 1.9 (#569)
rrjbca Aug 31, 2022
d36439c
BLD: Set numpy latest supported version to 1.24 (#589)
rrjbca Jan 5, 2023
59977c8
BLD: Set scipy latest supported version to 1.10 (#590)
rrjbca Jan 6, 2023
9a59a85
BLD: Set astropy latest supported version to 5.2 (#591)
rrjbca Jan 6, 2023
7b4bb1c
BLD: Set python latest supported version to 3.11 (#588)
rrjbca Jan 24, 2023
95a68af
BLD: Set numpy latest supported version to 1.25 (#601)
rrjbca Jul 9, 2023
94bd591
BLD: Set scipy latest supported version to 1.11 (#602)
rrjbca Jul 10, 2023
91e8f35
BLD: Set astropy latest supported version to 5.3 (#603)
rrjbca Jul 10, 2023
51b6bce
TST: Use conftest from latest astropy package template (#604)
rrjbca Jul 10, 2023
ff6d765
BLD: Set numpy latest supported version to 1.26 (#607)
rrjbca Sep 22, 2023
e8a95a1
BLD: Set astropy latest supported version to 6.0 (#611)
rrjbca Dec 11, 2023
c13836c
BLD: Upgrade GitHub actions that use deprecated node12 (#612)
rrjbca Dec 11, 2023
ca31c40
BLD: Set scipy latest supported version to 1.12 (#613)
rrjbca Feb 6, 2024
597a67b
BLD: Set scipy latest supported version to 1.13 (#615)
rrjbca May 28, 2024
06707dd
BLD: Set astropy latest supported version to 6.1 (#616)
rrjbca Jun 25, 2024
f31c62a
BLD: Set scipy oldest supported version to 1.6 (#618)
rrjbca Jun 25, 2024
1934eed
Use scipy.integrate.cumulative_trapezoid (#617)
rrjbca Jun 25, 2024
a6cda56
BLD: Set python latest supported version to 3.12 (#619)
rrjbca Jun 29, 2024
f402029
BLD: Set python oldest supported version to 3.8 (#620)
rrjbca Jun 29, 2024
c978031
BLD: Set scipy latest supported version to 1.14 (#621)
rrjbca Aug 7, 2024
aa6bfe6
BLD: Set numpy latest supported version to 2.0 (#622)
rrjbca Aug 7, 2024
4ccdb8a
MAINT: numpy.trapz is deprecated; use scipy.integrate.trapezoid (#623)
rrjbca Aug 9, 2024
160ebcf
MAINT: Upgrade to actions/setup-python@v5 (#624)
rrjbca Aug 9, 2024
b7be685
BLD: Set numpy oldest supported version to 1.17 (#626)
rrjbca Sep 8, 2024
e4b1272
BLD: Set numpy latest supported version to 2.1 (#625)
rrjbca Sep 8, 2024
cfb1f69
CI: Run tests and codestyle on release branches and tags (#627)
rrjbca Sep 8, 2024
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
8 changes: 6 additions & 2 deletions .github/workflows/codestyle.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,22 @@ on:
branches:
- main
- module/*
- 'v*x'
tags:
- 'v*'
pull_request:
branches:
- main
- module/*
- 'v*x'
jobs:
flake8:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Install Python 3.x
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Install Dependencies
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/compatibility.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,20 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
python: [3.9]
toxenv: [py39-test, py39-test-dev]
python: ['3.12']
toxenv: [py312-test, py312-test-dev]
release: [main, latest]
steps:
- name: Checkout Repository
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 0
- if: matrix.release != 'main'
name: Checkout Release
run: |
git checkout tags/$(curl -s https://api.github.com/repos/skypyproject/skypy/releases/${{ matrix.release }} | python -c "import sys, json; print(json.load(sys.stdin)['tag_name'])")
- name: Install Python ${{ matrix.python }}
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Install Dependencies
Expand Down
26 changes: 15 additions & 11 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@ on:
branches:
- main
- module/*
- 'v*x'
tags:
- 'v*'
pull_request:
branches:
- main
- module/*
- 'v*x'
jobs:
test:
name: ${{ matrix.name }}
Expand All @@ -19,32 +23,32 @@ jobs:

- name: latest supported versions
os: ubuntu-latest
python: 3.9
toxenv: py39-test-all-latest-cov
python: '3.12'
toxenv: py312-test-all-latest-cov
toxposargs: --cov-report=xml:${GITHUB_WORKSPACE}/coverage.xml

- name: oldest supported versions
os: ubuntu-latest
python: 3.6
toxenv: py36-test-oldest
python: '3.8'
toxenv: py38-test-oldest

- name: macOS latest supported
os: macos-latest
python: 3.9
toxenv: py39-test-latest
python: '3.12'
toxenv: py312-test-latest

- name: Windows latest supported
os: windows-latest
python: 3.9
toxenv: py39-test-latest
python: '3.12'
toxenv: py312-test-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Python ${{ matrix.python }}
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Install Dependencies
Expand All @@ -55,4 +59,4 @@ jobs:
tox -e ${{ matrix.toxenv }} ${{ matrix.toxargs }} -- ${{ matrix.toxposargs }}
- if: contains(matrix.toxenv, '-cov')
name: Report Coverage
uses: codecov/codecov-action@v1
uses: codecov/codecov-action@v3
2 changes: 1 addition & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: 2
build:
os: ubuntu-20.04
tools:
python: '3.7'
python: '3.8'
apt_packages:
- graphviz

Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ Before your pull request can be merged into the codebase, it will be reviewed by
General Guidelines
^^^^^^^^^^^^^^^^^^

- SkyPy is compatible with Python>=3.6 (see `setup.cfg <https://github.com/skypyproject/skypy/blob/main/setup.cfg>`_). SkyPy *does not* support backwards compatibility with Python 2.x; `six`, `__future__` and `2to3` should not be used.
- SkyPy is compatible with Python>=3.8 (see `setup.cfg <https://github.com/skypyproject/skypy/blob/main/setup.cfg>`_). SkyPy *does not* support backwards compatibility with Python 2.x; `six`, `__future__` and `2to3` should not be used.
- All contributions should follow the `PEP8 Style Guide for Python Code <https://www.python.org/dev/peps/pep-0008/>`_. We recommend using `flake8 <https://flake8.pycqa.org/>`__ to check your code for PEP8 compliance.
- Importing SkyPy should only depend on having `NumPy <https://www.numpy.org>`_, `SciPy <https://www.scipy.org/>`_ and `Astropy <https://www.astropy.org/>`__ installed.
- Code is grouped into submodules based on broad science areas e.g. `galaxies <https://skypy.readthedocs.io/en/stable/galaxies.html>`_. There is also a `utils <https://skypy.readthedocs.io/en/stable/utils/index.html>`_ submodule for general utility functions.
Expand Down
2 changes: 1 addition & 1 deletion docs/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ can be installed directly from GitHub using a recent version of pip:
Dependencies
------------

SkyPy is compatble with Python versions 3.6 or later on Ubuntu, macOS and
SkyPy is compatble with Python versions 3.8 or later on Ubuntu, macOS and
Windows operating systems. It has the following core dependencies:

- `astropy <https://www.astropy.org/>`__
Expand Down
3 changes: 2 additions & 1 deletion examples/galaxies/plot_schechter.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
from astropy.units import Quantity
from matplotlib import pyplot as plt
import numpy as np
import scipy.integrate
from skypy.galaxies import schechter_lf

z_range = np.linspace(0.2, 1.0, 100)
Expand Down Expand Up @@ -81,7 +82,7 @@
# SkyPy simulated galaxies
z_mask = np.logical_and(redshift >= z_min, redshift < z_max)
dV_dz = (cosmology.differential_comoving_volume(z) * sky_area).to_value('Mpc3')
dV = np.trapz(dV_dz, z)
dV = scipy.integrate.trapezoid(dV_dz, z)
dM = (np.max(bins)-np.min(bins)) / (np.size(bins)-1)
phi_skypy = np.histogram(magnitude[z_mask], bins=bins)[0] / dV / dM

Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ github_project = skypyproject/skypy
[options]
zip_safe = False
packages = find:
python_requires = >=3.6
python_requires = >=3.8
setup_requires = setuptools_scm
install_requires =
astropy>=4
Expand Down
47 changes: 18 additions & 29 deletions skypy/conftest.py
Original file line number Diff line number Diff line change
@@ -1,27 +1,29 @@
# This file is used to configure the behavior of pytest when using the Astropy
# test infrastructure. It needs to live inside the package in order for it to
# get picked up when running the tests inside an interpreter using
# packagename.test
"""Configure Test Suite.

import os
This file is used to configure the behavior of pytest when using the Astropy
test infrastructure. It needs to live inside the package in order for it to
get picked up when running the tests inside an interpreter using
`{{ cookiecutter.module_name }}.test()`.

"""

from astropy.version import version as astropy_version
import os

# For Astropy 3.0 and later, we can use the standalone pytest plugin
if astropy_version < '3.0':
from astropy.tests.pytest_plugins import * # noqa
del pytest_report_header
try:
from pytest_astropy_header.display import PYTEST_HEADER_MODULES, TESTED_VERSIONS
ASTROPY_HEADER = True
else:
try:
from pytest_astropy_header.display import PYTEST_HEADER_MODULES, TESTED_VERSIONS
ASTROPY_HEADER = True
except ImportError:
ASTROPY_HEADER = False
except ImportError:
ASTROPY_HEADER = False


def pytest_configure(config):
"""Configure Pytest with Astropy.

Parameters
----------
config : pytest configuration

"""
if ASTROPY_HEADER:

config.option.astropy_header = True
Expand All @@ -34,16 +36,3 @@ def pytest_configure(config):
from . import __version__
packagename = os.path.basename(os.path.dirname(__file__))
TESTED_VERSIONS[packagename] = __version__

# Uncomment the last two lines in this block to treat all DeprecationWarnings as
# exceptions. For Astropy v2.0 or later, there are 2 additional keywords,
# as follow (although default should work for most cases).
# To ignore some packages that produce deprecation warnings on import
# (in addition to 'compiler', 'scipy', 'pygments', 'ipykernel', and
# 'setuptools'), add:
# modules_to_ignore_on_import=['module_1', 'module_2']
# To ignore some specific deprecation warning messages for Python version
# MAJOR.MINOR or later, add:
# warnings_to_ignore_by_pyver={(MAJOR, MINOR): ['Message to ignore']}
# from astropy.tests.helper import enable_deprecations_as_exceptions # noqa
# enable_deprecations_as_exceptions()
2 changes: 1 addition & 1 deletion skypy/galaxies/redshift.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ def redshifts_from_comoving_density(redshift, density, sky_area, cosmology, nois
dN_dz *= density

# integrate density to get expected number of galaxies
N = np.trapz(dN_dz, redshift)
N = scipy.integrate.trapezoid(dN_dz, redshift)

# Poisson sample galaxy number if requested
if noise:
Expand Down
5 changes: 3 additions & 2 deletions skypy/galaxies/tests/test_redshift.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import numpy as np
import pytest
import scipy.integrate
from scipy.stats import kstest


Expand Down Expand Up @@ -38,7 +39,7 @@ def test_schechter_lf_redshift():
density *= (sky_area * cosmo.differential_comoving_volume(z)).to_value('Mpc3')

# integrate total number
n_gal = np.trapz(density, z, axis=-1)
n_gal = scipy.integrate.trapezoid(density, z, axis=-1)

# make sure noise-free sample has right size
assert np.isclose(len(z_gal), n_gal, atol=1.0)
Expand Down Expand Up @@ -85,7 +86,7 @@ def test_schechter_smf_redshift():
density *= (sky_area * cosmo.differential_comoving_volume(z)).to_value('Mpc3')

# integrate total number
n_gal = np.trapz(density, z, axis=-1)
n_gal = scipy.integrate.trapezoid(density, z, axis=-1)

# make sure noise-free sample has right size
assert np.isclose(len(z_gal), n_gal, atol=1.0)
Expand Down
2 changes: 1 addition & 1 deletion skypy/galaxies/tests/test_stellar_mass.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def calc_cdf(m):
mass_min = 10 ** 7
mass_max = 10 ** 13
pdf = calc_pdf(m, alpha, mass_star, mass_min, mass_max)
cdf = scipy.integrate.cumtrapz(pdf, m, initial=0)
cdf = scipy.integrate.cumulative_trapezoid(pdf, m, initial=0)
cdf = cdf / cdf[-1]
return cdf

Expand Down
2 changes: 1 addition & 1 deletion skypy/pipeline/scripts/skypy.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ def main(args=None):
logger.exception(e)
raise SystemExit(2) from e

return(0)
return 0
14 changes: 7 additions & 7 deletions skypy/pipeline/tests/test_skypy.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def test_logging(capsys, tmp_path):
output_filename = str(tmp_path / 'logging.fits')
skypy.main([config_filename, output_filename])
out, err = capsys.readouterr()
assert(not err)
assert not err

# Run again with increased verbosity and capture log. Force an exception by
# not using the "--overwrite" flag when the output file already exists.
Expand All @@ -78,19 +78,19 @@ def test_logging(capsys, tmp_path):
# Check all jobs appear in the log
for job in list(config) + list(tables) + columns:
log_string = f"[INFO] skypy.pipeline: Generating {job}"
assert(log_string in err)
assert log_string in err

# Check all functions appear in the log
for f in functions:
log_string = f"[INFO] skypy.pipeline: Calling {f.function.__name__}"
assert(log_string in err)
assert log_string in err

# Check cosmology appears in the log
if cosmology:
assert("[INFO] skypy.pipeline: Setting cosmology" in err)
assert "[INFO] skypy.pipeline: Setting cosmology" in err

# Check writing output file is in the log
assert(f"[INFO] skypy: Writing {output_filename}" in err)
assert f"[INFO] skypy: Writing {output_filename}" in err

# Check error for existing output file is in the log
try:
Expand All @@ -100,10 +100,10 @@ def test_logging(capsys, tmp_path):
except ImportError:
# Fallback on old error message from astropy v4.x
error_string = f"[ERROR] skypy: File {output_filename!r} already exists."
assert(error_string in err)
assert error_string in err

# Run again with decreased verbosity and check the log is empty
with pytest.raises(SystemExit):
skypy.main([config_filename, output_filename, '-qq'])
out, err = capsys.readouterr()
assert(not err)
assert not err
2 changes: 1 addition & 1 deletion skypy/utils/photometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def mag_ab(wavelength, spectrum, filters, *, redshift=None, coefficients=None,
u = u.reshape(u.shape + (1,)*(nd_s+nd_f))
m = np.ascontiguousarray(m[n])
m += u*dm[n]
del(dm, n, u)
del dm, n, u

# combine spectra if asked to
if coefficients is not None:
Expand Down
Loading
Loading