Example #1
0
#		capture range chip 2 (type 6) 17.8 26.5
#		for inputFrequency in numpy.arange(16.5e6,24.9e6,.1e6):	  
	startTime = time.time()	  
	for inputFrequency in inputFrequencies:
		generator.setWaveform(inputFrequency, 2.5,2.5,'SQU')
		time.sleep(.4) # .3 should be safe
		phaseShift,frequency = experiment.measurePhaseAndFrequency()
		sweepResults = numpy.append(sweepResults,[phaseShift],axis=1)
	print 'Sweep took %f s' % (startTime-time.time())
	
	unwrappedResults = numpy.unwrap(sweepResults)
	halfwayAngle = unwrappedResults[len(unwrappedResults)/2]
	correction = (numpy.trunc(halfwayAngle / (2*numpy.pi)) +1)*-2*numpy.pi
	unwrappedResults = unwrappedResults + correction


	results['experiment':experimentName] = numpy.rad2deg(unwrappedResults)
		
	pyplot.plot(inputFrequencies,numpy.rad2deg(unwrappedResults),'.-',label=experimentName)
	
	results.writeToExcel('../../results/pllSweepResults.xls')
	results.write('../../results/pllSweepResults.ma')
	



pyplot.xlabel('PLL input frequency (Hz)')
pyplot.ylabel('phi_out - phi_in (degrees)')
pyplot.legend()
pyplot.show()