@@ -134,6 +134,8 @@ def cssm(
134134 angle_grids ,
135135 pre_estimate ,
136136 fre_ref = None ,
137+ f_min = None ,
138+ f_max = None ,
137139 unit = "deg" ,
138140):
139141 """Coherent Signal Subspace Method (CSSM) for wideband DOA estimation.
@@ -148,6 +150,8 @@ def cssm(
148150 pre_estimate: pre-estimated angles
149151 fre_ref: reference frequency. If it's not provided the frequency point
150152 with the maximum power will be used.
153+ f_min : Minimum frequency of interest. Defaults to None.
154+ f_max : Maximum frequency of interest. Defaults to None.
151155 unit : Unit of angle, 'rad' for radians, 'deg' for degrees. Defaults to
152156 'deg'.
153157
@@ -162,8 +166,18 @@ def cssm(
162166 pre_estimate = pre_estimate .reshape (1 , - 1 )
163167
164168 # Divide the received signal into multiple frequency points
165- signal_fre_bins = np .fft .fft (received_data , axis = 1 )
166- fre_bins = np .fft .fftfreq (num_snapshots , 1 / fs )
169+ delta_f = fs / num_snapshots
170+ # there is a little trick to use as wider frequency range as possible
171+ idx_f_min = max (int (f_min / delta_f ) - 1 , 0 ) if f_min is not None else 0
172+ idx_f_max = (
173+ min (int (f_max / delta_f ) + 1 , num_snapshots // 2 )
174+ if f_max is not None
175+ else num_snapshots // 2
176+ )
177+ signal_fre_bins = np .fft .fft (received_data , axis = 1 )[
178+ :, idx_f_min : idx_f_max + 1
179+ ]
180+ fre_bins = np .fft .fftfreq (num_snapshots , 1 / fs )[idx_f_min : idx_f_max + 1 ]
167181
168182 if fre_ref is None :
169183 # Find the frequency point with the maximum power
0 commit comments