mirror of
https://gitlab.science.ru.nl/mthesis-edeboone/m-thesis-introduction.git
synced 2025-05-17 13:29:25 +02:00
ZH: move c_light value to lib
This commit is contained in:
parent
a4fa874b54
commit
3fce4036f3
4 changed files with 10 additions and 17 deletions
|
@ -6,6 +6,7 @@ import numpy as np
|
|||
from numpy.polynomial import Polynomial
|
||||
|
||||
from earsim import Antenna
|
||||
c_light = 3e8*1e-9 # m/ns
|
||||
|
||||
""" Beacon utils """
|
||||
def sine_beacon(f, t, t0=0, amplitude=1, baseline=0, phase=0):
|
||||
|
@ -34,13 +35,13 @@ def distance(x1, x2):
|
|||
|
||||
return np.sqrt( np.sum( (x1-x2)**2 ) )
|
||||
|
||||
def geometry_time(dist, x2=None, c_light=3e8):
|
||||
def geometry_time(dist, x2=None, c_light=c_light):
|
||||
if x2 is not None:
|
||||
dist = distance(dist, x2)
|
||||
|
||||
return dist/c_light
|
||||
|
||||
def beacon_from(tx, rx, f, t=0, t0=0, c_light=3e8, radiate_rsq=True, amplitude=1,**kwargs):
|
||||
def beacon_from(tx, rx, f, t=0, t0=0, c_light=c_light, radiate_rsq=True, amplitude=1,**kwargs):
|
||||
dist = distance(tx,rx)
|
||||
# suppress extra time delay from distance
|
||||
if c_light is not None and np.isfinite(c_light):
|
||||
|
@ -53,7 +54,7 @@ def beacon_from(tx, rx, f, t=0, t0=0, c_light=3e8, radiate_rsq=True, amplitude=1
|
|||
|
||||
return sine_beacon(f, t, t0=t0, amplitude=amplitude,**kwargs)
|
||||
|
||||
def remove_antenna_geometry_phase(tx, antennas, f_beacon, measured_phases=None, c_light=3e8):
|
||||
def remove_antenna_geometry_phase(tx, antennas, f_beacon, measured_phases=None, c_light=c_light):
|
||||
"""
|
||||
Remove the geometrical phase from the measured antenna phase.
|
||||
"""
|
||||
|
@ -110,7 +111,7 @@ def direct_fourier_transform(freqs, time, samplesets_iterable):
|
|||
# Numpy array
|
||||
return np.dot(c_k, samplesets_iterable), np.dot(s_k, samplesets_iterable)
|
||||
|
||||
def phase_field_from_tx(x, y, tx, f_beacon, c_light=3e8, t0=0, wrap_phase=True, return_meshgrid=True):
|
||||
def phase_field_from_tx(x, y, tx, f_beacon, c_light=c_light, t0=0, wrap_phase=True, return_meshgrid=True):
|
||||
"""
|
||||
"""
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ seed = 12345
|
|||
dt = 1 # ns
|
||||
frequency = 45e-3 # GHz
|
||||
N = 5e2
|
||||
c_light = 3e8*1e-9
|
||||
c_light = lib.c_light
|
||||
|
||||
t = np.arange(0, 10*int(1e3), dt, dtype=float)
|
||||
rng = np.random.default_rng(seed)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue