I have 10 channels with each channel corresponding to a frequency: Ch Freq (Khz) 01 155.00 02 165.00 03 175.00 04 185.00 05 195.00 06 205.00 07 215.00 08 225.00 09 235.00 10 245.00 Each channel is actually 10 Khz wide, so anything between 150-160 Khz is on channel 01, 160-170 is 02 etc I also have an fft: np.fft.fftshift(np.fft.fftfreq(102, 1/102.4)) + 200 This gives me a 102 bin numpy array between 150 and 250 Khz and gives just over 10 "bins" of the array per 10 Khz of channel bandwidth. f=array([148.8, 149.803, 150.807. 151.811 ... 249.192, 250.196]) This means to get a frequency from a index is trivial f[index]. Question: Given an array of frequencies freqs=[165, 205] and an array of fft indexes, i.e peaks=[13, 54, 33, 42] - how do I remove from peaks any indexes that are not one of the indexes which maps to a frequency in freqs? In the example above 165 Khz, Channel 02 actually covers 160-170 Khz, which is going to correspond to approximately fft indexes 10-20. 205 Khz will correspond approximately to fft indexes 50-60. Working from the example above in the peaks array indexes 13 and 54 would remain, but 33 and 42 would not since those numbers do not fall into the range of indexes corresponding to either freq 165 Khz or 205 Khz. Note: the fft bins don't necessarily end exactly on a channel boundary. Continue reading...