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

[pre-commit.ci] pre-commit autoupdate #606

Merged
merged 2 commits into from
Oct 3, 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
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
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 @@
)

# 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

Check warning on line 492 in galpy/potential/SnapshotRZPotential.py

View check run for this annotation

Codecov / codecov/patch

galpy/potential/SnapshotRZPotential.py#L492

Added line #L492 was not covered by tests
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
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
4 changes: 2 additions & 2 deletions tests/test_potential.py
Original file line number Diff line number Diff line change
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
6 changes: 3 additions & 3 deletions tests/test_qdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -1460,7 +1460,7 @@ def test_vmomentdensity_diffinoutputs():
)
< 0.05
), "vmomentsurfmass w/ wrong glqeval input does not work"
# Test that we can re-use jr, etc.
# Test that we can reuse jr, etc.
surfmass, jr, lz, jz = qdf.vmomentdensity(
R, z, 0.0, 0.0, 0.0, gl=True, _return_actions=True
)
Expand All @@ -1472,7 +1472,7 @@ def test_vmomentdensity_diffinoutputs():
)
)
< 0.01
), "surfacemass calculated from re-used actions does not agree with that before"
), "surfacemass calculated from reused actions does not agree with that before"
surfmass, jr, lz, jz, rg, kappa, nu, Omega = qdf.vmomentdensity(
R, z, 0.0, 0.0, 0.0, gl=True, _return_actions=True, _return_freqs=True
)
Expand All @@ -1498,7 +1498,7 @@ def test_vmomentdensity_diffinoutputs():
)
)
< 0.01
), "surfacemass calculated from re-used actions does not agree with that before"
), "surfacemass calculated from reused actions does not agree with that before"
# Some tests of mc=True
surfmass, vrs, vts, vzs = qdf.vmomentdensity(
R, z, 0.0, 0.0, 0.0, mc=True, gl=False, _rawgausssamples=True, _returnmc=True
Expand Down
8 changes: 4 additions & 4 deletions tests/test_sphericaldf.py
Original file line number Diff line number Diff line change
Expand Up @@ -1669,7 +1669,7 @@ def test_king_beta_directint():

############################### OSIPKOV-MERRITT DF ############################
# For the following tests, we use a DehnenCoreSphericalPotential
osipkovmerritt_dfs_selfconsist = None # re-use in other tests
osipkovmerritt_dfs_selfconsist = None # reuse in other tests


def test_osipkovmerritt_selfconsist_dehnencore_dens_spherically_symmetric():
Expand Down Expand Up @@ -1831,7 +1831,7 @@ def test_osipkovmerritt_selfconsist_dehnencore_Qoutofbounds():

# For the following tests, we use a DehnenCoreSphericalPotential embedded in
# an NFW halo
osipkovmerritt_dfs_dehnencore_in_nfw = None # re-use in other tests
osipkovmerritt_dfs_dehnencore_in_nfw = None # reuse in other tests


def test_osipkovmerritt_dehnencore_in_nfw_dens_spherically_symmetric():
Expand Down Expand Up @@ -2028,7 +2028,7 @@ def test_constantbetadf_against_hernquist():


# For the following tests, we use a DehnenCoreSphericalPotential
constantbeta_dfs_selfconsist = None # re-use in other tests
constantbeta_dfs_selfconsist = None # reuse in other tests


@pytest.fixture(scope="module")
Expand Down Expand Up @@ -2268,7 +2268,7 @@ def test_constantbeta_selfconsist_dehnencore_rmin_inbounds(

# For the following tests, we use a DehnenCoreSphericalPotential embedded in
# an NFW halo
constantbeta_dfs_dehnencore_in_nfw = None # re-use in other tests
constantbeta_dfs_dehnencore_in_nfw = None # reuse in other tests


def test_constantbeta_dehnencore_in_nfw_dens_spherically_symmetric():
Expand Down