Closed yas-nakajima closed 2 years ago
Hi,
Sorry for the late reply. I looked into it and I found the source of the error. Turns out that when you apply the transformation to the mask the one center True
pixel in the mask is smeared on its neighbor pixels. This is the transformation of the mask before discretizing it back into True
/False
.
array([[0. , 0. , 0. , 0. , 0.5 ],
[0. , 0.25, 0.25, 0. , 0.5 ],
[0. , 0.25, 0.25, 0. , 0.5 ],
[0. , 0. , 0. , 0. , 0.5 ],
[0.5 , 0.5 , 0.5 , 0.5 , 0.75]], dtype=float32)
The threshold value that astroalign uses to consider a pixel to be on the mask is if it's larger than 0.4. All the 0.25 don't make the cut and the hole is lost.
This is probably a not so common case, but I wonder if the threshold should be more aggressive and set it to 0.1 for example. Or even just do a > 0
. The 0.4 was there to avoid too-soft edges.
Thank you for your reply. Now I understand the specification for the threshold.
I made a masked array.
[In]:
[Out]
Then I created a transform, a simple shift by (0.5, 0.5).
[In]:
[Out]:
Then I executed apply_transform with propagate_mask=True. [In]:
[In]:
[Out]:
[In]:
[Out]:
The 'True' mask(s) around the center vanished.
I expected something like
Do I misunderstand the usage?
Thanks