gammapy icon indicating copy to clipboard operation
gammapy copied to clipboard

Dark Matter JFactory Map

Open katrinstreil opened this issue 5 years ago • 3 comments

The calculation of the differential J-Factor is by defintion over the line of sight ds and not over the radius dr. When integrating over dr, the integral is missing the substitution of ds: math:: \frac{d J}{d \Omega} = \int_{LoS} ds \rho(r) = \int_{\r_min}^{\r_max} dr \frac{d s}{d r} \rho(r) = \int_{\r_min}^{\r_max} dr frac{r}{sqrt{r2- d2* sin(\theta)**2}} \rho(r)

since r = sqrt{d2 + s2 -2dl cos(\theta)}, where d is the distance to the GC and \theta the separation angle. I also found the integral limits to be incorrect. Integrating from rmin = separation.rad * self.distance to rmax = self.distance accounts only for the line of sight to the object at distance. But the line of sight continues beyond it.

In my solution I included the derivative \frac{d s}{d r} in the _eval_squared method of the corresponding profile class. Therefore the parameter separation has to be passed to the method integral in the corresponding profile class, since it calls _eval_squared.

If there is any need, I can upload my script.

katrinstreil avatar Feb 07 '20 09:02 katrinstreil

Merci! We will respond to your issue shortly. In the meantime, try import gammapy; gammapy.song()

github-actions[bot] avatar Feb 07 '20 09:02 github-actions[bot]

@kstre

Thanks for spotting this !

I think that the calculation of J-Factor maps in Gammapy was introduced more as a coding exercise than as a feature to compute accurate values. For this, we know that people from the dark matter community very often uses CLUMPY, which provides precise values with rigorous calculations and multiple fine-tuning parameters.

Having said that, you're right that the definition of the differential J-factor is not correct (at least in the documentation, and this has to be fixed) and that calculation of J-factor maps could be actually done in a more proper way, even if this is not the ultimate goal of Gammapy. Could you please paste a gist link to your script or the piece of code that shows how you fix it, please? So we can continue talking on this and agree on how to proceed.

Bultako avatar Feb 11 '20 07:02 Bultako

Hi, sorry for the (very) slow response! I created a gist (https://gist.github.com/katrinstreil/eeee9f2969dbc037888f876d5f4e5b9d) with my solution in it. I modified gammapy.astro.darkmatter.profiles.py and gammapy.astro.darkmatter.utils.py to correct for the integral limits and the substitution part. In addition, there is a notebook, which computes and compares the J-Factor map with the NFW profile computed with the original and the modified code.

I would be very happy to discuss this further! https://gist.github.com/katrinstreil/eeee9f2969dbc037888f876d5f4e5b9d

katrinstreil avatar Jul 12 '22 14:07 katrinstreil

What is the status here @katrinstreil ?

registerrier avatar Mar 24 '23 17:03 registerrier

I checked through the code and this should be closed by #4191

Therefore, I am closing this now.

Astro-Kirsty avatar Jan 29 '24 09:01 Astro-Kirsty