Skip to content

Commit

Permalink
protected against divide by zero issues with zero input signal
Browse files Browse the repository at this point in the history
  • Loading branch information
drowe67 committed Jan 9, 2025
1 parent 745686f commit 0530eea
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion radae/dsp.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ def update_snr_est(self, rx_sym_pilots, rx_pilots):
rx_phase = torch.angle(rx_pilots[0,:])
Rcn_hat = Pcn_hat * torch.exp(-1j*rx_phase)
S1 = torch.sum(torch.abs(Pcn_hat)**2)
S2 = torch.sum(torch.abs(Rcn_hat.imag)**2)
S2 = torch.sum(torch.abs(Rcn_hat.imag)**2) + 1E-12
snr_est = S1/(2*S2) - 1
# remove occasional illegal values
if snr_est <= 0:
Expand Down

0 comments on commit 0530eea

Please sign in to comment.