Speed up quad sus tf calculation 10x, by pre-solving the system symbolically
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
Activity
By the way, the next biggest hog is the TF products in
quantum.py
:%timeit gwinc.noise_calc(ifo2, freq) 40613 function calls in 0.181 seconds Ordered by: internal time ncalls tottime percall cumtime percall filename:lineno(function) 21000 0.074 0.000 0.074 0.000 {built-in method numpy.core.multiarray.dot} 7 0.056 0.008 0.137 0.020 quantum.py:409(getProdTF) 1 0.020 0.020 0.088 0.088 quantum.py:257(shotradSignalRecycled) 2 0.007 0.003 0.007 0.003 coatingthermal.py:446(getCoatTOPhase) 6 0.004 0.001 0.005 0.001 coatingthermal.py:234(getCoatThickCorr) 9003 0.003 0.000 0.003 0.000 {method 'squeeze' of 'numpy.ndarray' objects}
mentioned in merge request !32 (merged)
Can you add whatever notebook you used or a pdf/html rendering of it into the doc directory?
It seems if we are going to use generated code/math we should have the ability to regenerate it, as it is otherwise much more opaque. I don't think it needs to be particularly clean or documented, and it can be some work for someone to attempt to run it again, but "the code behind the code" seems like a good thing to include.
Again, I'll try to check this out and merge soon.
added 1 commit
- 4555bfc8 - Include sus TF generating code -- now we're ready for the quintuple pendulum
added 4 commits
-
4555bfc8...ea42d0c6 - 2 commits from branch
master
- cc89719d - Speed up quad sus tf calculation 10x, by pre-solving the system symbolically
- 442ac0b7 - Include sus TF generating code -- now we're ready for the quintuple pendulum
-
4555bfc8...ea42d0c6 - 2 commits from branch
mentioned in commit e9aabda9