mfouesneau / pyphot

suite to deal with passband photometry
https://mfouesneau.github.io/pyphot/
MIT License
57 stars 18 forks source link

filter cleaning too harsh #11

Closed bailer-jones closed 5 years ago

bailer-jones commented 6 years ago

In the filter get_flux (phot.py l.180) trimming values gets rid of all 0, missing the last pixels sometimes.

mfouesneau commented 5 years ago

changed from

    ind = ifT > 0.

to

        nonzero = np.where(ifT > 0)[0]
        nonzero_start = max(0, min(nonzero) - 5)
        nonzero_end = min(len(ifT), max(nonzero) + 5)
        ind = np.zeros(len(ifT), dtype=bool)
        ind[nonzero_start:nonzero_end] = True

Not only this will keep a few zero values on both ends but also avoid edge effects when a transmission has zero values in between (for some reasons like leaks etc.)