punchbowl.level1.stray_light#
Attributes#
Exceptions#
Raised when the histogram runs out of points. |
Classes#
Stores inputs and result of skewed Gaussian fitting. |
Functions#
|
Calculate a skewed Gaussian. |
|
Evaluate function and return the residual. |
|
Pick the first (left-most) peak, but isn't fooled if the bins dip by <20% and then keep going up. |
|
Find the edges of the first (left-most) peak, by expanding until appreciable up-hillage is found. |
|
Fit a skewed Gaussian to a histogram of data values to estimate the stray light value. |
|
This is our parallel worker, computing the stray light model for one y coordinate. |
|
Estimate the fixed stray light pattern using a percentile. |
|
Prefect task to remove stray light from an image. |
Module Contents#
- class punchbowl.level1.stray_light.SkewFitResult(fit: lmfit.minimizer.MinimizerResult, bin_centers: numpy.ndarray, scaled_x_values: numpy.ndarray, bin_values: numpy.ndarray, stack: numpy.ndarray, scale_factor: float, weights: numpy.ndarray, target_center: float)[source]#
Stores inputs and result of skewed Gaussian fitting.
- fit#
- bin_centers#
- scaled_x_values#
- bin_values#
- stack#
- scale_factor#
- weights#
- target_center#
- x0#
- A#
- alpha#
- sigma#
- m#
- b#
- dx#
- property result: float#
Return the mode of the skewed Gaussian.
- punchbowl.level1.stray_light.pdf_table_vals#
- punchbowl.level1.stray_light.cdf_table_vals#
- punchbowl.level1.stray_light.pdf_vals#
- punchbowl.level1.stray_light.cdf_vals#
- punchbowl.level1.stray_light.skew_gaussian(x: numpy.ndarray, A: float, alpha: float, x0: float, sigma: float, m: float, b: float) numpy.ndarray[source]#
Calculate a skewed Gaussian.
- punchbowl.level1.stray_light._resid_skew(params: lmfit.Parameters, scaled_x_values: numpy.ndarray, y_values: numpy.ndarray, bin_weights: numpy.ndarray) numpy.ndarray[source]#
Evaluate function and return the residual.
- punchbowl.level1.stray_light.pick_peak(bin_values: numpy.ndarray) int[source]#
Pick the first (left-most) peak, but isn’t fooled if the bins dip by <20% and then keep going up.
- punchbowl.level1.stray_light.find_peak_end(bin_values: numpy.ndarray, peak_location: int, direction: int) int[source]#
Find the edges of the first (left-most) peak, by expanding until appreciable up-hillage is found.
- exception punchbowl.level1.stray_light.OutOfPointsError[source]#
Bases:
RuntimeErrorRaised when the histogram runs out of points.
- punchbowl.level1.stray_light.fit_skew(stack: numpy.ndarray, ret_all: bool = False, x_scale_factor: float = 10000000000000.0, weight: bool = True, plot_histogram_steps: bool = False, exclude_above_percentile: float = 0) float | SkewFitResult[source]#
Fit a skewed Gaussian to a histogram of data values to estimate the stray light value.
- punchbowl.level1.stray_light.REQUIRED_FRACTION_OF_NEIGHBORHOOD_PIXELS = 0.5#
- punchbowl.level1.stray_light._estimate_stray_light_one_slice(y: int, data_slice: numpy.ndarray, x_grid: numpy.ndarray, half_width: int) numpy.ndarray[source]#
This is our parallel worker, computing the stray light model for one y coordinate.
- punchbowl.level1.stray_light.estimate_stray_light(filepaths: list[str], do_uncertainty: bool = True, reference_time: datetime.datetime | str | None = None, stride: int = 10, window_size: int = 5, blur_sigma: float = 1.5, n_crota_bins: int = 30, crota_bin_width: float = 45, image_mask_path: str | None = None, make_plots_along_the_way: bool = False, fallback_model_path: str | None = None, num_workers: int | None = None, num_loaders: int | None = None) list[ndcube.NDCube][source]#
Estimate the fixed stray light pattern using a percentile.
- punchbowl.level1.stray_light.remove_stray_light_task(data_object: ndcube.NDCube, stray_light_before_path: pathlib.Path | str | ndcube.NDCube | punchbowl.util.DataLoader, stray_light_after_path: pathlib.Path | str | ndcube.NDCube | punchbowl.util.DataLoader) ndcube.NDCube[source]#
Prefect task to remove stray light from an image.
Stray light is light in an optical system which was not intended in the design.
The PUNCH instrument stray light will be mapped periodically as part of the ongoing in-flight calibration effort. The stray light maps will be generated directly from the L0 and L1 science data. Separating instrumental stray light from the F-corona. This has been demonstrated with SOHO/LASCO and with STEREO/COR2 observations. It requires an instrumental roll to hold the stray light pattern fixed while the F-corona rotates in the field of view. PUNCH orbital rolls will be used to create similar effects.
Uncertainty across the image plane is calculated using a known stray light model and the difference between the calculated stray light and the ground truth. The uncertainty is convolved with the input uncertainty layer to produce the output uncertainty layer.
- Parameters:
data_object (NDCube) – data to operate on
stray_light_before_path (pathlib) – path to stray light model before observation to apply to data
stray_light_after_path (pathlib) – path to stray light model after observation to apply to data
- Returns:
modified version of the input with the stray light removed
- Return type:
NDCube