.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/const_cs/const_cs_testing.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_const_cs_const_cs_testing.py: ConstCSModel testing ==================== Simple testing for the constant sound speed model .. GENERATED FROM PYTHON SOURCE LINES 7-37 .. rst-class:: sphx-glr-horizontal * .. image-sg:: /auto_examples/const_cs/images/sphx_glr_const_cs_testing_001.png :alt: $c_{s,s}^2=1/3, c_{s,b}^2=0.323$, $v_w=0.5, \alpha_n=0.2$ :srcset: /auto_examples/const_cs/images/sphx_glr_const_cs_testing_001.png :class: sphx-glr-multi-img * .. image-sg:: /auto_examples/const_cs/images/sphx_glr_const_cs_testing_002.png :alt: const cs testing :srcset: /auto_examples/const_cs/images/sphx_glr_const_cs_testing_002.png :class: sphx-glr-multi-img .. rst-class:: sphx-glr-script-out .. code-block:: none Bubble and spectrum computation took 2.3646296649967553 s | .. code-block:: Python import time import matplotlib.pyplot as plt from pttools.bubble import Bubble from pttools.models import ConstCSModel from pttools.omgw0 import Spectrum # Specify the equation of state const_cs = ConstCSModel( a_s=1.5, a_b=1, css2=1/3, csb2=1/3-0.01, V_s=1 ) # Create a bubble and solve its fluid profile bubble = Bubble(const_cs, v_wall=0.5, alpha_n=0.2) # Compute gravitational wave spectrum for the bubble spectrum = Spectrum(bubble) bubble.plot() spectrum.plot_multi() # Performance testing, now that the model is initialised start_time = time.perf_counter() bubble2 = Bubble(const_cs, v_wall=0.45, alpha_n=0.2) spectrum2 = Spectrum(bubble2) print(f"Bubble and spectrum computation took {time.perf_counter() - start_time} s") plt.show() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 6.902 seconds) **Estimated memory usage:** 264 MB .. _sphx_glr_download_auto_examples_const_cs_const_cs_testing.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: const_cs_testing.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: const_cs_testing.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: const_cs_testing.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_