commit 4c724153aee45f424e5628508317387ee4e7c8e9
parent 44ce2d83110a7e281849b1ec43f1e812ecca2edd
Author: Egor Achkasov <eaachkasov@edu.hse.ru>
Date: Tue, 14 Jan 2025 22:57:57 +0100
Add sampling_frequency arg; Add a 0 init
Diffstat:
5 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/compute_paths.c b/compute_paths.c
@@ -384,6 +384,7 @@ void compute_paths(
IN const float *rx_velocities, /* shape (num_rx, 3) */
IN const float *tx_velocities, /* shape (num_tx, 3) */
IN float carrier_frequency, /* > 0.0 (IN GHz!) */
+ IN float sampling_frequency, /* > 0.0 (IN Hz!) */
IN size_t num_rx, /* number of receivers */
IN size_t num_tx, /* number of transmitters */
IN size_t num_paths, /* number of paths */
@@ -504,6 +505,12 @@ void compute_paths(
}
free(h);
+ /* Init a */
+ for (size_t i = 0; i < num_rx * num_tx * num_paths; ++i) {
+ a_te_re[i] = a_te_im[i] = 0.f;
+ a_tm_re[i] = a_tm_im[i] = 0.f;
+ }
+
/* Do the final propagations from the final hit points
* directly to the receivers.
* Also broadcast the gains and delays to rx
diff --git a/compute_paths.h b/compute_paths.h
@@ -16,6 +16,7 @@
* \param rx_velocities receiver velocities, shape (num_rx, 3)
* \param tx_velocities transmitter velocities, shape (num_tx, 3)
* \param carrier_frequency carrier frequency in GHz. Must be > 0.0
+ * \param sampling_frequency sampling frequency in Hz. Must be > 0.0
* \param num_rx number of receivers. Must be > 0
* \param num_tx number of transmitters. Must be > 0
* \param num_paths number of paths to compute. Must be > 0
@@ -34,6 +35,7 @@ void compute_paths(
IN const float *rx_velocities, /* shape (num_rx, 3) */
IN const float *tx_velocities, /* shape (num_tx, 3) */
IN float carrier_frequency, /* > 0.0 (IN GHz!) */
+ IN float sampling_frequency, /* > 0.0 (IN Hz!) */
IN size_t num_rx, /* number of receivers */
IN size_t num_tx, /* number of transmitters */
IN size_t num_paths, /* number of paths */
diff --git a/compute_paths_pybind11.cpp b/compute_paths_pybind11.cpp
@@ -22,6 +22,7 @@ compute_paths_wrapper(
py::array_t<float> rx_velocities,
py::array_t<float> tx_velocities,
float carrier_frequency,
+ float sampling_frequency,
int num_rx,
int num_tx,
int num_paths,
@@ -49,6 +50,7 @@ compute_paths_wrapper(
(const float*)rx_vel_info.ptr, // Rx velocities
(const float*)tx_vel_info.ptr, // Tx velocities
carrier_frequency, // Carrier frequency in GHz
+ sampling_frequency, // Sampling frequency in Hz
(size_t)num_rx,
(size_t)num_tx,
(size_t)num_paths,
@@ -89,6 +91,7 @@ PYBIND11_MODULE(rt, m) {
py::arg("rx_velocities"),
py::arg("tx_velocities"),
py::arg("carrier_frequency"),
+ py::arg("sampling_frequency"),
py::arg("num_rx"),
py::arg("num_tx"),
py::arg("num_paths"),
diff --git a/test.c b/test.c
@@ -15,6 +15,7 @@ int main(int argc, char **argv)
float rx_velocities[3] = {0.0, 0.0, 0.0};
float tx_velocities[3] = {0.0, 0.0, 0.0};
float carrier_frequency = 3.0; /* 3 GHz */
+ float sampling_frequency = 3*1e9; /* 3 GHz */
size_t num_rx = 1;
size_t num_tx = 1;
size_t num_paths = 10000;
@@ -32,6 +33,7 @@ int main(int argc, char **argv)
rx_velocities,
tx_velocities,
carrier_frequency,
+ sampling_frequency,
num_rx, num_tx, num_paths, num_bounces, num_samples,
a_te_re, a_te_im, a_tm_re, a_tm_im,
tau);
diff --git a/test.py b/test.py
@@ -8,6 +8,7 @@ tx_positions = np.array([[0., 0., 2.5]], dtype=np.float64)
rx_velocities = np.array([[0., 0., 0.]], dtype=np.float64)
tx_velocities = np.array([[0., 0., 0.]], dtype=np.float64)
carrier_frequency = 3.0
+sampling_rate = 3*1e9
num_rx = 1
num_tx = 1
num_paths = 10000
@@ -22,6 +23,7 @@ a_te_re, a_te_im, a_tm_re, a_tm_im, tau = compute_paths(
rx_velocities,
tx_velocities,
carrier_frequency,
+ sampling_rate,
num_rx,
num_tx,
num_paths,