array of shape :code:`(comps,)` Initial guess for the alphas. Defaults to -0.7. I0i : $(array_type), optional array of shape :code:`(comps,)` Initial guess for the intensities at the reference frequency. Defaults to 1.0. tol : float, optional Solver absolute tolerance (optional). Defaults to 1e-6. maxiter : int, optional Solver maximum iterations (optional). Defaults to 100. dtype : np.dtype, optional Datatype of result. Should be either np.float32 or np.float64. Defaults to np.float64. Returns ------- out : $(array_type) array of shape :code:`(4, comps)` The fitted components arranged as [alphas, alphavars, I0s, I0vars] """) try: fit_spi_components.__doc__ = SPI_DOCSTRING.substitute( array_type=":class:`numpy.ndarray`") except AttributeError: pass
where: - :math:`u` and :math:`v` are the UV coordinates and :math:`\lambda` the frequency. - :math:`e_{maj}` and :math:`e_{min}` are the major and minor axes and :math:`\alpha` the position angle. Parameters ---------- uvw : $(array_type) UVW coordinates of shape :code:`(row, 3)` frequency : $(array_type) frequencies of shape :code:`(chan,)` shape_param : $(array_type) Gaussian Shape Parameters of shape :code:`(source, 3)` where the second dimension contains the `(emajor, eminor, angle)` parameters describing the shape of the Gaussian Returns ------- gauss_shape : $(array_type) Shape parameters of shape :code:`(source, row, chan)` """) try: gaussian.__doc__ = GAUSSIAN_DOCS.substitute( array_type=":class:`numpy.ndarray`") except KeyError: pass
antenna1 : $(array_type) First antenna indices of shape :code:`(row,)`. antenna2 : $(array_type) Second antenna indices of shape :code:`(row,)` jones : $(array_type) Gains of shape :code:`(utime, ant, chan, dir, corr)` or :code:`(utime, ant, chan, dir, corr, corr)`. model : $(array_type) Model image as a function of time with shape :code:`(utime, chan, dir, corr)` or :code:`(utime, chan, dir, corr, corr)`. uvw : $(array_type) uvw coordinates of shape :code:`(row, 3)` lm : $(array_type) Source lm coordinates as a function of time :code:`(utime, dir, 2)` Returns ------- vis : $(array_type) visibilities of shape :code:`(row, chan, corr)` or :code:`(row, chan, corr, corr)`. """) try: compute_and_corrupt_vis.__doc__ = COMPUTE_AND_CORRUPT_VIS_DOCS.substitute( array_type=":class:`numpy.ndarray`") except AttributeError: pass
This is usually the same array as ``die1_jones`` as this preserves the symmetry of the RIME. ``predict_vis`` will perform the conjugate transpose internally. shape :code:`(time,ant,chan,corr_1,corr_2)` $(extra_args) Returns ------- visibilities : $(array_type) Model visibilities of shape :code:`(row,chan,corr_1,corr_2)` """) try: predict_vis.__doc__ = PREDICT_DOCS.substitute( array_type=":class:`numpy.ndarray`", get_time_index=":code:`np.unique(time, " "return_inverse=True)[1]`", extra_args="", extra_notes="") except AttributeError: pass APPLY_GAINS_DOCS = DocstringTemplate(r""" Apply gains to corrupted visibilities in order to recover the true visibilities. Thin wrapper around $(wrapper_func). .. math:: V_{pq} = G_{p} C_{pq} G_{q}^H
6a7e873d4d1fe538981dec5851418cbd371b8388/MeqNodes/src/PSVTensor.cc#L314_>`_ uses the CASA sign convention. Parameters ---------- lm : $(array_type) LM coordinates of shape :code:`(source, 2)` with L and M components in the last dimension. uvw : $(array_type) UVW coordinates of shape :code:`(row, 3)` with U, V and W components in the last dimension. frequency : $(array_type) frequencies of shape :code:`(chan,)` convention : {'fourier', 'casa'} Uses the :math:`e^{-2 \pi \mathit{i}}` sign convention if ``fourier`` and :math:`e^{2 \pi \mathit{i}}` if ``casa``. Returns ------- complex_phase : $(array_type) complex of shape :code:`(source, row, chan)` """) try: phase_delay.__doc__ = PHASE_DELAY_DOCS.substitute( array_type=":class:`numpy.ndarray`") except AttributeError: pass
*before* multiplication with `die1_jones` and `die2_jones`. shape :code:`(row,chan,corr_1,corr_2)`. die2_jones : $(array_type), optional :math:`G_{ps}` Direction-Independent Jones terms for the second antenna of the baseline. with shape :code:`(time,ant,chan,corr_1,corr_2)` $(extra_args) Returns ------- visibilities : $(array_type) Model visibilities of shape :code:`(row,chan,corr_1,corr_2)` """) try: predict_vis.__doc__ = PREDICT_DOCS.substitute( array_type=":class:`numpy.ndarray`", extra_args="", extra_notes="") except AttributeError: pass APPLY_GAINS_DOCS = DocstringTemplate(r""" Apply gains to corrupted visibilities in order to recover the true visibilities. Thin wrapper around $(wrapper_func). .. math:: V_{pq} = G_{p} C_{pq} G_{q}^H
:code:`(dim_1, ..., dim_n, icorr_1, ..., icorr_m)` input_schema : list of str or int A schema describing the :code:`icorr_1, ..., icorr_m` dimension of ``input``. Must have the same shape as the last dimensions of ``input``. output_schema : list of str or int A schema describing the :code:`ocorr_1, ..., ocorr_n` dimension of the return value. Returns ------- result : $(array_type) Result of shape :code:`(dim_1, ..., dim_n, ocorr_1, ..., ocorr_m)` The type may be floating point or promoted to complex depending on the combinations in ``output``. """ # Fill in the STOKES TYPES _map_str = ", ".join(["%s: %d" % (t, i) for i, t in enumerate(STOKES_TYPES)]) _map_str = "{{ " + _map_str + " }}" # Indent must match docstrings _map_str = fill(_map_str, initial_indent='', subsequent_indent=' ' * 8) CONVERT_DOCS = DocstringTemplate(CONVERT_DOCS.format(stokes_type_map=_map_str)) del _map_str try: convert.__doc__ = CONVERT_DOCS.substitute( array_type=":class:`numpy.ndarray`") except AttributeError: pass
lm : $(array_type) Source lm coordinates of shape :code:`(source, 2)`. These coordinates are: 1. Scaled if the associated frequency lies outside the beam cube. 2. Offset by pointing errors: ``point_errors`` 3. Rotated by parallactic angles: ``parallactic_angles``. 4. Scaled by antenna scaling factors: ``antenna_scaling``. parallactic_angles : $(array_type) Parallactic angles of shape :code:`(time, ant)`. point_errors : $(array_type) Pointing errors of shape :code:`(time, ant, chan, 2)`. antenna_scaling : $(array_type) Antenna scaling factors of shape :code:`(ant, chan, 2)` frequency : $(array_type) Frequencies of shape :code:`(chan,)`. Returns ------- ddes : $(array_type) Direction Dependent Effects of shape :code:`(source, time, ant, chan, corr, corr)` """) try: beam_cube_dde.__doc__ = BEAM_CUBE_DOCS.substitute( array_type=":class:`numpy.ndarray`") except AttributeError: pass
\begin{bmatrix} cos(pa) & sin(pa) \\ -sin(pa) & cos(pa) \end{bmatrix} \qquad \textrm{circular} \begin{bmatrix} e^{-i pa} & 0 \\ 0 & e^{i pa} \end{bmatrix} Parameters ---------- parallactic_angles : $(array_type) floating point parallactic angles. Of shape :code:`(pa0, pa1, ..., pan)`. feed_type : {'linear', 'circular'} The type of feed Returns ------- feed_matrix : $(array_type) Feed rotation matrix of shape :code:`(pa0, pa1,...,pan,2,2)` """) try: feed_rotation.__doc__ = FEED_ROTATION_DOCS.substitute( array_type=":class:`numpy.ndarray`") except AttributeError: pass
nu : int, optional The number of pixels in the padded grid along the :math:`x` direction. Chosen automatically by default. nv : int, optional The number of pixels in the padded grid along the :math:`y` direction. Chosen automatically by default. epsilon : float, optional The precision of the gridder with respect to the direct Fourier transform. By deafult, this is set to :code:`1e-5` for single precision and :code:`1e-7` for double precision. nthreads : int, optional The number of threads to use. Defaults to one. do_wstacking : bool, optional Whether to correct for the w-term or not. Defaults to True double_accum : bool, optional If true ducc will accumulate in double precision regardless of the input type. Returns ------- residual : $(array_type) Residual image corresponding to :code:`model` of shape :code:`(band, nx, ny)`. """) try: residual.__doc__ = RESIDUAL_DOCS.substitute( array_type=":class:`numpy.ndarray`") except AttributeError: pass
spi : $(array_type) Spectral index of shape :code:`(source, spi-comps)` or :code:`(source, spi-comps, pol)`. ref_freq : $(array_type) Reference frequencies of shape :code:`(source,)` frequencies : $(array_type) Frequencies of shape :code:`(chan,)` base : {"std", "log", "log10"} or {0, 1, 2} or list. string or corresponding enumeration specifying the polynomial base. Defaults to 0. If a list is provided, a polynomial base can be specified for each stokes parameter or polarisation in the ``pol`` dimension. string specification of the base is only supported in python 3. while the corresponding integer enumerations are supported on all python versions. Returns ------- spectral_model : $(array_type) Spectral Model of shape :code:`(source, chan)` or :code:`(source, chan, pol)`. """) try: spectral_model.__doc__ = SPECTRAL_MODEL_DOC.substitute( array_type=":class:`numpy.ndarray`") except AttributeError: pass
flux : $(array_type) Source flux of shape :code:`(source,)`. Contains the ``I`` field. coeffs : $(array_type) Source Polynomial coefficients of shape :code:`(source, coeffs)`. Contains the ``SpectralIndex`` field. log_poly : $(array_type) Source polynomial type of shape :code:`(source,)`. If True, logarithmic polynomials are used. If False, standard polynomials are used. Contains the ``LogarithmicSI`` field. ref_freq : $(array_type) Source Reference frequency of shape :code:`(source,)`. Contains the ``ReferenceFrequency`` field. gauss_shape : $(array_type) Gaussian shape parameters of shape :code:`(source, 3)` used when the corresponding ``source_type`` is ``"GAUSSIAN"``. The 3 components should contain the ``MajorAxis``, ``MinorAxis`` and ``Orientation`` fields in radians, respectively. frequency : $(array_type) Frequency of shape :code:`(chan,)`. Returns ------- visibilities : $(array_type) Complex visibilities of shape :code:`(row, chan, 1)` """) wsclean_predict.__doc__ = WSCLEAN_PREDICT_DOCS.substitute( array_type=":class:`numpy.ndarray`")
time_bin_indices : $(array_type) The start indices of the time bins of shape :code:`(utime)` time_bin_counts : $(array_type) The counts of unique time in each time bin of shape :code:`(utime)` antenna1 : $(array_type) First antenna indices of shape :code:`(row,)`. antenna2 : $(array_type) Second antenna indices of shape :code:`(row,)` jones : $(array_type) Gains of shape :code:`(time, ant, chan, dir, corr)` or :code:`(time, ant, chan, dir, corr, corr)`. model : $(array_type) Model data values of shape :code:`(row, chan, dir, corr)` or :code:`(row, chan, dir, corr, corr)`. Returns ------- vis : $(array_type) visibilities of shape :code:`(time, ant, chan, dir, corr)` or :code:`(time, ant, chan, dir, corr, corr)`. """) try: corrupt_vis.__doc__ = CORRUPT_VIS_DOCS.substitute( array_type=":class:`numpy.ndarray`") except AttributeError: pass
I : $(array_type) flux density in Janskys at the reference frequency of shape :code:`(source,)` coeffs : $(array_type) Polynomial coefficients for each source of shape :code:`(source, comp)` log_poly : $(array_type) or bool boolean array of shape :code:`(source, )` indicating whether logarithmic (True) or ordinary (False) polynomials should be used. ref_freq : $(array_type) Source reference frequencies of shape :code:`(source,)` frequency : $(array_type) frequencies of shape :code:`(chan,)` See Also -------- africanus.model.wsclean.load Returns ------- spectral_model : $(array_type) Spectral Model of shape :code:`(source, chan)` """) try: spectra.__doc__ = SPECTRA_DOCS.substitute( array_type=":class:`numpy.ndarray`") except AttributeError: pass
jhj : $(array_type) The diagonal of the Hessian of shape :code:`(time, ant, chan, dir, corr)` or shape :code:`(time, ant, chan, dir, corr, corr)` jhr : $(array_type) Residuals projected into gain space of shape :code:`(time, ant, chan, dir, corr)` or shape :code:`(time, ant, chan, dir, corr, corr)`. k: int Number of iterations (will equal maxiter if not converged) """) try: gauss_newton.__doc__ = GAUSS_NEWTON_DOCS.substitute( array_type=":class:`numpy.ndarray`") except AttributeError: pass JHJ_AND_JHR_DOCS = DocstringTemplate(""" Computes the diagonal of the Hessian and the residual locally projected in to gain space. Parameters ---------- time_bin_indices : $(array_type) The start indices of the time bins of shape :code:`(utime)` time_bin_counts : $(array_type) The counts of unique time in each time bin of shape :code:`(utime)`
Channel frequencies of shape :code:`(chan,)`. chan_width : $(array_type), optional Channel widths of shape :code:`(chan,)`. vis : $(array_type), optional Visibility data of shape :code:`(row, chan, corr)`. flag : $(array_type), optional Flag data of shape :code:`(row, chan, corr)`. weight_spectrum : $(array_type), optional Weight spectrum of shape :code:`(row, chan, corr)`. sigma_spectrum : $(array_type), optional Sigma spectrum of shape :code:`(row, chan, corr)`. time_bin_secs : float, optional Maximum summed interval in seconds to include within a bin. Defaults to 1.0. chan_bin_size : int, optional Number of bins to average together. Defaults to 1. Returns ------- namedtuple A namedtuple whose entries correspond to the input arrays. Output arrays will generally be ``None`` if the inputs were ``None``. """) try: time_and_channel.__doc__ = AVERAGING_DOCS.substitute( array_type=":class:`numpy.ndarray`") except AttributeError: pass
Parameters ---------- $(lm_name) : $(array_type) lm Direction Cosines of shape :code:`(coord, $(lm_components))` phase_centre : $(array_type), optional radec coordinates of the Phase Centre. Shape :code:`(2,)` Returns ------- $(array_type) radec coordinates of shape :code:`(coord, 2)` where Right-Ascension and Declination are in the last 2 components, respectively. """) try: radec_to_lmn.__doc__ = RADEC_TO_LMN_DOCS.substitute( lm_components="3", array_type=":class:`numpy.ndarray`") radec_to_lm.__doc__ = RADEC_TO_LMN_DOCS.substitute( lm_components="2", array_type=":class:`numpy.ndarray`") lmn_to_radec.__doc__ = LMN_TO_RADEC_DOCS.substitute( lm_name="lmn", lm_components="3", array_type=":class:`numpy.ndarray`") lm_to_radec.__doc__ = LMN_TO_RADEC_DOCS.substitute( lm_name="lm", lm_components="2", array_type=":class:`numpy.ndarray`") except AttributeError: pass
Visibility data of shape :code:`(row, chan, corr)` or :code:`(row, chan, corr, corr)` vis_type : str String specifying what kind of visibility we are checking against. Options are 'vis' or 'model' Returns ------- mode : integer An integer representing the calibration mode. Options are 0 -> DIAG_DIAG, 1 -> DIAG, 2 -> FULL """) try: check_type.__doc__ = CHECK_TYPE_DOCS.substitute( array_type=":class:`numpy.ndarray`") except AttributeError: pass CHUNKIFY_ROWS_DOCS = DocstringTemplate(""" Divides rows into chunks containing integer numbers of times keeping track of the indices at which the unique time changes and the number of times per unique time. Parameters: ----------- time : $(array_type) TIME column of MS utimes_per_chunk : integer
The output namedtuple contains an `offsets` array of shape :code:`(out_rows + 1,)` encoding the starting offsets of each output row, as well as a single entry at the end such that :code:`np.diff(offsets)` produces the number of channels for each output row. .. code-block:: python avg = bda(...) time = avg.time[avg.offsets[:-1]] out_chans = np.diff(avg.offsets) The implementation currently requires unique lexicographical combinations of (TIME, ANTENNA1, ANTENNA2). This can usually be achieved by suitably partitioning input data on indexing rows, DATA_DESC_ID and SCAN_NUMBER in particular. Returns ------- namedtuple A namedtuple whose entries correspond to the input arrays. Output arrays will be ``None`` if the inputs were ``None``. See the Notes for an explanation of the output formats. """) try: bda.__doc__ = BDA_DOCS.substitute(array_type=":class:`numpy.ndarray`") except AttributeError: pass
Flag data of shape :code:`(row, chan, corr)` or :code:`(row, chan, corr, corr)` model : $(array_type) Model data values of shape :code:`(row, chan, dir, corr)` or :code:`(row, chan, dir, corr, corr)`. Returns ------- residual : $(array_type) Residual visibilities of shape :code:`(time, ant, chan, dir, corr)` or :code:`(time, ant, chan, dir, corr, corr)`. """) try: residual_vis.__doc__ = RESIDUAL_VIS_DOCS.substitute( array_type=":class:`numpy.ndarray`") except AttributeError: pass CORRECT_VIS_DOCS = DocstringTemplate(""" Apply DIE gains to visibilities to generate corrected visibilities. For a measurement model of the form .. math:: V_{pq} = G_{p} X_{pq} G_{q}^H + n_{pq} the corrected visibilities are defined as
or shape :code:`(time, ant, chan, dir, corr, corr)` jhj : $(array_type) The diagonal of the Hessian of shape :code:`(time, ant, chan, dir, corr)` or shape :code:`(time, ant, chan, dir, corr, corr)` jhr : $(array_type) Residuals projected into gain space of shape :code:`(time, ant, chan, dir, corr)` or shape :code:`(time, ant, chan, dir, corr, corr)`. k : int Number of iterations (will equal maxiter if not converged) """) try: phase_only_gauss_newton.__doc__ = PHASE_CALIBRATION_DOCS.substitute( array_type=":class:`numpy.ndarray`") except AttributeError: pass JHJ_AND_JHR_DOCS = DocstringTemplate(""" Computes the diagonal of the Hessian and the residual projected in to gain space. These are the terms required to perform phase-only maximum likelihood calibration assuming scalar or diagonal inputs. Parameters ---------- time_bin_indices : $(array_type) The start indices of the time bins of shape :code:`(utime)`
The cell size of a pixel along the :math:`x` direction in radians. weights : $(array_type), optional Imaging weights of shape :code:`(row, chan)`. flag: $(array_type), optional Flags of shape :code:`(row,chan)`. Will only process visibilities for which flag!=0 celly : float, optional The cell size of a pixel along the :math:`y` direction in radians. By default same as cell size along :math:`x` direction. epsilon : float, optional The precision of the gridder with respect to the direct Fourier transform. By deafult, this is set to :code:`1e-5` for single precision and :code:`1e-7` for double precision. nthreads : int, optional The number of threads to use. Defaults to one. If set to zero will use all available cores. do_wstacking : bool, optional Whether to correct for the w-term or not. Defaults to True Returns ------- model : $(array_type) Dirty image corresponding to visibilities of shape :code:`(nband, nx, ny)`. """) try: dirty.__doc__ = DIRTY_DOCS.substitute(array_type=":class:`numpy.ndarray`") except AttributeError: pass
The cell size of a pixel along the :math:`x` direction in radians. weights : $(array_type), optional Imaging weights of shape :code:`(row, chan)`. flag: $(array_type), optional Flags of shape :code:`(row,chan)`. Will only process visibilities for which flag!=0 celly : float, optional The cell size of a pixel along the :math:`y` direction in radians. By default same as cell size along :math:`x` direction. epsilon : float, optional The precision of the gridder with respect to the direct Fourier transform. By deafult, this is set to :code:`1e-5` for single precision and :code:`1e-7` for double precision. nthreads : int, optional The number of threads to use. Defaults to one. If set to zero will use all available cores. do_wstacking : bool, optional Whether to correct for the w-term or not. Defaults to True Returns ------- vis : $(array_type) Visibilities corresponding to :code:`model` of shape :code:`(row,chan)`. """) try: model.__doc__ = MODEL_DOCS.substitute(array_type=":class:`numpy.ndarray`") except AttributeError: pass