punchbowl.level1.destreak#
Functions#
|
Compute a matrix used in correcting streaks in PUNCH images. |
|
Corrects an image for streaks. |
|
Prefect task to destreak an image. |
Module Contents#
- punchbowl.level1.destreak.streak_correction_matrix(n: int, exposure_time: float, readout_line_time: float, reset_line_time: float) numpy.ndarray#
Compute a matrix used in correcting streaks in PUNCH images.
Computes the inverse of a matrix of size n where the major diagonal contains the value exposure_time, the lower triangle contains readout_line_time and the upper triangle contains the reset_line_time. i.e. X[i,i]=diag, X[0:i-1,i]=below, X[0,i+1:n-1]=above
Adapted from solarsoft sc_inverse
- Parameters:
n (int) – size of the matrix (n x n)
exposure_time (float) – the exposure time, i.e. value on the diagonal of the matrix
readout_line_time (float) – the readout line time, i.e. value in the lower triangle
reset_line_time (float) – the reset line time, i.e. value in the upper triangle
- Returns:
value of specified streak correction array
- Return type:
np.ndarray
- Raises:
np.linalg.LinAlgError – Singular matrix: Matrix isn’t invertible
Notes
As long as the units are consistent, this should work. For PUNCH, we use milliseconds.
Examples
>>> streak_correction_matrix(3, 1, 2, 3) array([[-0.38461538, 0.23076923, 0.46153846], [ 0.30769231, -0.38461538, 0.23076923], [ 0.15384615, 0.30769231, -0.38461538]])
- punchbowl.level1.destreak.correct_streaks(image: numpy.ndarray, exposure_time: float, readout_line_time: float, reset_line_time: float) numpy.ndarray#
Corrects an image for streaks.
- Parameters:
image (np.ndarray (2D)) – image to be corrected
exposure_time (float) – exposure time in consistent units (e.g. milliseconds) with readout_line_time and reset_line time
readout_line_time (float) – time to read out a line in consistent units (e.g. milliseconds) with exposure_time and reset_line time
reset_line_time (float) – time to reset CCD in consistent units (e.g. milliseconds) with readout_line_time and exposure_time
- Returns:
a streak-corrected image
- Return type:
np.ndarray
- Raises:
ValueError – If the image is not 2D or not square
TypeError – If the image is not a numpy array
np.linalg.LinAlgError – Singular matrix: Matrix isn’t invertible
Examples
>>> correct_streaks(np.arange(9).reshape(3,3), 1, 2, 3) array([[ 3.46153846, 3.76923077, 4.07692308], [ 0.23076923, 0.38461538, 0.53846154], [-1.38461538, -1.30769231, -1.23076923]])
- punchbowl.level1.destreak.destreak_task(data_object: ndcube.NDCube, exposure_time: float = 1.0, readout_line_time: float = 0.1, reset_line_time: float = 0.1) ndcube.NDCube#
Prefect task to destreak an image.