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

c_ufunc wrapper generator #8

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

c_ufunc wrapper generator #8

wants to merge 1 commit into from

Conversation

nirinA
Copy link

@nirinA nirinA commented Aug 11, 2014

put erfa_wrapp.py and setup.py in the same directory where erfa.c and erfa.h are, and

python setup.py build_ext --inplace

there is no check for there returned value, i'm working on it, when it's an integer; so be sure to pass correct value

functions that manipulate char, eraASTROM and eraLDBODY are skipped, for now.
i added d2dtf manually. for this specific function, the only relevant string, according to the doc
is "utc". so there is no special need of a string argument here. for other functions with string, one may need a Python wrapper where one passes string argument. the corresponding c_ufunc must have fixed string.

there is still an issue with this function, on my platform, i have to cast the integer into int32:

In [13]: _erfa.d2dtf(np.int32(4),2450000.5,1.)
Out[13]: (1995, 10, 11, 0, 0, 0, 0)

same thing for other function using int

In [31]: _erfa.dat(np.int32(2003), np.int32(6), np.int32(1), 0.0)
Out[31]: 32.0

the script uses the doc to generate the wrapper, so it needs to be consistent and a careful check.
for example, there is a typo in the eraCr function and the generated wrapper cannot be computed.
these functions are skipped.

when dealing with matrix and vector, they need to be flattened. that's not very practical.
a wrapper using structured array may be used here. i'll try to see if this is doable.
or maybe a Python wrapper to flatten the arguments and reshape the results.

@nirinA
Copy link
Author

nirinA commented Aug 11, 2014

and there is no need to install liberfa as erfa.c is compiled against the module.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant