Example #1
0
 def find_best_iq_delay(self,iq_delay_range=np.arange(-4,5),set_tones=True,make_plot=False):
     if set_tones:
         self.set_tone_baseband_freqs(np.hstack((np.linspace(-220,-10,8),np.linspace(10,220,8)+2)),nsamp=2**16)
     best_delay,best_rejection = find_best_iq_delay_adc(self,iq_delay_range=iq_delay_range,make_plot=make_plot)
     if best_rejection < 15:
         logger.warning("Best image rejection was only %.1f dB at iq_delay=%d, which is suspiciously low.\nCheck "
                        "connections and "
                        "try running with make_plot=True to diagnose" % (best_rejection,best_rejection))
     self.iq_delay = best_delay
     logger.debug("iq_delay set to %d" % best_delay)
     return best_delay,best_rejection
Example #2
0
 def find_best_iq_delay(self,
                        iq_delay_range=np.arange(-4, 5),
                        set_tones=True,
                        make_plot=False):
     if set_tones:
         self.set_tone_baseband_freqs(np.hstack(
             (np.linspace(-220, -10, 8), np.linspace(10, 220, 8) + 2)),
                                      nsamp=2**16)
     best_delay, best_rejection = find_best_iq_delay_adc(
         self, iq_delay_range=iq_delay_range, make_plot=make_plot)
     if best_rejection < 15:
         logger.warning(
             "Best image rejection was only %.1f dB at iq_delay=%d, which is suspiciously low.\nCheck "
             "connections and "
             "try running with make_plot=True to diagnose" %
             (best_rejection, best_rejection))
     self.iq_delay = best_delay
     logger.debug("iq_delay set to %d" % best_delay)
     return best_delay, best_rejection
# Acquire
npd = acquire.new_npy_directory(suffix=suffix)
tic = time.time()
try:
    tools.set_and_attempt_external_phase_lock(ri, f_lo=lo_MHz, f_lo_spacing=lo_round_to_MHz)
    ri.set_lo(lomhz=lo_MHz, chan_spacing=lo_round_to_MHz)
    assert np.all(ri.adc_valon.get_phase_locks())
    assert np.all(ri.lo_valon.get_phase_locks())
    ri.set_dac_attenuator(dac_attenuation)
    ri.set_tone_bins(bins=np.array([center_integer]), nsamp=2 ** tone_sample_exponent)
    ri.fft_bins = np.atleast_2d(np.array([n_filterbank]))
    ri.select_bank(0)
    ri.select_fft_bins(np.array([0]))
    time.sleep(wait)
    tools.optimize_fft_gain(ri, fraction_of_maximum=0.5)
    time.sleep(wait)
    ri.iq_delay, _ = tools.find_best_iq_delay_adc(ri=ri)
    for tone_integer in tone_integers:
        ri.set_tone_bins(bins=np.array([tone_integer]), nsamp=2 ** tone_sample_exponent)
        ri.fft_bins = np.atleast_2d(np.array([n_filterbank]))
        ri.select_bank(0)
        ri.select_fft_bins(np.array([0]))
        time.sleep(wait)
        npd.write(ri.get_measurement(num_seconds=stream_length_seconds, demod=False, state=hw.state()))
        npd.write(ri.get_adc_measurement())
finally:
    npd.close()
    print("Wrote {}".format(npd.root_path))
    print("Elapsed time {:.0f} minutes.".format((time.time() - tic) / 60))