@@ -2,79 +2,71 @@ Code package for calculating correction factors to g_ell using pre-generated
22simulation maps for each single mask. This procedure assumes you are running
33this code on a cluster-- it is extremely slow to do otherwise.
44
5- There are three scripts used:
5+ There is one main script that calls two functions from the xfaster.gcorr_tools
6+ library:
67
7- 1. run_xfaster.py ---- This calls XFaster either to run or submit jobs.
8- The only part that you'll need to touch is at the beginning-- opts and
9- submit_opts, to match the options you use for data/for your cluster.
10- 2. compute_gcorr.py ---- A script that computes gcorr.npz file from all the
11- bandpower.npz files. You'll never need to touch or run this script .
12- 3. iterate .py ---- A iteration script, that calls script 1 and 2 to get a
13- new gcorr.npz file each time. This is the main script you'll run.
8+ 1. xfaster_gcorr ---- This function calls XFaster to run or submit jobs for
9+ gcorr runs.
10+ 2. process_gcorr ---- A function that computes the gcorr correction from the
11+ ensemble of bandpowers, updates the running total, and backs up the necessary
12+ files from each iteration .
13+ 3. iterate_gcorr .py ---- A iteration script, that calls function 1 and 2 to get
14+ a new gcorr.npz file each time. This is the main script you'll run.
1415
1516There is also a config file with options specific to computing gcorr.
1617
1718---------------------
1819Gcorr run procedure:
1920
20211. Edit the gcorr config file to suit your purposes. An example is given.
21- Required fields are:
22- * null -- must be true for null tests and false for signal runs
23- * map_tags -- comma-separated list of map tags
24- * data_subset -- the globabble data_subset argument to xfaster_run,
25- but without map tags. So, "full", "chunk*", etc.
26- * output_root -- the parent directory where your gcorr XFaster runs will
27- be written
28- * nsim -- the number of simulations to use to compute gcorr
29- * [xfaster_opts] -- this is where you'll put any string-type options
30- that will be directly input to xfaster_run
22+ Required fields are:
23+ * null -- must be true for null tests and false for signal runs
24+ * map_tags -- comma-separated list of map tags
25+ * data_subset -- the globabble data_subset argument to xfaster_run,
26+ but without map tags. So, "full", "chunk*", etc.
27+ * output_root -- the parent directory where your gcorr XFaster runs will
28+ be written
29+ * nsim -- the number of simulations to use to compute gcorr
30+ * [xfaster_opts] -- this is where you'll put any options
31+ that will be directly input to xfaster_run
32+ * [submit_opts] -- this is where you'll put any options
33+ that will be directly input to xfaster_submit,
34+ in addition to those in [xfaster_opts]
3135
32- 2. Edit the beginning of run_xfaster.py for non-string input options
33- to xfaster_run (opts dictionary) or xfaster_submit (submit_opts).
34- Here you might change things like lmin, lmax, bin size, etc. and
35- omp_threads.
36+ 2. Run iterate_gcorr.py once to get the full set of XFaster output files in the
37+ output directory. Since we haven't computed gcorr yet, this will set
38+ apply_gcorr=False. Make sure to use as many OMP threads as possible since
39+ this is the step where the sims_xcorr file, which benefits the most from
40+ extra threads, is computed. Your command should look like this:
3641
37- 3. Run run_xfaster.py once to get the full set of XFaster output files.
38- Since we haven't computed gcorr yet, you must use --no-gcorr. Make sure
39- to use as many OMP threads as possible since this is the step where the
40- sims_xcorr file, which benefits the most from extra threads, is computed.
41- Your command should look like this:
42- python run_xfaster.py --gcorr-config path-to-my-gcorr-config.ini --no-gcorr
42+ python iterate_gcorr.py path-to-my-gcorr-config.ini
4343
44- 4. Run iterate.py until convergence is reached. In practice, you will do:
45- iterate.py --gcorr-config path-to-my-gcorr-config.ini
46- then wait for it to finish. Then look at the correction-to-the-correction
47- that it both prints and plots (it should converge to 1s for TT, EE, BB),
48- and if it hasn't converged, up+enter (redo) the same command you just did.
49- In much more detail, here's what the code does:
50- 1. If this is the first iteration, copy the whole output directory into
51- one next to it with tag _iter. This is the directory that will now be
52- updated with new transfer functions and bandpowers on each iteration.
53- In the code, it's called rundir.
54- 2. Make a plot directory in that _iter directory-- look here for new plots
55- of the total gcorr and the correction-to-gcorr each iteration.
56- 3. For the first iteration, initialize a starting guess for gcorr as all
57- ones. This total gcorr is saved as gcorr_<tag>_total.npz in the original
58- (reference) output directory.
59- 4. If not the first iteration, load up the correction-to-gcorr computed
60- in the previous iteration. Multiply it by the total gcorr, and save that
61- to the reference directory as gcorr_total. Also save the previous
62- iteration's total gcorr as gcorr_<tag>_prev.npz.
63- 5. Plot gcorr total and the correction to gcorr total. Save in rundir/plots.
64- 6. Clear out rundir bandpowers/transfer functions/logs.
65- 7. Call run_xfaster.py for the 0th sim seed while also reloading gcorr.
66- This does a couple things-- saves the new gcorr in the masks_xcorr file,
67- so later seeds will use the right thing. And recompute the transfer
68- function, which doesn't depend on the sim_index, so is only necessary to
69- do once.
70- 8. After the transfer functions are all on disk, submit individual jobs for
71- all the other seeds, just doing the bandpowers step for those.
72- 9. Monitor the queue, checking every 10 seconds for jobs still running.
73- 10. Once they're all done, run compute_gcal.py, which saves a
74- correction-to-gcorr as gcorr_corr_<tag>.npz in the rundir.
75- 11. Print out the values of the correction-to-gcorr.
76- 12. Exit.
44+ 3. Run iterate_gcorr.py until convergence is reached. In practice, you will run
45+ the command above and wait for it to finish. If you include the `--max-iters`
46+ option with a non-zero value, the code will try to determine whether
47+ convergence or max_iters has been reached and stop on its own. Otherwise,
48+ you can look at the correction-to-the-correction that it both prints and
49+ plots (it should converge to 1s for TT, EE, BB), and if it hasn't converged,
50+ up+enter (redo) the same command you just did. In much more detail, here's
51+ what the code does:
7752
78- 5. After convergence is reached, copy the gcorr_total file from the refdir
79- to the mask directory, labeling it mask_map_<tag>_gcorr.npz for signal or
80- mask_map_<tag>_gcorr_null.npz for null.
53+ 1. Call xfaster_gcorr for the 0th sim seed while also reloading gcorr (if
54+ this is not the first iteration). This does a couple things-- saves the
55+ new gcorr in the masks_xcorr file, so later seeds will use the right
56+ thing. And recompute the transfer function, which doesn't depend on the
57+ sim_index, so is only necessary to do once.
58+ 2. After the transfer functions are all on disk, submit individual jobs for
59+ all the other seeds, just doing the bandpowers step for those.
60+ 3. Once they're all done, run compute_gcal, and save a correction-to-gcorr
61+ as gcorr_corr_<tag>_iter<iter>.npz in the rundir.
62+ 4. If not the first iteration, load up the correction-to-gcorr computed for
63+ this iteration. Multiply it by the total gcorr, and save that to the
64+ output directory as gcorr_total_<tag>_iter<iter>.npz.
65+ 5. Plot gcorr total and the correction to gcorr total. Save in rundir/plots.
66+ 6. Clear out rundir bandpowers/transfer functions/logs.
67+ 7. Exit.
68+
69+ 4. After convergence is reached, copy the gcorr_total file for the last
70+ iteration from the rundir to the mask directory, labeling it
71+ mask_map_<tag>_gcorr.npz for signal or mask_map_<tag>_gcorr_null.npz for
72+ null.
0 commit comments