Skip to content

Commit

Permalink
Add pal.polmo
Browse files Browse the repository at this point in the history
  • Loading branch information
timj committed Oct 19, 2014
1 parent c997e89 commit 7f89833
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 1 deletion.
2 changes: 2 additions & 0 deletions cpal.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,8 @@ cdef extern from "pal.h":
double *ra, double *dec, double *r, int *jstat )
void palPlantu ( double date, double elong, double phi, double u[13],
double *ra, double *dec, double *r, int *jstat )
void palPolmo( double elongm, double phim, double xp, double yp,
double *elong, double *phi, double *daz )
void palPm ( double r0, double d0, double pr, double pd,
double px, double rv, double ep0, double ep1,
double *r1, double *d1 )
Expand Down
14 changes: 14 additions & 0 deletions pal.pyx.in
Original file line number Diff line number Diff line change
Expand Up @@ -1489,6 +1489,20 @@ def pa( double ha, double dec, double phi):
"""
return cpal.palPa( ha, dec, phi )

def polmo( double elongm, double phim, double xp, double yp):
"""
(elong, phi, daz) = polmo( elongm, phim, xp, yp )

@palPolmo@
"""
cdef double elong
cdef double phi
cdef double daz

cpal.palPolmo( elongm, phim, xp, yp, &elong, &phi, &daz )

return (elong, phi, daz)

def pertel(int jform, double date0, double date1,
double epoch0, double orbi0, double anode0,
double perih0, double aorq0, double e0, double am0):
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
"palNutc.c", "palOap.c", "palOapqk.c", "palObs.c",
"palOne2One.c", "palPa.c", "palPertel.c", "palPertue.c",
"palPlanel.c", "palPlanet.c", "palPlante.c", "palPlantu.c",
"palPm.c", "palPrebn.c", "palPrec.c", "palPreces.c",
"palPm.c", "palPolmo.c", "palPrebn.c", "palPrec.c", "palPreces.c",
"palPrenut.c", "palPv2el.c", "palPv2ue.c", "palPvobs.c",
"palRdplan.c", "palRefco.c", "palRefro.c", "palRefv.c",
"palRefz.c", "palRverot.c", "palRvgalc.c", "palRvlg.c",
Expand Down
7 changes: 7 additions & 0 deletions test_pal.py
Original file line number Diff line number Diff line change
Expand Up @@ -895,6 +895,13 @@ def test_pmVector(self):
self.assertAlmostEqual(r1,r2,12)
self.assertAlmostEqual(d1,d2,12)

def test_polmo(self):
(elong, phi, daz) = pal.polmo( 0.7, -0.5, 1.0e-6, -2.0e-6)

self.assertAlmostEqual( elong, 0.7000004837322044, 12 )
self.assertAlmostEqual( phi, -0.4999979467222241, 12 )
self.assertAlmostEqual( daz, 1.008982781275728e-6, 12 )

def test_prebn(self):
expected = np.array( [
[ 9.999257613786738e-1, -1.117444640880939e-2, -4.858341150654265e-3 ],
Expand Down

0 comments on commit 7f89833

Please sign in to comment.