[AstroPy] Image combination with sigma clipping

Slavin, Jonathan jslavin at cfa.harvard.edu
Tue Feb 6 11:00:52 EST 2024


Hi Lisa,

Looks to me like the method sigma_clipping of the Combiner object acts on
the data in place and has no return statement (and so returns None).
If that's true then you want something like:

combiner.sigma_clipping(low_thresh=2, high_thresh=5, func='median',
dev_func='mad_std')

combined_average = combiner.average_combine()

Regards,
Jon



> Date: Tue, 6 Feb 2024 16:06:40 +0100
> From: Lisa Alborghetti <lisi.alborghetti at gmail.com>
> To: astropy at python.org
> Subject: [AstroPy] Image combination with sigma clipping
> Message-ID: <DB96B4E2-270E-4982-9414-EEAF0B56DC05 at gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> Hi everybody,
> I?m new to AstroPy, and I have what I believe to be a very simple
> question: I have a .fits file, containing a series of 50 images that I want
> to combine to create a dark image of my CCD. Before averaging, I would like
> to perform a sigma_clipping using mad_std.
> I was trying with something like this:
>
> from astropy import units as u
> from astropy.nddata import CCDData
> from ccdproc import Combiner
> import numpy as np
>
> ccd = CCDData.read('Dark Current/minus_10/5_sec/Background_fits.fits',
> unit="adu")
>
> combiner = Combiner(ccd)
>
> combiner_clipped = combiner.sigma_clipping(low_thresh=2, high_thresh=5,
> func='median', dev_func='mad_std')
>
> combined_average = combiner_clipped.average_combine()
>
>
> But it doesn?t seem to be the right way to do it. In fact, I get:
>
>
> ---> 12 combined_average = combiner_clipped.average_combine()
>
> AttributeError: 'NoneType' object has no attribute ?average_combine?
>
> Can someone help me with this, please?
> Thank you!
>
> Lisa
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.python.org/pipermail/astropy/attachments/20240206/f2526bd7/attachment.html>


More information about the AstroPy mailing list