From 361c10f9f525042d805789eb52fbec299ef58a5d Mon Sep 17 00:00:00 2001 From: "E. G. Patrick Bos" Date: Fri, 17 Apr 2026 15:34:21 +0200 Subject: [PATCH 1/8] remove pytpm It is causing too much issues, since it depends on a very old setuptools to install (due to the use_2to3 flag in setup.py) which clashes with the requirements of other packages. --- coordinates_benchmark/tools/pytpm.py | 60 ---------------------------- coordinates_benchmark/utils.py | 2 +- docs/Tools.rst | 15 ------- requirements.txt | 1 - 4 files changed, 1 insertion(+), 77 deletions(-) delete mode 100644 coordinates_benchmark/tools/pytpm.py diff --git a/coordinates_benchmark/tools/pytpm.py b/coordinates_benchmark/tools/pytpm.py deleted file mode 100644 index 3f35cc0..0000000 --- a/coordinates_benchmark/tools/pytpm.py +++ /dev/null @@ -1,60 +0,0 @@ -# Licensed under a 3-clause BSD style license - see LICENSE.rst -""" -Coordinate conversions with the pytpm Python package. - -https://github.com/phn/pytpm -http://phn.github.com/pytpm -""" -from __future__ import absolute_import, division, print_function - -import numpy as np -from astropy.table import Table -import pytpm -from pytpm import tpm - -SUPPORTED_SYSTEMS = 'fk5 fk4 galactic ecliptic'.split() - - -def get_state(system): - # The table of TPM states is here - # http://phn.github.com/pytpm/conversions.html#function-convert-convertv6 - - # We set the epoch and equinox to get consistent results with - # astrolib.coords.Position, see Position._set_tpmstate there. - d = dict() - d['fk5'] = dict(state=tpm.TPM_S06, epoch=tpm.J2000, equinox=tpm.J2000) - d['fk4'] = dict(state=tpm.TPM_S05, epoch=tpm.B1950, equinox=tpm.B1950) - d['galactic'] = dict(state=tpm.TPM_S04, epoch=tpm.J2000, equinox=tpm.byear2jd(1958)) - d['ecliptic'] = dict(state=tpm.TPM_S03, epoch=tpm.J2000, equinox=tpm.jyear2jd(1984)) - # d['icrs'] = TPM_S06 - return d[system] - - -def transform_celestial(coords, systems): - # Convert coords to a list of tpm.V6C objects called in_coords - lon, lat = np.radians(coords['lon']), np.radians(coords['lat']) - dummy = np.zeros_like(lon) - in_coords = pytpm.convert.cat2v6(lon, lat, dummy, dummy, dummy, dummy) - - # Do the coordinate transformation - in_state, out_state = get_state(systems['in']), get_state(systems['out']) - out_coords = pytpm.convert.convertv6(in_coords, s1=in_state['state'], s2=out_state['state'], - equinox=in_state['equinox']) # epoch=in_state['epoch'], - - # Maybe we have to precess here fore some systems? - # http://phn.github.com/pytpm/functions.html#pytpm.convert.precessv6 - - #import IPython; IPython.embed(); 1/0 - - # Convert list of tpm.V6C objects out_coords first - # to a list of dicts, then to lon, lat numpy arrays - out_coords = pytpm.convert.v62cat(out_coords) # , C=tpm.CB - lon = np.array([_['alpha'] for _ in out_coords]) - lat = np.array([_['delta'] for _ in out_coords]) - lon, lat = np.degrees(lon), np.degrees(lat) - - out = Table() - out['lon'] = lon - out['lat'] = lat - - return out diff --git a/coordinates_benchmark/utils.py b/coordinates_benchmark/utils.py index 769bb43..b8bef81 100644 --- a/coordinates_benchmark/utils.py +++ b/coordinates_benchmark/utils.py @@ -25,7 +25,7 @@ for _ in CELESTIAL_CONVERSIONS if _[0] != _[1]] -TOOLS = sorted('astropy kapteyn novas pyast palpy pyephem pyslalib pytpm skyfield'.split()) +TOOLS = sorted('astropy kapteyn novas pyast palpy pyephem pyslalib skyfield'.split()) TOOL_PAIRS = [_ for _ in itertools.product(TOOLS, TOOLS) if _[0] < _[1]] diff --git a/docs/Tools.rst b/docs/Tools.rst index 5862d08..beb281a 100644 --- a/docs/Tools.rst +++ b/docs/Tools.rst @@ -59,18 +59,6 @@ PySlalib `f2py `_ and `numpy `_ wrappers of the fortran version of the astro library `SLALIB `_ -PyTPM -+++++ - -`pytpm `_ is `Cython `_ interface to the -`TPM `_ C library with a high-level -``convert.convertv6`` function interface. Unmaintained. - -We are using the version from github main. - -Note that ``pytpm`` is unmaintained and is known to give incorrect results in this case: -https://github.com/phn/pytpm/issues/2 - Licenses and Features --------------------- @@ -91,7 +79,6 @@ pyast LGPL LGPL Yes Yes pyephem LGPL LGPL No Yes pyslalib GPL GPL No Yes pysofa MIT SOFA No Yes -pytpm BSD ??? No Yes ================= ============= ============= ===== ====== Notes: @@ -100,8 +87,6 @@ Notes: Please report any inaccuracies, especially concerning the license status. -The following packages have been removed from the ``coordinates-benchmark``: - Other tools that are currently not included +++++++++++++++++++++++++++++++++++++++++++ diff --git a/requirements.txt b/requirements.txt index cf41670..e4ac08b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,3 @@ -https://github.com/astrojuanlu/pytpm/archive/master.zip; python_version >= "3" git+http://github.com/astropy/astropy.git#egg=astropy novas pyephem From 6eef730123dc63c405a1f1c34d596d0cf5702eef Mon Sep 17 00:00:00 2001 From: "E. G. Patrick Bos" Date: Fri, 17 Apr 2026 16:14:43 +0200 Subject: [PATCH 2/8] update dependencies Also simplify the workflow script. --- .github/workflows/run-benchmarks.yml | 6 +----- requirements.txt | 4 ++-- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/.github/workflows/run-benchmarks.yml b/.github/workflows/run-benchmarks.yml index f37ea48..20815cf 100644 --- a/.github/workflows/run-benchmarks.yml +++ b/.github/workflows/run-benchmarks.yml @@ -14,9 +14,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - astropy-version: [4.1.*] - python-version: [3.7] - numpy-version: [1.17.4] + python-version: [3.11] steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 @@ -25,8 +23,6 @@ jobs: python-version: ${{ matrix.python-version }} - name: Install dependencies run: | - python -m pip install "numpy==$NUMPY_VERSION" - python -m pip install "astropy==$ASTROPY_VERSION" # Non declared build dependencies python -m pip install Cython # Tools to benchmark diff --git a/requirements.txt b/requirements.txt index e4ac08b..1290bf8 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,8 +4,8 @@ pyephem https://github.com/scottransom/pyslalib/archive/master.zip starlink-pyast palpy -kapteyn<=2.3; python_version < "3" -http://www.astro.rug.nl/software/kapteyn/kapteyn-3.0.tar.gz; python_version >= "3" +http://www.astro.rug.nl/software/kapteyn/kapteyn-3.4.tar.gz +numpy<2.3 # kapteyn doesn't work with >=2.3 due to deprecation of NPY_OWNDATA skyfield click matplotlib From b0f0171c58e1036ef50be783ec97a5fac021fca4 Mon Sep 17 00:00:00 2001 From: "E. G. Patrick Bos" Date: Fri, 17 Apr 2026 16:20:30 +0200 Subject: [PATCH 3/8] install numpy outside of requirements.txt --- .github/workflows/run-benchmarks.yml | 2 ++ requirements.txt | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/run-benchmarks.yml b/.github/workflows/run-benchmarks.yml index 20815cf..d1770a7 100644 --- a/.github/workflows/run-benchmarks.yml +++ b/.github/workflows/run-benchmarks.yml @@ -25,6 +25,8 @@ jobs: run: | # Non declared build dependencies python -m pip install Cython + # install numpy outside of requirements, since pyslalib doesn't declare it as a dependency + python -m pip install "numpy<2.3" # kapteyn doesn't work with >=2.3 due to deprecation of NPY_OWNDATA # Tools to benchmark python -m pip install -r requirements.txt # Prefetch as workaround for https://github.com/skyfielders/python-skyfield/issues/262 diff --git a/requirements.txt b/requirements.txt index 1290bf8..a45cb6c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,7 +5,6 @@ https://github.com/scottransom/pyslalib/archive/master.zip starlink-pyast palpy http://www.astro.rug.nl/software/kapteyn/kapteyn-3.4.tar.gz -numpy<2.3 # kapteyn doesn't work with >=2.3 due to deprecation of NPY_OWNDATA skyfield click matplotlib From 878195427045277a356305e284230511588eabff Mon Sep 17 00:00:00 2001 From: "E. G. Patrick Bos" Date: Tue, 21 Apr 2026 12:45:00 +0200 Subject: [PATCH 4/8] Remove pyslalib from the benchmark --- .github/workflows/run-benchmarks.yml | 1 - coordinates_benchmark/tools/pyslalib.py | 53 ------------------------- coordinates_benchmark/utils.py | 2 +- docs/Tools.rst | 9 ----- requirements.txt | 1 - 5 files changed, 1 insertion(+), 65 deletions(-) delete mode 100644 coordinates_benchmark/tools/pyslalib.py diff --git a/.github/workflows/run-benchmarks.yml b/.github/workflows/run-benchmarks.yml index d1770a7..84c5ce1 100644 --- a/.github/workflows/run-benchmarks.yml +++ b/.github/workflows/run-benchmarks.yml @@ -25,7 +25,6 @@ jobs: run: | # Non declared build dependencies python -m pip install Cython - # install numpy outside of requirements, since pyslalib doesn't declare it as a dependency python -m pip install "numpy<2.3" # kapteyn doesn't work with >=2.3 due to deprecation of NPY_OWNDATA # Tools to benchmark python -m pip install -r requirements.txt diff --git a/coordinates_benchmark/tools/pyslalib.py b/coordinates_benchmark/tools/pyslalib.py deleted file mode 100644 index 6ca9a1a..0000000 --- a/coordinates_benchmark/tools/pyslalib.py +++ /dev/null @@ -1,53 +0,0 @@ -# Licensed under a 3-clause BSD style license - see LICENSE.rst -""" -Coordinate conversions with the pyslalib Python package. - -https://github.com/scottransom/pyslalib -""" -from __future__ import absolute_import, division, print_function - -import numpy as np -from astropy.table import Table -from pyslalib import slalib - -SUPPORTED_SYSTEMS = 'fk5 fk4 icrs galactic ecliptic'.split() - - -def transform_celestial(coords, systems): - lons, lats = np.radians(coords['lon']), np.radians(coords['lat']) - - out = Table() - out['lon'] = np.zeros(len(coords), dtype='float64') - out['lat'] = np.zeros(len(coords), dtype='float64') - - for ii, (lon, lat) in enumerate(zip(lons, lats)): - - # First convert to FK5 J2000 in all cases - if systems['in'] == 'fk4': - lon, lat = slalib.sla_fk45z(lon, lat, 2000.0012775136652) - elif systems['in'] == 'icrs': - lon, lat = slalib.sla_hfk5z(lon, lat, 2000)[:2] - elif systems['in'] == 'galactic': - lon, lat = slalib.sla_galeq(lon, lat) - elif systems['in'] == 'ecliptic': - lon, lat = slalib.sla_ecleq(lon, lat, 51544) - - # Now convert from FK5 J2000 to out system - if systems['out'] == 'fk4': - # FK5 -> FK4 at BEPOCH 2000 assuming no proper motion or parallax - lon, lat = slalib.sla_fk54z(lon, lat, 2000.0012775136652)[:2] - elif systems['out'] == 'icrs': - # FK5 -> Hipparcos (i.e. ICRF, which is as close as SLALIB - # gets to ICRS) at epoch 2000 and with no proper motion - lon, lat = slalib.sla_fk5hz(lon, lat, 2000) - elif systems['out'] == 'galactic': - # FK5 -> Galactic - lon, lat = slalib.sla_eqgal(lon, lat) - elif systems['out'] == 'ecliptic': - # FK5 -> Ecliptic at TDB (MJD) 51544 (i.e. J2000) - lon, lat = slalib.sla_eqecl(lon, lat, 51544) - - out[ii]['lon'] = np.degrees(lon) - out[ii]['lat'] = np.degrees(lat) - - return out diff --git a/coordinates_benchmark/utils.py b/coordinates_benchmark/utils.py index b8bef81..0dd28ad 100644 --- a/coordinates_benchmark/utils.py +++ b/coordinates_benchmark/utils.py @@ -25,7 +25,7 @@ for _ in CELESTIAL_CONVERSIONS if _[0] != _[1]] -TOOLS = sorted('astropy kapteyn novas pyast palpy pyephem pyslalib skyfield'.split()) +TOOLS = sorted('astropy kapteyn novas pyast palpy pyephem skyfield'.split()) TOOL_PAIRS = [_ for _ in itertools.product(TOOLS, TOOLS) if _[0] < _[1]] diff --git a/docs/Tools.rst b/docs/Tools.rst index beb281a..06d4b06 100644 --- a/docs/Tools.rst +++ b/docs/Tools.rst @@ -51,14 +51,6 @@ PyEphem `xephem `_ coordinate routines, which are interfaced as C extensions. Currently a re-write using Cython is underway in the `version4` branch on github. -PySlalib -++++++++ - -`pyslalib `_ - -`f2py `_ and `numpy `_ -wrappers of the fortran version of the astro library `SLALIB `_ - Licenses and Features --------------------- @@ -77,7 +69,6 @@ novas Public Domain Public Domain No Yes palpy GPL GPL Some Yes pyast LGPL LGPL Yes Yes pyephem LGPL LGPL No Yes -pyslalib GPL GPL No Yes pysofa MIT SOFA No Yes ================= ============= ============= ===== ====== diff --git a/requirements.txt b/requirements.txt index a45cb6c..69e4b58 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,6 @@ git+http://github.com/astropy/astropy.git#egg=astropy novas pyephem -https://github.com/scottransom/pyslalib/archive/master.zip starlink-pyast palpy http://www.astro.rug.nl/software/kapteyn/kapteyn-3.4.tar.gz From bcb0ec22c9ad502fce7dea95e0b2b82e1716a4d2 Mon Sep 17 00:00:00 2001 From: "E. G. Patrick Bos" Date: Thu, 28 May 2026 13:19:36 +0200 Subject: [PATCH 5/8] Remove Kapteyn package references and related code --- coordinates_benchmark/tools/kapteyn.py | 47 -------------------------- coordinates_benchmark/utils.py | 2 +- docs/Tools.rst | 7 ---- requirements.txt | 1 - 4 files changed, 1 insertion(+), 56 deletions(-) delete mode 100644 coordinates_benchmark/tools/kapteyn.py diff --git a/coordinates_benchmark/tools/kapteyn.py b/coordinates_benchmark/tools/kapteyn.py deleted file mode 100644 index bb8afad..0000000 --- a/coordinates_benchmark/tools/kapteyn.py +++ /dev/null @@ -1,47 +0,0 @@ -# Licensed under a 3-clause BSD style license - see LICENSE.rst -""" -Coordinate conversions with the kapteyn Python package. - -kapteyn.celestial is very feature-complete and has great docs. -Check this out: - -http://www.astro.rug.nl/software/kapteyn/celestial.html -http://www.astro.rug.nl/software/kapteyn/celestial.html#celestial.sky2sky -http://www.astro.rug.nl/software/kapteyn/celestial.html#celestial.skyparser - -http://www.astro.rug.nl/software/kapteyn/celestialbackground.html -http://www.astro.rug.nl/software/kapteyn/celestialbackground.html#composing-other-transformations -""" -from __future__ import absolute_import, division, print_function - -import numpy as np -from astropy.table import Table -from kapteyn import celestial - -SUPPORTED_SYSTEMS = 'fk5 fk4 icrs galactic ecliptic'.split() - - -def system_spec(system): - """Convert generic system specification tags to Kapteyn specific specification strings.""" - d = dict() - d['fk5'] = 'fk5' - d['fk4'] = 'fk4,J2000_OBS' - d['icrs'] = 'icrs' - d['galactic'] = 'galactic' - d['ecliptic'] = 'ecliptic,J2000' - return str(d[system]) - - -def transform_celestial(coords, systems): - """Convert an array of in_coords from in_system to out_system""" - # Use kapteyn package specific specifiers for in- and out-systems - skyin, skyout = system_spec(systems['in']), system_spec(systems['out']) - - coords = celestial.sky2sky(skyin, skyout, coords['lon'], coords['lat']) - coords = np.array(coords) - - out = Table() - out['lon'] = coords[:, 0] - out['lat'] = coords[:, 1] - - return out diff --git a/coordinates_benchmark/utils.py b/coordinates_benchmark/utils.py index 0dd28ad..312e561 100644 --- a/coordinates_benchmark/utils.py +++ b/coordinates_benchmark/utils.py @@ -25,7 +25,7 @@ for _ in CELESTIAL_CONVERSIONS if _[0] != _[1]] -TOOLS = sorted('astropy kapteyn novas pyast palpy pyephem skyfield'.split()) +TOOLS = sorted('astropy novas pyast palpy pyephem skyfield'.split()) TOOL_PAIRS = [_ for _ in itertools.product(TOOLS, TOOLS) if _[0] < _[1]] diff --git a/docs/Tools.rst b/docs/Tools.rst index 06d4b06..6a44a5d 100644 --- a/docs/Tools.rst +++ b/docs/Tools.rst @@ -12,12 +12,6 @@ astropy.coordinates `astropy.coordinates `_: Uses `erfa `_ for some computations, but re-implements many things using Python / numpy. -kapteyn.celestial -+++++++++++++++++ - -`kapteyn.celestial `_: -Part of the `Kapteyn `_ package. - NOVAS +++++ @@ -64,7 +58,6 @@ Licenses and Features Package License Lib License Array Alt/Az ================= ============= ============= ===== ====== astropy BSD --- No No -kapteyn.celestial BSD --- Yes No novas Public Domain Public Domain No Yes palpy GPL GPL Some Yes pyast LGPL LGPL Yes Yes diff --git a/requirements.txt b/requirements.txt index 69e4b58..0a848cd 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,7 +3,6 @@ novas pyephem starlink-pyast palpy -http://www.astro.rug.nl/software/kapteyn/kapteyn-3.4.tar.gz skyfield click matplotlib From 46c460af16889a8b1ea6fff3bca688a70e2f8c14 Mon Sep 17 00:00:00 2001 From: "E. G. Patrick Bos" Date: Thu, 28 May 2026 13:05:18 +0200 Subject: [PATCH 6/8] add vscode to gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 7c8fa0b..cf9ceef 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ .pydevproject .settings .idea +.vscode *.html *.pyc *~ From cee1daff303be64002927cf99b653d8388b5cec0 Mon Sep 17 00:00:00 2001 From: "E. G. Patrick Bos" Date: Thu, 28 May 2026 13:29:46 +0200 Subject: [PATCH 7/8] remove numpy pin It was only necessary for kapteyn, which we just removed. --- .github/workflows/run-benchmarks.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/run-benchmarks.yml b/.github/workflows/run-benchmarks.yml index 84c5ce1..646e0af 100644 --- a/.github/workflows/run-benchmarks.yml +++ b/.github/workflows/run-benchmarks.yml @@ -24,8 +24,7 @@ jobs: - name: Install dependencies run: | # Non declared build dependencies - python -m pip install Cython - python -m pip install "numpy<2.3" # kapteyn doesn't work with >=2.3 due to deprecation of NPY_OWNDATA + python -m pip install Cython numpy # Tools to benchmark python -m pip install -r requirements.txt # Prefetch as workaround for https://github.com/skyfielders/python-skyfield/issues/262 From 8e1f7a0278fea93514fe2ea9b80a968a79e56eb1 Mon Sep 17 00:00:00 2001 From: "E. G. Patrick Bos" Date: Thu, 28 May 2026 13:31:44 +0200 Subject: [PATCH 8/8] fix angular_separation import It was moved after astropy v6 --- coordinates_benchmark/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coordinates_benchmark/utils.py b/coordinates_benchmark/utils.py index 312e561..534b596 100644 --- a/coordinates_benchmark/utils.py +++ b/coordinates_benchmark/utils.py @@ -136,7 +136,7 @@ def celestial_results(tool, systems, symmetric=False): # TODO: switch internally to radians and get rid of this helper function! def angular_separation_deg_to_arcsec(lon1, lat1, lon2, lat2): - from astropy.coordinates.angle_utilities import angular_separation + from astropy.coordinates import angular_separation from astropy.coordinates import Angle lon1 = np.radians(lon1) lat1 = np.radians(lat1)