def flag_poltime(data_object, time, polarization):
    if isinstance(data_object, UVData):
        bltsel = np.isclose(data_object.time_array, time, atol=1e-07, rtol=0.0)
        polnum = np.where((data_object.polarization_array == uvutils.polstr2num(polarization, x_orientation=data_object.x_orientation)))[0][0]
        data_object.flag_array[bltsel, :, :, polnum] = True
        data_object.data_array[bltsel, :, :, polnum] = 0.0
    elif isinstance(data_object, UVCal):
        polnum = np.where((data_object.jones_array == uvutils.polstr2num(polarization, x_orientation=data_object.x_orientation)))[0][0]
        gindt = np.where(np.isclose(data_object.time_array, time, atol=1e-07, rtol=0.0))[0][0]
        data_object.gain_array[:, 0, :, gindt, polnum] = 1.0
        data_object.flag_array[:, 0, :, gindt, polnum] = True
    else:
        raise ValueError('only supports data_object that is UVCal or UVData.')
def flag_poltime(data_object, time, polarization):
    if isinstance(data_object, UVData):
        bltsel = np.isclose(data_object.time_array, time, atol=1e-07, rtol=0.0)
        polnum = np.where((data_object.polarization_array == uvutils.polstr2num(polarization, x_orientation=data_object.x_orientation)))[0][0]
        data_object.flag_array[bltsel, :, :, polnum] = True
        data_object.data_array[bltsel, :, :, polnum] = 0.0
    elif isinstance(data_object, UVCal):
        polnum = np.where((data_object.jones_array == uvutils.polstr2num(polarization, x_orientation=data_object.x_orientation)))[0][0]
        gindt = np.where(np.isclose(data_object.time_array, time, atol=1e-07, rtol=0.0))[0][0]
        data_object.gain_array[:, 0, :, gindt, polnum] = 1.0
        data_object.flag_array[:, 0, :, gindt, polnum] = True
    else:
        raise ValueError('only supports data_object that is UVCal or UVData.')