-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Description
In an edge case where the pixel is just touching the stellar disk on one corner, the pixeloverlaparea method misclassifies the pixel as completely outside the stellar disk
The original condition below is to blame, which I would guess originates from an arithmetic error (at least, I'm unable to derive the condition as given)
#radial distance squared minus 1
rsq = x0**2 + y0**2 - 1.
#calculate area of overlap between pixel and sky-projected stellar disk
if rsq > ((sqrt2*w)):
#pixel is guaranteed to be fully outside the star
area = 0.0
#print "outside"
A fix for this condition is the following:
pix_r = (x0**2 + y0**2)**0.5
pix_rc = ((abs(x0)+w/2)**2 + (abs(y0)+w/2)**2)**0.5
if (pix_r >= 1+w/SQRT2) or (abs(x0) >= (1+w/2)) or (abs(y0) >= (1+w/2)):
# pixel is guaranteed to be fully outside the star
if verbose: print("Pixel outside")
area = 0.0
return area
A similar issue occurs when the pixel is within the stellar disk with a corner just shy of the edge, but this is not an issue since the condition is not met and no intersections default to being fully within the disk.
Demonstration of issue:
w = 0.5
x0 = 1/sqrt2+w/2-.06
y0 = 1/sqrt2+w/2
rsq = x0**2+y0**2-1
pix_r = (x0**2+y0**2)**0.5
cGrid condition:
rsq > sqrt2*w
0.7209 > 0.7071 - True, will not look for intersections
New condition:
pix_r >= 1+w/sqrt2
1.3118 >= 1.3536 - False, will look for intersections
Area of overlap = 0.000542
Percent of full pixel = 0.682%
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels