
.. DO NOT EDIT.
.. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY.
.. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE:
.. "auto_examples/misc/plot_SimpleTest1_BaF.py"
.. LINE NUMBERS ARE GIVEN BELOW.

.. only:: html

    .. note::
        :class: sphx-glr-download-link-note

        :ref:`Go to the end <sphx_glr_download_auto_examples_misc_plot_SimpleTest1_BaF.py>`
        to download the full example code.

.. rst-class:: sphx-glr-example-title

.. _sphx_glr_auto_examples_misc_plot_SimpleTest1_BaF.py:


Simple Test 1 - BaF
===================

.. GENERATED FROM PYTHON SOURCE LINES 6-30

.. code-block:: Python


    from MoleCool import System, np
    system = System(description='SimpleTest1_BaF',load_constants='138BaF')

    # set up the lasers each with four sidebands
    for lamb in np.array([859.830, 895.699, 897.961])*1e-9:
        system.lasers.add_sidebands(lamb=lamb,P=20e-3,pol='lin',
                                    offset_freq=19e6,mod_freq=39.33e6,
                                    sidebands=[-2,-1,1,2],ratios=[0.8,1,1,0.8])

    # set up the ground and excited states and include all vibrational levels
    # up to the ground state vibrational level v=2
    system.levels.add_electronicstate('X','gs') #add ground state X
    system.levels.X.load_states(v=[0,1,2]) #loading the states defined in the json file
    system.levels.X.add_lossstate()

    system.levels.add_electronicstate('A','exs') #add excited state A
    system.levels.A.load_states(v=[0,1])

    system.levels.print_properties() #check the imported properties from the json file

    # Alternatively, all these steps for the levels can be done simpler with:
    # system.levels.add_all_levels(v_max=2)





.. rst-class:: sphx-glr-script-out

 .. code-block:: none

    System is created with description: SimpleTest1_BaF
    /home/docs/checkouts/readthedocs.org/user_builds/molecool-py/checkouts/latest/MoleCool/Levelsystem.py:1229: UserWarning: No pre-defined states found for electronic state X with: v=1
    ...instead the same states as for v=0 were imported!
      warnings.warn(text+'\n...instead the same states as for v=0 were imported!')
    /home/docs/checkouts/readthedocs.org/user_builds/molecool-py/checkouts/latest/MoleCool/Levelsystem.py:1229: UserWarning: No pre-defined states found for electronic state X with: v=2
    ...instead the same states as for v=0 were imported!
      warnings.warn(text+'\n...instead the same states as for v=0 were imported!')
    /home/docs/checkouts/readthedocs.org/user_builds/molecool-py/checkouts/latest/MoleCool/Levelsystem.py:1229: UserWarning: No pre-defined states found for electronic state A with: v=1
    ...instead the same states as for v=0 were imported!
      warnings.warn(text+'\n...instead the same states as for v=0 were imported!')
    ****************************************
    ************* Levelsystem **************
    ****************************************

    mass (in u): 157.0

    ++++++++++++ level-specific ++++++++++++

    -------------------X--------------------

    g-factors:
    gs  v    N    J    F
    X   0.0  1.0  0.5  1   -0.5096
                       0    0.0000
                  1.5  1    0.9964
                       2    0.5005
    dtype: float64

    frequencies (in MHz):
    gs  v    N    J    F
    X   0.0  1.0  0.5  1   -94.9467
                       0   -67.0111
                  1.5  1    22.5475
                       2    56.5648
    dtype: float64

    -------------------A--------------------

    g-factors:
    exs  v    J    F
    A    0.0  0.5  0    0.0000
                   1   -0.1859
    dtype: float64

    frequencies (in MHz):
    exs  v    J    F
    A    0.0  0.5  0   -17.131
                   1     0.000
    dtype: float64

    Gamma (in MHz):
    exs A 2.8421

    +++++++++ transition-specific ++++++++++

    transition dipole moments:
         A
    X  1.0

    -----------------X <- A-----------------

    dipole matrix:
    exs                         A                              
    v                         0.0                              
    J                         0.5                              
    F                           0         1                    
    mF                          0        -1         0         1
    gs v   N   J   F mF                                        
    X  0.0 1.0 0.5 1 -1 -0.359064  0.499278  0.499278 -0.000000
                      0  0.359064 -0.499278  0.000000  0.499278
                      1 -0.359064 -0.000000 -0.499278 -0.499278
                   0  0  0.000000 -0.470748 -0.470748 -0.470748
               1.5 1 -1  0.452113  0.026856  0.026856 -0.000000
                      0 -0.452113 -0.026856  0.000000  0.026856
                      1  0.452113 -0.000000 -0.026856 -0.026856
                   2 -2  0.000000 -0.408703  0.000000 -0.000000
                     -1  0.000000  0.288997 -0.288997 -0.000000
                      0  0.000000 -0.166852  0.333704 -0.166852
                      1  0.000000 -0.000000 -0.288997  0.288997
                      2  0.000000 -0.000000  0.000000 -0.408703

    vibrational branching:
    exs              A                  
    v                0        1        2
    gs v                                
    X  0  9.674800e-01  0.04107  0.00050
       1  3.164000e-02  0.89385  0.08245
       2  8.700000e-04  0.06238  0.81959
       3  9.760000e-06  0.00266  0.09194
       4  1.200000e-07  0.00004  0.00540

    wavelengths (in nm):
    exs          A                  
    v            0        1        2
    gs v                            
    X  0   859.830  828.903  800.360
       1   895.699  862.188  831.350
       2   934.370  897.961  864.561
       3   976.181  936.510  900.238
       4  1021.520  978.165  938.663




.. GENERATED FROM PYTHON SOURCE LINES 31-32

calculate dynamics with rate equations

.. GENERATED FROM PYTHON SOURCE LINES 32-38

.. code-block:: Python

    system.calc_rateeqs(t_int=20e-6, magn_remixing=False)

    # plot populations, force, and scattered photon number
    system.plot_N()
    system.plot_F()
    system.plot_Nscatt()



.. rst-class:: sphx-glr-horizontal


    *

      .. image-sg:: /auto_examples/misc/images/sphx_glr_plot_SimpleTest1_BaF_001.png
         :alt: plot SimpleTest1 BaF
         :srcset: /auto_examples/misc/images/sphx_glr_plot_SimpleTest1_BaF_001.png
         :class: sphx-glr-multi-img

    *

      .. image-sg:: /auto_examples/misc/images/sphx_glr_plot_SimpleTest1_BaF_002.png
         :alt: plot SimpleTest1 BaF
         :srcset: /auto_examples/misc/images/sphx_glr_plot_SimpleTest1_BaF_002.png
         :class: sphx-glr-multi-img

    *

      .. image-sg:: /auto_examples/misc/images/sphx_glr_plot_SimpleTest1_BaF_003.png
         :alt: plot SimpleTest1 BaF
         :srcset: /auto_examples/misc/images/sphx_glr_plot_SimpleTest1_BaF_003.png
         :class: sphx-glr-multi-img


.. rst-class:: sphx-glr-script-out

 .. code-block:: none

    Solving ode with rate equations... Execution time: 0.3365 seconds
    Scattered Photons (A): 4.651972
    /home/docs/checkouts/readthedocs.org/user_builds/molecool-py/checkouts/latest/MoleCool/System.py:576: UserWarning: For calculation of hbar * k * Gamma/2, the wavelengths of the lasers' wavelengths differ by 1.97 % (which is more than 0.10 %). The returned unit might thus me inappropriate.
      warnings.warn(





.. rst-class:: sphx-glr-timing

   **Total running time of the script:** (0 minutes 1.399 seconds)


.. _sphx_glr_download_auto_examples_misc_plot_SimpleTest1_BaF.py:

.. only:: html

  .. container:: sphx-glr-footer sphx-glr-footer-example

    .. container:: sphx-glr-download sphx-glr-download-jupyter

      :download:`Download Jupyter notebook: plot_SimpleTest1_BaF.ipynb <plot_SimpleTest1_BaF.ipynb>`

    .. container:: sphx-glr-download sphx-glr-download-python

      :download:`Download Python source code: plot_SimpleTest1_BaF.py <plot_SimpleTest1_BaF.py>`

    .. container:: sphx-glr-download sphx-glr-download-zip

      :download:`Download zipped: plot_SimpleTest1_BaF.zip <plot_SimpleTest1_BaF.zip>`


.. only:: html

 .. rst-class:: sphx-glr-signature

    `Gallery generated by Sphinx-Gallery <https://sphinx-gallery.github.io>`_
