mirror of
				https://gitlab.science.ru.nl/mthesis-edeboone/m-thesis-introduction.git
				synced 2025-10-31 03:46:44 +01:00 
			
		
		
		
	ZH: findks: let function determine shifts irrespective of sampling
This commit is contained in:
		
							parent
							
								
									581b83ac5b
								
							
						
					
					
						commit
						9f610ab2e7
					
				
					 1 changed files with 8 additions and 4 deletions
				
			
		|  | @ -20,7 +20,7 @@ import aa_generate_beacon as beacon | |||
| import lib | ||||
| from lib import rit | ||||
| 
 | ||||
| def find_best_sample_shifts_summing_at_location(test_loc, antennas, allowed_sample_shifts, dt=None, sample_shift_first_trace=0, plot_iteration_with_shifted_trace=None, fig_dir=None, fig_distinguish=None): | ||||
| def find_best_period_shifts_summing_at_location(test_loc, antennas, allowed_ks, period=1, dt=None, period_shift_first_trace=0, plot_iteration_with_shifted_trace=None, fig_dir=None, fig_distinguish=None): | ||||
|     """ | ||||
|     Find the best sample_shift for each antenna by summing the antenna traces | ||||
|     and seeing how to get the best alignment. | ||||
|  | @ -41,6 +41,9 @@ def find_best_sample_shifts_summing_at_location(test_loc, antennas, allowed_samp | |||
|         else: | ||||
|             plot_iteration_with_shifted_trace = [] | ||||
| 
 | ||||
|     allowed_sample_shifts = np.rint(allowed_ks * period /dt).astype(int) | ||||
|     sample_shift_first_trace = np.rint(period_shift_first_trace * period/dt).astype(int) | ||||
| 
 | ||||
|     # propagate to test location | ||||
|     for i, ant in enumerate(antennas): | ||||
|         aloc = [ant.x, ant.y, ant.z] | ||||
|  | @ -338,8 +341,7 @@ if __name__ == "__main__": | |||
| 
 | ||||
|     # determine allowable ks per location | ||||
|     dt = ev.antennas[0].t_AxB[1] - ev.antennas[0].t_AxB[0] | ||||
|     allowed_sample_shifts = np.rint(allowed_ks/f_beacon /dt).astype(int) | ||||
|     print("Checking:", allowed_ks, ": shifts :", allowed_sample_shifts) | ||||
|     print("Checking k:", allowed_ks) | ||||
| 
 | ||||
|     ## | ||||
|     ## Determine grid positions | ||||
|  | @ -411,7 +413,9 @@ if __name__ == "__main__": | |||
|             yy.append(y_+yoff) | ||||
| 
 | ||||
|             # Find best k for each antenna | ||||
|             shifts, maximum = find_best_sample_shifts_summing_at_location(test_loc, ev.antennas, allowed_sample_shifts, dt=dt, fig_dir=tmp_fig_subdir, plot_iteration_with_shifted_trace=[ 5, len(ev.antennas)-1], fig_distinguish=f"run{r}.") | ||||
|             shifts, maximum = find_best_period_shifts_summing_at_location(test_loc, ev.antennas, allowed_ks, period=1/f_beacon, dt=dt, | ||||
|                     plot_iteration_with_shifted_trace=[ 5, len(ev.antennas)-1], | ||||
|                     fig_dir=tmp_fig_subdir, fig_distinguish=f"run{r}.") | ||||
| 
 | ||||
|             # Translate sample shifts back into period multiple k | ||||
|             ks = np.rint(shifts*f_beacon*dt) | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue