Search#
- jwpoint.search.do_region_search(dq_mask, img, region_size, psf, n_top=5, dither_pattern=None, n_dithers=None, detector=None, kernel='uniform', forbidden_size=None, joint_offsets=None, min_edge_distance=None, subarray=None, show=True)[source]#
Perform optimal region search and show some plots
Thin wrapper around
find_regions().- Parameters:
mask – Bad pixel mask
img (
ndarray) – Full frame image used as referenceregion_size (
int) – Region size to optimizepsf (
ndarray) – PSF used for weighting and siplayn_top (
int) – Number of regionskernel (
str|ndarray) – Kernel to weigh the bad pixels in the window. One of: - “uniform”: uniform on the region - “weighted”: weighted by a PSF centered on the region - A custom arrayforbidden_size (
int|None) – Size of the central region where no bad pixels are allowed. Defaults toNone.joint_offsets (
list[tuple[int,int]] |None) – Offests to apply after the pointing to generate the window in pixels. Useful to replicate dithers. Should be a list of (dx, dy) offsets where y is along rows and x along columns. Defaults toNone.min_edge_distance (
int|None) – Minimal distance to keep from the edge in pixels. Defaults toNone.subarray (
str|None) – Subarray to use for the region search. This is mostly useful in cases where the LW and SW channels have different field of view. IfNone, all pixels in the image are used. Defaults toNone.show (
bool) – Show the plots if Truedq_mask (ndarray)
dither_pattern (str | None)
n_dithers (int | None)
detector (str | None)
- Return type:
tuple[ndarray,ndarray]- Returns:
The X and Y offsets
- jwpoint.search.find_regions(mask, window_size, kernel='uniform', n_top=10, forbidden_size=None, joint_offsets=None, min_edge_distance=None, subarray=None, return_weighted=False)[source]#
Find regions for optimal pointing
Searches the
n_topwindows that minimize the number of bad pixels. Returns the optimal pointing position for each window.- Parameters:
mask (
ndarray) – Bad pixel maskwindow_size (
int) – Window size to optimizekernel (
str|ndarray) – Kernel used to weigh bad pixels in the window. Can be “uniform” or a custom array. Defaults to “uniform”.n_top (
int) – Number of optimal pointings to return. 10 by default.forbidden_size (
int|None) – Size of the central region where no bad pixels are allowed. Defaults toNone.joint_offsets (
list[tuple[int,int]] |ndarray|None) – Offests to apply after the pointing to generate the window in pixels. Useful to replicate dithers. Should be a list of (dx, dy) offsets where y is along rows and x along columns. Defaults toNone.min_edge_distance (
int|None) – Minimal distance to keep from the edge in pixels. Defaults toNone.subarray (
str|None) – Subarray to use for the region search. IfNone, the FULL subarray is used. Defaults toNone.return_weighted (
bool) – Whether the mask weighted by the kernel for all explored windows should be returned. Defaults toFalse.
- Return type:
tuple[ndarray,ndarray] |tuple[ndarray,ndarray,ndarray]- Returns:
Arrays of x and y optimal pointing coordinate, along with the weighted mask if
return_weightedis true.