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

Add full set of celestial conversions; add some documentation #4

Merged
merged 24 commits into from
Nov 27, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
d0de033
Add more conversions; Add run_benchmark.py script
cdeil Nov 25, 2012
e1a5ebf
Add specification of input and output sky definitions
cdeil Nov 19, 2012
424f50f
Add Kapteyn coordinate conversion result text files.
cdeil Nov 25, 2012
1c109e7
Convert matrix to array to make Kapteyn output correct
cdeil Nov 25, 2012
6570b05
Add astropy celestial conversion output
cdeil Nov 25, 2012
6ca8393
Fixed kapteyn output formatting
cdeil Nov 26, 2012
c4f0bcd
Extend run_benchmark.py script. Remove summary.py
cdeil Nov 26, 2012
e4f8c80
Add all celestial conversions for pyast
cdeil Nov 26, 2012
5442274
Update summary txt and html files
cdeil Nov 26, 2012
9d26719
Each tool declares the coordinate systems it can handle
cdeil Nov 26, 2012
27d33e9
Add ICRS to list of systems we test
cdeil Nov 26, 2012
97e731a
Fix indentation error in html write code
cdeil Nov 26, 2012
8d4a9c0
Only print each pair of tools once in summary
cdeil Nov 26, 2012
47656ab
Run pyephem via run_benchmark.py
cdeil Nov 26, 2012
52426bd
Add pyephem output for all celestial conversions
cdeil Nov 26, 2012
0e5bb22
Add celestial conversions for all systems for tpm.
cdeil Nov 26, 2012
5828ff9
Minor cleanup
cdeil Nov 26, 2012
a9100f0
Rename tpm to astrolib.
cdeil Nov 26, 2012
cd4c955
Update to README and Specification
cdeil Nov 26, 2012
a03b8ac
Move Specification to docs sub-folder
cdeil Nov 26, 2012
1c89470
Add a HOWTO, Notes and Tools document
cdeil Nov 26, 2012
b93c785
Fix typo in Tools.rst
cdeil Nov 26, 2012
6ebf9b1
Add all celestial conversions for pyslalib
cdeil Nov 26, 2012
6dd119c
Add license info for pyslalib and pyast
cdeil Nov 26, 2012
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
*.project
*.pydevproject
*.html
*.pyc
/plots/
64 changes: 24 additions & 40 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,47 +1,31 @@
Coordinates Benchmark
=====================

Here we compare astropy coordinate conversion results against other Python packages.

For now we only compare precision, in the future we also want to compare speed.

Links
-----

Repository: https://github.com/astropy/coordinates-benchmark
Results summary: http://mpia.de/~robitaille/astropy/coordinates/summary.html

Mailing list discussions:
* https://groups.google.com/forum/?fromgroups#!topic/astropy-dev/tbcpMQ1rOcY
* https://groups.google.com/forum/?fromgroups#!topic/astropy-dev/-ulzSY9qJKk
* https://groups.google.com/forum/?fromgroups#!searchin/astropy-dev/benchmark

Documentation is in the `docs` folder:
* Specification.rst
* Notes.rst
* Tools.rst
* HOWTO.rst

History
-------

- Fixed kapteyn transforms to explicitly specify the epoch of observation for
the B1950 conversion, and the equinox for the ecliptic conversion

- Explicitly precess astropy.coordinates fk4 result to B1950

Notes
-----

From David Berry:

> 1) The differences between kapteyn and (idl,pyast,tpm) on the J2000 to
> B1950 tests is reduced seriously if you specify the epoch of
> observation explicitly in kapteyn/convert.py. That is, change
>
> transform_to(skyout='fk4', tag='b1950')
>
> to
>
> transform_to(skyout='fk4,J2000_OBS', tag='b1950')
>
> This reduces the median difference from 0.217 arc-sec, to 0.0044
> arc-sec (this must mean that kapteyn is using a different default
> epoch of observation to the other systems).
>
> 2) Improved agreement in J2000->ecliptic can be achieved by
> specifying the equinox explicitly in kapteyn/convert.py. Change:
>
> transform_to(skyout='ecliptic', tag='ecliptic')
>
> to
>
> transform_to(skyout='ecliptic,J2000', tag='ecliptic')
>
> This causes kapteyn and IDL have zero difference. The kaptyn->pyast
> median difference goes down from 0.04 to 0.036. The remaining
> difference between kapteyn and pyast seems to be down to:
>
> a) DIfferent obliquity models. kaptyn uses the IAU 2000 model, and
> pyast uses the IAU 2006 model.
> b) Different precession models. kaptyn uses IAU 1976 and pyast uses IAU 2006.
>
> Reverting the models used by pyast gives zero difference between
> kapteyn and pyast for the J2000->Ecliptic test

54 changes: 54 additions & 0 deletions astrolib/convert.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
"""
Coordinate conversions with the astrolib coords package.
astrolib coords is a Python wrapper around the TPM C library [2].

I couldn't find a repository for TPM, but there is another
Python wrapper for it called pytpm which has TPM bundled
and is on github, so you can look at the code there.

[1] http://www.scipy.org/AstroLibCoordsHome
[2] http://www.sal.wisc.edu/~jwp/astro/tpm/tpm.html
[3] https://github.com/phn/pytpm/tree/master/src/tpm
"""
import numpy as np
from coords import Position

SUPPORTED_SYSTEMS = 'fk5 fk4 galactic ecliptic'.split()

def convert(coords, systems):

if not set(systems.values()).issubset(SUPPORTED_SYSTEMS):
return None

lons = np.zeros_like(coords['lon'])
lats = np.zeros_like(coords['lat'])

for ii, (lon, lat) in enumerate(zip(coords['lon'], coords['lat'])):

# Create coordinate in input system
if systems['in'] == 'fk5':
coord = Position((lon, lat))
elif systems['in'] == 'fk4':
coord = Position((lon, lat), system='celestial', equinox='B1950')
elif systems['in'] == 'galactic':
coord = Position((lon, lat), system='galactic')
elif systems['in'] == 'ecliptic':
coord = Position((lon, lat), system='ecliptic')
else:
raise ValueError()

# Convert to appropriate output system
if systems['out'] == 'fk5':
lon, lat = coord.j2000()
elif systems['out'] == 'fk4':
lon, lat = coord.b1950()
elif systems['out'] == 'galactic':
lon, lat = coord.galactic()
elif systems['out'] == 'ecliptic':
lon, lat = coord.ecliptic()
else:
raise ValueError()

lons[ii], lats[ii] = lon, lat

return dict(lon=lons, lat=lats)
Loading