@@ -1326,7 +1326,7 @@ def _default_frequency_range(syslist, Hz=None, number_of_samples=None,
13261326 features_ = np .concatenate ((np .abs (sys .pole ()),
13271327 np .abs (sys .zero ())))
13281328 # Get rid of poles and zeros at the origin
1329- toreplace = features_ == 0.0
1329+ toreplace = np . isclose ( features_ , 0.0 )
13301330 if np .any (toreplace ):
13311331 features_ = features_ [~ toreplace ]
13321332 elif sys .isdtime (strict = True ):
@@ -1339,7 +1339,7 @@ def _default_frequency_range(syslist, Hz=None, number_of_samples=None,
13391339 # Get rid of poles and zeros on the real axis (imag==0)
13401340 # * origin and real < 0
13411341 # * at 1.: would result in omega=0. (logaritmic plot!)
1342- toreplace = (features_ .imag == 0.0 ) & (
1342+ toreplace = np . isclose (features_ .imag , 0.0 ) & (
13431343 (features_ .real <= 0. ) |
13441344 (np .abs (features_ .real - 1.0 ) < 1.e-10 ))
13451345 if np .any (toreplace ):
@@ -1360,15 +1360,13 @@ def _default_frequency_range(syslist, Hz=None, number_of_samples=None,
13601360
13611361 if Hz :
13621362 features /= 2. * math .pi
1363- features = np .log10 (features )
1364- lsp_min = np .floor (np .min (features ) - feature_periphery_decades )
1365- lsp_max = np .ceil (np .max (features ) + feature_periphery_decades )
1363+ features = np .log10 (features )
1364+ lsp_min = np .rint (np .min (features ) - feature_periphery_decades )
1365+ lsp_max = np .rint (np .max (features ) + feature_periphery_decades )
1366+ if Hz :
13661367 lsp_min += np .log10 (2. * math .pi )
13671368 lsp_max += np .log10 (2. * math .pi )
1368- else :
1369- features = np .log10 (features )
1370- lsp_min = np .floor (np .min (features ) - feature_periphery_decades )
1371- lsp_max = np .ceil (np .max (features ) + feature_periphery_decades )
1369+
13721370 if freq_interesting :
13731371 lsp_min = min (lsp_min , np .log10 (min (freq_interesting )))
13741372 lsp_max = max (lsp_max , np .log10 (max (freq_interesting )))
0 commit comments