Giter VIP home page Giter VIP logo

Comments (6)

timj avatar timj commented on August 14, 2024

Yes. That would be nice. It might be best to write a script to extract the information from the C files and generate the python code before the PyPI distribution is built. The prologues are standard Starlink format and can be extracted either with the SST application or a perl module. I don't have native python code at the moment for parsing the documentation.

from palpy.

timj avatar timj commented on August 14, 2024

I've had a stab at this and I've pushed some test code in commit 35a562f

Seems to work in that help(palpy) is much more useful than it used to be.

Some routines are still undocumented because they are undocumented in PAL (they are the ones that map trivially to ERFA/SOFA). I'll sort those out in PAL itself.

Please let me know if this works for you (not tested on python 2).

For reference your example now gives me:

mapqk(...)
         (ra, da) = mapqk( rm, dm, pr, pd, px, rv, amprms )

    Quick mean to apparent place

    rm = double (Given)
       Mean RA (radians)
    dm = double (Given)
       Mean declination (radians)
    pr = double (Given)
       RA proper motion, changes per Julian year (radians)
    pd = double (Given)
       Dec proper motion, changes per Julian year (radians)
    px = double (Given)
       Parallax (arcsec)
    rv = double (Given)
       Radial velocity (km/s, +ve if receding)
    amprms = double [21] (Given)
       Star-independent mean-to-apparent parameters (see palMappa).
    ra = double * (Returned)
       Apparent RA (radians)
    dec = double * (Returned)
       Apparent dec (radians)

    - The reference frames and timescales used are post IAU 2006.

from palpy.

SimonKrughoff avatar SimonKrughoff commented on August 14, 2024

That looks great. I'll download the branch and give it a try.

from palpy.

SimonKrughoff avatar SimonKrughoff commented on August 14, 2024

I got it to compile and run under Python 2.7. I ran the test file and it passed, so it seem like it's good to go.

I had to do two things.

  1. In Python 2.7, the open built-in doesn't take a codec argument. You have to used the codecs module. I checked and this should be forward compatible to Python 3. Following is the patch for setup.py:
diff --git a/setup.py b/setup.py
index 0c0e680..4f6f48e 100644
--- a/setup.py
+++ b/setup.py
@@ -2,6 +2,7 @@
 import os
 import numpy
 import re
+import codecs
 from distutils.core import setup
 from distutils.extension import Extension
 from Cython.Distutils import build_ext
@@ -94,8 +95,8 @@ for cfile in pal_c:

 # Generate cpal.pxd
 paldoc_re = re.compile(r"@(pal.*)@")
-outfh = open("pal.pyx", "w", encoding="utf8")
-with open('pal.pyx.in') as file:
+outfh = codecs.open("pal.pyx", "w", "utf8")
+with codecs.open('pal.pyx.in', 'r', 'utf8') as file:
     prevline = ""
     for line in file.readlines():
         match_paldoc = paldoc_re.search(line)
  1. In Python 2 you can't import from a directory without making it a module. This just requires placing an empty init.py in the support directory.

I can create a pull request, if you like. Just let me know.

from palpy.

timj avatar timj commented on August 14, 2024

Should now all work for you with commit 160bec2. Closing.

from palpy.

timj avatar timj commented on August 14, 2024

I'll release v1.2 in a couple of weeks once I know that @schandra doesn't need any more tweaks made for his OpSim updates.

from palpy.

Related Issues (6)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.