Beispiel #1
0
def noise_run(rate, freq, front_end, tones, lapse, decimation, gain, vna, mode,
              pf, trigger, amplitudes, delay):

    if trigger is not None:
        try:
            trigger = eval('u.' + trigger + '()')
        except SyntaxError:
            u.print_error(
                "Cannot find the trigger \'%s\'. Is it implemented in the USRP_triggers module?"
                % trigger)
            return ""
        except AttributeError:
            u.print_error(
                "Cannot find the trigger \'%s\'. Is it implemented in the USRP_triggers module?"
                % trigger)
            return ""

    noise_filename = u.Get_noise(tones,
                                 measure_t=lapse,
                                 rate=rate,
                                 decimation=decimation,
                                 amplitudes=amplitudes,
                                 RF=freq,
                                 output_filename=None,
                                 Front_end=front_end,
                                 Device=None,
                                 delay=delay * 1e-9,
                                 pf_average=pf,
                                 tx_gain=gain,
                                 mode=mode,
                                 trigger=trigger)
    if vna is not None:
        u.copy_resonator_group(vna, noise_filename)

    return noise_filename
Beispiel #2
0
    if args.frontend == 'A':
        ant = "A_RX2"
    elif args.frontend == 'B':
        ant = "B_RX2"
    else:
        err_msg = "Frontend %s unknown" % args.frontend
        u.print_warning(err_msg)
        ant = None

    if trigger is not None:
        try:
            trigger = eval('u.' + trigger + '()')
        except SyntaxError:
            u.print_error(
                "Cannot find the trigger \'%s\'. Is it implemented in the USRP_triggers module?"
                % trigger)
            return ""
        except AttributeError:
            u.print_error(
                "Cannot find the trigger \'%s\'. Is it implemented in the USRP_triggers module?"
                % trigger)
            return ""

    #replicate the VNA measure (WARNING: DOES NOT SUPPORT ITERATIONS)
    u.print_debug("Replicating seed VNA measure to ensure phase coherency...")
    VNA_seed_info = u.get_rx_info(args.VNA, ant=ant)
    seed_rf, seed_tones = u.get_tones(args.VNA)
    seed_start_f = VNA_seed_info['freq'][0]
    seed_end_f = VNA_seed_info['chirp_f'][0]
    seed_measure_t = VNA_seed_info['chirp_t'][0]
Beispiel #3
0
    try:
        sys.path.append('../AnalysisScripts')
        import PyMKID_USRP_functions as puf
    except ImportError:
        print("Cannot find the PyMKID_USRP_functions package")
        exit()

try:
    import PyMKID_USRP_import_functions as puf2
except ImportError:
    print("Cannot find the PyMKID_USRP_import_functions package")
    exit()

## Attempt to connect to GPU SDR server
if not u.Connect():
    u.print_error("Cannot find the GPU server! Exiting.")
    quit()

## Create some directories for the data files
dataPath = '/data/UsrpNoiseScans'
if not os.path.exists(dataPath):
    os.makedirs(dataPath)

dateStr = str(datetime.datetime.now().strftime('%Y%m%d'))  #sweep date
series = str(datetime.datetime.now().strftime('%Y%m%d_%H%M%S'))
seriesPath = dataPath + '/' + series
if not os.path.exists(seriesPath):
    os.makedirs(seriesPath)
print("Scan stored as series " + series + " in path " + dataPath)

## Set some noise scan parameters
Beispiel #4
0
        u.print_debug("getting %d tones from %s" % (len(tones), args.VNA))
    else:
        if args.random is not None:
            tones = [
                random.randint(-args.rate / 2., -args.rate / 2.)
                for c in range(args.random)
            ]
        else:
            try:
                if args.tones is not None:
                    tones = [float(x) for x in args.tones]
                    tones = np.asarray(tones) * 1e6
                else:
                    tones = []
            except ValueError:
                u.print_error("Cannot convert tone argument.")

    rf_freq = args.freq * 1e6

    if args.random is not None:
        tones = [
            random.uniform(-args.rate * 1e6 / 2, args.rate * 1e6 / 2)
            for ui in range(args.random)
        ]

    if not u.Connect():
        u.print_error("Cannot find the GPU server!")
        exit()

    if args.guard_tones is not None:
        guard_tones = [float(x) for x in args.guard_tones]
Beispiel #5
0
    if (abs(cTemp - temp) > 1e-3):
        if (debugPowerScan == False):
            fridge.setTempSP(temp)
        for i in range(0, nSteps):
            sleep(timeInterval)
            cTemp = fridge.getTemp()
            print("#  ", i, cTemp)
    else:
        print("No Ramp Needed")

    cTempStr = getTempStr(cTemp)

    print("Temp:" + cTempStr + ", Starting VNA Scan")

    if not u.Connect():
        u.print_error("Cannot find the GPU server!")
        exit()

    for power in powers:
        N_power = 10**(((-1 * power) - 14) / 20)
        print(str(round(-14 - 20 * np.log10(N_power), 2)) + ' dBm of power')
        print(
            str(N_power) +
            ' is the equivalent number of tones needed to split the DAQ power into the above amount'
        )

        output_filename = sweepPath + "/TPsweep" + "_T" + cTempStr + "_P" + str(
            power) + "_" + series

        vna_file, delay = puf2.vna_run(tx_gain=0, \
                                       rx_gain = 25,\
Beispiel #6
0
        '-w',
        help=
        'minimum peak distance and fit init range in Hz. Default behaviour is different if the number of peaks is contrained of if a threshold is provided',
        type=float,
        default=20e3)
    parser.add_argument('--mag',
                        '-m',
                        help='Magnitude cut-off',
                        type=float,
                        default=1)
    args = parser.parse_args()
    os.chdir(args.folder)
    peaks = []
    files = glob.glob("USRP_VNA*.h5")
    if args.threshold is None and args.N_peaks is None:
        u.print_error("Provide number of peaks or threshold.")
    if args.N_peaks is not None:
        if len(files) != len(args.N_peaks):
            err_msg = "number of peaks excpected different from number of files found"
            u.print_error(err_msg)
            raise ValueError(err_msg)

        print("Fitting vna scan from files:")
        for i in range(len(files)):
            p = int(args.N_peaks[i])
            peaks.append(p)
            print "\'%s\' expected peaks: %d" % (files[i], p)

    run(files,
        args.backend,
        args.att,