def METHOD_NAME(sdr_address, SampleRate, TX_freq, RX_freq, Rx_gain, Tx_gain, buffer_size):
    """Setup contexts"""
    sdr = adi.ad9361(uri=sdr_address)
    sdr._ctrl.debug_attrs[
        "adi,frequency-division-duplex-mode-enable"
    ].value = "1"  # set to fdd mode
    sdr._ctrl.debug_attrs[
        "adi,ensm-enable-txnrx-control-enable"
    ].value = "0"  # Disable pin control so spi can move the states
    sdr._ctrl.debug_attrs["initialize"].value = "1"
    sdr.rx_enabled_channels = [0, 1]  # enable Rx1 (voltage0) and Rx2 (voltage1)
    sdr.gain_control_mode_chan0 = "manual"  # We must be in manual gain control mode (otherwise we won't see the peaks and nulls!)
    sdr.gain_control_mode_chan1 = "manual"  # We must be in manual gain control mode (otherwise we won't see the peaks and nulls!)
    sdr._rxadc.set_kernel_buffers_count(
        1
    )  # Default is 4 Rx buffers are stored, but we want to change and immediately measure the result, so buffers=1
    rx = sdr._ctrl.find_channel("voltage0")
    rx.attrs[
        "quadrature_tracking_en"
    ].value = "1"  # set to '1' to enable quadrature tracking
    sdr.sample_rate = int(SampleRate)
    sdr.rx_lo = int(RX_freq)
    sdr.rx_buffer_size = int(
        buffer_size
    )  # small buffers make the scan faster -- and we're primarily just looking at peak power
    sdr.tx_lo = int(TX_freq)
    sdr.tx_cyclic_buffer = True
    sdr.tx_hardwaregain_chan0 = int(-80)  # turn off Tx1
    sdr.tx_hardwaregain_chan1 = int(Tx_gain)
    sdr.rx_hardwaregain_chan0 = int(Rx_gain + ccal[0])
    sdr.rx_hardwaregain_chan1 = int(Rx_gain + ccal[1])
    # sdr.filter = "/usr/local/lib/osc/filters/LTE5_MHz.ftr"
    # sdr.rx_rf_bandwidth = int(SampleRate*2)
    # sdr.tx_rf_bandwidth = int(SampleRate*2)
    signal_freq = int(SampleRate / 8)
    if (
        True
    ):  # use either DDS or sdr.tx(iq) to generate the Tx waveform.  But don't do both!
        sdr.dds_enabled = [1, 1, 1, 1, 1, 1, 1, 1]  # DDS generator enable state
        sdr.dds_frequencies = [
            signal_freq,
            0,
            signal_freq,
            0,
            signal_freq,
            0,
            signal_freq,
            0,
        ]  # Frequencies of DDSs in Hz
        sdr.dds_scales = [
            0.5,
            0,
            0.5,
            0,
            0.9,
            0,
            0.9,
            0,
        ]  # Scale of DDS signal generators Ranges [0,1]
    else:
        fs = int(SampleRate)
        N = 1000
        fc = int(signal_freq / (fs / N)) * (fs / N)
        ts = 1 / float(fs)
        t = np.arange(0, N * ts, ts)
        i = np.cos(2 * np.pi * t * fc) * 2 ** 15
        q = np.sin(2 * np.pi * t * fc) * 2 ** 15
        iq = 0.9 * (i + 1j * q)
        sdr.tx([iq, iq])
    return sdr