liberfa/erfa-wrapping-experiments — pull request #8 by nirinA (2014-08-11 22:38:40+00:00)
Title: c_ufunc wrapper generator

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.