Weighting functions
C/C++
-
void sdp_optimized_weighting(const sdp_Mem *uvw, const sdp_Mem *freqs, const sdp_Mem *vis, const sdp_Mem *weights, const double robust_param, const int grid_size, const int64_t support, sdp_Mem *sorted_uu, sdp_Mem *sorted_vv, sdp_Mem *sorted_weight, sdp_Mem *sorted_tile, sdp_Mem *tile_offsets, sdp_Mem *num_points_in_tiles, sdp_Mem *output_weights, sdp_Error *status)
Calculate the number of hits per UV cell and use the inverse of this as the weight, calculate the sum of these weights and the sum of these weights squared and with these sums, adjust the weight according to the robust parameter provided. This is done on each tile, for bucket sorted visibilities and weights.
Array dimensions are as follows, from slowest to fastest varying:
uvwis 3D and real-valued, with shape:[ num_times, num_baselines, 3 ]
freqsis 1D and real-valued, with shape:[ num_channels ]
visis 4D and complex-valued, with shape:[ num_times, num_baselines, num_channels, num_pols ]
weightsis 4D and real-valued, with shape:[ num_times, num_baselines, num_channels, num_pols ]
sorted_uuis 1D and real valued with shape:[ num_visibilities ]
sorted_vvis 1D and real valued with shape:[ num_visibilties ]
sorted_weightis 1D and real valued with shape:[ num_visiblities ]
sorted_tileis 1D and real valued with shape:[ num_visiblities ]
tile_offsetsis 1D and real-valued with shape:[ num_tiles + 1 ]
num_points_in_tilesis 1D and real-valued with shape:[ num_tiles ]
output_weightsis 1D and real-valued with shape:[ num_visibilities ]
- Parameters:
uvw – Baseline (u,v,w) coordinates, in metres. Dimensions as above.
freqs – Channel frequencies, in Hz. Dimensions as above.
vis – Complex-valued visibilities. Dimensions as above.
weights – Weights for each visibility, as available in the input data. Dimensions as above.
robust_param – Input parameter by the user to determine robustness of the weighting. Integer value between -2 and 2.
output_weights – Output of the function including the weights for each visibility. Dimensions as above.
grid_size – Size of the grid in one dimension. Assumed to be square.
num_visibilites – Number of total visibilities after prefix sum.
sorted_uu – Sorted u coordinates after bucket sort. Dimensions as above.
sorted_vv – Sorted v coordinates after bucket sort. Dimensions as above.
sorted_weight – Sorted weights after bucket sort. Dimensions as above.
sorted_tile – Sorted visibilities in tile positions after bucket sort. Dimensions as above.
tile_offsets – Prefix summed visibilities in each tile. Dimensions as above.
num_points_in_tiles – Number of visibilities in each tile. Dimensions as above.
output_weights – Returned weights by the function that are still sorted. Dimensions as above.
status – Error status.
-
void sdp_optimised_indexed_weighting(const sdp_Mem *uvw, const sdp_Mem *vis, const sdp_Mem *weights, const double robust_param, const int grid_size, const double cell_size_rad, const int64_t support, const int *num_visibilites, sdp_Mem *sorted_tile, sdp_Mem *sorted_uu, sdp_Mem *sorted_vv, sdp_Mem *sorted_vis_index, sdp_Mem *tile_offsets, sdp_Mem *num_points_in_tiles, sdp_Mem *output_weights, sdp_Error *status)
Calculate the number of hits per UV cell and use the inverse of this as the weight, calculate the sum of these weights and the sum of these weights squared and with these sums, adjust the weight according to the robust parameter provided. This is done on each tile, for visibilities and weights, through their sorted indices.
Array dimensions are as follows, from slowest to fastest varying:
uvwis 3D and real-valued, with shape:[ num_times, num_baselines, 3 ]
visis 4D and complex-valued, with shape:[ num_times, num_baselines, num_channels, num_pols ]
weightsis 4D and real-valued, with shape:[ num_times, num_baselines, num_channels, num_pols ]
sorted_uuis 1D and real valued with shape:[ num_visibilities ]
sorted_vvis 1D and real valued with shape:[ num_visibilties ]
sorted_vis_indexis 1D and real valued with shape:[ num_visiblities ]
sorted_tileis 1D and real valued with shape:[ num_visiblities ]
tile_offsetsis 1D and real-valued with shape:[ num_tiles + 1 ]
num_points_in_tilesis 1D and real-valued with shape:[ num_tiles ]
output_weightsis 1D and real-valued with shape:[ num_visibilities ]
- Parameters:
uvw – Baseline (u,v,w) coordinates, in metres. Dimensions as above.
vis – Complex-valued visibilities. Dimensions as above.
weights – Weights for each visibility, as available in the input data. Dimensions as above.
robust_param – Input parameter by the user to determine robustness of the weighting. Integer value between -2 and 2.
grid_size – Size of the grid in one dimension. Assumed to be square.
cell_size_rad – Size of the cell, in radians.
num_visibilites – Number of total visibilities after prefix sum.
sorted_tile – Sorted visibilities in tile positions after bucket sort. Dimensions as above.
sorted_uu – Sorted u coordinates after bucket sort. Dimensions as above.
sorted_vv – Sorted v coordinates after bucket sort. Dimensions as above.
sorted_vis_index – Sorted indices of the visibilities after bucket sort. Dimensions as above.
tile_offsets – Prefix summed visibilities in each tile. Dimensions as above.
num_points_in_tiles – Number of visibilities in each tile. Dimensions as above.
output_weights – Returned weights by the function that are still sorted. Dimensions as above.
status – Error status.
-
void sdp_weighting_briggs(const sdp_Mem *uvw, const sdp_Mem *freq_hz, double max_abs_uv, const double robust_param, sdp_Mem *weight_grid_uv, sdp_Mem *input_weights, sdp_Mem *output_weights, sdp_Error *status)
Calculate the number of hits per UV cell and use the inverse of this as the weight.
Array dimensions are as follows, from slowest to fastest varying:
uvwis 3D and real-valued, with shape:[ num_times, num_baselines, 3 ]
freq_hzis 1D and real-valued, with shape:[ num_channels ]
grid_uvis 2D and real-valued (should be zero-initialised), with shape:[ num_cells_v, num_cells_u ]
weightsis 4D and real-valued, with shape:[ num_times, num_baselines, num_channels, num_pols ]
- Parameters:
uvw – Baseline (u,v,w) coordinates, in metres. Dimensions as above.
freq_hz – Channel frequencies, in Hz. Dimensions as above.
max_abs_uv – Maximum absolute value of UV coordinates in wavelength units.
weight_grid_uv – Output number of hits per grid cell. Dimensions as above.
input_weights – Input weights for the visibilities. Dimensions as above.
output_weights – Output of the function including the weights for each grid cell. Dimensions as above.
weighting_type – Weighting type defined by the user for matching the uv function. Enum Type.
robust_param – Input parameter by the user to determine robustness of the weighting. Integer value between -2 and 2.
status – Error status.
Python
- ska_sdp_func.visibility.weighting.get_uv_range(uvw, freq_hz)
Calculate uv-range in wavelength units given UVW-coordinates and frequency array.
- Parameters:
uvw (numpy.ndarray) – List of UVW coordinates in metres, real-valued. Dimensions are [num_times, num_baselines, 3]
freq_hz (numpy.ndarray) – List of frequencies in Hz, real-valued. Dimension is [num_channels]
- Returns max_abs_uv:
Maximum absolute value of UV coordinates in wavelength units, real-valued
- ska_sdp_func.visibility.weighting.uniform_weights(uvw, freq_hz, max_abs_uv, grid_uv, input_weights, output_weights)
Calculate the number of hits per UV cell and use the inverse of this as the weight.
- Parameters:
uvw (numpy.ndarray) – List of UVW coordinates in metres, real-valued. Dimensions are [num_times, num_baselines, 3]
freq_hz (numpy.ndarray) – List of frequencies in Hz, real-valued. Dimension is [num_channels]
max_abs_uv (float) – Maximum absolute value of UV coordinates in wavelength units, real-valued.
grid_uv (numpy.ndarray) – A initially zero-valued 2D UV grid array. Returns the number of hits per UV cell.
weights (numpy.ndarray) – A real-valued 4D array, returns the weights. Dimensions are [num_times, num_baselines, num_channels, num_pols]