Synthetic data generation framework

SimCoordinator

class meqsilhouette.framework.SimCoordinator.SimCoordinator(msname, output_column, input_fitsimage, input_fitspol, input_changroups, bandpass_table, bandpass_freq_interp_order, T_rx, corr_eff, predict_oversampling, predict_seed, atm_seed, aperture_eff, elevation_limit, trop_enabled, trop_wetonly, pwv, gpress, gtemp, coherence_time, fixdelay_max_picosec, uvjones_g_on, uvjones_d_on, parang_corrected, gR_mean, gR_std, gL_mean, gL_std, dR_mean, dR_std, dL_mean, dL_std, feed_angle, thermal_noise_enabled)[source]

Bases: object

add_bjones_manual()[source]

Read in the bandpass info from an ASCII table, interpolate (spline) MS frequencies, and apply to data

add_gjones_manual()[source]

Add time-varying station-based complex gains.

add_noise(tropnoise, thermalnoise)[source]

Add sky and receiver noise components to the visibilities and populate weight columns.

Parameters

tropnoisebool

If True, include tropospheric noise.

thermalnoisebool

If True, include receiver noise.

add_pol_leakage_manual()[source]

Add constant-in-time station-based polarization leakage (D-Jones term) that varies with frequency to data. These can be generated in either antenna frame or sky frame.

add_receiver_noise(load=None)[source]

Adds baseline dependent thermal noise to the data.

Parameters

load(bool, optional)

If True, loads the thermal noise from a file. Defaults to None.

Raises

MemoryError

If the arrays are too large to be held in memory.

add_weights(additional_noise_terms=None)[source]

Populate SIGMA, SIGMA_SPECTRUM, WEIGHT, WEIGHT_SPECTRUM columns in the MS.

Parameters

additional_noise_terms(ndarray, optional)

Additional noise terms to be added to the receiver RMS.

Raises

MemoryError

If the arrays are too large to be held in memory.

apply_phase_errors(combined_phase_errors)[source]

Apply phase errors that have been generated in previous steps to data and save.

Parameters

combined_phase_errorsndarray

The array containing the combined phase errors.

apply_pointing_amp_error()[source]

Apply pointing amplitude errors to data and save.

calc_ant_rise_set_times()[source]

Calculates the rise and set times for each antenna during the course of the observation. These are used to mask out pointing offsets for stowed antennas.

calculate_baseline_mean_elevation()[source]

Calculates the mean elevation for each baseline. Used in plotting uv-coverage.

calculate_baseline_min_elevation()[source]

Calculates the minimum elevation for each baseline. Used in plotting uv-coverage.

compute_receiver_rms()[source]

Populate the RMS receiver noise array. This will be later used to realise thermal noise.

copy_MS(new_name)[source]

Copies a Measurement Set (MS) to a new location.

Parameters

new_namestr

Path to the new Measurement Set.

Raises

Exception

If the copy operation fails for any reason.

elevation_calc()[source]

Calculates and returns the elevation angle.

Returns

elevation_ant_matrixndarray

The computed elevation angle matrix for each antenna during the course of the observation.

Raises

Exception

If the elevation angle cannot be computed for any reason.

interferometric_sim()[source]

Performs an interferometric simulation.

This method checks for the format of the sky model and generates the forward model (i.e. sky to visibilities) using either MeqTrees or WSClean. It also populates the data array which will be used for the rest of the synthetic data generation.

Raises

Exception

If ‘input_fitspol’ is set to True but not all polarisation images are present.

make_bandpass_plots()[source]

Generate plots of bandpass amplitudes and phases vs frequency.

make_baseline_dictionary()[source]

Creates and returns a dictionary of baselines for the current instance.

Returns

dict

A dictionary with all baselines present in the observation.

Raises

Exception

If the baseline dictionary cannot be created for any reason.

make_ms_plots()[source]

uv-coverage, uv-dist sensitivty bins, etc. All by baseline colour

make_pol_plots()[source]

Generate polarization leakage plots.

parallactic_angle_calc()[source]

Calculates and returns the parallactic angle.

Returns

parang_matrixndarray

The computed parallactic angle matrix for each antenna during the course of the observation.

Raises

Exception

If the parallactic angle cannot be computed for any reason.

plot_pointing_errors()[source]

Generate pointing error plots.

pointing_constant_offset(pointing_rms, pointing_timescale, PB_FWHM230)[source]

Compute pointing amplitude offsets.

Parameters

pointing_rmsndarray

The array containing the pointing RMS for each antenna.

pointing_timescalendarray

The timescale over which pointing errors are applied for each antenna.

PB_FWHM230ndarray

The primary beam FWHM at 230 GHz for each antenna.

Notes

Changes the pointing error for each antenna every pointing_timescale which one of could essentially think of as a scan length (e.g. 10 minutes).

save_data()[source]

Saves the contents of data array to the output column specified by the user.

trop_ATM_dispersion()[source]

Calculates extra path length due to mean wet and dry troposphere per frequency channel.

Returns

extra_path_lengthndarray

The calculated extra path length due to mean wet and dry troposphere per frequency channel.

trop_add_sky_noise(load=None)[source]

for non-zero tropospheric opacity, calc sky noise

trop_calc_fixdelay_phase_offsets()[source]

insert constant delay for each station for all time stamps. Used for testing fringe fitters

trop_calc_mean_delays()[source]

Insert mean delays (i.e. non-turbulent) due to mean dry and wet troposphere.

trop_generate_turbulence_phase_errors()[source]

Generates phase offsets/errors due to tropospheric turbulence and save to file.

Returns

None

Raises

Exception

If the turbulence phase errors cannot be generated for any reason.

trop_opacity_attenuate()[source]

Calculates attenuation due to tropospheric opacity and applies to data.

trop_phase_corrupt(normalise=True, percentage_turbulence=100, load=None)[source]

only supports different channels but not different subbands

trop_plots()[source]

Generate plots for tropospheric quantities.

trop_return_opacity_emissivity()[source]

Calculates and returns opacity and sky temperature using the external program AATM.

Returns

opacityndarray

The array containing the wet (and optionally, dry) components of the tropospheric opacity.

emissivityndarray

The array containing the emissivity returned by AATM.

write_flag(elevation_limit)[source]

flag data if below user-specified elevation limit

Create Measurement Set

meqsilhouette.framework.create_ms.compute_casa_offset(msname, input_fits, ms)[source]

fn to compute casa offset

meqsilhouette.framework.create_ms.convertdec(dec)[source]
meqsilhouette.framework.create_ms.convertra(RA)[source]

Convert RA from degrees to hours

meqsilhouette.framework.create_ms.create_ms(msname, input_fits, ms_dict)[source]

create empty MS

meqsilhouette.framework.create_ms.create_msv2(msname, input_fits, ms)[source]

main fn to create MS

meqsilhouette.framework.create_ms.genms(msname, input_fits, antenna_table, starttime, obslength_in_sec, RA, DEC, stokes, tint, nu, dnu, nchan, nscan, scan_lag, datacolumn)[source]

setup ms configuration

meqsilhouette.framework.create_ms.return_simms_string(msname, input_fits, RA, DEC, polproducts, antenna_table, obslength, dnu, tint, nu, StartTime, nchan, nscan, scan_lag, datacolumn, makeplots, correctCASAoffset)[source]

generate simms string to create an empty MS, however, what is first required is a small MS to be generated in order to determine spurious time offset that CASA inserts, and adjust SYMBA start time accordingly

MeqTrees helper functions

meqsilhouette.framework.meqtrees_funcs.copy_between_cols(dest_col, src_col)[source]
meqsilhouette.framework.meqtrees_funcs.make_dirty_image_lwimager(im_dict, ms_dict)[source]
meqsilhouette.framework.meqtrees_funcs.make_image_wsclean()[source]
meqsilhouette.framework.meqtrees_funcs.run_turbosim(input_fitsimage, output_column, taql_string)[source]
meqsilhouette.framework.meqtrees_funcs.run_wsclean(input_fitsimage, input_fitspol, input_changroups, startvis, endvis, oversampling)[source]

Process configuration file

meqsilhouette.framework.process_input_config.load_json_parameters_into_dictionary(config)[source]

Load JSON parameters from a file into a dictionary.

Parameters

configstr

The path to the JSON file.

Returns

paramsdict

A dictionary containing the loaded and refactored JSON parameters.

meqsilhouette.framework.process_input_config.params_refactoring(_params)[source]

Modify input dictionary (hack: be careful!!!).

Parameters

_paramsdict

The path to the JSON file.

Returns

_paramsdict

The updated dictionary.

meqsilhouette.framework.process_input_config.read_json_files(config)[source]

Load JSON parameters from a file into a dictionary.

Parameters

configstr

The path to the JSON file.

Returns

paramsdict

A dictionary containing the loaded JSON parameters.

meqsilhouette.framework.process_input_config.setup_keyword_dictionary(prefix, dictionary)[source]

Create a dictionary from a dictionary with keys that start with a given prefix.

Parameters

prefixstr

The prefix to use for filtering the keys.

dictionarydict

The dictionary to filter.

Returns

dict

The filtered dictionary.