def tensorize_gains(uvcal, polarization, time, dtype=np.float32):
    'Helper function to extract gains into fitting tensors.\n\n    Parameters\n    ----------\n    uvcal: UVCal object\n        UVCal object holding gain data to tensorize.\n    polarization: str\n        pol-str of gain to extract.\n    time: float\n        JD of time to convert to tensor.\n    dtype: numpy.dtype\n        dtype of tensors to output.\n\n    Returns\n    -------\n    gains_re: tf.Tensor object.\n        tensor object holding real component of gains\n        for time_index and polarization\n        shape is Nant x Nfreq\n    gains_im: tf.Tensor object.\n        tensor object holding imag component of gains\n        for time_index and polarization\n        shape is Nant x Nfreq\n\n    '
    polnum = np.where((uvcal.jones_array == uvutils.polstr2num(polarization, x_orientation=uvcal.x_orientation)))[0][0]
    gindt = np.where(np.isclose(uvcal.time_array, time, atol=1e-07, rtol=0.0))[0][0]
    gains_re = tf.convert_to_tensor(uvcal.gain_array[:, 0, :, gindt, polnum].squeeze().real, dtype=dtype)
    gains_im = tf.convert_to_tensor(uvcal.gain_array[:, 0, :, gindt, polnum].squeeze().imag, dtype=dtype)
    return (gains_re, gains_im)
Helper function to extract gains into fitting tensors.

Parameters
----------
uvcal: UVCal object
    UVCal object holding gain data to tensorize.
polarization: str
    pol-str of gain to extract.
time: float
    JD of time to convert to tensor.
dtype: numpy.dtype
    dtype of tensors to output.

Returns
-------
gains_re: tf.Tensor object.
    tensor object holding real component of gains
    for time_index and polarization
    shape is Nant x Nfreq
gains_im: tf.Tensor object.
    tensor object holding imag component of gains
    for time_index and polarization
    shape is Nant x Nfreq
def tensorize_gains(uvcal, polarization, time, dtype=np.float32):
    'Helper function to extract gains into fitting tensors.\n\n    Parameters\n    ----------\n    uvcal: UVCal object\n        UVCal object holding gain data to tensorize.\n    polarization: str\n        pol-str of gain to extract.\n    time: float\n        JD of time to convert to tensor.\n    dtype: numpy.dtype\n        dtype of tensors to output.\n\n    Returns\n    -------\n    gains_re: tf.Tensor object.\n        tensor object holding real component of gains\n        for time_index and polarization\n        shape is Nant x Nfreq\n    gains_im: tf.Tensor object.\n        tensor object holding imag component of gains\n        for time_index and polarization\n        shape is Nant x Nfreq\n\n    '
    polnum = np.where((uvcal.jones_array == uvutils.polstr2num(polarization, x_orientation=uvcal.x_orientation)))[0][0]
    gindt = np.where(np.isclose(uvcal.time_array, time, atol=1e-07, rtol=0.0))[0][0]
    gains_re = tf.convert_to_tensor(uvcal.gain_array[:, 0, :, gindt, polnum].squeeze().real, dtype=dtype)
    gains_im = tf.convert_to_tensor(uvcal.gain_array[:, 0, :, gindt, polnum].squeeze().imag, dtype=dtype)
    return (gains_re, gains_im)