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

.. only:: html

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

        Click :ref:`here <sphx_glr_download_gallery_build_qip_plot_qip_intro_processor.py>`
        to download the full example code

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

.. _sphx_glr_gallery_build_qip_plot_qip_intro_processor.py:


Basic use of Processor
=============================

This example contains the basic functions of :class:`qutip.qip.device.Processor`. We define a simulator with control Hamiltonian, pulse amplitude and time slice for each pulse. The two figures illustrate the pulse shape for two different setup: step function or continuous pulse.

.. GENERATED FROM PYTHON SOURCE LINES 7-31



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


    *

      .. image-sg:: /gallery/build/qip/images/sphx_glr_plot_qip_intro_processor_001.png
         :alt: plot qip intro processor
         :srcset: /gallery/build/qip/images/sphx_glr_plot_qip_intro_processor_001.png
         :class: sphx-glr-multi-img

    *

      .. image-sg:: /gallery/build/qip/images/sphx_glr_plot_qip_intro_processor_002.png
         :alt: plot qip intro processor
         :srcset: /gallery/build/qip/images/sphx_glr_plot_qip_intro_processor_002.png
         :class: sphx-glr-multi-img


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

 Out:

 .. code-block:: none


    (<Figure size 1200x600 with 1 Axes>, [<AxesSubplot: >])





|

.. code-block:: default

    import copy
    import numpy as np
    import matplotlib.pyplot as plt
    pi = np.pi
    from qutip.qip.device import Processor
    from qutip.operators import sigmaz
    from qutip.states import basis

    processor = Processor(N=1)
    processor.add_control(sigmaz(), targets=0)

    tlist = np.linspace(0., 2*np.pi, 20)
    processor = Processor(N=1, spline_kind="step_func")
    processor.add_control(sigmaz(), 0)
    processor.pulses[0].tlist = tlist
    processor.pulses[0].coeff = np.array([np.sin(t) for t in tlist])
    processor.plot_pulses()

    tlist = np.linspace(0., 2*np.pi, 20)
    processor = Processor(N=1, spline_kind="cubic")
    processor.add_control(sigmaz())
    processor.pulses[0].tlist = tlist
    processor.pulses[0].coeff = np.array([np.sin(t) for t in tlist])
    processor.plot_pulses()


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

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


.. _sphx_glr_download_gallery_build_qip_plot_qip_intro_processor.py:


.. only :: html

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



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

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



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

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


.. only:: html

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

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