CLMM icon indicating copy to clipboard operation
CLMM copied to clipboard

Add miscentering to the theory module

Open combet opened this issue 2 years ago • 3 comments

Miscentered profiles (single cluster or stacked) should be added to the theory module. See e.g. the cluster-toolkit documentation.

  • for a single cluster --> new R_mis parameter to quantify the miscentering + 2 integrations
  • for a stack --> needs extra integration over a miscentering distribution

Is it better to create new 'miscentered' functions or have extra keywords to the existing ones? What precision are we happy to live with. If sticking with scipy.integrate, we'll have to sacrifice a bit accuracy for speed I believe...

combet avatar Apr 05 '23 09:04 combet

Just pushed initial notebook that explores the set of integrals that need to be computed.

combet avatar May 26 '23 08:05 combet

I made some optimization to the integrals and explored the possibilities of using different profiles and the CCL backend. The results on DeltaSigma_mis calculation are summarized here.

implementation/profile NFW EIN HER
backend independent 2 sec 3 min 2 sec
implementation/profile CCL NFW CCL EIN CCL HER NC NFW NC EIN NC HER CT NFW
optimized 40 sec 15 min^ 40 sec 20 sec 10 sec 15 sec 1 min
original 20 min X 7 min 7 min 4 min 7 min 30 min

X = (possibly) won't finish ^ Use CCL PR 1093 (Merged into master as CCL v2.8.1.dev73+g86125b08)

  1. Backend independent implementation means we do not rely on the backends to calculate the surface mass densities.
  2. Relaxing epsrel of quad_vec to 1e-6 will make the miscentering integrations work for the Hernquist profile (The default value is 1e-8) without compromising the precision of the profile.
  3. backend independent EIN can potentially be faster by correctly setting up quad_vec to use multiprocessing.

hsinfan1996 avatar Jun 29 '23 14:06 hsinfan1996

I have added an option to compute Sigma mean miscentered with dblquad instead of two nested quads. Testing this on the demo_theory_functionality_oo.ipynb notebook, it seems to increase the speed x2. However, the two variants (simple quads and dblquad) appear much slower in this notebook, as compared to the explore_miscentering_theory.ipynb notebook. For an NFW profile, I obtain the following times :

  • explore_miscentering_theory.ipynb : backend independant : 2s backend independant + dblquad : 0.3s

  • demo_theory_functionality_oo.ipynb : backend independant : 12s backend independant + dblquad : 5s

Not sure what is causing this difference

AnnaNiemiec avatar Jul 17 '24 14:07 AnnaNiemiec