def get_auto_weights(uvdata, delay_extent=25.0):
    '\n    inverse variance weights from interpolated autocorrelation data\n\n    Parameters\n    ----------\n    uvdata: UVData object\n        UVData object containing autocorrelation data to use for computing inverse noise weights.\n    offset: float, optional\n        Fit autocorrelation to delay components with this width.\n\n    Returns\n    -------\n    data_weights: UVFlag object\n        UFlag in flag-mode where flags contain original data flags and weights contain autocorr weights.\n    '
    dpss_components = modeling.yield_dpss_model_comps_bl_grp(0.0, uvdata.freq_array[0], offset=delay_extent)
    data_weights = UVFlag(uvdata, mode='flag')
    data_weights.weights_array = np.zeros(uvdata.data_array.shape)
    auto_fit_dict = {}
    bls = uvdata.get_antpairpols()
    for bl in bls:
        if (bl[0] == bl[1]):
            d_wf = uvdata.get_data(bl)
            w_wf = (~ uvdata.get_flags(bl))
            auto_fit_dict[bl] = []
            for (ds, fs) in zip(d_wf, w_wf):
                nunflagged = np.count_nonzero(fs)
                amat = tf.convert_to_tensor(dpss_components[fs])
                dvec = tf.reshape(tf.convert_to_tensor(ds[fs].real), (nunflagged, 1))
                model = (dpss_components @ tf.linalg.lstsq(amat, dvec).numpy().squeeze())
                auto_fit_dict[bl].append(model)
            auto_fit_dict[bl] = np.atleast_2d(np.asarray(auto_fit_dict[bl]))
    for bl in bls:
        smooth_weights = (1.0 / (auto_fit_dict[(bl[0], bl[0], bl[(- 1)])] * auto_fit_dict[(bl[1], bl[1], bl[(- 1)])]))
        smooth_weights *= (~ uvdata.get_flags(bl))
        dinds = data_weights.antpair2ind(*bl[:2])
        polnum = np.where((data_weights.polarization_array == uvutils.polstr2num(bl[(- 1)], x_orientation=data_weights.x_orientation)))[0][0]
        data_weights.weights_array[dinds, 0, :, polnum] = smooth_weights
    return data_weights
inverse variance weights from interpolated autocorrelation data

Parameters
----------
uvdata: UVData object
    UVData object containing autocorrelation data to use for computing inverse noise weights.
offset: float, optional
    Fit autocorrelation to delay components with this width.

Returns
-------
data_weights: UVFlag object
    UFlag in flag-mode where flags contain original data flags and weights contain autocorr weights.
def get_auto_weights(uvdata, delay_extent=25.0):
    '\n    inverse variance weights from interpolated autocorrelation data\n\n    Parameters\n    ----------\n    uvdata: UVData object\n        UVData object containing autocorrelation data to use for computing inverse noise weights.\n    offset: float, optional\n        Fit autocorrelation to delay components with this width.\n\n    Returns\n    -------\n    data_weights: UVFlag object\n        UFlag in flag-mode where flags contain original data flags and weights contain autocorr weights.\n    '
    dpss_components = modeling.yield_dpss_model_comps_bl_grp(0.0, uvdata.freq_array[0], offset=delay_extent)
    data_weights = UVFlag(uvdata, mode='flag')
    data_weights.weights_array = np.zeros(uvdata.data_array.shape)
    auto_fit_dict = {}
    bls = uvdata.get_antpairpols()
    for bl in bls:
        if (bl[0] == bl[1]):
            d_wf = uvdata.get_data(bl)
            w_wf = (~ uvdata.get_flags(bl))
            auto_fit_dict[bl] = []
            for (ds, fs) in zip(d_wf, w_wf):
                nunflagged = np.count_nonzero(fs)
                amat = tf.convert_to_tensor(dpss_components[fs])
                dvec = tf.reshape(tf.convert_to_tensor(ds[fs].real), (nunflagged, 1))
                model = (dpss_components @ tf.linalg.lstsq(amat, dvec).numpy().squeeze())
                auto_fit_dict[bl].append(model)
            auto_fit_dict[bl] = np.atleast_2d(np.asarray(auto_fit_dict[bl]))
    for bl in bls:
        smooth_weights = (1.0 / (auto_fit_dict[(bl[0], bl[0], bl[(- 1)])] * auto_fit_dict[(bl[1], bl[1], bl[(- 1)])]))
        smooth_weights *= (~ uvdata.get_flags(bl))
        dinds = data_weights.antpair2ind(*bl[:2])
        polnum = np.where((data_weights.polarization_array == uvutils.polstr2num(bl[(- 1)], x_orientation=data_weights.x_orientation)))[0][0]
        data_weights.weights_array[dinds, 0, :, polnum] = smooth_weights
    return data_weights