Simu: distance sum over last axis

This commit is contained in:
Eric Teunis de Boone 2022-03-24 15:10:06 +01:00
parent 99cd7264f0
commit a50f6640a4
2 changed files with 2 additions and 2 deletions

View file

@ -5,7 +5,7 @@ def distance(x1, x2):
""" """
Calculate the Euclidean distance between two locations x1 and x2 Calculate the Euclidean distance between two locations x1 and x2
""" """
return np.sqrt( np.sum( (x1 - x2)**2, axis=0) ) return np.sqrt( np.sum( (x1 - x2)**2, axis=-1) )
def plot_geometry(ax, emitters=[], antennae=[], unit='m'): def plot_geometry(ax, emitters=[], antennae=[], unit='m'):
""" """

View file

@ -53,7 +53,7 @@ class Signal():
if x_0 is None: if x_0 is None:
x_0 = self.x_0 x_0 = self.x_0
return np.sum(np.sqrt( (x_f - x_0)**2 )/velocity) return np.sqrt( np.sum((x_f - x_0)**2, axis=-1) )/velocity
def temporal_time_offset(self, t_f, t_0=None): def temporal_time_offset(self, t_f, t_0=None):
""" """