Skip to content

Commit

Permalink
Merge pull request #266 from adrn/py310
Browse files Browse the repository at this point in the history
Bump versions and test on python 3.10
  • Loading branch information
adrn authored Mar 2, 2022
2 parents edb7fef + fa97872 commit 9386310
Show file tree
Hide file tree
Showing 23 changed files with 102 additions and 87 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/cron-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ jobs:
fail-fast: true
matrix:
os: [ubuntu-latest, macos-latest] # TODO: re-enable windows-latest
python: [3.7, 3.8, 3.9]
python: ['3.8', '3.9', '3.10']
include:
# These set options for each python version. So, for example, when any
# python 3.7 job in the matrix runs, it should use this toxenv
- python: 3.7
toxenv: py37-test
# python 3.10 job in the matrix runs, it should use this toxenv
- python: '3.10'
toxenv: py310-test

- python: 3.9
toxenv: py39-test-cov
Expand Down
11 changes: 8 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ jobs:
python: 3.9
toxenv: py39-test-cov

- name: Python 3.10
os: ubuntu-latest
python: '3.10'
toxenv: py310-test

# Has to happen on ubuntu because galpy is finnicky on macOS
- name: Python 3.9 with all optional dependencies
os: ubuntu-latest
Expand All @@ -39,10 +44,10 @@ jobs:
python: 3.9
toxenv: nogsl

- name: Python 3.7 with oldest supported version of all dependencies
- name: Python 3.8 with oldest supported version of all dependencies
os: ubuntu-latest
python: 3.7
toxenv: py37-test-oldestdeps
python: 3.8
toxenv: py38-test-oldestdeps

# Mac and Windows:
- name: Python 3.9 standard tests (macOS)
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:

env:
CIBW_BUILD: "cp3?-*"
CIBW_SKIP: "*-win32 *-manylinux_i686 cp35-* cp36-*"
CIBW_SKIP: "*-win32 *-manylinux_i686 cp35-* cp36-* cp37-*"
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014

jobs:
Expand Down Expand Up @@ -47,7 +47,7 @@ jobs:
- name: Build wheels
run: |
python -m pip install cibuildwheel==1.6.3
python -m pip install cibuildwheel
python -m cibuildwheel --output-dir wheelhouse
- uses: actions/upload-artifact@v2
Expand Down
10 changes: 5 additions & 5 deletions gala/dynamics/lyapunov/dop853_lyapunov.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ from ...potential.potential.cpotential cimport CPotentialWrapper
from ...potential.frame.cframe cimport CFrameWrapper

cdef extern from "frame/src/cframe.h":
ctypedef struct CFrame:
ctypedef struct CFrameType:
pass

cdef extern from "potential/src/cpotential.h":
Expand All @@ -29,10 +29,10 @@ cdef extern from "potential/src/cpotential.h":

cdef extern from "dopri/dop853.h":
ctypedef void (*FcnEqDiff)(unsigned n, double x, double *y, double *f,
CPotential *p, CFrame *fr, unsigned norbits,
CPotential *p, CFrameType *fr, unsigned norbits,
unsigned nbody, void *args) nogil
void Fwrapper (unsigned ndim, double t, double *w, double *f,
CPotential *p, CFrame *fr, unsigned norbits, unsigned nbody)
CPotential *p, CFrameType *fr, unsigned norbits, unsigned nbody)
double six_norm (double *x)

cpdef dop853_lyapunov_max(hamiltonian, double[::1] w0,
Expand Down Expand Up @@ -62,7 +62,7 @@ cpdef dop853_lyapunov_max(hamiltonian, double[::1] w0,

# whoa, so many dots
CPotential cp = (<CPotentialWrapper>(hamiltonian.potential.c_instance)).cpotential
CFrame cf = (<CFrameWrapper>(hamiltonian.frame.c_instance)).cframe
CFrameType cf = (<CFrameWrapper>(hamiltonian.frame.c_instance)).cframe

void *args

Expand Down Expand Up @@ -139,7 +139,7 @@ cpdef dop853_lyapunov_max_dont_save(hamiltonian, double[::1] w0,

# whoa, so many dots
CPotential cp = (<CPotentialWrapper>(hamiltonian.potential.c_instance)).cpotential
CFrame cf = (<CFrameWrapper>(hamiltonian.frame.c_instance)).cframe
CFrameType cf = (<CFrameWrapper>(hamiltonian.frame.c_instance)).cframe

void *args

Expand Down
10 changes: 5 additions & 5 deletions gala/dynamics/mockstream/mockstream.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ from cpython.exc cimport PyErr_CheckSignals
from ...integrate.cyintegrators.dop853 cimport (dop853_step,
dop853_helper_save_all)
from ...potential.potential.cpotential cimport CPotentialWrapper, CPotential
from ...potential.frame.cframe cimport CFrameWrapper, CFrame
from ...potential.frame.cframe cimport CFrameWrapper, CFrameType
from ...potential.potential.builtin.cybuiltin import NullWrapper

from ...potential import Hamiltonian
Expand All @@ -43,11 +43,11 @@ __all__ = ['mockstream_dop853', 'mockstream_dop853_animate']

cdef extern from "dopri/dop853.h":
ctypedef void (*FcnEqDiff)(unsigned n, double x, double *y, double *f,
CPotential *p, CFrame *fr,
CPotential *p, CFrameType *fr,
unsigned norbits, unsigned nbody,
void *args) nogil
void Fwrapper_direct_nbody(unsigned ndim, double t, double *w, double *f,
CPotential *p, CFrame *fr,
CPotential *p, CFrameType *fr,
unsigned norbits, unsigned nbody, void *args) nogil


Expand Down Expand Up @@ -94,7 +94,7 @@ cpdef mockstream_dop853(nbody, double[::1] time,

# whoa, so many dots
CPotential cp = (<CPotentialWrapper>(nbody.H.potential.c_instance)).cpotential
CFrame cf = (<CFrameWrapper>(nbody.H.frame.c_instance)).cframe
CFrameType cf = (<CFrameWrapper>(nbody.H.frame.c_instance)).cframe

# for the test particles
CPotentialWrapper null_wrapper = NullWrapper(1., [],
Expand Down Expand Up @@ -215,7 +215,7 @@ cpdef mockstream_dop853_animate(nbody, double[::1] t,

# whoa, so many dots
CPotential cp = (<CPotentialWrapper>(nbody.H.potential.c_instance)).cpotential
CFrame cf = (<CFrameWrapper>(nbody.H.frame.c_instance)).cframe
CFrameType cf = (<CFrameWrapper>(nbody.H.frame.c_instance)).cframe

int nbodies = nbody._c_w0.shape[0] # includes the progenitor
double [:, ::1] nbody_w0 = nbody._c_w0
Expand Down
8 changes: 4 additions & 4 deletions gala/dynamics/nbody/nbody.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ from ...integrate.cyintegrators.dop853 cimport (dop853_helper,
dop853_helper_save_all)

cdef extern from "frame/src/cframe.h":
ctypedef struct CFrame:
ctypedef struct CFrameType:
pass

cdef extern from "potential/src/cpotential.h":
Expand All @@ -36,10 +36,10 @@ cdef extern from "potential/src/cpotential.h":

cdef extern from "dopri/dop853.h":
ctypedef void (*FcnEqDiff)(unsigned n, double x, double *y, double *f,
CPotential *p, CFrame *fr, unsigned norbits,
CPotential *p, CFrameType *fr, unsigned norbits,
unsigned nbody, void *args) nogil
void Fwrapper_direct_nbody(unsigned ndim, double t, double *w, double *f,
CPotential *p, CFrame *fr, unsigned norbits,
CPotential *p, CFrameType *fr, unsigned norbits,
unsigned nbody, void *args)

cpdef direct_nbody_dop853(double [:, ::1] w0, double[::1] t,
Expand Down Expand Up @@ -67,7 +67,7 @@ cpdef direct_nbody_dop853(double [:, ::1] w0, double[::1] t,
void *args
CPotential *c_particle_potentials[MAX_NBODY]
CPotential cp = (<CPotentialWrapper>(hamiltonian.potential.c_instance)).cpotential
CFrame cf = (<CFrameWrapper>(hamiltonian.frame.c_instance)).cframe
CFrameType cf = (<CFrameWrapper>(hamiltonian.frame.c_instance)).cframe

# Some input validation:
if not isinstance(hamiltonian, Hamiltonian):
Expand Down
10 changes: 5 additions & 5 deletions gala/integrate/cyintegrators/dop853.pxd
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# cython: language_level=3

cdef extern from "frame/src/cframe.h":
ctypedef struct CFrame:
ctypedef struct CFrameType:
pass

cdef extern from "potential/src/cpotential.h":
Expand All @@ -10,20 +10,20 @@ cdef extern from "potential/src/cpotential.h":

cdef extern from "dopri/dop853.h":
ctypedef void (*FcnEqDiff)(unsigned n, double x, double *y, double *f,
CPotential *p, CFrame *fr, unsigned norbits,
CPotential *p, CFrameType *fr, unsigned norbits,
unsigned nbody, void *args) nogil

cdef void dop853_step(CPotential *cp, CFrame *cf, FcnEqDiff F,
cdef void dop853_step(CPotential *cp, CFrameType *cf, FcnEqDiff F,
double *w, double t1, double t2, double dt0,
int ndim, int norbits, int nbody, void *args,
double atol, double rtol, int nmax) except *

cdef dop853_helper(CPotential *cp, CFrame *cf, FcnEqDiff F,
cdef dop853_helper(CPotential *cp, CFrameType *cf, FcnEqDiff F,
double[:,::1] w0, double[::1] t,
int ndim, int norbits, int nbody, void *args, int ntimes,
double atol, double rtol, int nmax, int progress)

cdef dop853_helper_save_all(CPotential *cp, CFrame *cf, FcnEqDiff F,
cdef dop853_helper_save_all(CPotential *cp, CFrameType *cf, FcnEqDiff F,
double[:,::1] w0, double[::1] t,
int ndim, int norbits, int nbody, void *args,
int ntimes, double atol, double rtol, int nmax,
Expand Down
16 changes: 8 additions & 8 deletions gala/integrate/cyintegrators/dop853.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ from ...potential.potential.cpotential cimport CPotentialWrapper
from ...potential.frame.cframe cimport CFrameWrapper

cdef extern from "frame/src/cframe.h":
ctypedef struct CFrame:
ctypedef struct CFrameType:
pass

cdef extern from "potential/src/cpotential.h":
Expand All @@ -33,14 +33,14 @@ cdef extern from "potential/src/cpotential.h":

cdef extern from "dopri/dop853.h":
ctypedef void (*FcnEqDiff)(unsigned n, double x, double *y, double *f,
CPotential *p, CFrame *fr, unsigned norbits,
CPotential *p, CFrameType *fr, unsigned norbits,
unsigned nbody, void *args) nogil
ctypedef void (*SolTrait)(long nr, double xold, double x, double* y,
unsigned n, int* irtrn)

# See dop853.h for full description of all input parameters
int dop853 (unsigned n, FcnEqDiff fn,
CPotential *p, CFrame *fr, unsigned n_orbits, unsigned nbody,
CPotential *p, CFrameType *fr, unsigned n_orbits, unsigned nbody,
void *args,
double x, double* y, double xend,
double* rtoler, double* atoler, int itoler, SolTrait solout,
Expand All @@ -49,7 +49,7 @@ cdef extern from "dopri/dop853.h":
long nstiff, unsigned nrdens, unsigned* icont, unsigned licont)

void Fwrapper (unsigned ndim, double t, double *w, double *f,
CPotential *p, CFrame *fr, unsigned norbits)
CPotential *p, CFrameType *fr, unsigned norbits)

cdef extern from "stdio.h":
ctypedef struct FILE
Expand All @@ -59,7 +59,7 @@ cdef void solout(long nr, double xold, double x, double* y, unsigned n, int* irt
# TODO: see here for example in FORTRAN: http://www.unige.ch/~hairer/prog/nonstiff/dr_dop853.f
pass

cdef void dop853_step(CPotential *cp, CFrame *cf, FcnEqDiff F,
cdef void dop853_step(CPotential *cp, CFrameType *cf, FcnEqDiff F,
double *w, double t1, double t2, double dt0,
int ndim, int norbits, int nbody, void *args,
double atol, double rtol, int nmax) except *:
Expand All @@ -80,7 +80,7 @@ cdef void dop853_step(CPotential *cp, CFrame *cf, FcnEqDiff F,
elif res == -4:
raise RuntimeError("The problem is probably stiff (interrupted).")

cdef dop853_helper(CPotential *cp, CFrame *cf, FcnEqDiff F,
cdef dop853_helper(CPotential *cp, CFrameType *cf, FcnEqDiff F,
double[:, ::1] w0, double[::1] t,
int ndim, int norbits, int nbody, void *args, int ntimes,
double atol, double rtol, int nmax, int progress):
Expand Down Expand Up @@ -128,7 +128,7 @@ cdef dop853_helper(CPotential *cp, CFrame *cf, FcnEqDiff F,

return w

cdef dop853_helper_save_all(CPotential *cp, CFrame *cf, FcnEqDiff F,
cdef dop853_helper_save_all(CPotential *cp, CFrameType *cf, FcnEqDiff F,
double[:, ::1] w0, double[::1] t,
int ndim, int norbits, int nbody, void *args,
int ntimes, double atol, double rtol, int nmax,
Expand Down Expand Up @@ -207,7 +207,7 @@ cpdef dop853_integrate_hamiltonian(hamiltonian, double[:, ::1] w0, double[::1] t

# whoa, so many dots
CPotential cp = (<CPotentialWrapper>(hamiltonian.potential.c_instance)).cpotential
CFrame cf = (<CFrameWrapper>(hamiltonian.frame.c_instance)).cframe
CFrameType cf = (<CFrameWrapper>(hamiltonian.frame.c_instance)).cframe

# 0 below is for nbody - we ignore that in this test particle integration
all_w = dop853_helper_save_all(&cp, &cf, <FcnEqDiff> Fwrapper,
Expand Down
10 changes: 5 additions & 5 deletions gala/integrate/cyintegrators/dopri/dop853.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ static double max_d (double a, double b)
} /* max_d */


static double hinit (unsigned n, FcnEqDiff fcn, CPotential *p, CFrame *fr, unsigned norbits, unsigned nbody, void *args,
static double hinit (unsigned n, FcnEqDiff fcn, CPotential *p, CFrameType *fr, unsigned norbits, unsigned nbody, void *args,
double x, double* y,
double posneg, double* f0, double* f1, double* yy1, int iord,
double hmax, double* atoler, double* rtoler, int itoler)
Expand Down Expand Up @@ -155,7 +155,7 @@ static double hinit (unsigned n, FcnEqDiff fcn, CPotential *p, CFrame *fr, unsig


/* core integrator */
static int dopcor (unsigned n, FcnEqDiff fcn, CPotential *p, CFrame *fr, unsigned norbits, unsigned nbody, void *args,
static int dopcor (unsigned n, FcnEqDiff fcn, CPotential *p, CFrameType *fr, unsigned norbits, unsigned nbody, void *args,
double x, double* y, double xend,
double hmax, double h, double* rtoler, double* atoler,
int itoler, FILE* fileout, SolTrait solout, int iout,
Expand Down Expand Up @@ -695,7 +695,7 @@ static int dopcor (unsigned n, FcnEqDiff fcn, CPotential *p, CFrame *fr, unsigne

/* front-end */
int dop853
(unsigned n, FcnEqDiff fcn, CPotential *p, CFrame *fr, unsigned norbits, unsigned nbody, void *args,
(unsigned n, FcnEqDiff fcn, CPotential *p, CFrameType *fr, unsigned norbits, unsigned nbody, void *args,
double x, double* y, double xend, double* rtoler,
double* atoler, int itoler, SolTrait solout, int iout, FILE* fileout, double uround,
double safe, double fac1, double fac2, double beta, double hmax, double h,
Expand Down Expand Up @@ -977,7 +977,7 @@ double contd8 (unsigned ii, double x)

/* ADDED BY APW */
void Fwrapper (unsigned full_ndim, double t, double *w, double *f,
CPotential *p, CFrame *fr, unsigned norbits, unsigned na,
CPotential *p, CFrameType *fr, unsigned norbits, unsigned na,
void *args) {
/* na can be ignored here - used in nbody wrapper below */

Expand All @@ -991,7 +991,7 @@ void Fwrapper (unsigned full_ndim, double t, double *w, double *f,
}

void Fwrapper_direct_nbody (unsigned full_ndim, double t, double *w, double *f,
CPotential *p, CFrame *fr,
CPotential *p, CFrameType *fr,
unsigned norbits, unsigned nbody,
void *args) {
/* Here, the extra args are actually the array of CPotential objects that
Expand Down
8 changes: 4 additions & 4 deletions gala/integrate/cyintegrators/dopri/dop853.h
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ nfcnRead Number of function calls.
#include "hamiltonian/src/chamiltonian.h"

typedef void (*FcnEqDiff)(unsigned n, double x, double *y, double *f,
CPotential *p, CFrame *fr, unsigned norbits,
CPotential *p, CFrameType *fr, unsigned norbits,
unsigned nbody, void *args);

typedef void (*SolTrait)(long nr, double xold, double x, double* y, unsigned n, int* irtrn);
Expand All @@ -197,7 +197,7 @@ extern int dop853
(unsigned n, /* dimension of the system <= UINT_MAX-1*/
FcnEqDiff fcn, /* function computing the value of f(x,y) */
CPotential *p, /* ADDED BY ADRN: parameters for gradient function */
CFrame *fr, /* ADDED BY ADRN: reference frame */
CFrameType *fr, /* ADDED BY ADRN: reference frame */
unsigned n_orbits, /* ADDED BY ADRN: total number of orbits, i.e. bodies */
unsigned n_body, /* ADDED BY ADRN: number of nbody particles */
void *args, /* ADDED BY ADRN: a container for other stuff */
Expand Down Expand Up @@ -239,10 +239,10 @@ extern double xRead (void);

/* ADDED BY APW */
extern void Fwrapper (unsigned ndim, double t, double *w, double *f,
CPotential *p, CFrame *fr,
CPotential *p, CFrameType *fr,
unsigned norbits, unsigned nbody, void *args);
extern void Fwrapper_direct_nbody(unsigned ndim, double t, double *w, double *f,
CPotential *p, CFrame *fr,
CPotential *p, CFrameType *fr,
unsigned norbits, unsigned nbody,
void *args); // here args becomes the particle potentials
extern double six_norm (double *x); /* Needed for Lyapunov */
2 changes: 1 addition & 1 deletion gala/integrate/cyintegrators/leapfrog.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ from ...potential.potential.cpotential cimport CPotentialWrapper
from ...potential.frame import StaticFrame

cdef extern from "frame/src/cframe.h":
ctypedef struct CFrame:
ctypedef struct CFrameType:
pass

cdef extern from "potential/src/cpotential.h":
Expand Down
2 changes: 1 addition & 1 deletion gala/integrate/cyintegrators/ruth4.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ from ...potential.potential.cpotential cimport CPotentialWrapper
from ...potential.frame import StaticFrame

cdef extern from "frame/src/cframe.h":
ctypedef struct CFrame:
ctypedef struct CFrameType:
pass

cdef extern from "potential/src/cpotential.h":
Expand Down
Loading

0 comments on commit 9386310

Please sign in to comment.