-
-
Notifications
You must be signed in to change notification settings - Fork 17
downsample does not accept dtype=int #43
Comments
@astrofrog @larrybradley Do we want to provide the |
@barentsen @cdeil I think these functions weren't added to |
Here is a one-line equivalent of
However, it will work only when the |
The numpy one-liner is perhaps somewhat obscure -- I didn't think of it. I'd say the act of binning data is common enough to deserve a user-friendly function in astropy? |
I agree (the one-line equivalent of |
Here is a version that works including the trimming of the data: def downsample(image, factor):
nx_new = image.shape[1] // factor
ny_new = image.shape[0] // factor
nx_init = nx_new * factor
ny_init = ny_new * factor
return (image[:ny_init, :nx_init]
.reshape((ny_new, factor, nx_new, factor))
.mean(axis=3).mean(axis=1)) |
|
It looks like
downsample
does not accept an array withdtype=int
. Given that many images are stored as ints, it would be nice if it did?Of course this works fine:
The text was updated successfully, but these errors were encountered: