Function to find closest frequency in frequency array. Returns closest value and position index.
(array, value)
| 1388 | |
| 1389 | |
| 1390 | def _find_nearest(array, value): |
| 1391 | """ |
| 1392 | Function to find closest frequency in frequency array. |
| 1393 | Returns closest value and position index. |
| 1394 | """ |
| 1395 | array = np.asarray(array) |
| 1396 | idx = (np.abs(array - value)).argmin() |
| 1397 | return array[idx], idx |
| 1398 | |
| 1399 | |
| 1400 | def _polygon_under_graph(xlist, ylist, Pmin): |