Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Astrometry issue #533

Closed
mShuntov opened this issue Dec 19, 2022 · 5 comments
Closed

Astrometry issue #533

mShuntov opened this issue Dec 19, 2022 · 5 comments

Comments

@mShuntov
Copy link

Hi,

I have found a possible bug in the astrometry of detected and modeled sources in SE++.

In particular, the ourput world coordinates (RA, Dec) from the code show an unusual large scatter when compared to the true coordinates of the sources in the image. Here's an example

image
This is the astrometry in JWST-like simulated images, where the dashed lines mark the size of a pixel. The dispersion in RA is larger than a pixel (and unacceptable) -- but it indicates perhaps a rounding to the nearest pixel issue. In Dec the scatter is smaller (ignore the offset at the moment, that is probably an issue in the simulated images).

This astrometry issue persists with both detection and model coordinates.

I did some tests that indicate that the problem is the image to world coordinate transformation with the WCS in the code, as obtained with the function
ra, dec, wc_rad, wc_angle, wc_ratio = get_world_parameters(x, y, rad, angle, ratio).

In fact, if I use the image coordinates (in pixel), both model and detection, and I use the detection image WCS information to convert them to world coordinates using astropy's function
ra_pxtosc, dec_pxtosc = convert_pixel_to_skycoord(cat0['X_MODEL'], cat0['Y_MODEL'], wcs)
I get excellent agreement with the true coordinates (modulo the Dec offset which we think it's an issue in the simulated images)

image

In my case, I will use this workaround for this issue, but you might want to address this for the next release, as it is an easy fix.

@mkuemmel
Copy link
Collaborator

I am afraid I can confirm that converting 'pixel_centroid_x' and 'pixel_centroid_y' to RA and Dec with e.g. astropy gives a different result than 'world_centroid_alpha' and 'world_centroid_delta'.

The same is true for the fitting pixel positions and their conversion you get from 'get_world_position_parameters(x, y)' in the python configuration file.

Actually I think I found the problem for the detection coordinates, but for the fitting coordinates it is more complicated.

Which SE++ installation do you have? Conda or source code?

mkuemmel added a commit that referenced this issue Dec 20, 2022
#533.
world_centroid_alpha and world_centroid_delta is fine now.
@mkuemmel
Copy link
Collaborator

Here the difference between RA/Dec computed via astropy from the fitted pixel positions and the RA/Dec provided in SE++:
scatter

It's not a uniform scatter. The fundamental computations in SE++ are done via wcslib, so I think the problem is rather communicating the values to the table.

@mkuemmel
Copy link
Collaborator

Here the histograms for ra (red) and dec (green):
hist

@mkuemmel
Copy link
Collaborator

The pull request contains a solution for both WCS conversion. That should be in the next release then. Thanks for spotting this problem.

marcschefer added a commit that referenced this issue Jan 27, 2023
* Part of the solution for
#533.
world_centroid_alpha and world_centroid_delta is fine now.

* Stores the model fitting results with high enough precision!

Co-authored-by: Marc Schefer <Marc.Schefer@unige.ch>
@marcschefer
Copy link
Member

Fixed in 0.19.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants