.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/const_cs/plot_const_cs.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_plot_const_cs.py: ConstCSModel ============ Plot various quantities for the constant sound speed model .. GENERATED FROM PYTHON SOURCE LINES 7-38 .. rst-class:: sphx-glr-horizontal * .. image-sg:: /auto_examples/const_cs/images/sphx_glr_plot_const_cs_001.png :alt: plot const cs :srcset: /auto_examples/const_cs/images/sphx_glr_plot_const_cs_001.png :class: sphx-glr-multi-img * .. image-sg:: /auto_examples/const_cs/images/sphx_glr_plot_const_cs_002.png :alt: $c_{s,s}^2=1/3, c_{s,b}^2=0.322$, $v_w=0.5, \alpha_n=0.2$ :srcset: /auto_examples/const_cs/images/sphx_glr_plot_const_cs_002.png :class: sphx-glr-multi-img * .. image-sg:: /auto_examples/const_cs/images/sphx_glr_plot_const_cs_003.png :alt: plot const cs :srcset: /auto_examples/const_cs/images/sphx_glr_plot_const_cs_003.png :class: sphx-glr-multi-img .. code-block:: Python import matplotlib.pyplot as plt import numpy as np from examples.utils import save from pttools.bubble import Bubble from pttools.models import ConstCSModel from pttools.analysis.plot_model import ModelPlot from pttools.ssmtools import NucType from pttools.omgw0 import Spectrum def main(): csb = 1 / np.sqrt(3) - 0.01 const_cs = ConstCSModel(a_s=1.5, a_b=1, css2=1/3, csb2=csb**2, V_s=1) model_plot = ModelPlot(const_cs, t_log=False, y_log=False) save(model_plot.fig, "const_cs.png") bubble = Bubble(const_cs, v_wall=0.5, alpha_n=0.2) bubble_fig = bubble.plot() save(bubble_fig, "const_cs_bubble.png") spectrum = Spectrum(bubble, nuc_type=NucType.EXPONENTIAL) spectrum_fig = spectrum.plot_multi() save(spectrum_fig, "const_cs_spectrum.png") if __name__ == "__main__": main() plt.show() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 4.627 seconds) **Estimated memory usage:** 271 MB .. _sphx_glr_download_auto_examples_const_cs_plot_const_cs.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_const_cs.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_const_cs.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_const_cs.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_