Skip to content

Commit

Permalink
add planck cluster cosmology case
Browse files Browse the repository at this point in the history
  • Loading branch information
borisbolliet committed Nov 7, 2024
1 parent 0a78d1c commit 961ce19
Show file tree
Hide file tree
Showing 2 changed files with 211 additions and 0 deletions.
7 changes: 7 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,13 @@ Cosmic Linear Anisotropy Solving System with Machine Learning Accelerated CMB, L
:caption: TSZ X Galaxies

notebooks/class_sz_ngal_tSZ


.. toctree::
:maxdepth: 2
:caption: SZ cluster cosmology

notebooks/class_szfast_cluster_counts



Expand Down
204 changes: 204 additions & 0 deletions docs/notebooks/class_szfast_cluster_counts.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,204 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "b62b5ce8-fbf5-41f3-b109-c05ac94a0b35",
"metadata": {},
"source": [
"# Planck binned cluster counts"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "2a2825a6-6e82-42e0-97b9-65d34f8af150",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Using PATH_TO_CLASS_SZ_DATA: /Users/boris/class_sz_data_directory\n",
"Found class_sz_data_directory directory with all repositories at: /Users/boris/class_sz_data_directory\n",
"PATH_TO_CLASS_SZ_DATA is already correctly set.\n",
"Required directories already exist. Skipping download.\n"
]
}
],
"source": [
"import numpy as np\n",
"from classy_sz import Class as Class_sz"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "2a569f13-432f-4d4f-b246-13feabd4fc7c",
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/Users/boris/Work/CLASS-SZ/SO-SZ/mcfit/mcfit/mcfit.py:130: UserWarning: use backend='jax' if desired\n",
" warnings.warn(\"use backend='jax' if desired\")\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Ntot 5.5943177031e+02\n"
]
}
],
"source": [
"\n",
"class_sz = Class_sz()\n",
"\n",
"\n",
"class_sz.set({\n",
"\n",
"'output' : 'sz_cluster_counts',\n",
"'mass function' : 'T08M500c',\n",
"'has_selection_function' : 1,\n",
"'experiment' : 0,\n",
"'y_m_relation' : 0,\n",
"'use_skyaveraged_noise': 0,\n",
"'use_planck_binned_proba' : 0,\n",
"\n",
"\n",
"'m_pivot_ym_[Msun]': 3e14, \n",
"\n",
"'M_min' : 1e13*0.7, \n",
"'M_max' : 1e16*0.7,\n",
"\n",
"'z_min' : 0.01,\n",
"'z_max' : 1.02,\n",
"\n",
"'omega_b': 0.0224178568132,\n",
"'omega_cdm': 0.11933148326520002,\n",
"'H0': 70.,\n",
"'tau_reio': 0.0561,\n",
"'ln10^{10}A_s': 2.9799585,\n",
"'n_s': 0.96,\n",
"\n",
"\n",
"\n",
"'bin_z_min_cluster_counts' : 0.01,\n",
"'bin_z_max_cluster_counts' : 1.01,\n",
"'bin_dz_cluster_counts' : 0.1,\n",
"\n",
"'bin_dlog10_snr': 0.25, # fiducial 0.25\n",
"'log10_snr_min' : 0.7, # fiducial 0.7\n",
"\n",
"#the paramater dlny is crucial, it controls the speed of the calculation\n",
"#important to check that lnymin and lnymax are broad enough\n",
"'dlny' : 0.01, # fiducial 0.05\n",
"'lnymin' : -15, # fiducial -11\n",
"'lnymax' : 1., # fiducial 1.\n",
"'sigmaM_ym' :0.173, # fiducial 0.173\n",
"\n",
"\n",
"'dlnM_cluster_count_completeness_grid' : 0.01, # 0.01 fiducial\n",
"\n",
"\n",
"'cluster_count_completeness_grid_z_cutoff_low' : 0.5,\n",
"'cluster_count_completeness_grid_z_cutoff_mid' : 1.5,\n",
"'dz_cluster_count_completeness_grid_low_z' : 5e-3,\n",
"'dz_cluster_count_completeness_grid_mid_z' : 1e-2,\n",
"'dz_cluster_count_completeness_grid_high_z' : 1e-1,\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"'signal-to-noise_cut-off_for_survey_cluster_completeness' : 6.,\n",
"\n",
"\n",
"# X ray mass bias (if applicable)\n",
"'B' : 1.25,\n",
"\n",
"\n",
"\n",
"\n",
"# tabulation of mass function:\n",
"'n_z_dndlnM' : 200,\n",
"'n_m_dndlnM' : 200,\n",
"'ndim_redshifts' : 200,\n",
"\n",
"'szcc_dof': 0.,\n",
"'cosmo_model': 1,\n",
"\n",
"})\n",
"class_sz.compute_class_szfast()\n",
"\n",
"dNdzdy_theoretical = class_sz.dndzdy_theoretical()['dndzdy']\n",
"z_center = class_sz.dndzdy_theoretical()['z_center']\n",
"z_edges = class_sz.dndzdy_theoretical()['z_edges']\n",
"log10y_center = class_sz.dndzdy_theoretical()['log10y_center']\n",
"log10y_edges = class_sz.dndzdy_theoretical()['log10y_edges']\n",
"\n",
"N_z,N_y = np.shape(dNdzdy_theoretical)\n",
"N_clusters_z_theory = []\n",
"\n",
"for iz in range(N_z):\n",
" N_clusters_z_theory.append(np.sum(dNdzdy_theoretical[iz][0:]))\n",
"N_clusters_y_theory = []\n",
"\n",
"for iy in range(N_y):\n",
" N_clusters_y_theory.append(np.sum(np.asarray(dNdzdy_theoretical)[:,iy]))\n",
"print('Ntot %.10e'%(np.sum(N_clusters_z_theory)))"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "58039759-2291-44ca-890b-fb509af0a4ff",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.787079475530407"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"class_sz.sigma8()"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.13"
},
"widgets": {
"application/vnd.jupyter.widget-state+json": {
"state": {},
"version_major": 2,
"version_minor": 0
}
}
},
"nbformat": 4,
"nbformat_minor": 5
}

0 comments on commit 961ce19

Please sign in to comment.