-
Notifications
You must be signed in to change notification settings - Fork 67
Closed
Description
The docs says
Masking a pixel is equivalent to setting data to zero and noise (if present) to infinity.
A test case to demonstrate this:
import numpy as np
import sep
mask = np.zeros((7, 7)).astype(bool)
mask[3, 3:] = True
data = np.ones((7, 7))
data[2:5, 2:5] += 20
obj, seg = sep.extract(data, thresh=1,
mask=mask,
segmentation_map=True)
print(data)
print(mask.astype(int))
print(seg)
print(obj["x"], obj["y"])# image
[[ 1. 1. 1. 1. 1. 1. 1.]
[ 1. 1. 1. 1. 1. 1. 1.]
[ 1. 1. 21. 21. 21. 1. 1.]
[ 1. 1. 21. 21. 21. 1. 1.]
[ 1. 1. 21. 21. 21. 1. 1.]
[ 1. 1. 1. 1. 1. 1. 1.]
[ 1. 1. 1. 1. 1. 1. 1.]]
# mask
[[0 0 0 0 0 0 0]
[0 0 0 0 0 0 0]
[0 0 0 0 0 0 0]
[0 0 0 1 1 1 1]
[0 0 0 0 0 0 0]
[0 0 0 0 0 0 0]
[0 0 0 0 0 0 0]]
# Segmap
[[0 0 0 0 0 0 0]
[0 1 1 1 1 1 0]
[0 1 1 1 1 1 0]
[0 1 1 1 1 1 0]
[0 1 1 1 1 1 0]
[0 1 1 1 1 1 0]
[0 0 0 0 0 0 0]]
# Final x, y
[2.8595679] [3.]
The obj is correctly calculated after masking the pixels. (∵ obj["x"] != 3.0)
However, seg includes masked pixels, too.
I think this might be intentional, because the pixels used for extract can be retrived by seg & ~mask, while the additional segmentation information is given to the user. (I am not sure what is SExtractor's default, as I have never used it)
However, if that's the case, I think the documentation needs a bit more information.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels