Skip to content

Commit

Permalink
corrections of the tutorial
Browse files Browse the repository at this point in the history
  • Loading branch information
gaetanfacchinetti committed Apr 2, 2024
1 parent 2bc8986 commit a64ec9f
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 4 deletions.
7 changes: 6 additions & 1 deletion examples/example.config
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,9 @@ F_ESC10 : 3.0
ALPHA_ESC : 3.0
L_X : 0.1
M_TURN : 3.0
NU_X_THRESH : 3.0
NU_X_THRESH : 3.0


[cosmo_params]

[cosmo_params_vary]
2 changes: 1 addition & 1 deletion examples/fisher.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"outputs": [],
"source": [
"configuration_file = \"/scratch/ulb/physth_fi/gfacchin/runs_21cmCAST/config/constraint_nobkr.config\"\n",
"p21c.init_runs_from_fiducial(configuration_file, clean_existing_dir=False)"
"p21c.init_runs(configuration_file, clean_existing_dir=False)"
]
},
{
Expand Down
2 changes: 2 additions & 0 deletions src/py21cmcast/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
prepare_plot,
prepare_2subplots,
prepare_triangle_plot,
confidence_ellipse,
ellipse_from_covariance,
)

from .power import (
Expand Down
1 change: 1 addition & 0 deletions src/py21cmcast/runs.py
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,7 @@ def run_lightcone_from_config(config_file: str, n_omp: int = None, random_seed:
astro_params = p21c_tools.read_config_params(config.items('astro_params'), int_type=False)
cosmo_params = p21c_tools.read_config_params(config.items('cosmo_params'), int_type=False)


# manually set the number of threads
if n_omp is not None:
user_params['N_THREADS'] = int(n_omp)
Expand Down
10 changes: 8 additions & 2 deletions src/py21cmcast/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ def read_config_params(config_items, int_type = True, allow_lists = False):
else:
cast_val = float(value)
except:

if value == 'True':
cast_val = True
elif value == 'False':
Expand Down Expand Up @@ -332,11 +333,14 @@ def ellipse_from_covariance(cov_matrix, fiducial):
'LOG10_TK_at_Z_HEAT_MAX' : {'tex_name' : r'\log_{10}[\frac{\bar T_K^{\rm init}}{\rm K}]', 'min': -2, 'max': 1, 'ticks' : []},
'OMm' : {'tex_name' : r'\Omega_{\rm m}', 'min': -2, 'max': 1, 'ticks' : []},
'OMb' : {'tex_name' : r'\Omega_{\rm b}', 'min': -2, 'max': 1, 'ticks' : []},
'Omch2' : {'tex_name' : r'\Omega_{\rm c}h^2', 'min': -2, 'max': 1, 'ticks' : []},
'Ombh2' : {'tex_name' : r'\Omega_{\rm b}h^2', 'min': -2, 'max': 1, 'ticks' : []},
'hlittle' : {'tex_name' : r'h', 'min': -2, 'max': 1, 'ticks' : []},
'Ln_1010_As' : {'tex_name' : r'\ln(10^{10} A_{\rm s})', 'min': -2, 'max': 1, 'ticks' : []},
'SIGMA_8' : {'tex_name' : r'\sigma_8', 'min': -2, 'max': 1, 'ticks' : []},
'POWER_INDEX' : {'tex_name' : r'n_{\rm s}', 'min': -2, 'max': 1, 'ticks' : []},
'INVERSE_M_WDM' : {'tex_name' : r'1/m_{\rm WDM}', 'min': -2, 'max': 1, 'ticks' : []},
'NEUTRINO_MASS_1' : {'tex_name' : r'\sum m_\nu / 3', 'min': -2, 'max': 1, 'ticks' : []},
'NEUTRINO_MASS_1' : {'tex_name' : r'm_{\nu, 1} ~ [{\rm eV}]', 'min': -2, 'max': 1, 'ticks' : []},
}


Expand Down Expand Up @@ -433,7 +437,9 @@ def prepare_triangle_plot(params_to_plot, val_min, val_max):

axs[j_name][i_name].set_xlim([x_min, x_max])

if i != j :
if i != j :
if y_min == np.NaN or y_min == np.Inf or y_max == np.NaN or y_max == np.Inf:
print("Problem here: ", j_name, " ", i_name)
axs[j_name][i_name].set_ylim([y_min, y_max])

if i == j :
Expand Down

0 comments on commit a64ec9f

Please sign in to comment.