specutils icon indicating copy to clipboard operation
specutils copied to clipboard

Spectrum1D.new_flux_unit returns copy but docs says it acts on original object

Open kecnry opened this issue 4 years ago • 1 comments

The docstring on Spectrum1D.new_flux_unit say "This is an in-place change to the object." but the code returns a modified deepcopy of the original object. The corresponding methods for the spectral axis, which also return a modified copy, are named with_ instead of new_.

kecnry avatar Oct 20 '21 18:10 kecnry

Yeah it looks like you can blame it on that @eteq guy - see #309.

That said, I think this is due to some back-and-forth about copying versus in-place. The quick-fix that reflects reality is to just remove the "this is an in-place change", because in the end it seems there wasn't really much need for the in-place modification given it never really got implemented.

That said, I totally agree the naming is pretty confusing now, again, an artifact of the back-and-forth I think. So I'd be happy with changing this to with_flux_unit and deprecating new_flux_unit (similar to my suggestion in https://github.com/astropy/specutils/issues/889#issuecomment-948709031).

eteq avatar Oct 21 '21 22:10 eteq