# Threshold for CAF Surface

I am calculating a time partitioned Cross Ambiguity Function (CAF) by adding the surfaces of different time-sectioned CAFs together. Meaning, I calculate a CAF using 10 seconds of IQ data, calculate a second CAF using another 10 seconds of IQ data, square the values and add the signals together.

If I have a single CAF surface, I identify a peak by applying an SNR threshold of 18dB to the surface. 18dB is a rule of thumb saying that we are 99% (or some high value) sure the peak is a signal peak instead of a noise peak.

The noise on the CAF surface is a Chi-Squared distribution with 2 degrees of freedom. I am assuming the second CAF's noise is uncorrelated with the first CAF's noise. The noise floor variance and the CAF peak's variance will decrease as I add surfaces together. The below illustrates my thought process so far.

How much can I decrease the threshold value I am using for 1 surface when I add N surfaces together and still maintain my probability of False Alarm? Is it simply a matter of experimenting with different threshold values?

from scipy.stats import chi2
import matplotlib.pyplot as plt
import numpy as np
from matplotlib import style

num_integrations = np.arange(1, 4)
threshold = 18  # dB
un_db = 10**(threshold/20)

deg_of_freedom = 2

num_values = int(1e7)

output = np.zeros((1, num_values))
prob_above_thresh = []
non_noise_prob = []
for index in num_integrations:
print('Integrations:', index)
values = chi2.rvs(deg_of_freedom, size=num_values)
output = output + values

mean = np.average(output)
above_thresh = (np.asarray(output/mean) > un_db).sum()

prob_above_thresh.append(above_thresh/num_values)
non_noise_prob.append((1 - prob_above_thresh[-1])*100)
print('Probability non-noise peak =', non_noise_prob[-1], '%')

# make plot
fig, ax = plt.subplots(1, 1)
plt.title('Probability non-noise peak')
plt.plot(num_integrations, non_noise_prob)
plt.grid()
plt.show()