mirror of
				https://gitlab.science.ru.nl/mthesis-edeboone/m-thesis-introduction.git
				synced 2025-10-31 03:46:44 +01:00 
			
		
		
		
	ZH: show phase due to t_trace[0] from measurement
This is not required to be known when finding the phase as lib.find_beacon_in_traces already accounts for it.
This commit is contained in:
		
							parent
							
								
									4c834ad8e7
								
							
						
					
					
						commit
						14a9fdb957
					
				
					 2 changed files with 48 additions and 8 deletions
				
			
		| 
						 | 
				
			
			@ -1,5 +1,12 @@
 | 
			
		|||
#!/usr/bin/env python3
 | 
			
		||||
 | 
			
		||||
"""
 | 
			
		||||
Test the functions in lib concerning
 | 
			
		||||
beacon generation and phase measuring
 | 
			
		||||
work correctly together.
 | 
			
		||||
"""
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
import matplotlib.pyplot as plt
 | 
			
		||||
import numpy as np
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -7,20 +14,25 @@ import lib
 | 
			
		|||
 | 
			
		||||
seed = 12345
 | 
			
		||||
dt = 1 # ns
 | 
			
		||||
t = np.arange(0, 10*int(1e3), dt)
 | 
			
		||||
frequency = 45e-3 # GHz
 | 
			
		||||
 | 
			
		||||
N = 5e2
 | 
			
		||||
 | 
			
		||||
t = np.arange(0, 10*int(1e3), dt, dtype=float)
 | 
			
		||||
rng = np.random.default_rng(seed)
 | 
			
		||||
 | 
			
		||||
phase_res = np.zeros(int(N))
 | 
			
		||||
 | 
			
		||||
# Vary both the base time and the phase
 | 
			
		||||
for i in range(int(N)):
 | 
			
		||||
    t_extra = (2*rng.uniform(size=1) - 1) *1e3
 | 
			
		||||
    t += t_extra
 | 
			
		||||
 | 
			
		||||
    phase = lib.phase_mod(np.pi*(2*rng.uniform(size=1) -1)) # rad
 | 
			
		||||
    beacon = lib.sine_beacon(frequency, t, t0=0, phase=phase)
 | 
			
		||||
 | 
			
		||||
    measured = lib.find_beacon_in_traces([beacon], t, frequency, frequency_fit=False)
 | 
			
		||||
 | 
			
		||||
    t -= t_extra
 | 
			
		||||
    phase_res[i] = lib.phase_mod(measured[1][0] - phase)
 | 
			
		||||
 | 
			
		||||
fig, ax = plt.subplots()
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue