matvis.wrapper.simulate_vis¶
- matvis.wrapper.simulate_vis(ants: dict[int, ndarray], fluxes: ndarray, ra: ndarray, dec: ndarray, freqs: ndarray, times: Time, beams: list[AnalyticBeam | UVBeam | BeamInterface], telescope_loc: EarthLocation, polarized: bool = False, precision: Literal[1, 2] = 1, use_feed: Literal['x', 'y'] = 'x', use_gpu: bool = False, beam_spline_opts: dict | None = None, beam_idx: ndarray | None = None, antpairs: ndarray | list[tuple[int, int]] | None = None, source_buffer: float = 1.0, coord_method: Literal['CoordinateRotationAstropy', 'CoordinateRotationERFA', 'GPUCoordinateRotationERFA'] = 'CoordinateRotationAstropy', coord_method_params: dict | None = None, matprod_method: Literal['MatMul', 'VectorLoop', 'CPUMatMul', 'GPUMatMul', 'CPUVectorLoop', 'GPUVectorLoop'] = 'MatMul', **backend_kwargs)[source]¶
Run a basic simulation using
matvis.This wrapper handles the necessary coordinate conversions etc.
- Parameters:
ants (dict) – Dictionary of antenna positions. The keys are the antenna names (integers) and the values are the Cartesian x,y,z positions of the antennas (in meters) relative to the array center.
fluxes (array_like) – 2D array with the flux of each source as a function of frequency, of shape (NSRCS, NFREQS).
ra (array_like) – Arrays of source RA and Dec positions in radians. RA goes from [0, 2 pi] and Dec from [-pi/2, +pi/2].
dec (array_like) – Arrays of source RA and Dec positions in radians. RA goes from [0, 2 pi] and Dec from [-pi/2, +pi/2].
freqs (array_like) – Frequency channels for the simulation, in Hz.
times (astropy.Time instance) – Times of the observation (can be an array of times).
beams (list of
UVBeam,AnalyticBeamorBeamInterfaceobjects) – Beam objects to use for each antenna.telescope_loc – An EarthLocation object representing the center of the array.
polarized (bool, optional) – If True, use polarized beams and calculate all available linearly- polarized visibilities, e.g. V_nn, V_ne, V_en, V_ee. Default: False (only uses the ‘ee’ polarization).
precision (int, optional) – Which precision setting to use for
matvis(). If set to1, uses the (np.float32,np.complex64) dtypes. If set to2, uses the (np.float64,np.complex128) dtypes.use_feed – Either ‘x’ or ‘y’. Only used if polarized is False.
use_gpu (bool, optional) – Whether to use the GPU for simulation.
beam_spline_opts (dict, optional) – Options to be passed to
pyuvdata.uvbeam.UVBeam.interp()as spline_opts.beam_idx – An array of integers, of the same length as
ants. Each entry is for an antenna of the same index, and its value should be the index of the beam in the beam list that corresponds to the antenna.antpairs – A list of antpairs (in the form of 2-tuples of integers) to actually calculate visibility for. If None, all feed-pairs are calculated.
source_buffer (float, optional) – The fraction of the total number of sources to use when allocating memory for the sources above horizon. For large numbers of sources, a fraction of ~0.55 should be sufficient.
coord_method – The method to use to transform coordinates from the equatorial to horizontal frame. The default is to use Astropy coordinate transforms. A faster option, which is accurate to within 6 mas, is to use “CoordinateTransformERFA” (or its GPU version, if using GPU).
coord_method_params – Parameters particular to the coordinate rotation method of choice. For example, for the CoordinateRotationERFA (and GPU version of the same) method, there is the parameter
update_bcrs_every, which should be a time in seconds, for which larger values speed up the computation.matprod_method – The method to use for the final matrix multiplication. Default is ‘MatMul’, which simply uses matrix multiplication over the two full matrices. Currently, the other option is VectorLoop, which uses a loop over the antenna pairs, computing the sum over sources as a vector dot product, which can be faster for large arrays where antpairs is small (possibly from high redundancy). You should run a performance test before changing this. If not CPU/GPU prefix is specified, it will be added automatically based on the value of use_gpu.
- Returns:
vis – Complex array of shape (NFREQS, NTIMES, NBLS, NFEED, NFEED) if
polarized == True, or (NFREQS, NTIMES, NBLS) otherwise.- Return type:
array_like