From a50f6640a484ea31f67f58b10d3939c6bacbb9c1 Mon Sep 17 00:00:00 2001 From: Eric Teunis de Boone Date: Thu, 24 Mar 2022 15:10:06 +0100 Subject: [PATCH] Simu: distance sum over last axis --- simulations/lib/location/location.py | 2 +- simulations/lib/signals/signal.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/simulations/lib/location/location.py b/simulations/lib/location/location.py index 0480a9a..65e736a 100644 --- a/simulations/lib/location/location.py +++ b/simulations/lib/location/location.py @@ -5,7 +5,7 @@ def distance(x1, 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'): """ diff --git a/simulations/lib/signals/signal.py b/simulations/lib/signals/signal.py index 0da73c3..095dd65 100644 --- a/simulations/lib/signals/signal.py +++ b/simulations/lib/signals/signal.py @@ -53,7 +53,7 @@ class Signal(): if x_0 is None: 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): """