mirror of
				https://gitlab.science.ru.nl/mthesis-edeboone/m-thesis-introduction.git
				synced 2025-10-29 19:06:35 +01:00 
			
		
		
		
	Simu:8.1 Phase Delay finally working
This commit is contained in:
		
							parent
							
								
									657d1d1870
								
							
						
					
					
						commit
						95e3af3d94
					
				
					 2 changed files with 478 additions and 3 deletions
				
			
		
							
								
								
									
										13
									
								
								lib/util.py
									
										
									
									
									
								
							
							
						
						
									
										13
									
								
								lib/util.py
									
										
									
									
									
								
							|  | @ -47,13 +47,20 @@ def time2phase(time, frequency=1): | ||||||
| def phase2time(phase, frequency=1): | def phase2time(phase, frequency=1): | ||||||
|     return phase/(2*np.pi*frequency) |     return phase/(2*np.pi*frequency) | ||||||
| 
 | 
 | ||||||
| def time_roll(a, samplerate, time_shift, *roll_args, int_func=lambda x: np.rint(x).astype(int), **roll_kwargs): | def phase_modulo(phase, low=np.pi): | ||||||
|  |     """ | ||||||
|  |     Modulo phase such that it falls within the  | ||||||
|  |     interval $[-low, 2\pi - low)$. | ||||||
|  |     """ | ||||||
|  |     return (phase + low) % (2*np.pi) - low | ||||||
|  | 
 | ||||||
|  | def time_roll(a, samplerate, time_shift, sample_shift=0, int_func=lambda x: np.rint(x).astype(int), **roll_kwargs): | ||||||
|     """ |     """ | ||||||
|     Like np.roll, but use samplerate and time_shift to approximate |     Like np.roll, but use samplerate and time_shift to approximate | ||||||
|     the offset to roll. |     the offset to roll. | ||||||
|     """ |     """ | ||||||
|     shift = int_func(time_shift*samplerate) |     shift = int_func(time_shift*samplerate + sample_shift) | ||||||
|     return np.roll(a, shift, *roll_args, **roll_kwargs) |     return np.roll(a, shift, **roll_kwargs) | ||||||
| 
 | 
 | ||||||
| ### signal generation | ### signal generation | ||||||
| def fft_bandpass(signal, band, samplerate): | def fft_bandpass(signal, band, samplerate): | ||||||
|  |  | ||||||
							
								
								
									
										468
									
								
								simulations/08_find_beacon_phase_delay.ipynb
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										468
									
								
								simulations/08_find_beacon_phase_delay.ipynb
									
										
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue