diff --git a/examples/demo_theory_functionality.ipynb b/examples/demo_theory_functionality.ipynb index 81b244d38..cda9a8e7c 100644 --- a/examples/demo_theory_functionality.ipynb +++ b/examples/demo_theory_functionality.ipynb @@ -348,7 +348,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "scrolled": true + }, "outputs": [], "source": [ "plot_profile(r3d, kappa, \"$\\\\kappa$\")" @@ -437,7 +439,7 @@ "- In CCL, the default Einasto slope depends on cosmology, redshift and halo mass. \n", "- In NumCosmo, the default value is $\\alpha_{\\rm ein}=0.25$.\n", "\n", - "**NB: for CCL, setting a user-defined value for the Einasto slope is only available for CCL version >= 2.6.** Earlier versions only allow the default option.\n", + "**NB: for CCL, setting a user-defined value for the Einasto slope is only available for versions >= 2.6.** Earlier versions only allow the default option.\n", "\n", "The verbose option allows to print the value of $\\alpha$ that is being used, as follows:" ] @@ -459,8 +461,8 @@ " verbose=True,\n", ")\n", "\n", - "# For CCL < 2.6, the above call will return an error, as alpha_ein could not be set. The call below, not specifying alpha_ein,\n", - "# will use the default value (for both backend)\n", + "# For CCL < 2.6, the above call will return an error, as alpha_ein cannot not be set. The call below, not specifying alpha_ein,\n", + "# will use the default value (for both CCL and NC backends)\n", "\n", "# rho = m.compute_3d_density(r3d, mdelta=cluster_mass, cdelta=cluster_concentration,\n", "# z_cl=z_cl, cosmo=cosmo, halo_profile_model='einasto',\n", @@ -469,13 +471,64 @@ "\n", "plot_profile(r3d, rho, \"$\\\\rho_{\\\\rm 3d}$\")" ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "For CCL versions >= 2.8.1.dev73+g86125b08, the surface mass density profile can be calculated with quad_vec numerial integration in addition to the default FFTLog. This option will increase the precision of the profile at large radii and can be enabled by passing `use_projected_quad` keyword argument to `compute_surface_density`." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# use quad_vec\n", + "Sigma_quad = m.compute_surface_density(\n", + " r3d,\n", + " mdelta=cluster_mass,\n", + " cdelta=cluster_concentration,\n", + " z_cl=z_cl,\n", + " cosmo=cosmo,\n", + " halo_profile_model=\"einasto\",\n", + " alpha_ein=0.17,\n", + " use_projected_quad=True, # use quad_vec\n", + " verbose=True,\n", + ")\n", + "\n", + "plot_profile(r3d, Sigma_quad, \"$\\\\Sigma_{\\\\rm quad}$\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# default behavior\n", + "Sigma_FFTLog = m.compute_surface_density(\n", + " r3d,\n", + " mdelta=cluster_mass,\n", + " cdelta=cluster_concentration,\n", + " z_cl=z_cl,\n", + " cosmo=cosmo,\n", + " halo_profile_model=\"einasto\",\n", + " alpha_ein=0.17,\n", + " use_projected_quad=False, # default\n", + " verbose=True,\n", + ")\n", + "\n", + "plot_profile(r3d, Sigma_FFTLog, \"$\\\\Sigma_{\\\\rm FFTLog}$\")" + ] } ], "metadata": { "kernelspec": { - "display_name": "wrk", + "display_name": "Python 3 (ipykernel)", "language": "python", - "name": "wrk" + "name": "python3" }, "language_info": { "codemirror_mode": { @@ -487,7 +540,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.9" + "version": "3.11.5" } }, "nbformat": 4, diff --git a/examples/demo_theory_functionality_oo.ipynb b/examples/demo_theory_functionality_oo.ipynb index 322718713..290e58ae3 100644 --- a/examples/demo_theory_functionality_oo.ipynb +++ b/examples/demo_theory_functionality_oo.ipynb @@ -302,19 +302,48 @@ "plot_profile(r3d, rho, \"$\\\\rho_{\\\\rm 3d}$\")" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "For CCL versions >= 2.8.1.dev73+g86125b08, the surface mass density profile can be calculated with quad_vec numerial integration in addition to the default FFTLog. This option will increase the precision of the profile at large radii and can be enabled by calling `set_projected_quad(True)`." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# use quad_vec\n", + "moo_ein.set_projected_quad(True)\n", + "\n", + "Sigma_quad = moo_ein.eval_surface_density(r3d, z_cl, verbose=True)\n", + "\n", + "plot_profile(r3d, Sigma_quad, \"$\\\\Sigma_{\\\\rm quad}$\")" + ] + }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], - "source": [] + "source": [ + "# revert the effect from the previous cell\n", + "moo_ein.set_projected_quad(False)\n", + "\n", + "# default behavior\n", + "Sigma_FFTLog = moo_ein.eval_surface_density(r3d, z_cl, verbose=True)\n", + "\n", + "plot_profile(r3d, Sigma_FFTLog, \"$\\\\Sigma_{\\\\rm FFTLog}$\")" + ] } ], "metadata": { "kernelspec": { - "display_name": "wrk", + "display_name": "Python 3 (ipykernel)", "language": "python", - "name": "wrk" + "name": "python3" }, "language_info": { "codemirror_mode": { @@ -326,7 +355,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.9" + "version": "3.11.5" } }, "nbformat": 4,