Repository navigation
Fix sigma_clipped_stats to use the axis argument - #4726
Conversation
|
Thanks, @saimn. Looks good to me. |
|
@larrybradley , could you please tag the appropriate "Affect ..." and Milestone tags? |
|
@pllim I'd be happy to, except I don't have permission. |
|
@saimn Can you please add a change log entry? |
|
@larrybradley - Yes, but which version, bugfix for 1.1 ? |
|
This fixes a released version, so it should go in the bug fix section of both 1.2 (next feature release) and 1.1.3 (next bug fix release). |
|
@larrybradley - Ok, done. |
|
I cannot tag multiple milestones, so I will just tag the bug fix. |
|
Two more things before I can merge:
|
|
I'd agree -- would be happy to see this merged as soon as @pllim suggested changes are made. Also should be back ported. |
The axis argument was added in astropy#3792 and is passed correctly to sigma_clip, but then mean, median and std did not use axis and were computed on the whole array. This commit changes this to use axis to compute the statistics. Also another minor annoyance is that, with Numpy 1.10, np.ma.median always return a MaskedArray, even when axis is None. This was not the case in previous version (and will probably be fixed in the future), and mean and std return a scalar. So if it happens here, we take the first element of the array.
|
@pllim , @crawfordsm : ok, done. |
|
Thanks. Merging. 😄 |
|
This seems to brake a few tests in photutils https://travis-ci.org/astropy/photutils/jobs/125377151#L789 Should we treat it as a bug in photutils or as an API change here (meaning that it should go to 1.2, rather than a bugfix release)? |
|
Oh sorry, the bug is in the code from this PR and the inconsistent behavior from |
The axis argument was added in #3792 and is passed correctly to
sigma_clip, butthen mean, median and std did not use axis and were computed on the whole array.
This commit changes this to use axis to compute the statistics.
Also another minor annoyance is that, with Numpy 1.10,
np.ma.medianalwaysreturn a masked array, even when axis is None. This was not the case in previous
versions (and will probably be fixed in the future), and mean and std return
a scalar. So if it happens here, we take the first element of the array.
cc @larrybradley