Skip to content

Commit

Permalink
Add option to automatically determine the overscan axis
Browse files Browse the repository at this point in the history
If the overscan axis is explicitly set to `None` in
`subtract_overscan`, the overscan direction is determined from the
shape of the overscan section, set the shortest dimension. (In case of
a square overscan, the default of 1 is picked.)

This can be convenient in cases where `fits_section` is used with an
(unknown) input string (for example, from an image's BIASSEC header
keyword): the user can let the function determine the appropriate
axis.
  • Loading branch information
evertrol committed Dec 15, 2015
1 parent a4ee839 commit 773f37c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ccdproc/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,9 @@ def subtract_overscan(ccd, overscan=None, overscan_axis=1, fits_section=None,
if fits_section is not None:
overscan = ccd[slice_from_string(fits_section, fits_convention=True)]

if overscan_axis is None:
overscan_axis = 1 if overscan.shape[0] > overscan.shape[1] else 0

if median:
oscan = np.median(overscan.data, axis=overscan_axis)
else:
Expand Down

0 comments on commit 773f37c

Please sign in to comment.