Skip to content

Commit 467deec

Browse files
committed
Refactor receiver channel addition API
Updated Receiver.AddChannel to accept explicit antenna and pattern parameters instead of RxChannel. Refactored cp_radarsimc.pyx to match the new API, removing RxChannel usage and updating channel addition logic for improved clarity and flexibility.
1 parent a51b14f commit 467deec

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

src/radarsimpy/includes/radarsimc.pxd

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,13 @@ cdef extern from "receiver.hpp":
253253
const T & baseband_gain, # Baseband gain (dB)
254254
const T & baseband_bw) except + # Baseband bandwidth (Hz)
255255

256-
void AddChannel(const RxChannel[T] & channel) # Add receiver channel
256+
void AddChannel(const Vec3[T] & location, # Antenna location
257+
const Vec3[cpp_complex[T]] & polar, # Polarization vector
258+
const vector[T] & phi, # Azimuth angle array
259+
const vector[T] & phi_ptn, # Azimuth pattern
260+
const vector[T] & theta, # Elevation angle array
261+
const vector[T] & theta_ptn, # Elevation pattern
262+
const T & antenna_gain) # Antenna gain (dB)
257263

258264
#------------------------------------------------------------------------------
259265
# Radar System Configuration

src/radarsimpy/lib/cp_radarsimc.pyx

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,9 @@ from libcpp.memory cimport shared_ptr, make_shared
3232

3333
# Local imports
3434
from radarsimpy.includes.radarsimc cimport (
35-
Transmitter, Receiver, TxChannel, RxChannel,
36-
Radar, TargetsManager, PointsManager, Mem_Copy, Mem_Copy_Vec3,
35+
Transmitter, Receiver,
36+
Radar, TargetsManager, PointsManager,
37+
Mem_Copy, Mem_Copy_Vec3,
3738
Mem_Copy_Complex, IsFreeTier
3839
)
3940
from radarsimpy.includes.rsvector cimport Vec3
@@ -457,8 +458,7 @@ cdef void cp_AddTxChannel(tx, tx_idx, Transmitter[double, float_t] * tx_c):
457458
@cython.cdivision(True)
458459
@cython.boundscheck(False)
459460
@cython.wraparound(False)
460-
cdef RxChannel[float_t] cp_RxChannel(rx,
461-
rx_idx):
461+
cdef void cp_AddRxChannel(rx, rx_idx, Receiver[float_t] * rx_c):
462462
"""
463463
cp_RxChannel(rx, rx_idx)
464464
@@ -516,7 +516,7 @@ cdef RxChannel[float_t] cp_RxChannel(rx,
516516
polar = rx.rxchannel_prop["polarization"][rx_idx]
517517
cdef Vec3[cpp_complex[float_t]] polarization_vt = Vec3[cpp_complex[float_t]](cpp_complex[float_t](np.real(polar[0]), np.imag(polar[0])), cpp_complex[float_t](np.real(polar[1]), np.imag(polar[1])), cpp_complex[float_t](np.real(polar[2]), np.imag(polar[2])))
518518
# cdef float_t[:] polarization_mv = rx.rxchannel_prop["polarization"][rx_idx].astype(np_float)
519-
return RxChannel[float_t](
519+
rx_c[0].AddChannel(
520520
Vec3[float_t](&location_mv[0]),
521521
polarization_vt,
522522
az_ang_vt,
@@ -634,9 +634,7 @@ cdef shared_ptr[Radar[double, float_t]] cp_Radar(radar, frame_start_time):
634634
<float_t> radar.radar_prop["receiver"].bb_prop["noise_bandwidth"]
635635
)
636636
for idx_c in range(0, rxsize_c):
637-
rx_c.get()[0].AddChannel(
638-
cp_RxChannel(radar.radar_prop["receiver"], idx_c)
639-
)
637+
cp_AddRxChannel(radar.radar_prop["receiver"], idx_c, rx_c.get())
640638

641639
"""
642640
Radar

0 commit comments

Comments
 (0)