.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/basic/basic.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_basic.py: Basic usage =========== Plot a single bubble .. GENERATED FROM PYTHON SOURCE LINES 7-37 .. rst-class:: sphx-glr-horizontal * .. image-sg:: /auto_examples/basic/images/sphx_glr_basic_001.png :alt: Bag, $a_s=1.031, a_b=1.000, V_s=1.000, V_b=0.000$, $v_w=0.5, \alpha_n=0.2$ :srcset: /auto_examples/basic/images/sphx_glr_basic_001.png :class: sphx-glr-multi-img * .. image-sg:: /auto_examples/basic/images/sphx_glr_basic_002.png :alt: basic :srcset: /auto_examples/basic/images/sphx_glr_basic_002.png :class: sphx-glr-multi-img .. code-block:: Python import matplotlib.pyplot as plt from examples.utils import save from pttools.bubble import Bubble from pttools.models import BagModel from pttools.ssmtools import NucType from pttools.omgw0 import Spectrum def main(): # Create the equation of state. # If you don't specify a_s and a_b or g_s and g_b, # you have to specify a minimum alpha_n for which the model will be valid. model = BagModel(alpha_n_min=0.01) # Create and simulate the fluid profile of a bubble. bubble = Bubble(model, v_wall=0.5, alpha_n=0.2) bubble_fig = bubble.plot() save(bubble_fig, "bag_bubble.png") # Compute the gravitational wave spectrum for the bubble. spectrum = Spectrum(bubble, nuc_type=NucType.EXPONENTIAL) spectrum_fig = spectrum.plot_multi() save(spectrum_fig, "bag_spectrum.png") if __name__ == "__main__": main() plt.show() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 40.448 seconds) **Estimated memory usage:** 608 MB .. _sphx_glr_download_auto_examples_basic_basic.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: basic.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: basic.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: basic.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_