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

align filters to each other #2

Open
yuval-harpaz opened this issue Feb 28, 2023 · 2 comments
Open

align filters to each other #2

yuval-harpaz opened this issue Feb 28, 2023 · 2 comments

Comments

@yuval-harpaz
Copy link

In order to get colored images composed of multiple filters images should be aligned.
The task can be divided into two parts: detecting bad alignment, and correcting the issue. We may want the bot simply to avoid using badly aligned layers and stop there, no fixing.
In order to proceed with this issue I applied an old code that I wrote for this on a badly aligned set of filters from SDSSJ1723+3411.

the function optimize_xy (see here) takes two layers, and shifts one layer N times each way (up, down, left, right). every time matrices are flattened, then Pearson's correlation is computed. The best shift is then reported as best x (0, 3, 3 for this example) and best y (0, 0, -1). for these three layers, red stays with 0 x and 0 y (because it is the reference), blue and green got to move 3 pix on x, and there is y shift of one pixel for blue only.
image

@yuval-harpaz
Copy link
Author

Since correlation is costly, I tried another approach. I find star centers using clustering and maximum value per cluster. I consulted with chatGPT about it so I called the function maxima_gpt. I later match stars on different filters and find the common shift. results are similar, however the clustering requires smoothing that might be costly again. see optimize_xy_clust, also in astro_utils. So we got two approaches that work more or less, in order to proceed I think we should check them on different targets, test memory efficiency, accuracy, and adjust parameters.

@yuval-harpaz
Copy link
Author

yuval-harpaz commented Mar 15, 2023

I now face a dataset (NGC 5068) where the alignment changes midpicture. I can match some stars in different layers and estimate the necessary shift for each star. I'd like to take the median shift and apply it to the whole image but there is a shift zero for the top part and 6 pixels for the bottom half. The estimated glitches are plotted as green lines.
image

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

1 participant