twirl icon indicating copy to clipboard operation
twirl copied to clipboard

getting the image center coordinates

Open artooksanen opened this issue 5 months ago • 5 comments

Hello! I dont know if this is really an issue or just me doing something wrong.

I am trying to get the image center world coordinates but after solving the image with twirl I get slightly wrong values.

Following the tutorial example (https://twirl.readthedocs.io/en/latest/ipynb/wcs.html):

Getting the image center from the original wcs:

center = true_wcs.pixel_to_world(*np.array(data.shape) / 2)
print("center (true_wcs):",center)

gives the correct coordinates:

center (true_wcs): <SkyCoord (FK5: equinox=2000.0): (ra, dec) in deg
    (132.83371279, 11.81205998)>

And wcs gives this:

center = wcs.pixel_to_world(*np.array(data.shape) / 2)
print("center (wcs):",center)

gives this:

center (wcs): <SkyCoord (ICRS): (ra, dec) in deg
    (132.64337958, 11.93021108)>

But the image generated with

radecs_xy = np.array(wcs.world_to_pixel_values(all_radecs))
plt.imshow(data, vmin=np.median(data), vmax=3 * np.median(data), cmap="Greys_r")
_ = CircularAperture(radecs_xy[0:10], 5).plot(color="y", alpha=0.5)

still shows the perfect alignment.

What is wrong? Why different coordinates?

arto

artooksanen avatar Jul 25 '25 15:07 artooksanen

Thanks for opening an issue. Could you share the image?

lgrcia avatar Jul 25 '25 15:07 lgrcia

The image is the same as in the tutorial example.

Arto

Arto Oksanen @.*** Muurame, Finland

pe 25. heinäk. 2025 klo 18.45 Lionel Garcia @.***> kirjoitti:

lgrcia left a comment (lgrcia/twirl#39) https://github.com/lgrcia/twirl/issues/39#issuecomment-3118814675

Thanks for opening an issue. Could you share the image?

— Reply to this email directly, view it on GitHub https://github.com/lgrcia/twirl/issues/39#issuecomment-3118814675, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACZ42K5HYKYXPJK7KEHXNWT3KJGLHAVCNFSM6AAAAACCL6J4X6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTCMJYHAYTINRXGU . You are receiving this because you authored the thread.Message ID: @.***>

artooksanen avatar Jul 25 '25 15:07 artooksanen

Image

artooksanen avatar Jul 25 '25 15:07 artooksanen

I think this was an user error. Now it is working just fine. The main problem was that my test image was generated with JNow coordinates and twirl was using J2000.0. I fixed that and also used a bit larger FOV and now twirl is solving all the images and the plate solutions are accurate.

arto

artooksanen avatar Jul 29 '25 14:07 artooksanen

Thanks a lot @artooksanen. Would you recommend any change to the doc?

lgrcia avatar Aug 05 '25 09:08 lgrcia