state=hw.state())[0] ri.set_modulation_output(7) time.sleep(3) # Let the lock-in catch up logger.info( "Recording {:.1f} s stream with source modulating".format( stream_length_seconds)) mod_stream = ri.get_measurement(num_seconds=stream_length_seconds, demod=True, state=hw.state())[0] ri.set_modulation_output('low') logger.info("Recording {:.1f} s stream with source on".format( stream_length_seconds)) on_stream = ri.get_measurement(num_seconds=stream_length_seconds, demod=True, state=hw.state())[0] ri.set_modulation_output('high') sssl = basic.SingleSweepStreamList( single_sweep=sweep, stream_list=[off_stream, mod_stream, on_stream], state={ 'f_index': f_index, 'attenuation_index': attenuation_index }) npd.write(sssl) npd.write(ri.get_adc_measurement()) finally: ri.set_modulation_output('high') npd.close() print("Wrote {}".format(npd.root_path)) print("Elapsed time {:.0f} minutes.".format((time.time() - tic) / 60))
ri.select_bank( np.argmin(np.abs(f_baseband_bin_center - f_baseband))) ri.select_fft_bins(np.array([0])) logger.info("Recording {:.1f} s stream with source off".format( stream_length_seconds)) off_stream = ri.get_measurement(num_seconds=stream_length_seconds, demod=True, state=hw.state())[0] ri.set_modulation_output(7) logger.info( "Recording {:.1f} s stream with source modulating".format( stream_length_seconds)) mod_stream = ri.get_measurement(num_seconds=stream_length_seconds, demod=True, state=hw.state())[0] ri.set_modulation_output('high') sweep_stream_list = basic.SingleSweepStreamList( single_sweep=fine_sweep, stream_list=[off_stream, mod_stream], state={ 'lo_index': lo_index, 'attenuation_index': attenuation_index }) npd.write(sweep_stream_list) npd.write(ri.get_adc_measurement()) finally: ri.set_modulation_output('high') npd.close() print("Wrote {}".format(npd.root_path)) print("Elapsed time {:.0f} minutes.".format((time.time() - tic) / 60))
n_tone_center = 2 ** tones_per_bin_exponent * n_filterbank logger.info("Center tone bin index is {:d}".format(n_tone_center)) streams = [] for offset in offsets_stream: logger.info("Recording {:.1f} s stream at tone offset {:d}".format(length_seconds_stream, offset)) n_tone = n_tone_center + offset f_lo_MHz_stream = f_lo_round_to_MHz * round(1e-6 * (f0 - f_tone_stream * n_tone) / f_lo_round_to_MHz) ri.set_lo(lomhz=f_lo_MHz_stream, chan_spacing=f_lo_round_to_MHz) logger.info("Set LO to {:.6f} MHz".format(f_lo_MHz_stream)) ri.set_tone_bins(bins=np.array([n_tone]), nsamp=num_tone_samples_stream) logger.info("Resetting filterbank bin from {:d} to {:d}".format(ri.fft_bins[0, 0], n_filterbank)) ri.fft_bins = np.atleast_2d(np.array([n_filterbank])) ri.select_bank(0) ri.select_fft_bins(np.array([0])) time.sleep(wait) state = hw.state() state['lo_index'] = lo_index state['lo_valon'] = {'frequency_a': 1e6 * ri.lo_valon.get_frequency_a(), 'frequency_b': 1e6 * ri.lo_valon.get_frequency_b()} stream = ri.get_measurement(num_seconds=length_seconds_stream, demod=True, state=state)[0] stream.number = None streams.append(stream) npd.write(ri.get_adc_measurement()) sssl = basic.SingleSweepStreamList(single_sweep=sweep, stream_list=streams, description='f_0 = {:.1f}'.format(f0)) npd.write(sssl) finally: npd.close() print("Wrote {}".format(npd.root_path)) print("Elapsed time {:.0f} minutes.".format((time.time() - tic) / 60))