def insert_gains_into_uvcal(uvcal, time, polarization, gains_re, gains_im):
    'Insert tensorized gains back into uvcal object\n\n    Parameters\n    ----------\n    uvdata: UVData object\n        uvdata object to insert model data into.\n    time: float\n        JD of time to insert.\n    polarization: str\n        polarization to insert.\n    gains_re: dict with int keys and tf.Tensor object values\n        dictionary mapping i antenna numbers to Nfreq 1d tf.Tensor object\n        representing the real component of the complex gain for antenna i.\n    gains_im: dict with int keys and tf.Tensor object values\n        dictionary mapping j antenna numbers to Nfreq 1d tf.Tensor object\n        representing the imag component of the complex gain for antenna j.\n\n    Returns\n    -------\n    N/A: Modifies uvcal inplace.\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]
    for ant_index in range(uvcal.Nants_data):
        uvcal.gain_array[ant_index, 0, :, gindt, polnum] = (gains_re[ant_index].numpy() + (1j * gains_im[ant_index].numpy()))
Insert tensorized gains back into uvcal object

Parameters
----------
uvdata: UVData object
    uvdata object to insert model data into.
time: float
    JD of time to insert.
polarization: str
    polarization to insert.
gains_re: dict with int keys and tf.Tensor object values
    dictionary mapping i antenna numbers to Nfreq 1d tf.Tensor object
    representing the real component of the complex gain for antenna i.
gains_im: dict with int keys and tf.Tensor object values
    dictionary mapping j antenna numbers to Nfreq 1d tf.Tensor object
    representing the imag component of the complex gain for antenna j.

Returns
-------
N/A: Modifies uvcal inplace.
def insert_gains_into_uvcal(uvcal, time, polarization, gains_re, gains_im):
    'Insert tensorized gains back into uvcal object\n\n    Parameters\n    ----------\n    uvdata: UVData object\n        uvdata object to insert model data into.\n    time: float\n        JD of time to insert.\n    polarization: str\n        polarization to insert.\n    gains_re: dict with int keys and tf.Tensor object values\n        dictionary mapping i antenna numbers to Nfreq 1d tf.Tensor object\n        representing the real component of the complex gain for antenna i.\n    gains_im: dict with int keys and tf.Tensor object values\n        dictionary mapping j antenna numbers to Nfreq 1d tf.Tensor object\n        representing the imag component of the complex gain for antenna j.\n\n    Returns\n    -------\n    N/A: Modifies uvcal inplace.\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]
    for ant_index in range(uvcal.Nants_data):
        uvcal.gain_array[ant_index, 0, :, gindt, polnum] = (gains_re[ant_index].numpy() + (1j * gains_im[ant_index].numpy()))