<jupyter_start><jupyter_text>Author: <NAME> Date Created: 5 Oct 2018 This example jupyer notebook uses clmm code to generate mock data with a set of configuration parameters, producing a catalog of ideal and noisy example data.<jupyter_code>import matplotlib.pyplot as plt
%matplotlib inline<jupyter_output><empty_output><jupyter_text>Import mock data module and setup the configuration<jupyter_code>import clmm.mock_data as mock<jupyter_output><empty_output><jupyter_text>Mock data generation requires a config dictionary<jupyter_code>config={}
config['cluster_m'] = 1.e15
config['cluster_z'] = 0.3
config['src_z'] = 0.8
config['concentration'] = 4
config['cosmo'] = 'WMAP7-ML'
config['ngals'] = 10000
config['mdef'] = '200c'

ideal_data = mock.MockData(config=config)
noisy_data = mock.MockData(config=config)
noisy_data_z = mock.MockData(config=config)<jupyter_output><empty_output><jupyter_text>Generate the mock catalog from the configuration. Consider 3 examples of increasing complexity:* Ideal data, no noise, all galaxies at the same redshift* Noisy data, including shape noise and redshift error, all galaxies at the same redshift* Noisy data, galaxies following redshift distribution, redshift error, shape noise<jupyter_code>ideal_data.generate()
noisy_data.generate(is_shapenoise=True, shapenoise=0.005, is_zerr=True)
noisy_data_z.generate(is_shapenoise=True, is_zdistribution=True, is_zerr=True)<jupyter_output><empty_output><jupyter_text>Ideal catalog first entries: no noise on the shape measurement, all galaxies at z=0.3<jupyter_code>ideal_data.catalog[0:5]<jupyter_output><empty_output><jupyter_text>More realistic catalog: noise has been added on the shape measurement, galaxies follow some photoz distribution, gaussian pdf for each photoz is also provided (along with corresponding bins)<jupyter_code>noisy_data_z.catalog[0:2]
# Histogram of the redshift distribution of bkg galaxies (starting at z_cluster + 0.1)
hist = plt.hist(noisy_data_z.catalog['z'], bins=50)
# pdz for the first galaxy in the catalog
plt.plot(noisy_data_z.catalog['z_bins'][0],noisy_data_z.catalog['z_pdf'][0])<jupyter_output><empty_output><jupyter_text>Compute and plot shear profile<jupyter_code>from clmm import ShearAzimuthalAverager
cl_dict = {'z':config['cluster_z'], 'ra':0.0, 'dec': 0.0}

saa_ideal = ShearAzimuthalAverager(cl_dict,ideal_data.catalog)
saa_noisy = ShearAzimuthalAverager(cl_dict,noisy_data.catalog)
saa_noisy_z = ShearAzimuthalAverager(cl_dict,noisy_data_z.catalog)


saa_ideal.compute_shear()
saa_noisy.compute_shear()
saa_noisy_z.compute_shear()

saa_ideal.make_shear_profile()
saa_noisy.make_shear_profile()
saa_noisy_z.make_shear_profile()
# Ideal data
saa_ideal.plot_profile()
# Noisy data, all galaxies at the same redshift
saa_noisy.plot_profile()
# Noisy data, galaxies following redshift distribution
saa_noisy_z.plot_profile()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.09667359667359668, 'fraction_numerical': 0.0148995148995149, 'mean_word_length': 8.72053872053872, 'pattern_counts': {'":': 0, '<': 30, '<?xml version=': 0, '>': 30, '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': '505623', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 1033, 'n_tokens_neox': 979, 'n_words': 233, 'path': 'examples/generate_mock_data.ipynb', 'repo_name': 'lbaumo/CLMM', 'size': '2893'}