|
| 1 | +G-Correction Calculation |
| 2 | +======================== |
| 3 | + |
| 4 | +Code package for calculating correction factors to g_ell using pre-generated |
| 5 | +simulation maps for each single mask. This procedure assumes you are running |
| 6 | +this code on a cluster-- it is extremely slow to do otherwise. |
| 7 | + |
| 8 | +There is one main command-line utility that calls two functions from the |
| 9 | +:py:mod:`~xfaster.gcorr_tools` library: |
| 10 | + |
| 11 | +1. :py:func:`~xfaster.gcorr_tools.xfaster_gcorr_once` -- This function calls |
| 12 | + XFaster to run or submit jobs for gcorr runs. |
| 13 | +2. :py:func:`~xfaster.gcorr_tools.process_gcorr` -- A function that computes the |
| 14 | + gcorr correction from the ensemble of bandpowers, updates the running total, |
| 15 | + and backs up the necessary files from each iteration. |
| 16 | +3. ``xfaster gcorr`` -- An xfaster command-line utility, that calls function 1 |
| 17 | + and 2 to get a new gcorr.npz file each time. This is the main code you'll |
| 18 | + run. |
| 19 | + |
| 20 | +There is also a config file with options specific to computing gcorr. |
| 21 | + |
| 22 | +Procedure |
| 23 | +--------- |
| 24 | + |
| 25 | +1. Edit the gcorr config file to suit your purposes. Examples are given for |
| 26 | + signal and null runs in the examples directory. Required fields are: |
| 27 | + |
| 28 | + * ``null`` -- must be true for null tests and false for signal runs |
| 29 | + * ``map_tags`` -- comma-separated list of map tags |
| 30 | + * ``data_subset`` -- the globabble data_subset argument to xfaster_run, but |
| 31 | + without map tags. So, "full", "chunk*", etc. |
| 32 | + * ``output_root`` -- the parent directory where your gcorr XFaster runs will |
| 33 | + be written |
| 34 | + * ``nsim`` -- the number of simulations to use to compute gcorr |
| 35 | + * ``[xfaster_opts]`` -- this is where you'll put any options that will be |
| 36 | + directly input to :py:func:`~xfaster.xfaster_exec.xfaster_run` |
| 37 | + * ``[submit_opts]`` -- this is where you'll put any options that will be |
| 38 | + directly input to :py:func:`~xfaster.xfaster_exec.xfaster_submit`, in |
| 39 | + addition to those in ``[xfaster_opts]`` |
| 40 | + |
| 41 | +2. Run ``xfaster gcorr`` once to get the full set of XFaster output files in the |
| 42 | + output directory. Since we haven't computed gcorr yet, this will set |
| 43 | + ``apply_gcorr=False``. Make sure to use as many OMP threads as possible since |
| 44 | + this is the step where the sims_xcorr file, which benefits the most from |
| 45 | + extra threads, is computed. Your command should look like this:: |
| 46 | + |
| 47 | + xfaster gcorr path-to-my-gcorr-config.ini |
| 48 | + |
| 49 | +3. Run ``xfaster gcorr`` until convergence is reached. In practice, you will run |
| 50 | + the command above and wait for it to finish. If you include the |
| 51 | + ``--max-iters`` option with a non-zero value, the code will try to determine |
| 52 | + whether convergence or max_iters has been reached and stop on its own. |
| 53 | + Otherwise, you can look at the correction-to-the-correction that it both |
| 54 | + prints and plots (it should converge to 1s for TT, EE, BB), and rerun the |
| 55 | + same command if it hasn't converged. In much more detail, here's what the |
| 56 | + code does: |
| 57 | + |
| 58 | + 1. Call :py:func:`~xfaster.gcorr_tools.xfaster_gcorr_once` for the 0th sim |
| 59 | + seed while also reloading gcorr (if this is not the first iteration). |
| 60 | + This does a couple things-- saves the new gcorr in the ``masks_xcorr`` |
| 61 | + file, so later seeds will use the right thing. And recompute the transfer |
| 62 | + function, which doesn't depend on the ``sim_index``, so is only necessary |
| 63 | + to do once. |
| 64 | + 2. After the transfer functions are all on disk, submit individual jobs for |
| 65 | + all the other seeds, just doing the bandpowers step for those. |
| 66 | + 3. Once they're all done, run :py:func:`~xfaster.gcorr_tools.compute_gcal`, |
| 67 | + and save a correction-to-gcorr as ``gcorr_corr_<tag>_iter<iter>.npz`` in the |
| 68 | + rundir. |
| 69 | + 4. If not the first iteration, load up the correction-to-gcorr computed for |
| 70 | + this iteration. Multiply it by the total gcorr, and save that to the |
| 71 | + output directory as ``gcorr_total_<tag>_iter<iter>.npz``. |
| 72 | + 5. Plot gcorr total and the correction to gcorr total. Save in rundir/plots. |
| 73 | + 6. Clear out rundir bandpowers/transfer functions/logs. |
| 74 | + 7. Exit. |
| 75 | + |
| 76 | +4. After convergence is reached, copy the gcorr_total file for the last |
| 77 | + iteration from the rundir to the mask directory, labeling it |
| 78 | + ``mask_map_<tag>_gcorr.npz`` for signal or ``mask_map_<tag>_gcorr_null.npz`` |
| 79 | + for null. |
0 commit comments