.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/basic/plot_spectra.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_basic_plot_spectra.py: Plot multiple spectra ===================== Plot the velocity and GW spectra of multiple bubbles .. GENERATED FROM PYTHON SOURCE LINES 7-42 .. image-sg:: /auto_examples/basic/images/sphx_glr_plot_spectra_001.png :alt: plot spectra :srcset: /auto_examples/basic/images/sphx_glr_plot_spectra_001.png :class: sphx-glr-single-img .. code-block:: Python import matplotlib.pyplot as plt from examples import utils from pttools.analysis import plot_spectra from pttools.bubble import Bubble from pttools.models import BagModel, ConstCSModel from pttools.omgw0 import Spectrum def main() -> plt.Figure: # Create the equations of state model1 = BagModel(alpha_n_min=0.1) # Instead of giving alpha_n_min you can give a_s, a_b and V_s to specify a model. model2 = ConstCSModel( css2=1/4, # speed of sound in the symmetric phase csb2=1/3, # speed of sound in the broken phase a_s=1.5, # degrees of freedom coefficient for the equation of state in the symmetric phase a_b=1, # degrees of freedom coefficient for the equation of state in the broken phase V_s=1 # potential in the symmetric phase ) # Create the bubbles bubbles = [ Bubble(model1, v_wall=0.5, alpha_n=0.2), Bubble(model2, v_wall=0.5, alpha_n=0.2) ] # Convert the bubbles to GW spectra spectra = [Spectrum(bubble) for bubble in bubbles] return plot_spectra(spectra) if __name__ == "__main__": fig = main() utils.save_and_show(fig, "spectra.png") .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 4.172 seconds) **Estimated memory usage:** 271 MB .. _sphx_glr_download_auto_examples_basic_plot_spectra.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_spectra.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_spectra.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_spectra.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_