Closed zonca closed 13 years ago
Hello,
I have re-written the C function convert
, in convert.c
, which is indirectly called by tpmu.convert
and directly by tpm.convert
, so that it accept coordinates and time tag as arrays. This should be faster than directly processing lists in python and then calling tpmu.convert
for each coordinate pair in the list; haven't tested this claim though.
The changed code is in the git branch convert-input-an-array
. I don't want to merge it into master at this time. I am currently writing documentation, and tests, and would like to make a release of the existing code with the documentation. After that, the changes to convert can be released as a new version.
Basically, we accept python lists into tpmu.convert
and then construct C arrays from them, Then we pass the C arrays to tpm.convert
. It returns C arrays, which are then processed back into python lists. These lists are then returned by tpmu.convert
.
So now, we can do:
x_out, y_out = tpmu.convert(x=a_list, y=b_list, timetag=c_list, ..........)
print tpm.fmt_alpha(utils.d2r(x_out[0]), tpm.fmt_alpha(tpmu.d2r(y_out[0])
Files test/sanity_test.py and test/test_convert.py have some simple examples.
Hope this helps.
Also, if you can send me a list of coordinates and time tags that you want to test, I can add that as a test and see what we get.
Thanks Prasanth
it looks wonderful, let me test it, then I'll reply back, thanks! andrea
tested, it works fine, however I expected a bigger improvement in performance, now on my laptop it takes 30s with lists of 46800 values. while with a python for loop using the master branch it takes 34.1s with the same lists.
hi, I would like to convert a long array from local frame to equatorial using: tpmu.convert
is there a better way than using a for loop? the best would be to have a function which accepts arrays for x, y and timetag.
thanks