barycorrpy icon indicating copy to clipboard operation
barycorrpy copied to clipboard

Vectorize JD to avoid calling JPL Horizons in a loop

Open cbender opened this issue 2 years ago • 0 comments

https://github.com/shbhuk/barycorrpy/blob/4f48f89980b5e2b3ebc8030a3c98211b24688f1b/barycorrpy/barycorrpy.py#L234

As implemented, if the input to get_bc_vel is a list of JDs (as a list or Time objects), then the BC for each is computed individually. This causes problems for the reflected light section reference above, which makes 3 calls to JPL Horizons. The consequence is that a simple calculation over an array of JDs can result in hundreds of back to back calls to Horizons, which flags this as an attack and dumps the socket. The same call can be done in a vectorized manner, resulting in only 3 calls, which is fine.

Assign this to me and I will provide a patch.

cbender avatar Jan 28 '23 23:01 cbender