<commit_before>{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<img src=\"../../images/QISKit.gif\" alt=\"Note: In order for images to show up in this jupyter notebook you need to select File => Trusted Notebook\" width=\"250 px\" align=\"left\">"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## _*Relaxation and Decoherence*_ \n",
    "\n",
    "The latest version of this notebook is available on https://github.com/QISKit/qiskit-tutorial.\n",
    "\n",
    "***\n",
    "### Contributors\n",
    "<NAME>, <NAME>, <NAME>, and <NAME>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Introduction\n",
    "\n",
    "The interaction of quantum systems with their environment imposes certain limits and constraints on the study of their dynamics. The level of isolation of a quantum system dictates the rate at which it can exchange energy with its environment. This means that a quantum system will not hold a particular state for an arbitrary time, but will in general exchange energy with its environment and relax (or excite) to another state with different energy. This brings a trade-off in terms of controllability: a system that does not exchange much energy with the environment will keep its state for longer, but it will be more difficult to access and manipulate. \n",
    "\n",
    "Interaction with the environment can also result in decoherence, a process that does not result in energy exchange but that transforms quantum coherent states into classical mixed states.\n",
    "\n",
    "These processes, energy relaxation and decoherence, are typically described by timescales referred to as $T_1$ and $T_2$, respectively.     "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "from qiskit import QuantumProgram\n",
    "import Qconfig\n",
    "import numpy as np\n",
    "from scipy.optimize import curve_fit\n",
    "from qiskit.tools.qcvv.fitters import exp_fit_fun, osc_fit_fun, plot_coherence"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "# function for padding with QId gates\n",
    "def pad_QId(circuit,N,qr):\n",
    "    # circuit to add to, N= number of QId gates to add, qr=qubit reg\n",
    "    for ii in range(N):\n",
    "        circuit.barrier(qr)\n",
    "        circuit.iden(qr)\n",<commit_msg>proofread relaxation_and_decoherence<commit_after>{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<img src=\"../../images/QISKit.gif\" alt=\"Note: In order for images to show up in this jupyter notebook you need to select File => Trusted Notebook\" width=\"250 px\" align=\"left\">"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## _*Relaxation and Decoherence*_ \n",
    "\n",
    "The latest version of this notebook is available on https://github.com/QISKit/qiskit-tutorial.\n",
    "\n",
    "***\n",
    "### Contributors\n",
    "<NAME>, <NAME>, <NAME>, and <NAME>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Introduction\n",
    "\n",
    "The interaction of quantum systems with their environment imposes certain limits and constraints on the study of their dynamics. The level of isolation of a quantum system dictates the rate at which it can exchange energy with its environment. This means that a quantum system will not hold a particular state for an arbitrary time, but will in general exchange energy with its environment and relax (or excite) to another state with different energy. This brings a trade-off in terms of controllability: a system that does not exchange much energy with the environment will keep its state for longer, but it will be more difficult to access and manipulate. \n",
    "\n",
    "Interaction with the environment can also result in decoherence, a process that does not result in energy exchange but that transforms quantum coherent states into classical mixed states.\n",
    "\n",
    "These processes, energy relaxation and decoherence, are typically described by timescales referred to as $T_1$ and $T_2$, respectively.     "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "from qiskit import QuantumProgram\n",
    "import Qconfig\n",
    "import numpy as np\n",
    "from scipy.optimize import curve_fit\n",
    "from qiskit.tools.qcvv.fitters import exp_fit_fun, osc_fit_fun, plot_coherence"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "# function for padding with QId gates\n",
    "def pad_QId(circuit,N,qr):\n",
    "    # circuit to add to, N = number of QId gates to add, qr = qubit reg\n",
    "    for ii in range(N):\n",
    "        circuit.barrier(qr)\n",
    "        circuit.iden(qr)\n",
{'fraction_non_alphanumeric': 0.13220870929776382, 'fraction_numerical': 0.002746174970576697, 'mean_word_length': 3.1489015459723353, 'pattern_counts': {'":': 44, '<': 13, '<?xml version=': 0, '>': 15, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4815920', 'n_tokens_mistral': 1592, 'n_tokens_neox': 1543, 'n_words': 573}