Repository navigation
Several changes to sigma clipping functions - #3595
Conversation
|
@embray Any suggestions about deprecation warnings? |
|
I have a few suggestions on that, yeah. If you think they'll be necessary (they probably should be, since I know there are people actively using Unfortunately if you do want to be able to support old arguments what you're probably going to have to do is change the argument signature for the function to accept However, this is made somewhat easier by Python 3's new Signature handling. We have a version of this that is backported to work in Python 2 included in Astropy. You can read about the Signature spec here: https://docs.python.org/3/library/inspect.html#introspecting-callables-with-the-signature-object and the backported version in Astropy is found here: https://github.com/astropy/astropy/blob/master/astropy/utils/compat/funcsigs.py What you'll probably want to do create two Does that make any sense? This reminds me I've wanted for a while to add a decorator specifically for this purpose... |
c45febf to
1552228
Compare
|
@embray This is ready for review. |
|
Needs a changelog entry briefly describing the API changes. |
|
@embray I've updated the changelog and rebased. |
|
👍 Is there an appropriate assignee to sign off on this? I'm just here for nitpicking, not actual useful comments about the functionality. |
|
Note, once merged this will close #3236. |
|
fyi, I just fixed the changelog indentation. I was hoping someone would review this for functionality, but it's been 2 months now.... |
|
I don't know who the best person to ask is. You should ask on the astropy-dev mailing list. Possibly @adonath? |
|
I was thinking @astrofrog because he wrote the original |
|
I've volunteered to help maintain the stats package but I am happy to take a look at the functionality of this tomorrow. |
|
Functionality wise, it works as expected and passes all the tests, so from that end it looks good to me. This could be done in a separate PR, , but I could also imagine that cenfunc, stdfunc, and axis could be included as parameters to sigma_clip_stats. @embray should there be any tests added for the depreciation warning or the change in the sig parameter names? |
|
No, it's fine. |
|
Thanks, @crawfordsm! I'll add those keywords to |
|
I'm will go ahead and merge this in. Thanks for the contribution @larrybradley |
Several changes to sigma clipping functions
This PR makes several changes to the sigma clipping functions:
sigma_lowerandsigma_upperkeywords to allow for unsymmetric clipping.sigma_clip, I renamed thesigkeyword tosigma(if unspecified thensigma_lowerandsigma_upperdefault tosigma).sigma_clipinput fromvarfunctostdfunc. There are readily available alternate standard deviation estimators, e.g.astropy.stats.mad_stdorastropy.stats.biweight_midvariance, but none that I'm aware of for an alternate variance function.sigma_clipnow uses thenp.ma.masked_lessandnp.ma.masked_greaterfunctions to preventRuntimeWarningmessages: "invalid value encountered in greater filtered_data.mask |= do * do > varfunc(filtered_data) * sig ** 2" that would occur for example when thedatacontainnp.nan.sigma_clipped_stats, I changed the keyword frommask_valtomask_value.In this PR, three parameter names have been changed, breaking the current API. Is there a good way to issue an
AstropyDeprecationWarningabout these parameter changes?CC: @perrygreenfield, @hcferguson