source_components_common

API documentation for source_components_common.c

Functions

void source_component_common(woden_settings_t *woden_settings, beam_settings_t *beam_settings, double *cpu_freqs, double *mem_freqs, source_t *chunked_source, source_t *mem_chunked_source, beam_gains_t *mem_component_beam_gains, e_component_type comptype, visibility_set_t *mem_visibility_set)

Performs necessary calculations that are common to all POINT, GAUSSIAN, and SHAPELET component types: calculating the lmn coordinates; extrapolating flux densities to given frequencies; calculating primary beam values.

This function either calls the CPU or GPU version of the functions, depending on the value of woden_settings->do_gpu. The mem_ prefix indicates that the variable should be allocated on the GPU if do_gpu is set to 1. Otherwise, it should be allocated on the CPU.

If woden_settings->do_autos is 1, the function will calculate the auto-correlations

Parameters:
  • woden_settings – Pointer to the WODEN settings structure.

  • beam_settings – Pointer to the beam settings structure.

  • cpu_freqs – Pointer to the array of CPU frequencies.

  • mem_freqs – Pointer to the array of memory frequencies.

  • chunked_source – Pointer to the chunked source structure.

  • mem_chunked_source – Pointer to the memory chunked source structure.

  • mem_component_beam_gains – Pointer to the memory component beam gains structure.

  • comptype – The type of component being processed.

  • mem_visibility_set – Pointer to the memory visibility set structure.

void extrapolate_Stokes(source_t *mem_chunked_source, double *mem_extrap_freqs, int num_extrap_freqs, e_component_type comptype, int do_gpu)

Extrapolates Stokes IQUV parameters for a given comptype to a requested set of frequencies mem_extrap_freqs for a given populated mem_chunked_source. This function will extrapolate all available SED model for the source.

This function performs extrapolation of Stokes parameters for a given source over a specified number of frequencies. The extrapolation can be performed either on the CPU or GPU depending on the value of the do_gpu parameter.

Parameters:
  • mem_chunked_source – Pointer to the source data structure.

  • mem_extrap_freqs – Pointer to an array of frequencies for extrapolation.

  • num_extrap_freqs – Number of frequencies for extrapolation.

  • comptype – The type of component for which the extrapolation is performed (POINT, GAUSSIAN, or SHAPELET)

  • do_gpu – Flag indicating whether to perform the extrapolation on the GPU (1) or CPU (0).

void fill_ant_to_baseline_mapping_cpu(int num_ants, int *ant1_to_baseline_map, int *ant2_to_baseline_map)

Fill the ant1_to_baseline_map and ant2_to_baseline_map arrays with indexes corresponding to ant1 and ant2 for all unique baselines in an array of num_ants antennas.

The ant1_to_baseline_map and ant2_to_baseline_map should already have their memory allocated

Parameters:
  • num_ants[in] Number of antennas in the array

  • *ant1_to_baseline_map[inout] Memory-allocated array of size ((num_ants - 1)*num_ants) / 2

  • *ant2_to_baseline_map[inout] Memory-allocated array of size ((num_ants - 1)*num_ants) / 2

void malloc_extrapolated_flux_arrays_gpu(components_t *d_components, int num_comps, int num_freqs)

External GPU code linked in from source_components_gpu.cpp, see source_components_gpu.h for full details.

void extrap_power_laws_stokesI_gpu(components_t d_components, int n_powers, double *d_extrap_freqs, int num_extrap_freqs)

External GPU code linked in from source_components_gpu.cpp, see source_components_gpu.h for full details.

void extrap_curved_power_laws_stokesI_gpu(components_t d_components, int n_curves, double *d_extrap_freqs, int num_extrap_freqs)

External GPU code linked in from source_components_gpu.cpp, see source_components_gpu.h for full details.

void extrap_list_fluxes_stokesI_gpu(components_t d_components, int n_lists, double *d_extrap_freqs, int num_extrap_freqs)

External GPU code linked in from source_components_gpu.cpp, see source_components_gpu.h for full details.

void extrap_power_laws_stokesV_gpu(components_t d_components, double *d_extrap_freqs, int num_extrap_freqs)

External GPU code linked in from source_components_gpu.cpp, see source_components_gpu.h for full details.

void extrap_curved_power_laws_stokesV_gpu(components_t d_components, double *d_extrap_freqs, int num_extrap_freqs)

External GPU code linked in from source_components_gpu.cpp, see source_components_gpu.h for full details.

void polarisation_fraction_stokesV_gpu(components_t d_components, double *d_extrap_freqs, int num_extrap_freqs)

External GPU code linked in from source_components_gpu.cpp, see source_components_gpu.h for full details.

void extrap_list_fluxes_stokesV_gpu(components_t d_components, double *d_extrap_freqs, int num_extrap_freqs)

External GPU code linked in from source_components_gpu.cpp, see source_components_gpu.h for full details.

void extrap_power_laws_linpol_gpu(components_t d_components, double *d_extrap_freqs, int num_extrap_freqs)

External GPU code linked in from source_components_gpu.cpp, see source_components_gpu.h for full details.

void extrap_curved_power_laws_linpol_gpu(components_t d_components, double *d_extrap_freqs, int num_extrap_freqs)

External GPU code linked in from source_components_gpu.cpp, see source_components_gpu.h for full details.

void polarisation_fraction_linpol_gpu(components_t d_components, double *d_extrap_freqs, int num_extrap_freqs)

External GPU code linked in from source_components_gpu.cpp, see source_components_gpu.h for full details.

void extrap_list_fluxes_linpol_gpu(components_t d_components, double *d_extrap_freqs, int num_extrap_freqs)

External GPU code linked in from source_components_gpu.cpp, see source_components_gpu.h for full details.

void extrap_p_list_fluxes_linpol_gpu(components_t d_components, double *d_extrap_freqs, int num_extrap_freqs)

External GPU code linked in from source_components_gpu.cpp, see source_components_gpu.h for full details.

void apply_rotation_measure_gpu(components_t d_components, double *d_extrap_freqs, int num_extrap_freqs)

External GPU code linked in from source_components_gpu.cpp, see source_components_gpu.h for full details.

void malloc_beam_gains_gpu(beam_gains_t *d_component_beam_gains, int beamtype, int num_gains)

External GPU code linked in from source_components_gpu.cpp, see source_components_gpu.h for full details.

void calc_autos_gpu(components_t *d_components, beam_settings_t *beam_settings, beam_gains_t *d_component_beam_gains, visibility_set_t *d_visibility_set, woden_settings_t *woden_settings, int num_components, int use_twobeams)

External GPU code linked in from source_components_gpu.cpp, see source_components_gpu.h for full details.

void copy_CPU_component_gains_to_GPU_beam_gains(components_t *components, beam_gains_t *d_beam_gains, int num_gains)

External GPU code linked in from source_components_gpu.cpp, see source_components_gpu.h for full details.

void copy_CPU_beam_gains_to_GPU_beam_gains(beam_gains_t *beam_gains, beam_gains_t *d_beam_gains, int num_gains)

External GPU code linked in from source_components_gpu.cpp, see source_components_gpu.h for full details.

void calc_lmn_for_components_gpu(components_t *d_components, int num_components, woden_settings_t *woden_settings)

Calculates the \(l,m,n\) image coords for an intialised d_components struct. Assumes d_components->ras, d_components->decs have been allocated and set on the device.

External GPU code linked in from fundamental_coods_gpu.cpp, see fundamental_coods_gpu.h for full details.

Runs kern_calc_lmn using d_components->ras, d_components->decs and woden_settings->ra0, woden_settings->sdec0, woden_settings->cdec0 as inputs. This function allocates device memory for d_components->ls, d_components->ms, and d_components->ns, and puts the results in these arrays.

Parameters:
  • d_components[inout] Initialised components_t struct containing the ra and dec arrays

  • num_components[in] Number of RA,Dec coords in d_components

  • woden_settings[in] Woden settings struct containing the phase centre

void wrapper_calculate_gaussian_beam_gpu(int num_components, user_precision_t cos_theta, user_precision_t sin_theta, user_precision_t sin_2theta, user_precision_t fwhm_lm, woden_settings_t *woden_settings, beam_settings_t *beam_settings, components_t *components, beam_gains_t *d_component_beam_gains, double *d_freqs)

Wrapper function to call the Gaussian beam on the GPU from C. Calls calculate_gaussian_beam_gpu; see that function for more details.

External GPU code linked in from primary_beam_gpu.cpp, see primary_beam_gpu.h for full details.

Need a wrapper here as the GPU function has GPU types in the argument, so can’t be linked to directly from the CPU.

Parameters:
  • num_components – The number of components to process.

  • cos_theta – Cosine of the rotation angle

  • sin_theta – Sine of the rotation angle

  • sin_2theta – Sine of two times the rotation angle

  • fwhm_lm – FWHM of the beam in \(l,m\) coords

  • woden_settings – Pointer to the WODEN settings structure.

  • beam_settings – Pointer to the beam settings structure.

  • components – Pointer to the components structure.

  • d_component_beam_gains – Pointer to the device memory for component beam gains.

  • d_freqs – Pointer to the device memory array for frequencies.

void wrapper_calculate_analytic_dipole_beam_gpu(int num_components, components_t *components, beam_gains_t *d_component_beam_gains, double *d_freqs, woden_settings_t *woden_settings)

Wrapper to call the analytic dipole beam on the GPU from C. Calls calculate_analytic_dipole_beam_gpu; see that function for more details.

External GPU code linked in from primary_beam_gpu.cpp, see primary_beam_gpu.h for full details.

Need a wrapper here as the GPU function has GPU types in the argument, so can’t be linked to directly from the CPU.

Parameters:
  • num_components – The number of components to process.

  • components – Pointer to the components structure.

  • d_component_beam_gains – Pointer to the device memory beam gains struct.

  • d_freqs – Pointer to the device memory array for frequencies.

  • woden_settings – Pointer to the settings structure for WODEN.

void wrapper_run_hyperbeam_gpu(int num_components, beam_settings_t *beam_settings, int num_beams, int parallactic, double *reordered_azs, double *reordered_zas, beam_gains_t *d_component_beam_gains, double *d_freqs, woden_settings_t *woden_settings)

Wrapper function to run the Hyperbeam GPU computation from C. Calls run_hyperbeam_gpu; see that function for more details.

External GPU code linked in from primary_beam_gpu.cpp, see primary_beam_gpu.h for full details.

Need a wrapper here as the GPU function has GPU types in the argument, so can’t be linked to directly from the CPU.

Parameters:
  • num_components – The number of components to process.

  • beam_settings – Pointer to the beam settings structure.

  • num_beams – The number of beams to process.

  • parallactic – Flag indicating whether to use parallactic angle correction.

  • reordered_azs – Pointer to the array of reordered azimuth values; they should be ordered by time index, then component index (other WODEN beam functions expect component index, then time index).

  • reordered_zas – Pointer to the array of reordered zenith angle values; they should be ordered by time index, then component index (other WODEN beam functions expect component index, then time index).

  • d_component_beam_gains – Pointer to the device memory component beam gains struct

  • d_freqs – Pointer to the device memeory array of frequencies.

  • woden_settings – Pointer to the Woden settings structure.

void wrapper_calculate_RTS_MWA_analytic_beam_gpu(int num_components, components_t *components, int norm, beam_gains_t *d_component_beam_gains, double *d_freqs, woden_settings_t *woden_settings)

Wrapper function to calculate the RTS MWA analytic beam on the GPU from C.

External GPU code linked in from primary_beam_gpu.cpp, see primary_beam_gpu.h for full details.

Need a wrapper here as the GPU function has GPU types in the argument, so can’t be linked to directly from the CPU.

Parameters:
  • num_components – The number of components to process.

  • components – Pointer to an array of components to be processed.

  • norm – Normalisation flag (1 to normalise, 0 otherwise).

  • d_component_beam_gains – Pointer to the device memory where the beam gains for each component will be stored.

  • d_freqs – Pointer to the device memory array containing the frequencies.

  • woden_settings – Pointer to the settings structure for WODEN.