Parsing

All parameters in an experiment have a value assigned through a configuration or settings file, which is read using the module Parse, which in turn is based on configparser.

There are two main strategies to load the configuration file:

  1. From a command line, python run_experiment.py config.ini
  2. From the python interpreter

Both strategies can be used with the same code, as follows:

from Parser import Parser
from sys import argv

if len(argv) > 1:
    config = Parser(argv[1])
else:
    config = Parser()

Which loads the default configuration file, set in the variable DEFAULT_INI in the :mod:Parser module.

Also, a configuration file can be loaded from the python interpreter directly

from Parser import Parser
config = Parser('custom_file.ini')

Finally, once the configuration object has been instatiated woth the default variable values, they can be changed with the :meth:Parser.load_config method, for example:

from Parser import Parser
config = Parser('custom_file.ini')
n_jobs = 4
run_parallel = 'yes'
config.load_config(keys=['n_jobs', 'run_parallel'],
                   values=[n_jobs, run_parallel])

Variables are accessed by sections. For example, in order to access the variable ‘datadir_cmb’ in the section ‘maps’:

print(config['maps']['datadir_cmb'])

The sections in the configuration file are:

  • experiment: unique ID for the experiment
  • cmb: data for the CMB maps
  • glx: data for the galaxy catalogue
  • run: computing configuration, options and optimizations
  • out: output data
  • UX: user experience

Configuration of required fields

The following are the required fields for a basic experiment:

Here we present the detailed description of these fields. For all variables which admit Y/N options, the following values are accepted:

  • YES (y, yes, s, si, true). Case insensitive.
  • NO (n, no, false). Case insensitive.
experiment_ID
An identifier for each experiment. When running a new experiment, directories will be created to store the output results and plots. Examples: EXP_001, 01, TEST, etc. (without spaces).
datadir_cmb
Directory where the data files with the CMB temperature maps and masks are located. It accepts absolute paths or relative paths to the directory where the Parse object is executed.
filedata_cmb_nside
Healpix nside corresponding to the map. If a wrong value is set, an error is raised. If a wrong value is set, an error is raised.
filedata_cmb_mapa
File with the Healpix map with the temperatures.
filedata_field_mapa
Field in the FITS file with the Healpix map with the temperatures.
filedata_cmb_mask
File with the Healpix mask with the temperatures.
filedata_field_mask
Field in the FITS file with the Healpix mask with the temperatures.
datadir_glx
Directory where the data files with the galaxy catalogues are located. It accepts absolute paths or relative paths to the directory where the Parse object is executed.
filedata_glx
File name with the galaxy catalogue.
theta_start
Starting value of the angle with respect to the galaxy disk
theta_stop
Ending value of the angle with respect to the galaxy disk
theta_n_bins
Number of bins in the range [theta_start, theta_stop]
theta_units

Units for the values of theta_start and theta_stop.

Options:

  • rad,
  • arcmin,
  • arcsec.
r_start
Starting value of the angular distance to the center
r_stop
Ending value of the angular distance to the center
r_n_bins
Number of bins in the range [r_start, r_stop]
r_units

Units for the values of r_start and r_stop.

Options:

  • rad: radians
  • arcmin: arc minutes
  • arcsec: arc seconds
  • angular: distance is normalized to the angular size of each galaxy
  • physical: distance is normalized to the physical size of each galaxy
save_pickle
Wether to save the results in pickle files. Options: Y/N
dir_output
Directory of output data files.
pickle_name_root
Root of pickle filename
pickle_name_ext
Extension of pickle filename (e.g., ‘pk’)
dir_plots
Directory of output data files.
plot_name_root
Root of plot filename
plot_format
Format of plot filename
clobber
Wether to overwrite the output files when repeating experiments. Options: Y/N.
plot_fname
root name for the plot
plot_ftype
filetype for the plot

Configuration of optional fields

The following are optional fields for a given experiment:

Detailed description of the optional fields:

max_centers
Limit the number of centers to a maximum value. ‘no’ for no limitation.
control_sample
If True, galaxy positions are shuffled randomly in the sky. Options: Y/N
control_n_samples
If a number greater than zero, run control_n_samples control samples
control_ranmap
Shuffle temperatures in pixels
control_angles
Randomize position angles
n_jobs
Number of threads for parallel computation
run_parallel
Run parallel computation (Options: Y/N)
r_avg_cuts
List if indices to dilute the number of pixels in average temperature estimation. See manual optimization for more details.
r_avg_fact
Factor to dilute the number of pixels in average temperature estimation. See manual optimization for more details.
adaptative_resolution
Choice if using adaptative resolution in pixel schemes. See depletion function for more details.
adaptative_res_nside
Healpix nside for low resolution map if using adaptative resolution in pixel schemes. See depletion function for more details.
adaptative_res_dilut
Additional dilution factor in if using adaptative resolution in pixel schemes. See depletion function for more details.
disk_align
Compute profile aligning all galaxy disks in the stacking
galaxy_types

Selection of galaxy types. Based on 2MASS XSC documentation. Options:

  • early
  • late
  • Sa
  • Sb
  • Sc
  • Sd

Also several type are allowed, e.g.,

  • Sc Sd
redshift_min
description
redshift_max
description
ellipt_min
description
ellipt_max
description
glx_angsize_min
description
glx_angsize_max
description
glx_angsize_unit
description
glx_physize_min
description
glx_physize_max
description
glx_physize_unit
description
show_progress
description
verbose
description
interactive
description