<jupyter_start><jupyter_text>Model a Galaxy Cluster  Notebook for generating an example galaxy cluster model. This notebook goes through the steps to generate model data for galaxy cluster weak lensing observables.  In particular, we define a galaxy cluster model that follows and NFW distribution and generate various profiles for the model (mass density, convergence, shear, etc.), which we plot.  Note, a full pipeline to measure a galaxy cluster weak lensing mass requires fitting the observed (or mock) data to a model. In this notebook we use the OO interface to modeling.<jupyter_code>import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline<jupyter_output><empty_output><jupyter_text>Imports specific to clmm<jupyter_code>import sys
import os
sys.path.append('./support')

os.environ['CLMM_MODELING_BACKEND'] = 'ccl' # here you may choose ccl or nc (NumCosmo)

import clmm
from clmm import Cosmology<jupyter_output><empty_output><jupyter_text>Make sure we know which version we're using<jupyter_code>clmm.__version__<jupyter_output><empty_output><jupyter_text>Define a cosmology using astropy<jupyter_code>cosmo = Cosmology(H0 = 70.0, Omega_dm0 = 0.27 - 0.045, Omega_b0 = 0.045, Omega_k0 = 0.0)<jupyter_output><empty_output><jupyter_text>Define the galaxy cluster model.  Here, we choose parameters that describe the galaxy cluster model, including the mass definition, concentration, and mass distribution.  For the mass distribution, we choose a distribution that follows an NFW profile.<jupyter_code>moo = clmm.Modeling (massdef = 'mean', delta_mdef = 200, halo_profile_model = 'nfw')

moo.set_cosmo (cosmo)
moo.set_concentration (4)
moo.set_mass (1.e15)

z_cl = 1.
z_source = 2.<jupyter_output><empty_output><jupyter_text>Quick test of all modeling functionality<jupyter_code>r3d        = np.logspace(-2, 2, 100)
rho        = moo.eval_density (r3d, z_cl)
Sigma      = moo.eval_sigma (r3d, z_cl)
DeltaSigma = moo.eval_sigma_excess (r3d, z_cl)
Sigmac     = moo.eval_sigma_crit (z_cl, z_source)
gammat     = moo.eval_shear (r3d, z_cl, z_source)
kappa      = moo.eval_convergence (r3d, z_cl, z_source)
gt         = moo.eval_reduced_shear (r3d, z_cl, z_source)
mu         = moo.eval_magnification (r3d, z_cl, z_source)<jupyter_output><empty_output><jupyter_text>Plot the predicted profiles<jupyter_code>def plot_profile(r, profile_vals, profile_label='rho'):
    plt.loglog(r, profile_vals)
    plt.xlabel('r [Mpc]', fontsize='xx-large')
    plt.ylabel(profile_label, fontsize='xx-large')
plot_profile(r3d, rho, '$\\rho_{\\rm 3d}$')
plot_profile(r3d, Sigma, '$\\Sigma_{\\rm 2d}$')
plot_profile(r3d, DeltaSigma, '$\\Delta\\Sigma_{\\rm 2d}$')
plot_profile(r3d, kappa, '$\\kappa$')
plot_profile(r3d, gammat, '$\\gamma_t$')
plot_profile(r3d, gt, '$g_t$')
plot_profile(r3d, mu, '$\mu$')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.11020840692334864, 'fraction_numerical': 0.018368067820558106, 'mean_word_length': 5.616822429906542, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '7', 'dir': 'jupyter-structured-clean-dedup', 'id': '483010', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 1046, 'n_tokens_neox': 1004, 'n_words': 273, 'path': 'examples/demo_modeling_functionality_oo.ipynb', 'repo_name': '96RadhikaJadhav/CLMM', 'size': '2831'}