Parameters

All user-definable analysis parameters in BayesEoR are handled via the bayeseor.params.BayesEoRParser class:

class bayeseor.params.BayesEoRParser(*args, parse_as_dict=False, **kwargs)

Command line argument parser class for all BayesEoR analysis parameters.

For more information on the command line syntax, please see

python run-analysis.py --help
General Parameters
config

Path to a yaml configuration file containing any command line arguments below parsable by jsonargparse.ArgumentParser. Please note command line arguments use dashes ‘-’ but the configuration yaml file requires underscores ‘_’. For example, to specify the array directory prefix on the command line, the command line argument is –array-dir-prefix. To specify the array directory prefix in the configuration yaml file, use array_dir_prefix instead. For an example, please see the provided configuration yaml file BayesEoR/example-config.yaml.

Type:

str, optional

quiet

Quiet mode where only a few statements are printed. Defaults to False.

Type:

bool, optional

clobber

Overwrite files if they exist. This includes the matrix stack, any existing preprocessed data/noise vectors, and instrument model files. Defaults to False.

Type:

bool, optional

Compute Parameters
use_gpu

Use GPUs (True) or CPUs (False). Defaults to True.

Type:

bool, optional

run

Run a full power spectrum analysis. To build the matrix stack only, run can be omitted or set to False in the configuration yaml.

Type:

bool, optional

Matrix Parameters
array_dir_prefix

Directory for matrix storage. Defaults to ‘./array-storage’.

Type:

str, optional

use_sparse_matrices

Use sparse matrices (True) to reduce storage requirements or dense matrices (False). Defaults to True.

Type:

bool, optional

build_Finv_and_Fprime

If True, construct Finv and Fprime independently and write both matrices to disk when building the matrix stack. Otherwise (default), construct the matrix product Finv_Fprime in place from the dense matrices comprising Finv and Fprime to minimize the memory and time required to build the matrix stack. In this case, only the matrix product Finv_Fprime is written to disk.

Type:

bool, optional

Prior Parameters
priors

Power spectrum prior range [min, max] for each k bin.

Type:

list of list

log_priors

Assume priors on power spectrum coefficients are in log_10 units (True) or linear units (False). Defaults to True.

Type:

bool, optional

uprior_bins

Array indices of k-bins using a uniform prior. All other bins use the default log-uniform prior. Follows python slicing syntax. Can pass a range via ‘1:4’ (non-inclusive high end), a list of indices via ‘1,4,6’ (no spaces between commas), a single index ‘3’ or ‘-3’, or ‘all’. Defaults to an empty string (all k-bins use log-uniform priors).

Type:

str, optional

inverse_LW_power

Prior on the inverse power of the large spectral scale model (LSSM) coefficients. A large value, 1e16, constrains the LSSM coefficients to be zero. A small value, 1e-16 (default), leaves the LSSM coefficients unconstrained.

Type:

float, optional

use_LWM_Gaussian_prior

Use a Gaussian prior on the large spectral scale model (True, NOT CURRENTLY IMPLEMENTED). Otherwise, use a uniform prior (False, default)

Type:

bool, optional

Sampler Parameters
output_dir

Directory for sampler output. Defaults to ‘./chains/’.

Type:

str, optional

file_root

If None (default), start a new analysis. Otherwise, resume analysis from file_root.

Type:

str, optional

use_Multinest

Use MultiNest (True) or Polychord (False) as the sampler. Using Polychord is advised for large parameter spaces. Defaults to True (use MultiNest).

Type:

bool, optional

Frequency Parameters
nf

Number of frequency channels. Required if data_path points to a preprocessed data vector with a ‘.npy’ suffix. Otherwise, nf sets the number of frequencies to keep starting from freq_idx_min or freq_min, or around freq_center. Defaults to None (keep all frequencies).

Type:

int, optional

df

Frequency channel width in hertz. Required if data_path points to a preprocessed numpy-compatible file. Otherwise, if None (default), defaults to the frequency channel width in the input pyuvdata-compatible visibilities. Defaults to None.

Type:

float, optional

freq_idx_min

Minimum frequency channel index to keep in the data vector. Used only if data_path points to a pyuvdata-compatible visibility file. Defaults to None (keep all frequencies).

Type:

int, optional

freq_min

Minimum frequency in hertz. If data_path points to a pyuvdata-compatible visibility file, freq_min sets the minimum frequency kept in the data vector. All frequencies greater than or equal to freq_min will be kept, unless nf is specified. If None (default), all frequencies are kept. If data_path points to a preprocessed data vector with a ‘.npy’ suffix, one of freq_min or freq_center is required.

Type:

float, optional

freq_center

Central frequency in Hertz. If data_path points to a pyuvdata-compatible visibility file, nf is also required to determine the number of frequencies kept around freq_center in the data vector. If None (default), all frequencies are kept. If data_path points to a preprocessed data vector with a ‘.npy’ suffix, one of freq_min or freq_center is required.

Type:

float, optional

neta

Number of line-of-sight Fourier modes. Defaults to nf.

Type:

int, optional

nq

Number of large spectral scale model quadratic basis vectors. If beta is not None, the quadratic basis vectors are replaced by power law basis vectors according to the spectral indices in beta. Defaults to 0.

Type:

int, optional

beta

Brightness temperature power law spectral index/indices used in the large spectral scale model. Can be a single spectral index, ‘[2.63]’, or multiple spectral indices can be passed, ‘[2.63,2.82]’, to use multiple power law spectral basis vectors. Do not put spaces after commas if using multiple spectral indices. Defaults to [2.63, 2.82].

Type:

list of float, optional

fit_for_spectral_model_parameters

Fit for the optimal large spectral scale model spectral indices. Defaults to False.

Type:

bool, optional

pl_min

Minimum brightness temperature spectral index when fitting for the optimal large spectral scale model spectral indices. Defaults to None.

Type:

float, optional

pl_max

Maximum brightness temperature spectral index when fitting for the optimal large spectral scale model spectral indices. Defaults to None.

Type:

float, optional

pl_grid_spacing

Grid spacing for the power law spectral index axis when fitting for the optimal large spectral scale model spectral indices. Defaults to None.

Type:

float, optional

Time Parameters
nt

Number of times. Required if data_path points to a preprocessed data vector with a ‘.npy’ suffix. Otherwise, sets the number of times to keep starting from jd_idx_min or jd_min, or around jd_center. Defaults to None (keep all times).

Type:

int, optional

dt

Integration time in seconds. Required if data_path points to a preprocessed data vector with a ‘.npy’ suffix. Otherwise, if None (default), defaults to the integration time in the input pyuvdata-compatible visibilities. Defaults to None.

Type:

float, optional

jd_idx_min

Minimum time index to keep in the data vector. Used only if data_path points to a pyuvdata-compatible visibility file. Defaults to None (keep all times). Defaults to None (keep all times).

Type:

int, optional

jd_min

Minimum time as a Julian date. If data_path points to a pyuvdata-compatible visibility file, jd_min sets the minimum time kept in the data vector. All times greater than or equal to jd_min will be kept, unless nt is specified. If None (default), all times are kept. If data_path points to a preprocessed data vector with a ‘.npy’ suffix, one of jd_min or jd_center is required.

Type:

float, optional

jd_center

Central time as a Julian date. If data_path points to a pyuvdata-compatible visibility file, nt is also required to determine the number of times kept around jd_center in the data vector. If None (default), all times are kept. If data_path points to a preprocessed data vector with a ‘.npy’ suffix, one of jd_min or jd_center is required.

Type:

float, optional

Model Image Parameters
nside

HEALPix resolution parameter. Sets the resolution of the sky model. Note, the HEALPix resolution must be chosen such that there are two HEALPix pixels per minimum fringe wavelength from the model uv-plane to satisfy the Nyquist-Shannon sampling theorem.

Type:

int

fov_ra_eor

Field of view of the right ascension axis of the EoR sky model in degrees.

Type:

float

fov_dec_eor

Field of view of the declination axis of the EoR sky model in degrees. Defaults to fov_ra_eor.

Type:

float, optional

fov_ra_fg

Field of view of the right ascension axis of the foreground sky model in degrees. Defaults to fov_ra_eor.

Type:

float, optional

fov_dec_fg

Field of view of the declination axis of the foreground sky model in degrees. Defaults to fov_ra_fg or fov_dec_eor if fov_ra_fg is not defined.

Type:

float, optional

simple_za_filter

Filter pixels in the sky model by zenith angle only (True, default). Otherwise, filter pixels in a rectangular region set by the field of view values along the RA and Dec axes (False). It is suggested to set simple_za_filter to True (see issue #11).

Type:

bool, optional

Model uv-Plane Parameters
nu

Number of pixels on the u-axis of the model uv-plane for the EoR model.

Type:

int

nv

Number of pixels on the v-axis of the model uv-plane for the EoR model. Defaults to nu.

Type:

int, optional

nu_fg

Number of pixels on the u-axis of the model uv-plane for the foreground model. Defaults to nu.

Type:

int, optional

nv_fg

Number of pixels on the v-axis of the model uv-plane for the foreground model. Defaults to nu_fg or nv if nu_fg is not defined.

Type:

int, optional

fit_for_monopole

Include (True) or exclude (False) the (u, v) == (0, 0) pixel in the model uv-plane. Defaults to False.

Type:

bool, optional

Noise Model Parameters
sigma

Standard deviation of the visibility noise in mK sr. Required if calc_noise is False and data_path points to a pyuvdata-compatible visibility file or noise_data_path is None and data_path points to a preprocessed numpy-compatible visibility vector. Defaults to None.

Type:

float, optional

noise_seed

Seed for numpy.random. Used to generate the noise vector if adding noise to the input visibility data. Defaults to 742123.

Type:

float, optional

use_intrinsic_noise_fitting

Fit for the noise level. Defaults to False.

Type:

bool, optional

Instrument Model Parameters
model_instrument

Forward model an instrument (True) or exclude instrumental effects (False). Defaults to True.

Type:

bool, optional

inst_model

Path to a directory containing the instrument model. This directory must at least contain two numpy-compatible files: uvw_model.npy containing the sampled (u, v, w) coordinates with shape (nt, nbls, 3) where nbls is the number of baselines, and redundancy_model.npy containing the number of baselines in a each sampled (u, v, w) with shape (nt, nbls, 1). Please see bayeseor.model.instrument for more details. Used only if include_instrumental_effects is True. Defaults to None.

Type:

str, optional

telescope_latlonalt

Telescope location in latitude (deg), longitude (deg), and altitude (meters). Passed as a list of floats, e.g. ‘[30.1,125.6,80.4]’. Do not put spaces after commas. Required if include_instrumental_effects is True. Defaults to None.

Type:

list of float, optional

drift_scan

Model the instrument in drift scan mode (True) or in phased mode (False). Used only if include_instrumental_effects is True. Defaults to True.

Type:

bool, optional

beam_type

Path to a pyuvdata-compatible beam file or one of ‘uniform’, ‘gaussian’, ‘airy’, ‘gausscosine’, or ‘taperairy’. Used only if include_instrumental_effects is True. Defaults to None.

Type:

str

fwhm_deg

Full width at half maximum of beam in degrees. Used only if include_instrumental_effects is True and beam_type is ‘airy’, ‘gaussian’, or ‘gausscosine’. Defaults to None.

Type:

float, optional

antenna_diameter

Antenna (aperture) diameter in meters. Used only if include_instrumental_effects is True and beam_type is ‘airy’, ‘gaussian’, or ‘gausscosine’. Defaults to None.

Type:

float, optional

cosfreq

Cosine frequency if using a ‘gausscosine’ beam. Used only if include_instrumental_effects is True. Defaults to None.

Type:

float, optional

achromatic_beam

Force the beam to be achromatic. The frequency at which the beam will be calculated is set via beam_ref_freq. Used only if include_instrumental_effects is True. Defaults to False.

Type:

bool, optional

beam_ref_freq

Beam reference frequency in hertz. Used only if include_instrumental_effects is True. Defaults to freq_min.

Type:

bool, optional

beam_peak_amplitude

Peak amplitude of the beam. Used only if include_instrumental_effects is True. Defaults to 1.0.

Type:

float, optional

beam_center

Beam center offsets from the phase center in RA and Dec in degrees. Default behavior is the beam center aligns with the phase center. Passed as a list of floats, e.g. ‘[-1.3,0.01]’. Do not include a space after the comma. Defaults to None.

Type:

list of float, optional

Subharmonic Grid Parameters
nu_sh

Number of pixels on a side for the u-axis in the subharmonic grid model uv-plane. Defaults to None.

Type:

int, optional

nv_sh

Number of pixels on a side for the v-axis in the subharmonic grid model uv-plane. Defaults to nu_sh.

Type:

int, optional

fit_for_shg_amps

Fit for the amplitudes of the subharmonic grid pixels. Defaults to False.

Type:

bool, optional

Tapering Parameters
taper_func

Taper function applied to the frequency axis of the visibilities. Can be any valid argument to scipy.signal.windows.get_window. Defaults to None.

Type:

str, optional

Input Data Parameters
data_path

Path to either a pyuvdata-compatible visibility file or a preprocessed numpy-compatible visibility vector in units of mK sr.

Type:

str

noise_data_path

Path to a preprocessed numpy-compatible noise visibility vector in units of mK sr. Required if calc_noise is False and sigma is None.

Type:

str, optional

ant_str

Antenna downselect string. If data_path points to a pyuvdata-compatible visibility file, ant_str determines what baselines to keep in the data vector. Please see pyuvdata.UVData.select for more details. Defaults to ‘cross’ (cross-correlation baselines only).

Type:

str, optional

bl_cutoff

Baseline length cutoff in meters. If data_path points to a pyuvdata-compatible visibility file, bl_cutoff determines the longest baselines kept in the data vector. Defaults to None (keep all baselines).

Type:

float, optional

form_pI

Form pseudo-Stokes I visibilities. Otherwise, use the polarization specified by pol. Used only if data_path points to a pyuvdata-compatible visibility file. Defaults to True.

Type:

bool, optional

pI_norm

Normalization, N, used in forming pseudo-Stokes I from XX and YY via pI = N * (XX + YY). Used only if data_path points to a pyuvdata-compatible visibility file and form_pI is True. Defaults to 1.0.

Type:

float, optional

pol

Case-insensitive polarization string. Can be one of ‘xx’, ‘yy’, or ‘pI’ for XX, YY, or pseudo-Stokes I polarization, respectively. Used only if data_path points to a pyuvdata-compatible visibility file and form_pI is False. Defaults to ‘xx’.

Type:

str, optional

redundant_avg

Redundantly average the data. Used only if data_path points to a pyuvdata-compatible visibility file. Defaults to False.

Type:

bool, optional

uniform_redundancy

Force the redundancy model to be uniform. Used only if data_path points to a pyuvdata-compatible visibility file. Defaults to False.

Type:

bool, optional

phase_time

The time to which the visibilities will be phased as a Julian date. Used only if drift_scan is False. If drift_scan is False and phase_time is None, phase_time will be automatically set to the central time in the data. Used only if data_path points to a pyuvdata-compatible visibility file. Defaults to None.

Type:

float, optional

calc_noise

Calculate a noise estimate from the visibilities via differencing adjacent times per baseline and frequency. Used only if data_path points to a pyuvdata-compatible visibility file. Defaults to False.

Type:

bool, optional

save_vis

Write visibility vector to disk in out_dir. If calc_noise is True, also save the noise vector. Used only if data_path points to a pyuvdata-compatible visibility file. Defaults to False.

Type:

bool, optional

save_model

Write instrument model (antenna pairs, (u, v, w) sampling, and redundancy model) to disk in out_dir. If phase is True, also save the phasor vector. Used only if data_path points to a pyuvdata-compatible visibility file. Defaults to False.

Type:

bool, optional

parse_args(args_str=None)

Parse arguments from sys.argv or args.

Parameters:

args_str (list of str, optional) – Command line arguments as a list of strings, e.g. ‘[”–config”, “example_config.yaml”]’. If None (default), pulls from sys.argv.

Returns:

args – Namespace of parsed arguments.

Return type:

Namespace

Setting Parameters

The jsonargparse package allows for all of these parameters to be set via the command line or a yaml configuration file. Two example yaml files have been provided, one for each test dataset. Here, we provide an example of the configuration yaml for the EoR Only test data, test_data/eor/config.yaml:

# data_path can point to either a pyuvdata-compatible file (recommended) or
# a preprocessed numpy-compatible file generated via `bayeseor.setup.run_setup`
data_path: test_data/eor/eor.uvh5

# EoR model params
# Number of pixels along the u-axis of the model uv-plane
nu: 15
# nv can be set independently, but if None (default), nv will be set to nu
# nv: 15
# FoV of the image-space model in degrees along right ascension
fov_ra_eor: 12.9080728652
# The FoV of the declination axis of the image-space model, fov_dec_eor, can
# be set independently, buf it None (default), fov_dec_eor will be set to
# fov_ra_eor.
# fov_dec_eor: 12.9080728652
# Use a rectangular FoV for the image-space model.  Please note that using
# a rectangular FoV is not recommended (please see BayesEoR issue #11) and we
# recommend leaving simple_za_filter set to True (default).  For this
# particular test dataset, a rectangular FoV is okay.
simple_za_filter: False
# HEALPix nside parameter for the image-space model
nside: 128

# Noise model params
# The input data are noise free, so we need to simulate and add noise to the
# data vector.  sigma sets the standard deviation of the mean-zero Gaussian
# distribution from which the noise is drawn.  The amplitude has been chosen
# such that, in the visibility domain, the signal-to-noise ratio of the
# EoR-only visibility component to the noise component is 0.5.
sigma: 0.00615864342588761

# Instrument model params
# Telescope latitude [degrees], longitude [degrees], and altitude [meters]
telescope_latlonalt: [-30.72152777777791, 21.428305555555557, 1073.0000000093132]
# Beam type str as one of: uniform, gaussian, airy, gausscosine, or taperairy
beam_type: gaussian
# Full width at half maximum of the Gaussian beam
fwhm_deg: 9.306821090681533

# Prior params
# Prior [min, max] for each k bin in logarithmic units.  These priors have
# been chosen to be the true dimensionless power spectrum of the EoR-only
# visibilities plus or minus two orders of magnitude.
priors: [[-2.0, 2.0], [-1.2, 2.8], [-0.7, 3.3], [0.7, 2.7], [1.1, 3.1],
         [1.5, 3.5], [2.0, 4.0], [2.4, 4.4], [2.7, 4.7]]
# If you wish to set priors in linear units, you can do by setting log_priors
# to False and changing the prior min/max values above to linear units.
# log_priors: False

Any variable that can be set via a command line argument can also be set in this yaml configuration file (command line arguments containing dashes in the variable name must be replaced with underscores, i.e. the command line argument --data-path can be set in the configuration file via data_path: "/path/to/data.uvh5"). Please also note that any command line argument with a dest attribute is referenced by the corresponding dest variable name in the configuration yaml. For example, to request the code use GPUs, you can set this via --gpu on the command line or via use_gpu: True in the configuration file.

The command line interface in BayesEoR uses several classes from the jsonargparse package, notably the ArgumentParser and ActionYesNo classes. For more information on these classes, please refer to the jsonargparse documentation.