punchbowl.level1.deficient_pixel#

Functions#

sliding_window(→ numpy.ndarray)

Construct a sliding window view of the array.

cell_neighbors(→ numpy.ndarray)

Return d-th neighbors of cell (i, j).

mean_correct(→ numpy.ndarray)

Mean correct.

median_correct(→ numpy.ndarray)

Median correct.

remove_deficient_pixels(→ ndcube.NDCube)

Remove deficient pixels.

remove_deficient_pixels_task(→ ndcube.NDCube)

Subtracts a deficient pixel map from an input data frame.

create_all_valid_deficient_pixel_map(→ ndcube.NDCube)

Create valid deficient pixel map.

Module Contents#

punchbowl.level1.deficient_pixel.sliding_window(arr: numpy.ndarray, window_size: int) numpy.ndarray#

Construct a sliding window view of the array.

borrowed from: https://stackoverflow.com/questions/10996769/pixel-neighbors-in-2d-array-image-using-python.

punchbowl.level1.deficient_pixel.cell_neighbors(arr: numpy.ndarray, i: int, j: int, window_size: int = 1) numpy.ndarray#

Return d-th neighbors of cell (i, j).

borrowed from: https://stackoverflow.com/questions/10996769/pixel-neighbors-in-2d-array-image-using-python.

punchbowl.level1.deficient_pixel.mean_correct(data_array: numpy.ndarray, mask_array: numpy.ndarray, required_good_count: int = 3, max_window_size: int = 10) numpy.ndarray#

Mean correct.

punchbowl.level1.deficient_pixel.median_correct(data_array: numpy.ndarray, mask_array: numpy.ndarray, required_good_count: int = 3, max_window_size: int = 10) numpy.ndarray#

Median correct.

punchbowl.level1.deficient_pixel.remove_deficient_pixels(data: ndcube.NDCube, deficient_pixels: numpy.ndarray, required_good_count: int = 3, max_window_size: int = 10, method: str = 'median') ndcube.NDCube#

Remove deficient pixels.

punchbowl.level1.deficient_pixel.remove_deficient_pixels_task(data: ndcube.NDCube, deficient_pixel_map_path: str | None, required_good_count: int = 3, max_window_size: int = 10, method: str = 'median') ndcube.NDCube#

Subtracts a deficient pixel map from an input data frame.

checks the dimensions of input data frame and map match and subtracts the background model from the data frame of interest.

Parameters:
  • data (NDCube) – A PUNCHobject data frame to be background subtracted

  • deficient_pixel_map_path (Optional[str]) – The path to the deficient pixel map use to in correction

  • required_good_count (int) –

    how many neighboring pixels must not be deficient to correct a pixel,

    if fewer than that many pixels are good neighbors then the box expands

  • max_window_size (int) – the width of the max window

  • method (str) – either “mean” or “median” depending on which measure should fill the deficient pixel

Returns:

A background subtracted data frame

Return type:

NDCube

punchbowl.level1.deficient_pixel.create_all_valid_deficient_pixel_map(data: ndcube.NDCube) ndcube.NDCube#

Create valid deficient pixel map.