Skip to content

Commit

Permalink
Merge branch 'main' into py312
Browse files Browse the repository at this point in the history
  • Loading branch information
jobovy committed Oct 10, 2023
2 parents 6b3ae4c + 2c77613 commit 66a6241
Show file tree
Hide file tree
Showing 25 changed files with 52 additions and 54 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ jobs:
env:
PYTHON_COVREPORTS_VERSION: "3.11"
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
Expand Down Expand Up @@ -317,10 +317,9 @@ jobs:
pip install pytest-cov
# Turn astropy deprecation warnings into errors as well if astropy
if $REQUIRES_ASTROPY; then export PYTEST_ADDOPTS="-W error::astropy.utils.exceptions.AstropyDeprecationWarning"; else export PYTEST_ADDOPTS=""; fi
export XDRLIB_DEPRECATION="-W ignore:\"'xdrlib' is deprecated and slated for removal in Python 3.13\":DeprecationWarning"
export TQDM_DEPRECATION="-W ignore:\"datetime.datetime.utcfromtimestamp() is deprecated and scheduled for removal in a future version.\":DeprecationWarning -W ignore:\"datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC\":DeprecationWarning"
# eval necessary for -k 'not ...' in TEST_FILES
eval "pytest -W error::DeprecationWarning -W error::FutureWarning $PYTEST_ADDOPTS $XDRLIB_DEPRECATION $TQDM_DEPRECATION -v $TEST_FILES --cov galpy --cov-config .coveragerc --disable-pytest-warnings --durations=0 --cov-report=term --cov-report=xml"
eval "pytest -W error::DeprecationWarning -W error::FutureWarning $PYTEST_ADDOPTS $TQDM_DEPRECATION -v $TEST_FILES --cov galpy --cov-config .coveragerc --disable-pytest-warnings --durations=0 --cov-report=term --cov-report=xml"
- name: Generate code coverage
if: ${{ matrix.python-version == env.PYTHON_COVREPORTS_VERSION && matrix.os == 'ubuntu-latest' }}
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build_pyodide_wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
name: Build pyodide/wasm wheels
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: 3.10.2
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/build_windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ jobs:
REQUIRES_NUMBA: false
REQUIRES_JAX: false
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
Expand Down Expand Up @@ -240,6 +240,5 @@ jobs:
pip install pytest-cov
# Turn astropy deprecation warnings into errors as well if astropy
if $REQUIRES_ASTROPY; then export PYTEST_ADDOPTS="-W error::astropy.utils.exceptions.AstropyDeprecationWarning"; else export PYTEST_ADDOPTS=""; fi
export XDRLIB_DEPRECATION="-W ignore:\"'xdrlib' is deprecated and slated for removal in Python 3.13\":DeprecationWarning"
# eval necessary for -k 'not ...' in TEST_FILES
eval "pytest -W error::DeprecationWarning -W error::FutureWarning $PYTEST_ADDOPTS $XDRLIB_DEPRECATION -v $TEST_FILES --cov galpy --cov-config .coveragerc --disable-pytest-warnings --durations=0"
eval "pytest -W error::DeprecationWarning -W error::FutureWarning $PYTEST_ADDOPTS -v $TEST_FILES --cov galpy --cov-config .coveragerc --disable-pytest-warnings --durations=0"
12 changes: 6 additions & 6 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ jobs:
- [macos-latest, macosx, x86_64]
- [macos-latest, macosx, arm64]
- [windows-2019, win, amd64]
python: ["cp38", "cp39", "cp310", "cp311"]
python: ["cp38", "cp39", "cp310", "cp311", "cp312"]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install GSL (Windows / Mac OS x86_64)
uses: mamba-org/setup-micromamba@v1
if: matrix.buildplat[1] == 'win' || ( matrix.buildplat[1] == 'macosx' && matrix.buildplat[2] == 'x86_64' )
Expand Down Expand Up @@ -88,7 +88,7 @@ jobs:
rsync -azv gsl/lib/ /usr/local/lib/
echo "REPAIR_LIBRARY_PATH=/usr/local/lib/" >> $GITHUB_ENV # https://github.com/pypa/cibuildwheel/issues/816#issuecomment-916197079
- name: Build wheels
uses: pypa/cibuildwheel@v2.15
uses: pypa/cibuildwheel@v2.16
env:
CIBW_BUILD: ${{ matrix.python }}-${{ matrix.buildplat[1] }}_${{ matrix.buildplat[2] }}
CIBW_BUILD_VERBOSITY: 1
Expand All @@ -108,7 +108,7 @@ jobs:
runs-on: ubuntu-latest
steps:
# check-out this repository
- uses: actions/checkout@v3
- uses: actions/checkout@v4
# Setup python
- name: Set up Python
uses: actions/setup-python@v4
Expand All @@ -132,7 +132,7 @@ jobs:
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'created'
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- run: |
mkdir tmp_wheelhouse
mkdir wheelhouse
Expand All @@ -152,7 +152,7 @@ jobs:
runs-on: ubuntu-latest
if: github.event_name != 'release' && github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- run: |
mkdir tmp_wheelhouse
mkdir wheelhouse
Expand Down
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ repos:
- id: check-executables-have-shebangs
- id: check-yaml
- repo: https://github.com/asottile/pyupgrade
rev: v3.10.1
rev: v3.14.0
hooks:
- id: pyupgrade
args: [--py38-plus]
Expand All @@ -30,12 +30,12 @@ repos:
- id: isort
name: isort (python)
- repo: https://github.com/codespell-project/codespell
rev: "v2.2.5"
rev: "v2.2.6"
hooks:
- id: codespell
args: ["-L", "thisE,thise,mye,tE,te,hist,ro,sav,ccompiler,aas",
"-x","doc/source/_static/try-galpy.js"]
- repo: https://github.com/psf/black
rev: 23.7.0
rev: 23.9.1
hooks:
- id: black
4 changes: 2 additions & 2 deletions doc/source/basic_df.rst
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ The warm response is slightly smaller in amplitude
although the numerical uncertainty in ``mvrwarm`` is large, because
the grid is not sufficiently fine.

We can then re-use this grid in calculations of other moments of
We can then reuse this grid in calculations of other moments of
the DF, e.g.,

>>> print(edfcold.meanvT(0.9,phi=22.5,deg=True,t=0.,grid=gridcold))
Expand Down Expand Up @@ -468,7 +468,7 @@ A_{\mathrm{axi}}+0.05/(2\sqrt{2})` where :math:`A_{\mathrm{axi}} =
>>> print(oortacold-(0.5/0.9+0.05/2./sqrt(2.)))
# 0.0022613349141670236

These grids can then be re-used for the other Oort functions, for
These grids can then be reused for the other Oort functions, for
example,

>>> print(edfcold.oortB(0.9,phi=22.5,deg=True,t=0.,grid=gridcold,derivphiGrid=gridphicold,derivRGrid=gridrcold))
Expand Down
4 changes: 2 additions & 2 deletions doc/source/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ If you are reading this, either the simple installation instructions at the top
To compile ``galpy`` from source, you will first need to install the GSL. The
easiest way to do this is using `Homebrew <http://brew.sh/>`__ as::

brew install gsl --universal
brew install gsl

Alternatively, you can use ``conda`` to install the GSL and use ``conda`` to
manage your Python environment. Install the GSL in your preferred environment
Expand Down Expand Up @@ -444,7 +444,7 @@ The easiest way to install this is using its Anaconda build::
If you do not want to go that route, on a Mac, the next easiest way to install
the GSL is using `Homebrew <http://brew.sh/>`_ as::

brew install gsl --universal
brew install gsl

You should be able to check your version using (on Mac/Linux)::

Expand Down
2 changes: 1 addition & 1 deletion galpy/actionAngle/actionAngleAdiabaticGrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def __init__(
nEz=, nEr=, nLz, nR= grid size
numcores= number of cpus to use to parallellize
numcores= number of cpus to use to parallelize
c= if True, use C to calculate actions
Expand Down
2 changes: 1 addition & 1 deletion galpy/actionAngle/actionAngleStaeckelGrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def __init__(
interpecc= (False) if True, also interpolate the approximate eccentricity, zmax, rperi, and rapo
numcores= number of cpus to use to parallellize
numcores= number of cpus to use to parallelize
ro= distance from vantage point to GC (kpc; can be Quantity)
Expand Down
2 changes: 1 addition & 1 deletion galpy/df/quasiisothermaldf.py
Original file line number Diff line number Diff line change
Expand Up @@ -2075,7 +2075,7 @@ def meanlz(self, R, z, nsigma=None, mc=True, nmc=10000, **kwargs):
PURPOSE:
calculate the mean angular momemtum by marginalizing over velocity
calculate the mean angular momentum by marginalizing over velocity
INPUT:
Expand Down
4 changes: 2 additions & 2 deletions galpy/df/sphericaldf.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def __init__(self, pot=None, denspot=None, rmax=None, scale=None, ro=None, vo=No
)
phys = conversion.get_physical(pot, include_set=True)
# if pot has physical units, transfer them (if already on, we know
# they are compaible)
# they are compatible)
if phys["roSet"] and phys["voSet"]:
self.turn_physical_on(ro=phys["ro"], vo=phys["vo"])
if pot is None: # pragma: no cover
Expand Down Expand Up @@ -731,7 +731,7 @@ def _call_internal(self, *args):
INPUT:
E,L,Lz - The energy, angular momemtum magnitude, and its z component (only E is used)
E,L,Lz - The energy, angular momentum magnitude, and its z component (only E is used)
OUTPUT:
Expand Down
6 changes: 3 additions & 3 deletions galpy/orbit/Orbits.py
Original file line number Diff line number Diff line change
Expand Up @@ -2705,7 +2705,7 @@ def _setupaA(self, pot=None, type="staeckel", **kwargs):
return None

def _setup_EccZmaxRperiRap(self, pot=None, **kwargs):
"""Internal function to compute e,zmax,rperi,rap and cache it for re-use"""
"""Internal function to compute e,zmax,rperi,rap and cache it for reuse"""
self._setupaA(pot=pot, **kwargs)
if hasattr(self, "_aA_ecc"):
return None
Expand Down Expand Up @@ -2738,7 +2738,7 @@ def _setup_EccZmaxRperiRap(self, pot=None, **kwargs):
return None

def _setup_actionsFreqsAngles(self, pot=None, **kwargs):
"""Internal function to compute the actions, frequencies, and angles and cache them for re-use"""
"""Internal function to compute the actions, frequencies, and angles and cache them for reuse"""
self._setupaA(pot=pot, **kwargs)
if hasattr(self, "_aA_jr"):
return None
Expand Down Expand Up @@ -2777,7 +2777,7 @@ def _setup_actionsFreqsAngles(self, pot=None, **kwargs):
return None

def _setup_actions(self, pot=None, **kwargs):
"""Internal function to compute the actions and cache them for re-use (used for methods that don't support frequencies and angles)"""
"""Internal function to compute the actions and cache them for reuse (used for methods that don't support frequencies and angles)"""
self._setupaA(pot=pot, **kwargs)
# Caching effectively checked in _setup_actionsFreqsAngles, because always called first
# if hasattr(self, "_aA_jr"):
Expand Down
2 changes: 1 addition & 1 deletion galpy/orbit/integrateFullOrbit.py
Original file line number Diff line number Diff line change
Expand Up @@ -1142,7 +1142,7 @@ def _rectForce(x, pot, t=0.0, vx=None):
x - current position
t - current time
pot - (list of) Potential instance(s)
vx = (None) if set, use this [vx,vy,vz] when evalulating dissipative forces
vx = (None) if set, use this [vx,vy,vz] when evaluating dissipative forces
OUTPUT:
force
HISTORY:
Expand Down
2 changes: 1 addition & 1 deletion galpy/orbit/integratePlanarOrbit.py
Original file line number Diff line number Diff line change
Expand Up @@ -1590,7 +1590,7 @@ def _planarRectForce(x, pot, t=0.0, vx=None):
x - current position
t - current time
pot - (list of) Potential instance(s)
vx = (None) if set, use this [vx,vy] when evalulating dissipative forces
vx = (None) if set, use this [vx,vy] when evaluating dissipative forces
OUTPUT:
force
HISTORY:
Expand Down
2 changes: 1 addition & 1 deletion galpy/orbit/orbit_c_ext/integrateFullOrbit.c
Original file line number Diff line number Diff line change
Expand Up @@ -932,7 +932,7 @@ void evalRectDeriv(double t, double *q, double *a,

void evalSOSDeriv(double psi, double *q, double *a,
int nargs, struct potentialArg * potentialArgs){
// q= (x,y,vx,vy,A,t,psi); to save operations, we re-use a first for the
// q= (x,y,vx,vy,A,t,psi); to save operations, we reuse a first for the
// rectForce then for the actual RHS
// Note also that we keep track of psi in q+6, not in psi! This is
// such that we can avoid having to convert psi to psi+psi0
Expand Down
4 changes: 2 additions & 2 deletions galpy/orbit/orbit_c_ext/integratePlanarOrbit.c
Original file line number Diff line number Diff line change
Expand Up @@ -876,7 +876,7 @@ void evalPlanarRectDeriv(double t, double *q, double *a,

void evalPlanarSOSDerivx(double psi, double *q, double *a,
int nargs, struct potentialArg * potentialArgs){
// q= (y,vy,A,t,psi); to save operations, we re-use a first for the
// q= (y,vy,A,t,psi); to save operations, we reuse a first for the
// rectForce then for the actual RHS
// Note also that we keep track of psi in q+4, not in psi! This is
// such that we can avoid having to convert psi to psi+psi0
Expand Down Expand Up @@ -910,7 +910,7 @@ void evalPlanarSOSDerivx(double psi, double *q, double *a,

void evalPlanarSOSDerivy(double psi, double *q, double *a,
int nargs, struct potentialArg * potentialArgs){
// q= (x,vx,A,t,psi); to save operations, we re-use a first for the
// q= (x,vx,A,t,psi); to save operations, we reuse a first for the
// rectForce then for the actual RHS
// Note also that we keep track of psi in q+4, not in psi! This is
// such that we can avoid having to convert psi to psi+psi0
Expand Down
2 changes: 1 addition & 1 deletion galpy/potential/SnapshotRZPotential.py
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ def _setup_potential(self, R, z, use_pkdgrav=False, dr=0.0001):
)

# do the same for the mixed radial-vertical component
if self._interpepifreq and self._interpverticalfreq: # re-use this
if self._interpepifreq and self._interpverticalfreq: # reuse this
Rzgrad = numpy.zeros(len(points_new))
for i, racc in enumerate(
rgrad_acc.reshape((len(rgrad_acc) // 2, 2, 3))
Expand Down
2 changes: 1 addition & 1 deletion galpy/potential/potential_c_ext/NonInertialFrameForce.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ void NonInertialFrameForcexyzforces_xyz(double R,double z,double phi,double t,
v0x= (*(*(potentialArgs->tfuncs+6)))(t);
v0y= (*(*(potentialArgs->tfuncs+7)))(t);
v0z= (*(*(potentialArgs->tfuncs+8)))(t);
// Re-use variable
// Reuse variable
Omegatimesvecx= Omegax * x0x + Omegay * x0y + Omegaz * x0z;
*Fx+= 2. * ( Omegaz * v0y - Omegay * v0z ) + Omega2 * x0x - Omegax * Omegatimesvecx;
*Fy+= -2. * ( Omegaz * v0x - Omegax * v0z ) + Omega2 * x0y - Omegay * Omegatimesvecx;
Expand Down
2 changes: 1 addition & 1 deletion galpy/util/bovy_rk.c
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ void bovy_rk6_onestep(void (*func)(double t, double *q, double *a,
//calculate k6
func(tn+dt/2.,ynk,a,nargs,potentialArgs);
for (ii=0; ii < dim; ii++) *(yn1+ii) -= 32.* dt * *(a+ii) / 120.;
for (ii=0; ii < dim; ii++) *(k5+ii)= dt * *(a+ii); //re-use k5 for k6
for (ii=0; ii < dim; ii++) *(k5+ii)= dt * *(a+ii); //reuse k5 for k6
for (ii=0; ii < dim; ii++) *(ynk+ii)= *(yn+ii) + ( 9. * *(k1+ii)
- 36. * *(k2+ii)
+63.* *(k3+ii)
Expand Down
4 changes: 2 additions & 2 deletions tests/test_SpiralArmsPotential.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

_NUMPY_VERSION = parse_version(numpy.__version__)
_NUMPY_1_23 = (_NUMPY_VERSION > parse_version("1.22")) * (
_NUMPY_VERSION < parse_version("1.26")
) # For testing 1.23/1.24/1.25 precision issues
_NUMPY_VERSION < parse_version("1.27")
) # For testing 1.23/1.24/1.25/1.26 precision issues
import unittest

from numpy.testing import assert_allclose
Expand Down
8 changes: 4 additions & 4 deletions tests/test_coords.py
Original file line number Diff line number Diff line change
Expand Up @@ -3073,8 +3073,8 @@ def test_radec_to_custom_pal5():
)
xieta = coords.radec_to_custom(_RAPAL5, _DECPAL5, T=_TPAL5, degree=False)

def checkrng(x, xpct, dom, shft):
return numpy.fabs(((numpy.fabs(x - xpct) + shft) % dom) - shft)
def checkrng(x, xpct, dom, shift):
return numpy.fabs(((numpy.fabs(x - xpct) + shift) % dom) - shift)

# 0 < xieta[0] < 2 * pi
assert (
Expand Down Expand Up @@ -3231,8 +3231,8 @@ def test_custom_to_radec_pal5(): # FIXME COMPARE TO DOCUMENT
)
xieta = coords.custom_to_radec(_RAPAL5, _DECPAL5, T=_TPAL5.T, degree=False)

def checkrng(x, xpct, dom, shft):
return numpy.fabs(((numpy.fabs(x - xpct) + shft) % dom) - shft)
def checkrng(x, xpct, dom, shift):
return numpy.fabs(((numpy.fabs(x - xpct) + shift) % dom) - shift)

# 0 < xieta[0] < 2 * pi
assert (
Expand Down
4 changes: 2 additions & 2 deletions tests/test_evolveddiskdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -1311,7 +1311,7 @@ def test_plot_grid():
gridpoints=_GRIDPOINTS,
)
grid.plot()
# w/ list of tiems
# w/ list of times
mvr, grid = edf.meanvR(
0.9,
t=[0.0, -2.5, -5.0, -7.5, -10.0],
Expand Down Expand Up @@ -1342,7 +1342,7 @@ def test_plot_hierarchgrid():
gridpoints=_GRIDPOINTS,
)
grid.plot()
# w/ list of tiems
# w/ list of times
mvr, grid = edf.meanvR(
0.9,
t=[0.0, -2.5, -5.0, -7.5, -10.0],
Expand Down
6 changes: 3 additions & 3 deletions tests/test_potential.py
Original file line number Diff line number Diff line change
Expand Up @@ -6026,7 +6026,7 @@ def pot(R, z, amp=1.0, a=0.75):
* special.jv(0, k * a)
* numpy.exp(-k * numpy.fabs(z)),
0.0,
numpy.infty,
numpy.inf,
)[0]
)

Expand Down Expand Up @@ -7284,13 +7284,13 @@ def test_TimeDependentAmplitudeWrapperPotential_inputerrors():
match="A= input to TimeDependentAmplitudeWrapperPotential should be a function",
):
tp = TimeDependentAmplitudeWrapperPotential(pot=lp)
# TypeError when suppplying a function with no argument
# TypeError when supplying a function with no argument
with pytest.raises(
TypeError,
match="A= input to TimeDependentAmplitudeWrapperPotential should be a function that can be called with a single parameter",
):
tp = TimeDependentAmplitudeWrapperPotential(pot=lp, A=lambda: 1.0)
# TypeError when suppplying a function with more than 1 argument
# TypeError when supplying a function with more than 1 argument
with pytest.raises(
TypeError,
match="A= input to TimeDependentAmplitudeWrapperPotential should be a function that can be called with a single parameter",
Expand Down
Loading

0 comments on commit 66a6241

Please sign in to comment.