gbrammer / eazy-py

Pythonic photometric redshift tools based on EAZY
MIT License
37 stars 25 forks source link

Pivot wavelengths are incorrectly calculated? #41

Closed kevinhainline closed 4 months ago

kevinhainline commented 5 months ago

In line 178 of filters.py, the pivot wavelengths are calculated:

    def pivot(self):
        """
        Pivot wavelength

        http://pysynphot.readthedocs.io/en/latest/properties.html
        """
        integrator = np.trapz

        num = integrator(self.wave, self.wave*self.throughput)
        den = integrator(self.wave, self.throughput/self.wave)
        pivot = np.sqrt(num/den)
        return pivot

The issue is that np.trapz accepts the y value first, and the x value second, such that it should read:

        num = integrator(self.wave*self.throughput, self.wave)
        den = integrator(self.throughput/self.wave, self.wave)

This has the effect of producing incorrect pivot wavelengths in zout.

gbrammer commented 4 months ago

Thanks @kevinhainline . I just merged the fix from @hbahk .