Skip to content

Commit

Permalink
fixing compatibility again
Browse files Browse the repository at this point in the history
  • Loading branch information
Gaetan Facchinetti ([email protected]) committed Nov 6, 2024
1 parent e7f09ce commit 9049b30
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
4 changes: 4 additions & 0 deletions examples/example_wdm.config
Original file line number Diff line number Diff line change
Expand Up @@ -83,5 +83,9 @@ L_X_MINI : 0.1
NU_X_THRESH : 3.0


## Here we only vary M_WDM on top of the other parameters
## Not knowing what is the good step size for an accurate evaluation of the derivative
## of the 21cm power spectrum in the Fisher matrix element, we test an array of them
## (given in percentages of the fiducial value)
[cosmo_params_vary]
M_WDM : [ 1. , 1.0277316 , 1.05623224, 1.08552325, 1.11562654, 1.14656465, 1.17836072, 1.21103855, 1.24462259, 1.27913796, 1.3146105 , 1.35106675, 1.38853399, 1.42704026, 1.46661437, 1.50728593, 1.54908538, 1.59204399, 1.63619392, 1.68156819, 1.72820077, 1.77612654, 1.82538137, 1.87600211, 1.92802665, 1.98149391, 2.03644391, 2.09291775, 2.15095771, 2.2106072 , 2.27191088, 2.3349146 , 2.39966551, 2.46621207, 2.53460408, 2.6048927 , 2.67713054, 2.75137165, 2.82767159, 2.90608744, 2.98667789, 3.06950325, 3.15462548, 3.24210829, 3.33201714, 3.4244193 , 3.51938392, 3.61698207, 3.71728676, 3.82037307, 3.92631812, 4.0352012 , 4.14710378, 4.2621096 , 4.38030471, 4.50177757, 4.62661906, 4.7549226 , 4.88678421, 5.02230255, 5.16157903, 5.30471787, 5.45182618, 5.60301403, 5.75839457, 5.91808406, 6.082202 , 6.25087118, 6.42421783, 6.60237167, 6.78546599, 6.97363781, 7.16702794, 7.36578108, 7.57004597, 7.77997545, 7.99572661, 8.21746089, 8.44534422, 8.67954712, 8.92024484, 9.16761749, 9.42185019, 9.68313316, 9.95166192, 10.22763742, 10.51126616, 10.80276038, 11.10233819, 11.41022379, 11.72664754, 12.05184622, 12.38606319, 12.72954852, 13.08255926, 13.44535955, 13.81822086, 14.20142222, 14.59525037, 15. ]
18 changes: 10 additions & 8 deletions examples/fisher.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
"source": [
"## I. Create the configuration files for varying parameters\n",
"\n",
"See the examples of master configuration files in the config folder. Running **init\\_fisher\\_from\\_fiducial** will create a folder (named after the run name set in the master configuration file) and sub configuration files inside (which correspond to the variation of each parameter). Once they are created each can by run with the script [**run\\_fisher.py**](https://github.com/gaetanfacchinetti/21cmCAST/blob/main/scripts/exec/run_fisher.py). Note that the script takes at least one argument (the name of the sub configuration files to run) and three optional: the number of threads, the number of the first seed, and the number of times the same script should be run with increasing seeds. The latter is only usefull to run several fiducial cases in order to determine what the 'average Universe' looks like. In practice, for a Fisher forecast one should fix the seed to a single value for all the runs. "
"/!\\ Equivalent to use init_fisher.py\n",
"\n",
"See the examples of master configuration files in the config folder. Running **init\\_runs** will create a folder (named after the run name set in the master configuration file) and sub configuration files inside (which correspond to the variation of each parameter). Once they are created each can by run with the script [**run\\_lightcone.py**](https://github.com/gaetanfacchinetti/21cmCAST/blob/main/scripts/exec/run_fisher.py). Note that the script takes at least one argument (the name of the sub configuration files to run) and a few optionals (check with running python **run\\_lightcone** -h). However, the option generate_script = True of **init\\_runs** directly produce a slurm script that can be submitted out of the box (after verification of the execution time and memory requirements)."
]
},
{
Expand All @@ -31,7 +33,7 @@
"outputs": [],
"source": [
"configuration_file = \"example_wdm.config\"\n",
"p21c.init_runs(configuration_file, clean_existing_dir=False)"
"p21c.init_runs(configuration_file, clean_existing_dir=False, generate_script = True, email_address = \"[email protected]\")"
]
},
{
Expand Down Expand Up @@ -85,18 +87,18 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## III. Define the fiducial model and get its power spectrum\n",
"## III. Define the fiducial model\n",
"\n",
"A **Fiducial** object can be defined by specifying the path where the lightcones are saved (depends on what was set on the config file) as well as the redshifts and modes bin edges. Note that we must set by hand whether the mode bins are linearly of logarithmically spaced with the option **logk** that is by default **False** as the output mode bin deges returned by **define\\_grid\\_modes\\_redshits()** are linearly spaced. Further options can be specified, such as a fraction of modeling error **frac\\_mod** (see below)."
]
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"fiducial = p21c.Fiducial(\"/globalscratch/ulb/physth_fi/gfacchin/wdm_21cm/output/WDM_FISHER/WDM_7.0_0_MINIHALOS\", z_bins, z_array, k_bins, False, load=True)"
"fiducial = p21c.Fiducial(\"/globalscratch/ulb/physth_fi/gfacchin/wdm_21cm/output/WDM_FISHER/WDM_7.0_MINIHALOS\", z_bins, z_array, k_bins, False, load=True)"
]
},
{
Expand Down Expand Up @@ -185,9 +187,9 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"### 2. Including WDM (or any other parameter)\n",
"### 2. Including WDM (or any other extra parameter)\n",
"\n",
"We define an array of parameter objects corresponding to M_WDM for many different step sizes around the central/fiducial value (given in percentage of the fiducial value). This part (especially for a large number of steps) can be long up to a few hours."
"We define an array of parameter objects corresponding to M_WDM for many different step sizes around the central/fiducial value (given in percentage of the fiducial value). This part (especially for a large number of steps) can be long up to a few hours. By extra parameters we mean parameters for which we do not know which step size gives a correct evaluation of the power spectrum derivative in the Fisher matrix element. For those parameters we test different step sizes (given in percentage of the fiducial value)."
]
},
{
Expand Down Expand Up @@ -234,7 +236,7 @@
"source": [
"## VI. Evaluate the Fisher matrix and its inverse\n",
"\n",
"From the list of parameters objects defined above one can directly compute the Fisher matrix with the **evaluate\\_fisher\\_matrix()** function. One can add a modeling noise to the power spectrum with the attribute **frac\\_noise** of the fiducial (as a percentage of the fiducial value). The triangle plot figure can be produced with the function **make\\_triangle\\_plot()** and plotted. Finally, the matrices can be displayed nicely with the **display\\_matrix()** function."
"From the list of parameters objects defined above one can directly compute the Fisher matrix with the **evaluate\\_fisher\\_matrix()** function. The triangle plot figure can be produced with the function **make\\_triangle\\_plot()** and plotted. Finally, the matrices can be displayed nicely with the **display\\_matrix()** function."
]
},
{
Expand Down

0 comments on commit 9049b30

Please sign in to comment.