esa / tetra3

A fast lost-in-space plate solver for star trackers.
https://tetra3.readthedocs.io/en/latest/
Apache License 2.0
102 stars 24 forks source link

IndexError when 'return_images' or 'return_moments' are set to True #10

Closed astropatel closed 1 year ago

astropatel commented 1 year ago

Hello Gustav,

There appears to be an IndexError that is raised when the kw_args

return_images
return_moments

are set to True. When these are False , the centroids in solve_from_image comes out to be an Nx2 array of N star centroids. When this is passed to solve_from_centroids, the line star_centroids[:num_stars,:] works perfectly. However, when those two keywords are set to True, a 3 element tuple is passed which throws an IndexError when star_centroids[:num_stars,:] tries to slice star_centroids.

gustavmpettersson commented 1 year ago

If return_moments=True and/or return_images=True in get_centroids_from_image the centroids are returned in the first position of a tuple together with the extra return data requested. This is specified in the documentation

astropatel commented 1 year ago

Yes, I understand. But if those return_moments and return_images are set to True, the code doens't seem to be handling the propagation correctly. If I run test_tetra3 as is, it runs perfectly.

But if I include those keywords, the error persists: image image

gustavmpettersson commented 1 year ago

Thanks for the note. Those arguments are not intended to be supported in solve_from_image, we will clarify this in the documentation. If you want to see more into the centroiding please use get_centroids... and solve_from_centroids

gustavmpettersson commented 1 year ago

FYI, this was now implemented anyway, so extra return values are passed through from get_centroids_from_image