Open jecampagne opened 7 months ago
Sorry, I didn't follow this. What do you think is being computed wrong? The point of the whole rmin, a, b thing is just so that the right number of photons get generated near r=0. Do you think that doesn't come out to the right number? Or that they are distributed wrongly within r<rmin? (Or something else?) If the latter, then it's definitionally ok, since rmin is determined by shoot_accuracy -- the level at which we are ok with a little bit of inaccuracy.
I have coded the linear approx with the normalization of (a,b) mentioned in the last post, and the pytest is passed. So one can have a linear approx with a correct expression that is ok.l
Hello, Well I'm looking at the
SBSpergel.cpp::SpergelInfo::shoot
method fornu<0
.Let me write some formula to a little more precise in the following. The Spergel profile noted
I_{nu}(r) = N_{Nu} * f(r/r0,nu)
is such that (N_{nu}
is a normalisation factor, see later)as the following property for
z->0
(orr->0
forI_{nu}(r)
)So, I agree that
I_{nu}(r)
is diverging fornu<=0
. But the cumulated integrated flux is proportional toso has no divergence at
z=0
ifnu>-1
(which is the original paper bound) and Galsim uses nu is in [-0.85, 4.0] so in principle there is no theoretical problem to generate a distribution with the cumulative flux function.But, let say the current implementation of
OneDimensionalDeviate
sampling that is a general purpose tool needs to have something that f(r) is non diverging. Let us have a look at the method used in theSpergelInfo::shoot
function. The main idea is to replace theI_{nu}(r)
expression by a linear one forr in [0, rmin]
imposing a flux conservation. Now,rmin/r0 = zmin
(with r0 the scale radius in the Galsim language) is defined suchThis is coded as
fine.
Now considering the linear approximation mentioned above, it is written (below I have replaced "r" by "z" as this is the reduced radius r/r0)
and I verify that it is what is really used to compute the
(a,b)
parameters as solutions of a 2eq-2var system. These paramters are used to defined a modified profile (ie.SpergelNuNegativeRadialFunction
) such thatBut, there is for me a problem: if the
(a,b)
are used to define\tilde{I}(z)
then I would expectAnd then it leads to a different 2eq-2var system, leading to different numerical values.
So there is a missmatch of definition and as
(a,b)
are defined & computed according to the first one, then I suspect a problem in the definition ofSpergelNuNegativeRadialFunction
and in the total flux normalization.Am I wrong in the math somewhere?