[AstroPy] Sigma clipping along an axis?
Mon Apr 29 19:30:41 CDT 2013
Yes, the Boolean array with False for clipped data is exactly what I
wanted. This works well, thank-you! I like the feature in sigma_clip of
being able to define the centre function and variance function - it makes
NaN handling easy which I was previously worried about.
Thank-you again for your answer! I will submit a feature request as you
On Tue, Apr 30, 2013 at 9:48 AM, Erik Tollerud <email@example.com>wrote:
> So what do you want as the output? If you want only the *values* that
> are clipped/not clipped, you can't get an array back, because each of
> the 60x60 sub-arrays will give you *different* lengths of clipped
> arrays back. So perhaps you want the mask of clipped arrays? If so,
> most straightforward is probably (unfortunately) nested for loops:
> from astropy.stats import sigma_clip
> frames = *your 60x60xN array*
> masks = [[sigma_clip(subarrj, ...) for subarrj in subarri] for
> subarri in frames] #gmail will probably break this into multiple
> line... but it's supposed to be all one line
> maskarr = np.array(masks)
> After that, maskarr will be a 60x60xN boolean array that is *False*
> where the data was clipped, and *True* where it is valid.
> There's also probably a way to adjust the astropy.stats.sigma_clip
> function to do this automatically and in a more numpy-optimized way.
> Feel free to add this as an issue for
> astropy (https://github.com/astropy/astropy/issues).
> On Mon, Apr 29, 2013 at 7:21 PM, Lisa Fogarty
> <firstname.lastname@example.org> wrote:
> > Hi All,
> > I would like to perform a sigma-clipped sum of several data frames (60x60
> > pixels each). I have put the frames into a 3D array - so if I have N
> > the array is 60x60xN. I therefore want to sigma clip along the z-axis. As
> > far as I can see the astropy.stats.sigma_clip function ravels the data
> > before performing the sigma clip (i.e. it clips in the whole array,
> where I
> > want to clip pixel-by-pixel). Is there a pythonic way I can accomplish
> > I want to do?
> > Many thanks,
> > Lisa.
> > --
> > Dr Lisa Fogarty | Postdoctoral Research Associate, SIfA, Sydney Institute
> > for Astronomy
> > School of Physics | Faculty of Science
> > THE UNIVERSITY OF SYDNEY
> > Rm 464, Physics Building A29 | The University of Sydney | NSW | 2006
> > | AUSTRALIA
> > T +61 2 935 13112
> > E email@example.com | W
> > _______________________________________________
> > AstroPy mailing list
> > AstroPy@scipy.org
> > http://mail.scipy.org/mailman/listinfo/astropy
Dr Lisa Fogarty | Postdoctoral Research Associate, SIfA, Sydney Institute
School of Physics | Faculty of Science
THE UNIVERSITY OF SYDNEY
Rm 464, Physics Building A29 | The University of Sydney | NSW | 2006
T +61 2 935 13112
E firstname.lastname@example.org | W
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the AstroPy