... | @@ -188,4 +188,31 @@ The function calls are timed for 5000 iterations using PyInstrument to determine |
... | @@ -188,4 +188,31 @@ The function calls are timed for 5000 iterations using PyInstrument to determine |
|
|
|
|
|
In `frequency_domain_strain`, `lal_binary_black_hole` is replaced with `binary_black_hole_roq`, which gives a 3.8x speedup. However, calculating the SNRs in `calculate_snrs` is only 1.4x faster. This limits the speedup, since `calculate_snrs` accounts for over twice as much time as `frequency_domain_strain`.
|
|
In `frequency_domain_strain`, `lal_binary_black_hole` is replaced with `binary_black_hole_roq`, which gives a 3.8x speedup. However, calculating the SNRs in `calculate_snrs` is only 1.4x faster. This limits the speedup, since `calculate_snrs` accounts for over twice as much time as `frequency_domain_strain`.
|
|
|
|
|
|
The majority of this time is spent initialising and calling SciPy's `interp1d`. Cubic splines are used for calibration, has a cost comparable to computing the waveform itself. Disabling calibration results in a much faster run time. |
|
The majority of this time is spent initialising and calling SciPy's `interp1d`. Cubic splines are used for calibration, has a cost comparable to computing the waveform itself. Disabling calibration speeds up the run time by a factor of 2-3x.
|
|
\ No newline at end of file |
|
|
|
|
|

|
|
|
|
|
|
|
|
Disabling calibration eliminates two out of three calls to `interp1d`. The remaining call is
|
|
|
|
```
|
|
|
|
d_inner_h = interp1d(
|
|
|
|
self.weights['time_samples'][indices],
|
|
|
|
d_inner_h_tc_array, kind='cubic', assume_sorted=True)(ifo_time)
|
|
|
|
```
|
|
|
|
When interpolating 5 points, linear interpolation is 2.4x faster. Using NumPy's linear interpolation function instead is 70x faster.
|
|
|
|
|
|
|
|
```
|
|
|
|
In [1]: x = np.arange(5)
|
|
|
|
|
|
|
|
In [2]: y = np.sin(x)
|
|
|
|
|
|
|
|
In [3]: %timeit interp1d(x, y, kind = 'linear', assume_sorted=True)(2.22)
|
|
|
|
63.5 µs ± 1.83 µs per loop (mean ± std. dev. of 7 runs, 10000 loops each)
|
|
|
|
|
|
|
|
In [4]: %timeit interp1d(x, y, kind = 'cubic', assume_sorted=True)(2.22)
|
|
|
|
157 µs ± 4.41 µs per loop (mean ± std. dev. of 7 runs, 10000 loops each)
|
|
|
|
|
|
|
|
In [5]: %timeit np.interp(2.22, x, y)
|
|
|
|
2.25 µs ± 20.6 ns per loop (mean ± std. dev. of 7 runs, 100000 loops each)
|
|
|
|
```
|
|
|
|
|
|
|
|
The average error in magnitude of `d_inner_h` when using linear interpolation is 0.1%, and max error is 3.7%. |
|
|
|
\ No newline at end of file |