Wgridder

ducc0.wgridder

ducc0.wgridder.dirty2ms(uvw: numpy.ndarray, freq: numpy.ndarray, dirty: numpy.ndarray, wgt: object = None, pixsize_x: float, pixsize_y: float, nu: int = 0, nv: int = 0, epsilon: float, do_wstacking: bool = False, nthreads: int = 1, verbosity: int = 0, mask: object = None, gpu: bool = False) numpy.ndarray

Converts a dirty image to an MS object.

Parameters:
  • uvw (numpy.ndarray((nrows, 3), dtype=numpy.float64)) – UVW coordinates from the measurement set

  • freq (numpy.ndarray((nchan,), dtype=numpy.float64)) – channel frequencies

  • dirty (numpy.ndarray((npix_x, npix_y), dtype=numpy.float32 or numpy.float64)) – dirty image Its data type determines the precision in which the calculation is carried out. Both dimensions must be even and at least 32.

  • wgt (numpy.ndarray((nrows, nchan), same dtype as dirty), optional) – If present, its values are multiplied to the output

  • pixsize_x (float) – angular pixel size (in projected radians) of the dirty image

  • pixsize_y (float) – angular pixel size (in projected radians) of the dirty image

  • nu (int) – obsolete, ignored

  • nv (int) – obsolete, ignored

  • epsilon (float) – accuracy at which the computation should be done. Must be larger than 2e-13. If dirty has type numpy.float32, it must be larger than 1e-5.

  • do_wstacking (bool) – if True, the full w-gridding algorithm is carried out, otherwise the w values are assumed to be zero.

  • nthreads (int) – number of threads to use for the calculation

  • verbosity (int) – 0: no output 1: some output

  • mask (numpy.ndarray((nrows, nchan), dtype=numpy.uint8), optional) – If present, only visibilities are processed for which mask!=0

Returns:

the measurement set data.

Return type:

numpy.ndarray((nrows, nchan), dtype=complex of same precision as dirty)

Notes

The input arrays should be contiguous and in C memory order. Other strides will work, but can degrade performance significantly.

ducc0.wgridder.dirty2vis(*, uvw: numpy.ndarray, freq: numpy.ndarray, dirty: numpy.ndarray, wgt: object = None, pixsize_x: float, pixsize_y: float, epsilon: float, do_wgridding: bool = False, nthreads: int = 1, verbosity: int = 0, mask: object = None, flip_v: bool = False, divide_by_n: bool = True, vis: object = None, sigma_min: float = 1.1, sigma_max: float = 2.6, center_x: float = 0.0, center_y: float = 0.0, allow_nshift: bool = True, gpu: bool = False) numpy.ndarray

Converts a dirty image to visibilities.

Parameters:
  • uvw (numpy.ndarray((nrows, 3), dtype=numpy.float64)) – UVW coordinates from the measurement set

  • freq (numpy.ndarray((nchan,), dtype=numpy.float64)) – channel frequencies

  • dirty (numpy.ndarray((npix_x, npix_y), dtype=numpy.float32 or numpy.float64)) – dirty image Its data type determines the precision in which the calculation is carried out. Both dimensions must be even and at least 32.

  • wgt (numpy.ndarray((nrows, nchan), same dtype as dirty), optional) – If present, its values are multiplied to the output

  • mask (numpy.ndarray((nrows, nchan), dtype=numpy.uint8), optional) – If present, only visibilities are processed for which mask!=0

  • pixsize_x (float) – angular pixel size (in projected radians) of the dirty image

  • pixsize_y (float) – angular pixel size (in projected radians) of the dirty image

  • center_x (float) – center of the dirty image relative to the phase center (in projected radians)

  • center_y (float) – center of the dirty image relative to the phase center (in projected radians)

  • epsilon (float) – accuracy at which the computation should be done. Must be larger than 2e-13. If dirty has type numpy.float32, it must be larger than 1e-5.

  • do_wgridding (bool) – if True, the full w-gridding algorithm is carried out, otherwise the w values are assumed to be zero.

  • flip_v (bool) – if True, all v coordinates in uvw are multiplied by -1

  • divide_by_n (bool) – if True, the dirty image pixels are divided by n

  • sigma_min (float) – minimum and maximum allowed oversampling factors

  • sigma_max (float) – minimum and maximum allowed oversampling factors

  • nthreads (int) – number of threads to use for the calculation

  • verbosity (int) – 0: no output 1: some diagnostic output and timings

  • vis (numpy.ndarray((nrows, nchan), dtype=complex of same precision as dirty),) – optional If provided, the computed visibilities will be stored in this array, and a handle to it will be returned.

Returns:

the computed visibilities.

Return type:

numpy.ndarray((nrows, nchan), dtype=complex of same precision as dirty)

Notes

The input arrays should be contiguous and in C memory order. Other strides will work, but can degrade performance significantly.

ducc0.wgridder.ms2dirty(uvw: numpy.ndarray, freq: numpy.ndarray, ms: numpy.ndarray, wgt: object = None, npix_x: int, npix_y: int, pixsize_x: float, pixsize_y: float, nu: int = 0, nv: int = 0, epsilon: float, do_wstacking: bool = False, nthreads: int = 1, verbosity: int = 0, mask: object = None, double_precision_accumulation: bool = False, gpu: bool = False) numpy.ndarray

Converts an MS object to dirty image.

Parameters:
  • uvw (numpy.ndarray((nrows, 3), dtype=numpy.float64)) – UVW coordinates from the measurement set

  • freq (numpy.ndarray((nchan,), dtype=numpy.float64)) – channel frequencies

  • ms (numpy.ndarray((nrows, nchan), dtype=numpy.complex64 or numpy.complex128)) – the input measurement set data. Its data type determines the precision in which the calculation is carried out.

  • wgt (numpy.ndarray((nrows, nchan), float with same precision as ms), optional) – If present, its values are multiplied to the input before gridding

  • npix_x (int) – dimensions of the dirty image (must both be even and at least 32)

  • npix_y (int) – dimensions of the dirty image (must both be even and at least 32)

  • pixsize_x (float) – angular pixel size (in projected radians) of the dirty image

  • pixsize_y (float) – angular pixel size (in projected radians) of the dirty image

  • nu (int) – obsolete, ignored

  • nv (int) – obsolete, ignored

  • epsilon (float) – accuracy at which the computation should be done. Must be larger than 2e-13. If ms has type numpy.complex64, it must be larger than 1e-5.

  • do_wstacking (bool) – if True, the full w-gridding algorithm is carried out, otherwise the w values are assumed to be zero.

  • nthreads (int) – number of threads to use for the calculation

  • verbosity (int) – 0: no output 1: some output

  • mask (numpy.ndarray((nrows, nchan), dtype=numpy.uint8), optional) – If present, only visibilities are processed for which mask!=0

  • double_precision_accumulation (bool) – If True, always use double precision for accumulating operations onto the uv grid. This is necessary to reduce numerical errors in special cases.

Returns:

the dirty image

Return type:

numpy.ndarray((npix_x, npix_y), dtype=float of same precision as ms)

Notes

The input arrays should be contiguous and in C memory order. Other strides will work, but can degrade performance significantly.

ducc0.wgridder.vis2dirty(*, uvw: numpy.ndarray, freq: numpy.ndarray, vis: numpy.ndarray, wgt: object = None, npix_x: int = 0, npix_y: int = 0, pixsize_x: float, pixsize_y: float, epsilon: float, do_wgridding: bool = False, nthreads: int = 1, verbosity: int = 0, mask: object = None, flip_v: bool = False, divide_by_n: bool = True, dirty: object = None, sigma_min: float = 1.1, sigma_max: float = 2.6, center_x: float = 0.0, center_y: float = 0.0, allow_nshift: bool = True, gpu: bool = False, double_precision_accumulation: bool = False) numpy.ndarray

Converts visibilities to a dirty image.

Parameters:
  • uvw (numpy.ndarray((nrows, 3), dtype=numpy.float64)) – UVW coordinates from the measurement set

  • freq (numpy.ndarray((nchan,), dtype=numpy.float64)) – channel frequencies

  • vis (numpy.ndarray((nrows, nchan), dtype=numpy.complex64 or numpy.complex128)) – the input visibilities. Its data type determines the precision in which the calculation is carried out.

  • wgt (numpy.ndarray((nrows, nchan), float with same precision as vis), optional) – If present, its values are multiplied to the input before gridding

  • mask (numpy.ndarray((nrows, nchan), dtype=numpy.uint8), optional) – If present, only visibilities are processed for which mask!=0

  • npix_x (int) – dimensions of the dirty image (must both be even and at least 32) If the dirty argument is provided, image dimensions will be inferred from the passed array; in this case npix_x and npix_y must be either consistent with these dimensions, or be zero.

  • npix_y (int) – dimensions of the dirty image (must both be even and at least 32) If the dirty argument is provided, image dimensions will be inferred from the passed array; in this case npix_x and npix_y must be either consistent with these dimensions, or be zero.

  • pixsize_x (float) – angular pixel size (in projected radians) of the dirty image

  • pixsize_y (float) – angular pixel size (in projected radians) of the dirty image

  • center_x (float) – center of the dirty image relative to the phase center (in projected radians)

  • center_y (float) – center of the dirty image relative to the phase center (in projected radians)

  • epsilon (float) – accuracy at which the computation should be done. Must be larger than 2e-13. If vis has type numpy.complex64, it must be larger than 1e-5.

  • do_wgridding (bool) – if True, the full w-gridding algorithm is carried out, otherwise the w values are assumed to be zero.

  • flip_v (bool) – if True, all v coordinates in uvw are multiplied by -1

  • divide_by_n (bool) – if True, the dirty image pixels are divided by n

  • sigma_min (float) – minimum and maximum allowed oversampling factors

  • sigma_max (float) – minimum and maximum allowed oversampling factors

  • nthreads (int) – number of threads to use for the calculation

  • verbosity (int) – 0: no output 1: some diagnostic output and timings

  • dirty (numpy.ndarray((npix_x, npix_y), dtype=float of same precision as vis),) – optional If provided, the dirty image will be written to this array and a handle to it will be returned.

  • double_precision_accumulation (bool) – If True, always use double precision for accumulating operations onto the uv grid. This is necessary to reduce numerical errors in special cases.

Returns:

the dirty image

Return type:

numpy.ndarray((npix_x, npix_y), dtype=float of same precision as vis)

Notes

The input arrays should be contiguous and in C memory order. Other strides will work, but can degrade performance significantly.

ducc0.wgridder.experimental

Experimental, more powerful interface to the gridding code

Notes

The functionality in this module is not considered to have a stable interface and also may be moved to other modules in the future. If you use it, be prepared to adjust your code at some point ion the future!

ducc0.wgridder.experimental.dirty2vis(*, uvw: numpy.ndarray, freq: numpy.ndarray, dirty: numpy.ndarray, wgt: object = None, pixsize_x: float, pixsize_y: float, epsilon: float, do_wgridding: bool = False, nthreads: int = 1, verbosity: int = 0, mask: object = None, flip_v: bool = False, divide_by_n: bool = True, vis: object = None, sigma_min: float = 1.1, sigma_max: float = 2.6, center_x: float = 0.0, center_y: float = 0.0, allow_nshift: bool = True, gpu: bool = False) numpy.ndarray

Converts a dirty image to visibilities.

Parameters:
  • uvw (numpy.ndarray((nrows, 3), dtype=numpy.float64)) – UVW coordinates from the measurement set

  • freq (numpy.ndarray((nchan,), dtype=numpy.float64)) – channel frequencies

  • dirty (numpy.ndarray((npix_x, npix_y), dtype=numpy.float32 or numpy.float64)) – dirty image Its data type determines the precision in which the calculation is carried out. Both dimensions must be even and at least 32.

  • wgt (numpy.ndarray((nrows, nchan), same dtype as dirty), optional) – If present, its values are multiplied to the output

  • mask (numpy.ndarray((nrows, nchan), dtype=numpy.uint8), optional) – If present, only visibilities are processed for which mask!=0

  • pixsize_x (float) – angular pixel size (in projected radians) of the dirty image

  • pixsize_y (float) – angular pixel size (in projected radians) of the dirty image

  • center_x (float) – center of the dirty image relative to the phase center (in projected radians)

  • center_y (float) – center of the dirty image relative to the phase center (in projected radians)

  • epsilon (float) – accuracy at which the computation should be done. Must be larger than 2e-13. If dirty has type numpy.float32, it must be larger than 1e-5.

  • do_wgridding (bool) – if True, the full w-gridding algorithm is carried out, otherwise the w values are assumed to be zero.

  • flip_v (bool) – if True, all v coordinates in uvw are multiplied by -1

  • divide_by_n (bool) – if True, the dirty image pixels are divided by n

  • sigma_min (float) – minimum and maximum allowed oversampling factors

  • sigma_max (float) – minimum and maximum allowed oversampling factors

  • nthreads (int) – number of threads to use for the calculation

  • verbosity (int) – 0: no output 1: some diagnostic output and timings

  • vis (numpy.ndarray((nrows, nchan), dtype=complex of same precision as dirty),) – optional If provided, the computed visibilities will be stored in this array, and a handle to it will be returned.

Returns:

the computed visibilities.

Return type:

numpy.ndarray((nrows, nchan), dtype=complex of same precision as dirty)

Notes

The input arrays should be contiguous and in C memory order. Other strides will work, but can degrade performance significantly.

ducc0.wgridder.experimental.dirty2vis_tuning(*, uvw: numpy.ndarray, freq: numpy.ndarray, dirty: numpy.ndarray, wgt: object = None, pixsize_x: float, pixsize_y: float, epsilon: float, do_wgridding: bool = False, nthreads: int = 1, verbosity: int = 0, mask: object = None, flip_v: bool = False, divide_by_n: bool = True, vis: object = None, sigma_min: float = 1.1, sigma_max: float = 2.6, center_x: float = 0.0, center_y: float = 0.0) numpy.ndarray

Converts a dirty image to visibilities.

This implementation tries to subdivide the operation into smaller tasks to optimize performance.

Parameters:
  • uvw (numpy.ndarray((nrows, 3), dtype=numpy.float64)) – UVW coordinates from the measurement set

  • freq (numpy.ndarray((nchan,), dtype=numpy.float64)) – channel frequencies

  • dirty (numpy.ndarray((npix_x, npix_y), dtype=numpy.float32 or numpy.float64)) – dirty image Its data type determines the precision in which the calculation is carried out. Both dimensions must be least 32.

  • wgt (numpy.ndarray((nrows, nchan), same dtype as dirty), optional) – If present, its values are multiplied to the output

  • mask (numpy.ndarray((nrows, nchan), dtype=numpy.uint8), optional) – If present, only visibilities are processed for which mask!=0

  • pixsize_x (float) – angular pixel size (in projected radians) of the dirty image

  • pixsize_y (float) – angular pixel size (in projected radians) of the dirty image

  • center_x (float) – center of the dirty image relative to the phase center (in projected radians)

  • center_y (float) – center of the dirty image relative to the phase center (in projected radians)

  • epsilon (float) – accuracy at which the computation should be done. Must be larger than 2e-13. If dirty has type numpy.float32, it must be larger than 1e-5.

  • do_wgridding (bool) – if True, the full w-gridding algorithm is carried out, otherwise the w values are assumed to be zero.

  • flip_v (bool) – if True, all v coordinates in uvw are multiplied by -1

  • divide_by_n (bool) – if True, the dirty image pixels are divided by n

  • sigma_min (float) – minimum and maximum allowed oversampling factors

  • sigma_max (float) – minimum and maximum allowed oversampling factors

  • nthreads (int) – number of threads to use for the calculation

  • verbosity (int) – 0: no output 1: some diagnostic output and timings

  • vis (numpy.ndarray((nrows, nchan), dtype=complex of same precision as dirty),) – optional If provided, the computed visibilities will be stored in this array, and a handle to it will be returned.

Returns:

the computed visibilities.

Return type:

numpy.ndarray((nrows, nchan), dtype=complex of same precision as dirty)

Notes

The input arrays should be contiguous and in C memory order. Other strides will work, but can degrade performance significantly.

ducc0.wgridder.experimental.sycl_active() bool
ducc0.wgridder.experimental.vis2dirty(*, uvw: numpy.ndarray, freq: numpy.ndarray, vis: numpy.ndarray, wgt: object = None, npix_x: int = 0, npix_y: int = 0, pixsize_x: float, pixsize_y: float, epsilon: float, do_wgridding: bool = False, nthreads: int = 1, verbosity: int = 0, mask: object = None, flip_v: bool = False, divide_by_n: bool = True, dirty: object = None, sigma_min: float = 1.1, sigma_max: float = 2.6, center_x: float = 0.0, center_y: float = 0.0, allow_nshift: bool = True, gpu: bool = False, double_precision_accumulation: bool = False) numpy.ndarray

Converts visibilities to a dirty image.

Parameters:
  • uvw (numpy.ndarray((nrows, 3), dtype=numpy.float64)) – UVW coordinates from the measurement set

  • freq (numpy.ndarray((nchan,), dtype=numpy.float64)) – channel frequencies

  • vis (numpy.ndarray((nrows, nchan), dtype=numpy.complex64 or numpy.complex128)) – the input visibilities. Its data type determines the precision in which the calculation is carried out.

  • wgt (numpy.ndarray((nrows, nchan), float with same precision as vis), optional) – If present, its values are multiplied to the input before gridding

  • mask (numpy.ndarray((nrows, nchan), dtype=numpy.uint8), optional) – If present, only visibilities are processed for which mask!=0

  • npix_x (int) – dimensions of the dirty image (must both be even and at least 32) If the dirty argument is provided, image dimensions will be inferred from the passed array; in this case npix_x and npix_y must be either consistent with these dimensions, or be zero.

  • npix_y (int) – dimensions of the dirty image (must both be even and at least 32) If the dirty argument is provided, image dimensions will be inferred from the passed array; in this case npix_x and npix_y must be either consistent with these dimensions, or be zero.

  • pixsize_x (float) – angular pixel size (in projected radians) of the dirty image

  • pixsize_y (float) – angular pixel size (in projected radians) of the dirty image

  • center_x (float) – center of the dirty image relative to the phase center (in projected radians)

  • center_y (float) – center of the dirty image relative to the phase center (in projected radians)

  • epsilon (float) – accuracy at which the computation should be done. Must be larger than 2e-13. If vis has type numpy.complex64, it must be larger than 1e-5.

  • do_wgridding (bool) – if True, the full w-gridding algorithm is carried out, otherwise the w values are assumed to be zero.

  • flip_v (bool) – if True, all v coordinates in uvw are multiplied by -1

  • divide_by_n (bool) – if True, the dirty image pixels are divided by n

  • sigma_min (float) – minimum and maximum allowed oversampling factors

  • sigma_max (float) – minimum and maximum allowed oversampling factors

  • nthreads (int) – number of threads to use for the calculation

  • verbosity (int) – 0: no output 1: some diagnostic output and timings

  • dirty (numpy.ndarray((npix_x, npix_y), dtype=float of same precision as vis),) – optional If provided, the dirty image will be written to this array and a handle to it will be returned.

  • double_precision_accumulation (bool) – If True, always use double precision for accumulating operations onto the uv grid. This is necessary to reduce numerical errors in special cases.

Returns:

the dirty image

Return type:

numpy.ndarray((npix_x, npix_y), dtype=float of same precision as vis)

Notes

The input arrays should be contiguous and in C memory order. Other strides will work, but can degrade performance significantly.

ducc0.wgridder.experimental.vis2dirty_tuning(*, uvw: numpy.ndarray, freq: numpy.ndarray, vis: numpy.ndarray, wgt: object = None, npix_x: int = 0, npix_y: int = 0, pixsize_x: float, pixsize_y: float, epsilon: float, do_wgridding: bool = False, nthreads: int = 1, verbosity: int = 0, mask: object = None, flip_v: bool = False, divide_by_n: bool = True, dirty: object = None, sigma_min: float = 1.1, sigma_max: float = 2.6, center_x: float = 0.0, center_y: float = 0.0, double_precision_accumulation: bool = False) numpy.ndarray

Converts visibilities to a dirty image.

This implementation tries to subdivide the operation into smaller tasks to optimize performance.

Parameters:
  • uvw (numpy.ndarray((nrows, 3), dtype=numpy.float64)) – UVW coordinates from the measurement set

  • freq (numpy.ndarray((nchan,), dtype=numpy.float64)) – channel frequencies

  • vis (numpy.ndarray((nrows, nchan), dtype=numpy.complex64 or numpy.complex128)) – the input visibilities. Its data type determines the precision in which the calculation is carried out.

  • wgt (numpy.ndarray((nrows, nchan), float with same precision as vis), optional) – If present, its values are multiplied to the input before gridding

  • mask (numpy.ndarray((nrows, nchan), dtype=numpy.uint8), optional) – If present, only visibilities are processed for which mask!=0

  • npix_x (int) – dimensions of the dirty image (must both be at least 32) If the dirty argument is provided, image dimensions will be inferred from the passed array; in this case npix_x and npix_y must be either consistent with these dimensions, or be zero.

  • npix_y (int) – dimensions of the dirty image (must both be at least 32) If the dirty argument is provided, image dimensions will be inferred from the passed array; in this case npix_x and npix_y must be either consistent with these dimensions, or be zero.

  • pixsize_x (float) – angular pixel size (in projected radians) of the dirty image

  • pixsize_y (float) – angular pixel size (in projected radians) of the dirty image

  • center_x (float) – center of the dirty image relative to the phase center (in projected radians)

  • center_y (float) – center of the dirty image relative to the phase center (in projected radians)

  • epsilon (float) – accuracy at which the computation should be done. Must be larger than 2e-13. If vis has type numpy.complex64, it must be larger than 1e-5.

  • do_wgridding (bool) – if True, the full w-gridding algorithm is carried out, otherwise the w values are assumed to be zero.

  • flip_v (bool) – if True, all v coordinates in uvw are multiplied by -1

  • divide_by_n (bool) – if True, the dirty image pixels are divided by n

  • sigma_min (float) – minimum and maximum allowed oversampling factors

  • sigma_max (float) – minimum and maximum allowed oversampling factors

  • nthreads (int) – number of threads to use for the calculation

  • verbosity (int) – 0: no output 1: some diagnostic output and timings

  • dirty (numpy.ndarray((npix_x, npix_y), dtype=float of same precision as vis),) – optional If provided, the dirty image will be written to this array and a handle to it will be returned.

  • double_precision_accumulation (bool) – If True, always use double precision for accumulating operations onto the uv grid. This is necessary to reduce numerical errors in special cases.

Returns:

the dirty image

Return type:

numpy.ndarray((npix_x, npix_y), dtype=float of same precision as vis)

Notes

The input arrays should be contiguous and in C memory order. Other strides will work, but can degrade performance significantly.