Skip to content

Speed up quad sus tf calculation 10x, by pre-solving the system symbolically

Christopher Wipf requested to merge fast-susp-tf into master

Profiling of precompIFO() before this change:

%timeit gwinc.precompIFO(freq, ifo)

404 ms ± 24 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)

%prun ifo2 = gwinc.precompIFO(freq, ifo)

      693645 function calls (693211 primitive calls) in 0.833 seconds

Ordered by: internal time

ncalls  tottime  percall  cumtime  percall filename:lineno(function)
 30000    0.362    0.000    0.695    0.000 linalg.py:319(solve)
    10    0.083    0.008    0.778    0.078 suspension.py:39(calc_transfer_functions)
 30008    0.065    0.000    0.109    0.000 linalg.py:141(_commonType)
 30018    0.056    0.000    0.056    0.000 {method 'astype' of 'numpy.ndarray' objects}
 60012    0.046    0.000    0.098    0.000 linalg.py:108(_makearray)
 etc, etc

And after:

%timeit gwinc.precompIFO(freq, ifo)

28.6 ms ± 4.87 ms per loop (mean ± std. dev. of 7 runs, 10 loops each)

%prun ifo2 = gwinc.precompIFO(freq, ifo)

      3596 function calls (3162 primitive calls) in 0.032 seconds

Ordered by: internal time

ncalls  tottime  percall  cumtime  percall filename:lineno(function)
    74    0.016    0.000    0.016    0.000 coatingthermal.py:743(getCoatRefl)
    10    0.006    0.001    0.006    0.001 suspension.py:30(tst_force_to_tst_displ)
     1    0.005    0.005    0.012    0.012 suspension.py:51(suspQuad)
   137    0.001    0.000    0.001    0.000 {built-in method numpy.core.multiarray.zeros}
     2    0.001    0.000    0.001    0.000 suspension.py:40(top_displ_to_tst_displ)
etc, etc

Merge request reports