sbird/fake_spectra

fixed point solver

Closed this issue · 2 comments

nebynh = fixed_point(rooted, nh, args=(nh, ienergy),xtol=self.converge)

Since rooted() returns nebynh shouln't the second argument of fixed_point() be just a unit vector ?

nebynh = fixed_point(rooted, nh, args=(nh, ienergy),xtol=self.converge)

Since rooted() returns nebynh shouln't the second argument of fixed_point() be just a unit vector ?

Sorry, It cannot be a unit vector :)) We are looking for x0 in f(x0)=x0.
But, this line seems to me is looking for nebynh = nh. Maybe I am wrong.

I modified the rooted() to return ne instead of nebynh. like this :

        def rooted(ne, nh, ienergy):
            return self._nebynh(nh, self._get_temp(ne/nh, ienergy, helium=helium), ne/nh, helium=helium)*nh
        ne = fixed_point(rooted, nh, args=(nh, ienergy),xtol=self.converge)
        assert np.all(np.abs(rooted(ne, nh, ienergy) - ne) < self.converge)
return nebynh * nh

It did not solve my issue with TNG though :((