Skip to content

Commit

Permalink
Apply suggestions from code review. Fix logic and clean docs
Browse files Browse the repository at this point in the history
Co-authored-by: Padraic Shafer <[email protected]>
  • Loading branch information
maffettone and padraic-shafer authored Jun 26, 2024
1 parent 98772cb commit ec916d1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
10 changes: 5 additions & 5 deletions csxtools/fastccd/dask.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@


def correct_images(images: DaskArray, dark: ArrayLike, flat: ArrayLike, gain: Tuple[float, float, float]):
"""_summary_
"""Apply intensity corrections to a stack of images.
Parameters
----------
images : DaskArray
Input array of images to correct of shape (N, y, x) where N is the
Input array of images to correct; has shape (N, y, x) where N is the
number of images and x and y are the image size.
dark : ArrayLike
Input array of dark images. This should be of shape (3, y, x).
dark[0] is the gain 8 (most sensitive setting) dark image with
dark[2] being the gain 1 (least sensitive) dark image.
dark[0] is the GAIN_8 (most sensitive setting) dark image with
dark[2] being the GAIN_1 (least sensitive) dark image.
flat : ArrayLike
Input array for the flatfield correction. This should be of shape
(y, x)
Expand All @@ -31,7 +31,7 @@ def correct_images(images: DaskArray, dark: ArrayLike, flat: ArrayLike, gain: Tu
gain settings
// Note GAIN_1 is the least sensitive setting which means we need to multiply the
// measured values by 8. Conversly GAIN_8 is the most sensitive and therefore only
// measured values by 8. Conversly GAIN_8 is the most sensitive and therefore
// does not need a multiplier
"""

Expand Down
8 changes: 6 additions & 2 deletions csxtools/image/dask.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,13 @@ def rotate90(images: DaskArray, sense: bool) -> DaskArray:
"""
# Rotate images. The axes (1, 2) specify the plane of rotation (y-x plane for each image).
# k controls the direction and repetitions of the rotation.
if sense:
if sense != 0:
# Counter-clockwise
k = 1
elif sense:
elif sense == 0:
# Clockwise
k = -1
else:
raise ValueError(f"{sense = } is not a valid integer")
rotated_images = da.rot90(images, k=k, axes=(-2, -1))
return rotated_images

0 comments on commit ec916d1

Please sign in to comment.