gpe.Examples.tutorial
=====================

.. py:module:: gpe.Examples.tutorial

.. autoapi-nested-parse::

   Example code from the tutorial.



Classes
-------

.. autoapisummary::

   gpe.Examples.tutorial.StateHOConvergence1
   gpe.Examples.tutorial.StateHOConvergence2


Module Contents
---------------

.. py:class:: StateHOConvergence1(**kw)

   Bases: :py:obj:`gpe.bec.HOMixin`, :py:obj:`gpe.bec.StateGPEBase`


   State with tools to check convergence for a 1D HO GPE.

   This is a simple state with default parameters forming a trapped gas in a 1D
   harmonic oscillator.  It has some functions for checking and plotting convergence.

   The state is specified by the parameter `dmu = mu / (hbar*w/2) - 1`.  If `dmu = 0`,
   we will have no interactions (but don't do this: use a small, non-zero value), while
   larger values will approach the TF limit.


   .. py:attribute:: Nx
      :value: 64



   .. py:attribute:: Lx
      :value: 14.0



   .. py:attribute:: dmu
      :value: 0.74



   .. py:attribute:: w
      :value: 1.0



   .. py:attribute:: g
      :value: 1.0



   .. py:method:: init()

      Initialize the state.

      This method defines the basis positions, momenta, etc. for use later
      on.  We define these here rather than in the constructor `__init__()`
      so that the user can change them later and the reinitialize the state.
      We also call this function from the `pre_evolve_hook()` so that it is
      called before any evolution takes place.  For this reason, we should
      not modify the state here.



   .. py:method:: get_convergence(full_output=False)

      Return `(ir, uv)` convergence factors.

      These are the ratios of the density at the edge vs maximum density in position
      (IR) and momentum (UV) space.

      :param full_output: If `True`, return `(ir, uv, x, nx, k, nk)`.
      :type full_output: bool



   .. py:method:: plot_convergence(ax=None, legend=True, **kw)

      Plot the convergence in axis `axs[0]`.

      :param ax: Plot convergence in ax if provided.
      :type ax: Axes
      :param legend: If `True`, include the legend.
      :type legend: bool
      :param \*\*kw: All other arguments are passed to `plot()`.
      :type \*\*kw: dict

      :returns: **ax**
      :rtype: Axes



   .. py:method:: get_gtilde()

      Return the dimensionless interaction parameter.



   .. py:method:: plot(axs=None, plot_convergence=False, **kw)

      Plot the state in axis `ax`.

      :param axs: List of axes.  Plot in axs[0] if provided.  plot the convergence in
                  `axs[1]`, if provided and `plot_convergence` is `True`.
      :type axs: [Axes]
      :param plot_convergence: If `True`, include the convergence plot.
      :type plot_convergence: bool
      :param \*\*kw: All other arguments are passed to `plot()`.
      :type \*\*kw: dict

      :returns: **ax**
      :rtype: Axes



   .. py:method:: get_initialized_state(fix_N=False, minimize_kw={})

      Return a minimized state.



.. py:class:: StateHOConvergence2(**kw)

   Bases: :py:obj:`StateHOConvergence1`


   State with tools to check convergence for a 2D HO GPE.

   This is a simple state with default parameters forming a trapped gas in a 2D
   harmonic oscillator.  It has some functions for checking and plotting convergence.

   The state is specified by the parameter `dmu = mu / (hbar*w/2) - 1`.  If `dmu = 0`,
   we will have no interactions (but don't do this: use a small, non-zero value), while
   larger values will approach the TF limit.


   .. py:attribute:: Nx
      :value: 64



   .. py:attribute:: Lx
      :value: 14.0



   .. py:attribute:: dmu
      :value: 0.74



   .. py:attribute:: w
      :value: 1.0



   .. py:attribute:: g
      :value: 1.0



   .. py:method:: get_convergence(full_output=False)

      Return `(ir, uv)` convergence factors.

      These are the ratios of the density at the edge vs maximum density in position
      (IR) and momentum (UV) space.

      :param full_output: If `True`, return `(ir, uv, r, nr, k, nk)`.
      :type full_output: bool



   .. py:method:: plot_convergence(ax=None, legend=True, **kw)

      Plot the convergence in axis `axs[0]`.

      :param ax: Plot convergence in ax if provided.
      :type ax: Axes
      :param legend: If `True`, include the legend.
      :type legend: bool
      :param \*\*kw: All other arguments are passed to `plot()`.
      :type \*\*kw: dict

      :returns: **ax**
      :rtype: Axes



   .. py:method:: plot(axs=None, plot_convergence=False, **kw)

      Plot the state in axis `ax`.

      :param axs: List of axes.  Plot in axs[0] if provided.  plot the convergence in
                  `axs[1]`, if provided and `plot_convergence` is `True`.
      :type axs: [Axes]
      :param plot_convergence: If `True`, include the convergence plot.
      :type plot_convergence: bool
      :param \*\*kw: All other arguments are passed to `plot()`.
      :type \*\*kw: dict

      :returns: **ax**
      :rtype: Axes



