Added phase control testing for RF sources
This commit is contained in:
parent
6f43caef49
commit
8cdd3a73ef
7
Scripts/Miscellaneous/PhaseTest/README.md
Normal file
7
Scripts/Miscellaneous/PhaseTest/README.md
Normal file
@ -0,0 +1,7 @@
|
||||
Phase Test
|
||||
==========
|
||||
This script helps in testing the correct function of the phase programming
|
||||
of RF sources. It measures a first and second, albeit phase shifted,
|
||||
interval and calculatets the dot product of these to intervals.
|
||||
The result should be a smooth full period of a cosine.
|
||||
|
25
Scripts/Miscellaneous/PhaseTest/phase_exp.py
Executable file
25
Scripts/Miscellaneous/PhaseTest/phase_exp.py
Executable file
@ -0,0 +1,25 @@
|
||||
import numpy as N
|
||||
# connect PTS RF source to ADC card, set to generate a few MHz
|
||||
# result should be a fulle period of sine/cosine
|
||||
def experiment():
|
||||
#step = 0.36 # for PTS 500
|
||||
step = 0.225 # for PTS 310
|
||||
for i in list(xrange(1)): # number of periods
|
||||
samples = 2048
|
||||
print samples
|
||||
for phase in N.arange(0,360,step):
|
||||
#phase=ph
|
||||
e=Experiment()
|
||||
#e.set_frequency(1e6,0)
|
||||
e.wait(20e-6)
|
||||
e.set_description("phase", phase)
|
||||
e.set_description("i", i)
|
||||
e.set_phase(0.0)
|
||||
#e.loop_start(1)
|
||||
e.wait(20e-6)
|
||||
e.record(samples, 20e6,sensitivity=10)
|
||||
e.set_phase(phase)
|
||||
e.wait(20e-6)
|
||||
#e.loop_end()
|
||||
e.record(samples, 20e6,sensitivity=10)
|
||||
yield e
|
23
Scripts/Miscellaneous/PhaseTest/phase_res.py
Executable file
23
Scripts/Miscellaneous/PhaseTest/phase_res.py
Executable file
@ -0,0 +1,23 @@
|
||||
import numpy
|
||||
|
||||
def result():
|
||||
o=MeasurementResult("overview")
|
||||
for r in results:
|
||||
if r is None: continue
|
||||
#print r
|
||||
data["single scan"]=r
|
||||
phase = r.get_description("phase")
|
||||
i = int(r.get_description("i"))
|
||||
r1=numpy.array(r.get_result_by_index(0).y[0], dtype="Float64")
|
||||
r2=numpy.array(r.get_result_by_index(1).y[0], dtype="Float64")
|
||||
#print r1
|
||||
r1-=r1.mean()
|
||||
r1/=r1.std()
|
||||
r2-=r2.mean()
|
||||
r2/=r2.std()
|
||||
|
||||
c = numpy.dot(r1, r2)
|
||||
print c
|
||||
o[phase+360*i]=AccumulatedValue(c)
|
||||
|
||||
data["overview"]=o
|
Loading…
Reference in New Issue
Block a user