bd-j / sedpy

Utilities for astronomical spectral energy distributions
https://sedpy.readthedocs.io/en/latest/
MIT License
28 stars 16 forks source link

Filter tranmission function final zero removed when not desired #17

Closed crispinlogan closed 4 years ago

crispinlogan commented 4 years ago

The zero after the last non-zero transmission point, when present in the original transmission function, is removed when instantiating a Filter object using observate.

In a python terminal can try e.g. from sedpy import observate filt = observate.Filter("sdss_r0") filt.transmission filt.wavelength

and you can see the final 0 is removed, even though present in the original tranmsission function.

This is due to line 156 in the function _remove_extra_zeros in observate.py which could be changed from inds = slice(max(v.min() - 1 , 0), min(v.max() + 1, len(transmission))) to inds = slice(max(v.min() - 1 , 0), min(v.max() + 2, len(transmission))) in order to keep the zero after the last non-zero tranmission point.

Note that at least according to the function _remove_extra_zeros description, that final zero should not be removed.

Happy to make a pull request with required fix, if you agree with the change.

bd-j commented 4 years ago

thanks, happy to take a PR

crispinlogan commented 4 years ago

PR done - branch is called fix_remove_extra_zeros

bd-j commented 4 years ago

merged #18, thanks!