{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import matplotlib.pyplot as plt\n",
    "from IPython.display import Math, display\n",
    "import numpy as np\n",
    "import sympy as sp\n",
    "from scipy import constants as const\n",
    "from scipy import sparse\n",
    "from scipy.optimize import minimize_scalar\n",
    "\n",
    "#add relative path to backend\n",
    "import sys\n",
    "sys.path.append('../../clean_diag/backend')\n",
    "\n",
    "import trap_units as si\n",
    "from twod_trap import DoubleTweezer"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Trap parameters:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "omega_r1: 60954.0Hz, omega_r2: 60954.0Hz\n",
      "omega_z1: 10279.9Hz, omega_z2: 10279.9Hz\n"
     ]
    }
   ],
   "source": [
    "initial_power = 7000* si.uW\n",
    "initial_waist = 0.71*si.uW\n",
    "initial_distance = 0.808*si.um\n",
    "\n",
    "trap: DoubleTweezer = DoubleTweezer(\n",
    "    power=0,  # Set pancake laser power to 0, no 2D trap\n",
    "    grad_z= 0*si.G/si.cm,\n",
    "    grad_r=0,\n",
    "    power_tweezer1 = initial_power,     #stationary\n",
    "    power_tweezer2 = initial_power,     #transfer tweezer\n",
    "    waist_tweezer1 = initial_waist,     #stationary\n",
    "    waist_tweezer2 = initial_waist,     #transfer tweezer\n",
    "    distance_tweezers = initial_distance,\n",
    "\n",
    "    m= 161 * const.value(\"atomic mass constant\"),\n",
    "    a_s= 85* const.value(\"Bohr radius\"),\n",
    "    mu_b= 9.93 * const.value(\"Bohr magneton\" ),\n",
    "    a= 180*(4 * np.pi * const.epsilon_0 * const.value(\"Bohr radius\")**3)/(2 * const.epsilon_0 * const.c),\n",
    "    wvl = 532 * si.nm,\n",
    "\n",
    "    g = 0,\n",
    ")\n",
    "\n",
    "omega_z1 = sp.sqrt(4*trap.power_tweezer1*trap.a/sp.pi**3/trap.m) * trap.wvl/trap.waist_tweezer1**3\n",
    "omega_z2 = sp.sqrt(4*trap.power_tweezer2*trap.a/sp.pi**3/trap.m) * trap.wvl/trap.waist_tweezer2**3\n",
    "\n",
    "omega_r1 = sp.sqrt(2*trap.power_tweezer1*trap.a/sp.pi/trap.m) * 2/trap.waist_tweezer1**2\n",
    "omega_r2 = sp.sqrt(2*trap.power_tweezer2*trap.a/sp.pi/trap.m) * 2/trap.waist_tweezer2**2\n",
    "\n",
    "print(f\"omega_r1: {float(trap.subs(omega_r1)/2/np.pi):.1f}Hz, omega_r2: {float(trap.subs(omega_r2)/2/np.pi):.1f}Hz\")\n",
    "print(f\"omega_z1: {float(trap.subs(omega_z1)/2/np.pi):.1f}Hz, omega_z2: {float(trap.subs(omega_z2)/2/np.pi):.1f}Hz\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "depth 1: 640.5648 Hz\n",
      "depth 2: 640.5648 Hz\n",
      "target trap frequency x: 2000.00 HZ\n",
      "trapping frequency x 1: 1498.08 Hz\n",
      "trapping frequency x 2: 1498.08 Hz\n",
      "trapping frequency y 1: 2076.31 Hz\n",
      "trapping frequency y 2: 2076.31 Hz\n",
      "trapping frequency z 1: 305.33 Hz\n",
      "trapping frequency z 2: 305.33 Hz\n",
      "harmonic oscillator length x: 204.71 nm\n",
      "harmonic oscillator length z: 453.45 nm\n",
      "tunneling distance: 677.63 nm\n",
      "files saved with ...._2025-04-02_20-46-43\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 215832 characters]",
      "text/plain": [
       "<Figure size 1800x500 with 12 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "_________________________________________________________________\n",
      "depth 1: 747.3688 Hz\n",
      "depth 2: 747.3688 Hz\n",
      "target trap frequency x: 2000.00 HZ\n",
      "trapping frequency x 1: 1541.79 Hz\n",
      "trapping frequency x 2: 1541.79 Hz\n",
      "trapping frequency y 1: 2069.22 Hz\n",
      "trapping frequency y 2: 2069.22 Hz\n",
      "trapping frequency z 1: 307.73 Hz\n",
      "trapping frequency z 2: 307.73 Hz\n",
      "harmonic oscillator length x: 201.79 nm\n",
      "harmonic oscillator length z: 451.67 nm\n",
      "tunneling distance: 705.49 nm\n",
      "files saved with ...._2025-04-02_21-43-42\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 217608 characters]",
      "text/plain": [
       "<Figure size 1800x500 with 12 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "_________________________________________________________________\n",
      "depth 1: 858.5535 Hz\n",
      "depth 2: 858.5535 Hz\n",
      "target trap frequency x: 2000.00 HZ\n",
      "trapping frequency x 1: 1581.13 Hz\n",
      "trapping frequency x 2: 1581.13 Hz\n",
      "trapping frequency y 1: 2062.75 Hz\n",
      "trapping frequency y 2: 2062.75 Hz\n",
      "trapping frequency z 1: 309.94 Hz\n",
      "trapping frequency z 2: 309.94 Hz\n",
      "harmonic oscillator length x: 199.26 nm\n",
      "harmonic oscillator length z: 450.06 nm\n",
      "tunneling distance: 731.73 nm\n",
      "files saved with ...._2025-04-02_22-49-04\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 217032 characters]",
      "text/plain": [
       "<Figure size 1800x500 with 12 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "_________________________________________________________________\n",
      "depth 1: 973.5322 Hz\n",
      "depth 2: 973.5322 Hz\n",
      "target trap frequency x: 2000.00 HZ\n",
      "trapping frequency x 1: 1616.69 Hz\n",
      "trapping frequency x 2: 1616.69 Hz\n",
      "trapping frequency y 1: 2056.86 Hz\n",
      "trapping frequency y 2: 2056.86 Hz\n",
      "trapping frequency z 1: 311.99 Hz\n",
      "trapping frequency z 2: 311.99 Hz\n",
      "harmonic oscillator length x: 197.06 nm\n",
      "harmonic oscillator length z: 448.58 nm\n",
      "tunneling distance: 756.56 nm\n",
      "files saved with ...._2025-04-02_23-54-09\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 213336 characters]",
      "text/plain": [
       "<Figure size 1800x500 with 12 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "_________________________________________________________________\n",
      "depth 1: 1091.7726 Hz\n",
      "depth 2: 1091.7726 Hz\n",
      "target trap frequency x: 2000.00 HZ\n",
      "trapping frequency x 1: 1648.94 Hz\n",
      "trapping frequency x 2: 1648.94 Hz\n",
      "trapping frequency y 1: 2051.50 Hz\n",
      "trapping frequency y 2: 2051.50 Hz\n",
      "trapping frequency z 1: 313.88 Hz\n",
      "trapping frequency z 2: 313.88 Hz\n",
      "harmonic oscillator length x: 195.12 nm\n",
      "harmonic oscillator length z: 447.23 nm\n",
      "tunneling distance: 780.16 nm\n",
      "files saved with ...._2025-04-03_01-00-43\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 218628 characters]",
      "text/plain": [
       "<Figure size 1800x500 with 12 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "_________________________________________________________________\n",
      "depth 1: 1212.7910 Hz\n",
      "depth 2: 1212.7910 Hz\n",
      "target trap frequency x: 2000.00 HZ\n",
      "trapping frequency x 1: 1678.27 Hz\n",
      "trapping frequency x 2: 1678.27 Hz\n",
      "trapping frequency y 1: 2046.62 Hz\n",
      "trapping frequency y 2: 2046.62 Hz\n",
      "trapping frequency z 1: 315.64 Hz\n",
      "trapping frequency z 2: 315.64 Hz\n",
      "harmonic oscillator length x: 193.41 nm\n",
      "harmonic oscillator length z: 445.98 nm\n",
      "tunneling distance: 802.67 nm\n",
      "files saved with ...._2025-04-03_02-13-30\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 222176 characters]",
      "text/plain": [
       "<Figure size 1800x500 with 12 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "_________________________________________________________________\n",
      "depth 1: 1336.1464 Hz\n",
      "depth 2: 1336.1464 Hz\n",
      "target trap frequency x: 2000.00 HZ\n",
      "trapping frequency x 1: 1705.04 Hz\n",
      "trapping frequency x 2: 1705.04 Hz\n",
      "trapping frequency y 1: 2042.17 Hz\n",
      "trapping frequency y 2: 2042.17 Hz\n",
      "trapping frequency z 1: 317.26 Hz\n",
      "trapping frequency z 2: 317.26 Hz\n",
      "harmonic oscillator length x: 191.89 nm\n",
      "harmonic oscillator length z: 444.84 nm\n",
      "tunneling distance: 824.23 nm\n",
      "files saved with ...._2025-04-03_03-25-43\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 221792 characters]",
      "text/plain": [
       "<Figure size 1800x500 with 12 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "_________________________________________________________________\n",
      "depth 1: 1461.4367 Hz\n",
      "depth 2: 1461.4367 Hz\n",
      "target trap frequency x: 2000.00 HZ\n",
      "trapping frequency x 1: 1729.50 Hz\n",
      "trapping frequency x 2: 1729.50 Hz\n",
      "trapping frequency y 1: 2038.13 Hz\n",
      "trapping frequency y 2: 2038.13 Hz\n",
      "trapping frequency z 1: 318.77 Hz\n",
      "trapping frequency z 2: 318.77 Hz\n",
      "harmonic oscillator length x: 190.52 nm\n",
      "harmonic oscillator length z: 443.78 nm\n",
      "tunneling distance: 844.93 nm\n",
      "files saved with ...._2025-04-03_04-32-08\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 222720 characters]",
      "text/plain": [
       "<Figure size 1800x500 with 12 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "_________________________________________________________________\n",
      "depth 1: 1588.2943 Hz\n",
      "depth 2: 1588.2943 Hz\n",
      "target trap frequency x: 2000.00 HZ\n",
      "trapping frequency x 1: 1751.90 Hz\n",
      "trapping frequency x 2: 1751.90 Hz\n",
      "trapping frequency y 1: 2034.45 Hz\n",
      "trapping frequency y 2: 2034.45 Hz\n",
      "trapping frequency z 1: 320.17 Hz\n",
      "trapping frequency z 2: 320.17 Hz\n",
      "harmonic oscillator length x: 189.30 nm\n",
      "harmonic oscillator length z: 442.81 nm\n",
      "tunneling distance: 864.87 nm\n",
      "files saved with ...._2025-04-03_05-37-29\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 230548 characters]",
      "text/plain": [
       "<Figure size 1800x500 with 12 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "_________________________________________________________________\n",
      "depth 1: 772.7363 Hz\n",
      "depth 2: 772.7363 Hz\n",
      "target trap frequency x: 14000.00 HZ\n",
      "trapping frequency x 1: 4608.89 Hz\n",
      "trapping frequency x 2: 4608.89 Hz\n",
      "trapping frequency y 1: 15246.80 Hz\n",
      "trapping frequency y 2: 15246.80 Hz\n",
      "trapping frequency z 1: 1899.50 Hz\n",
      "trapping frequency z 2: 1899.50 Hz\n",
      "harmonic oscillator length x: 116.71 nm\n",
      "harmonic oscillator length z: 181.80 nm\n",
      "tunneling distance: 265.41 nm\n",
      "files saved with ...._2025-04-03_06-12-40\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 133772 characters]",
      "text/plain": [
       "<Figure size 1800x500 with 12 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "_________________________________________________________________\n",
      "depth 1: 2239.1557 Hz\n",
      "depth 2: 2239.1557 Hz\n",
      "target trap frequency x: 14000.00 HZ\n",
      "trapping frequency x 1: 5930.95 Hz\n",
      "trapping frequency x 2: 5930.95 Hz\n",
      "trapping frequency y 1: 15133.21 Hz\n",
      "trapping frequency y 2: 15133.21 Hz\n",
      "trapping frequency z 1: 1938.35 Hz\n",
      "trapping frequency z 2: 1938.35 Hz\n",
      "harmonic oscillator length x: 102.88 nm\n",
      "harmonic oscillator length z: 179.97 nm\n",
      "tunneling distance: 346.61 nm\n",
      "files saved with ...._2025-04-03_06-55-41\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 141832 characters]",
      "text/plain": [
       "<Figure size 1800x500 with 12 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "_________________________________________________________________\n",
      "depth 1: 4367.4324 Hz\n",
      "depth 2: 4367.4324 Hz\n",
      "target trap frequency x: 14000.00 HZ\n",
      "trapping frequency x 1: 6917.56 Hz\n",
      "trapping frequency x 2: 6917.56 Hz\n",
      "trapping frequency y 1: 15029.93 Hz\n",
      "trapping frequency y 2: 15029.93 Hz\n",
      "trapping frequency z 1: 1973.11 Hz\n",
      "trapping frequency z 2: 1973.11 Hz\n",
      "harmonic oscillator length x: 95.27 nm\n",
      "harmonic oscillator length z: 178.38 nm\n",
      "tunneling distance: 410.04 nm\n",
      "files saved with ...._2025-04-03_07-42-48\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 160636 characters]",
      "text/plain": [
       "<Figure size 1800x500 with 12 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "_________________________________________________________________\n",
      "depth 1: 7080.6299 Hz\n",
      "depth 2: 7080.6299 Hz\n",
      "target trap frequency x: 14000.00 HZ\n",
      "trapping frequency x 1: 7707.82 Hz\n",
      "trapping frequency x 2: 7707.82 Hz\n",
      "trapping frequency y 1: 14935.98 Hz\n",
      "trapping frequency y 2: 14935.98 Hz\n",
      "trapping frequency z 1: 2004.37 Hz\n",
      "trapping frequency z 2: 2004.37 Hz\n",
      "harmonic oscillator length x: 90.25 nm\n",
      "harmonic oscillator length z: 176.98 nm\n",
      "tunneling distance: 463.20 nm\n",
      "files saved with ...._2025-04-03_08-28-04\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 167136 characters]",
      "text/plain": [
       "<Figure size 1800x500 with 12 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "_________________________________________________________________\n",
      "depth 1: 10310.8893 Hz\n",
      "depth 2: 10310.8893 Hz\n",
      "target trap frequency x: 14000.00 HZ\n",
      "trapping frequency x 1: 8365.34 Hz\n",
      "trapping frequency x 2: 8365.34 Hz\n",
      "trapping frequency y 1: 14850.47 Hz\n",
      "trapping frequency y 2: 14850.47 Hz\n",
      "trapping frequency z 1: 2032.63 Hz\n",
      "trapping frequency z 2: 2032.63 Hz\n",
      "harmonic oscillator length x: 86.63 nm\n",
      "harmonic oscillator length z: 175.74 nm\n",
      "tunneling distance: 509.44 nm\n",
      "files saved with ...._2025-04-03_09-10-04\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 157688 characters]",
      "text/plain": [
       "<Figure size 1800x500 with 12 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "_________________________________________________________________\n",
      "depth 1: 13998.1139 Hz\n",
      "depth 2: 13998.1139 Hz\n",
      "target trap frequency x: 14000.00 HZ\n",
      "trapping frequency x 1: 8925.20 Hz\n",
      "trapping frequency x 2: 8925.20 Hz\n",
      "trapping frequency y 1: 14772.62 Hz\n",
      "trapping frequency y 2: 14772.62 Hz\n",
      "trapping frequency z 1: 2058.26 Hz\n",
      "trapping frequency z 2: 2058.26 Hz\n",
      "harmonic oscillator length x: 83.87 nm\n",
      "harmonic oscillator length z: 174.65 nm\n",
      "tunneling distance: 550.60 nm\n",
      "files saved with ...._2025-04-03_09-52-23\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 139932 characters]",
      "text/plain": [
       "<Figure size 1800x500 with 12 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "_________________________________________________________________\n",
      "depth 1: 18088.8775 Hz\n",
      "depth 2: 18088.8775 Hz\n",
      "target trap frequency x: 14000.00 HZ\n",
      "trapping frequency x 1: 9409.82 Hz\n",
      "trapping frequency x 2: 9409.82 Hz\n",
      "trapping frequency y 1: 14701.73 Hz\n",
      "trapping frequency y 2: 14701.73 Hz\n",
      "trapping frequency z 1: 2081.61 Hz\n",
      "trapping frequency z 2: 2081.61 Hz\n",
      "harmonic oscillator length x: 81.68 nm\n",
      "harmonic oscillator length z: 173.66 nm\n",
      "tunneling distance: 587.84 nm\n",
      "files saved with ...._2025-04-03_10-35-07\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 120512 characters]",
      "text/plain": [
       "<Figure size 1800x500 with 12 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "_________________________________________________________________\n",
      "depth 1: 22535.5119 Hz\n",
      "depth 2: 22535.5119 Hz\n",
      "target trap frequency x: 14000.00 HZ\n",
      "trapping frequency x 1: 9834.81 Hz\n",
      "trapping frequency x 2: 9834.81 Hz\n",
      "trapping frequency y 1: 14637.15 Hz\n",
      "trapping frequency y 2: 14637.15 Hz\n",
      "trapping frequency z 1: 2102.97 Hz\n",
      "trapping frequency z 2: 2102.97 Hz\n",
      "harmonic oscillator length x: 79.90 nm\n",
      "harmonic oscillator length z: 172.78 nm\n",
      "tunneling distance: 621.96 nm\n",
      "files saved with ...._2025-04-03_11-21-10\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 108496 characters]",
      "text/plain": [
       "<Figure size 1800x500 with 12 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "_________________________________________________________________\n",
      "depth 1: 27295.3421 Hz\n",
      "depth 2: 27295.3421 Hz\n",
      "target trap frequency x: 14000.00 HZ\n",
      "trapping frequency x 1: 10210.46 Hz\n",
      "trapping frequency x 2: 10210.46 Hz\n",
      "trapping frequency y 1: 14578.32 Hz\n",
      "trapping frequency y 2: 14578.32 Hz\n",
      "trapping frequency z 1: 2122.53 Hz\n",
      "trapping frequency z 2: 2122.53 Hz\n",
      "harmonic oscillator length x: 78.41 nm\n",
      "harmonic oscillator length z: 171.98 nm\n",
      "tunneling distance: 653.50 nm\n",
      "files saved with ...._2025-04-03_12-06-39\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 101028 characters]",
      "text/plain": [
       "<Figure size 1800x500 with 12 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "_________________________________________________________________\n",
      "depth 1: 1276.4785 Hz\n",
      "depth 2: 1276.4785 Hz\n",
      "target trap frequency x: 26000.00 HZ\n",
      "trapping frequency x 1: 7163.69 Hz\n",
      "trapping frequency x 2: 7163.69 Hz\n",
      "trapping frequency y 1: 28411.69 Hz\n",
      "trapping frequency y 2: 28411.69 Hz\n",
      "trapping frequency z 1: 3494.25 Hz\n",
      "trapping frequency z 2: 3494.25 Hz\n",
      "harmonic oscillator length x: 93.61 nm\n",
      "harmonic oscillator length z: 134.04 nm\n",
      "tunneling distance: 220.70 nm\n",
      "files saved with ...._2025-04-03_12-41-54\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 110676 characters]",
      "text/plain": [
       "<Figure size 1800x500 with 12 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "_________________________________________________________________\n",
      "depth 1: 5272.0509 Hz\n",
      "depth 2: 5272.0509 Hz\n",
      "target trap frequency x: 26000.00 HZ\n",
      "trapping frequency x 1: 10070.43 Hz\n",
      "trapping frequency x 2: 10070.43 Hz\n",
      "trapping frequency y 1: 28191.96 Hz\n",
      "trapping frequency y 2: 28191.96 Hz\n",
      "trapping frequency z 1: 3570.06 Hz\n",
      "trapping frequency z 2: 3570.06 Hz\n",
      "harmonic oscillator length x: 78.96 nm\n",
      "harmonic oscillator length z: 132.61 nm\n",
      "tunneling distance: 314.93 nm\n",
      "files saved with ...._2025-04-03_13-19-43\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 123204 characters]",
      "text/plain": [
       "<Figure size 1800x500 with 12 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "_________________________________________________________________\n",
      "depth 1: 11674.2389 Hz\n",
      "depth 2: 11674.2389 Hz\n",
      "target trap frequency x: 26000.00 HZ\n",
      "trapping frequency x 1: 12120.27 Hz\n",
      "trapping frequency x 2: 12120.27 Hz\n",
      "trapping frequency y 1: 27992.24 Hz\n",
      "trapping frequency y 2: 27992.24 Hz\n",
      "trapping frequency z 1: 3637.67 Hz\n",
      "trapping frequency z 2: 3637.67 Hz\n",
      "harmonic oscillator length x: 71.97 nm\n",
      "harmonic oscillator length z: 131.37 nm\n",
      "tunneling distance: 384.55 nm\n",
      "files saved with ...._2025-04-03_14-05-23\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 129876 characters]",
      "text/plain": [
       "<Figure size 1800x500 with 12 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "_________________________________________________________________\n",
      "depth 1: 20202.7474 Hz\n",
      "depth 2: 20202.7474 Hz\n",
      "target trap frequency x: 26000.00 HZ\n",
      "trapping frequency x 1: 13724.44 Hz\n",
      "trapping frequency x 2: 13724.44 Hz\n",
      "trapping frequency y 1: 27810.59 Hz\n",
      "trapping frequency y 2: 27810.59 Hz\n",
      "trapping frequency z 1: 3698.40 Hz\n",
      "trapping frequency z 2: 3698.40 Hz\n",
      "harmonic oscillator length x: 67.63 nm\n",
      "harmonic oscillator length z: 130.29 nm\n",
      "tunneling distance: 441.54 nm\n",
      "files saved with ...._2025-04-03_14-48-08\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 122180 characters]",
      "text/plain": [
       "<Figure size 1800x500 with 12 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "_________________________________________________________________\n",
      "depth 1: 30610.7968 Hz\n",
      "depth 2: 30610.7968 Hz\n",
      "target trap frequency x: 26000.00 HZ\n",
      "trapping frequency x 1: 15040.57 Hz\n",
      "trapping frequency x 2: 15040.57 Hz\n",
      "trapping frequency y 1: 27645.29 Hz\n",
      "trapping frequency y 2: 27645.29 Hz\n",
      "trapping frequency z 1: 3753.15 Hz\n",
      "trapping frequency z 2: 3753.15 Hz\n",
      "harmonic oscillator length x: 64.61 nm\n",
      "harmonic oscillator length z: 129.33 nm\n",
      "tunneling distance: 490.45 nm\n",
      "files saved with ...._2025-04-03_15-34-21\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 98880 characters]",
      "text/plain": [
       "<Figure size 1800x500 with 12 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "_________________________________________________________________\n",
      "depth 1: 42680.2095 Hz\n",
      "depth 2: 42680.2095 Hz\n",
      "target trap frequency x: 26000.00 HZ\n",
      "trapping frequency x 1: 16151.40 Hz\n",
      "trapping frequency x 2: 16151.40 Hz\n",
      "trapping frequency y 1: 27494.82 Hz\n",
      "trapping frequency y 2: 27494.82 Hz\n",
      "trapping frequency z 1: 3802.75 Hz\n",
      "trapping frequency z 2: 3802.75 Hz\n",
      "harmonic oscillator length x: 62.35 nm\n",
      "harmonic oscillator length z: 128.49 nm\n",
      "tunneling distance: 533.60 nm\n",
      "files saved with ...._2025-04-03_16-17-17\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 88728 characters]",
      "text/plain": [
       "<Figure size 1800x500 with 12 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "_________________________________________________________________\n",
      "depth 1: 56217.3349 Hz\n",
      "depth 2: 56217.3349 Hz\n",
      "target trap frequency x: 26000.00 HZ\n",
      "trapping frequency x 1: 17106.99 Hz\n",
      "trapping frequency x 2: 17106.99 Hz\n",
      "trapping frequency y 1: 27357.81 Hz\n",
      "trapping frequency y 2: 27357.81 Hz\n",
      "trapping frequency z 1: 3847.86 Hz\n",
      "trapping frequency z 2: 3847.86 Hz\n",
      "harmonic oscillator length x: 60.58 nm\n",
      "harmonic oscillator length z: 127.73 nm\n",
      "tunneling distance: 572.40 nm\n",
      "files saved with ...._2025-04-03_17-01-15\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 89736 characters]",
      "text/plain": [
       "<Figure size 1800x500 with 12 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "_________________________________________________________________\n",
      "depth 1: 71049.6542 Hz\n",
      "depth 2: 71049.6542 Hz\n",
      "target trap frequency x: 26000.00 HZ\n",
      "trapping frequency x 1: 17940.51 Hz\n",
      "trapping frequency x 2: 17940.51 Hz\n",
      "trapping frequency y 1: 27233.01 Hz\n",
      "trapping frequency y 2: 27233.01 Hz\n",
      "trapping frequency z 1: 3889.04 Hz\n",
      "trapping frequency z 2: 3889.04 Hz\n",
      "harmonic oscillator length x: 59.16 nm\n",
      "harmonic oscillator length z: 127.05 nm\n",
      "tunneling distance: 607.77 nm\n",
      "files saved with ...._2025-04-03_17-47-06\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 97220 characters]",
      "text/plain": [
       "<Figure size 1800x500 with 12 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "_________________________________________________________________\n",
      "depth 1: 204.9425 Hz\n",
      "depth 2: 204.9425 Hz\n",
      "target trap frequency x: 38000.00 HZ\n",
      "trapping frequency x 1: 5536.67 Hz\n",
      "trapping frequency x 2: 5536.67 Hz\n",
      "trapping frequency y 1: 41761.24 Hz\n",
      "trapping frequency y 2: 41761.24 Hz\n",
      "trapping frequency z 1: 5023.78 Hz\n",
      "trapping frequency z 2: 5023.78 Hz\n",
      "harmonic oscillator length x: 106.48 nm\n",
      "harmonic oscillator length z: 111.79 nm\n",
      "tunneling distance: 115.49 nm\n",
      "files saved with ...._2025-04-03_18-14-53\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 99308 characters]",
      "text/plain": [
       "<Figure size 1800x500 with 12 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "_________________________________________________________________\n",
      "depth 1: 4863.2298 Hz\n",
      "depth 2: 4863.2298 Hz\n",
      "target trap frequency x: 38000.00 HZ\n",
      "trapping frequency x 1: 12043.82 Hz\n",
      "trapping frequency x 2: 12043.82 Hz\n",
      "trapping frequency y 1: 41418.46 Hz\n",
      "trapping frequency y 2: 41418.46 Hz\n",
      "trapping frequency z 1: 5143.91 Hz\n",
      "trapping frequency z 2: 5143.91 Hz\n",
      "harmonic oscillator length x: 72.20 nm\n",
      "harmonic oscillator length z: 110.48 nm\n",
      "tunneling distance: 255.12 nm\n",
      "files saved with ...._2025-04-03_18-50-37\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 102052 characters]",
      "text/plain": [
       "<Figure size 1800x500 with 12 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "_________________________________________________________________\n",
      "depth 1: 15116.2841 Hz\n",
      "depth 2: 15116.2841 Hz\n",
      "target trap frequency x: 38000.00 HZ\n",
      "trapping frequency x 1: 15772.72 Hz\n",
      "trapping frequency x 2: 15772.72 Hz\n",
      "trapping frequency y 1: 41107.02 Hz\n",
      "trapping frequency y 2: 41107.02 Hz\n",
      "trapping frequency z 1: 5250.66 Hz\n",
      "trapping frequency z 2: 5250.66 Hz\n",
      "harmonic oscillator length x: 63.09 nm\n",
      "harmonic oscillator length z: 109.35 nm\n",
      "tunneling distance: 339.08 nm\n",
      "files saved with ...._2025-04-03_19-33-51\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 119500 characters]",
      "text/plain": [
       "<Figure size 1800x500 with 12 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "_________________________________________________________________\n",
      "depth 1: 30309.6263 Hz\n",
      "depth 2: 30309.6263 Hz\n",
      "target trap frequency x: 38000.00 HZ\n",
      "trapping frequency x 1: 18523.04 Hz\n",
      "trapping frequency x 2: 18523.04 Hz\n",
      "trapping frequency y 1: 40823.87 Hz\n",
      "trapping frequency y 2: 40823.87 Hz\n",
      "trapping frequency z 1: 5346.11 Hz\n",
      "trapping frequency z 2: 5346.11 Hz\n",
      "harmonic oscillator length x: 58.22 nm\n",
      "harmonic oscillator length z: 108.37 nm\n",
      "tunneling distance: 403.92 nm\n",
      "files saved with ...._2025-04-03_20-14-43\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 102792 characters]",
      "text/plain": [
       "<Figure size 1800x500 with 12 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "_________________________________________________________________\n",
      "depth 1: 49868.7401 Hz\n",
      "depth 2: 49868.7401 Hz\n",
      "target trap frequency x: 38000.00 HZ\n",
      "trapping frequency x 1: 20714.34 Hz\n",
      "trapping frequency x 2: 20714.34 Hz\n",
      "trapping frequency y 1: 40566.30 Hz\n",
      "trapping frequency y 2: 40566.30 Hz\n",
      "trapping frequency z 1: 5431.90 Hz\n",
      "trapping frequency z 2: 5431.90 Hz\n",
      "harmonic oscillator length x: 55.05 nm\n",
      "harmonic oscillator length z: 107.51 nm\n",
      "tunneling distance: 457.97 nm\n",
      "files saved with ...._2025-04-03_20-58-18\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 81912 characters]",
      "text/plain": [
       "<Figure size 1800x500 with 12 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "_________________________________________________________________\n",
      "depth 1: 73287.1177 Hz\n",
      "depth 2: 73287.1177 Hz\n",
      "target trap frequency x: 38000.00 HZ\n",
      "trapping frequency x 1: 22530.94 Hz\n",
      "trapping frequency x 2: 22530.94 Hz\n",
      "trapping frequency y 1: 40331.90 Hz\n",
      "trapping frequency y 2: 40331.90 Hz\n",
      "trapping frequency z 1: 5509.37 Hz\n",
      "trapping frequency z 2: 5509.37 Hz\n",
      "harmonic oscillator length x: 52.79 nm\n",
      "harmonic oscillator length z: 106.75 nm\n",
      "tunneling distance: 504.82 nm\n",
      "files saved with ...._2025-04-03_21-38-42\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 81204 characters]",
      "text/plain": [
       "<Figure size 1800x500 with 12 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "_________________________________________________________________\n",
      "depth 1: 100116.3794 Hz\n",
      "depth 2: 100116.3794 Hz\n",
      "target trap frequency x: 38000.00 HZ\n",
      "trapping frequency x 1: 24075.64 Hz\n",
      "trapping frequency x 2: 24075.64 Hz\n",
      "trapping frequency y 1: 40118.49 Hz\n",
      "trapping frequency y 2: 40118.49 Hz\n",
      "trapping frequency z 1: 5579.68 Hz\n",
      "trapping frequency z 2: 5579.68 Hz\n",
      "harmonic oscillator length x: 51.06 nm\n",
      "harmonic oscillator length z: 106.07 nm\n",
      "tunneling distance: 546.46 nm\n",
      "files saved with ...._2025-04-03_22-24-37\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 90184 characters]",
      "text/plain": [
       "<Figure size 1800x500 with 12 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "_________________________________________________________________\n",
      "depth 1: 129958.0687 Hz\n",
      "depth 2: 129958.0687 Hz\n",
      "target trap frequency x: 38000.00 HZ\n",
      "trapping frequency x 1: 25410.60 Hz\n",
      "trapping frequency x 2: 25410.60 Hz\n",
      "trapping frequency y 1: 39924.15 Hz\n",
      "trapping frequency y 2: 39924.15 Hz\n",
      "trapping frequency z 1: 5643.68 Hz\n",
      "trapping frequency z 2: 5643.68 Hz\n",
      "harmonic oscillator length x: 49.71 nm\n",
      "harmonic oscillator length z: 105.47 nm\n",
      "tunneling distance: 584.07 nm\n",
      "files saved with ...._2025-04-03_23-11-44\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 97708 characters]",
      "text/plain": [
       "<Figure size 1800x500 with 12 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "_________________________________________________________________\n",
      "depth 1: 3809.4253 Hz\n",
      "depth 2: 3809.4253 Hz\n",
      "target trap frequency x: 50000.00 HZ\n",
      "trapping frequency x 1: 13074.47 Hz\n",
      "trapping frequency x 2: 13074.47 Hz\n",
      "trapping frequency y 1: 54680.76 Hz\n",
      "trapping frequency y 2: 54680.76 Hz\n",
      "trapping frequency z 1: 6704.72 Hz\n",
      "trapping frequency z 2: 6704.72 Hz\n",
      "harmonic oscillator length x: 69.29 nm\n",
      "harmonic oscillator length z: 96.77 nm\n",
      "tunneling distance: 209.15 nm\n",
      "files saved with ...._2025-04-03_23-42-03\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 102356 characters]",
      "text/plain": [
       "<Figure size 1800x500 with 12 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "_________________________________________________________________\n",
      "depth 1: 17668.5510 Hz\n",
      "depth 2: 17668.5510 Hz\n",
      "target trap frequency x: 50000.00 HZ\n",
      "trapping frequency x 1: 18920.08 Hz\n",
      "trapping frequency x 2: 18920.08 Hz\n",
      "trapping frequency y 1: 54254.29 Hz\n",
      "trapping frequency y 2: 54254.29 Hz\n",
      "trapping frequency z 1: 6852.18 Hz\n",
      "trapping frequency z 2: 6852.18 Hz\n",
      "harmonic oscillator length x: 57.60 nm\n",
      "harmonic oscillator length z: 95.72 nm\n",
      "tunneling distance: 307.24 nm\n",
      "files saved with ...._2025-04-04_00-23-25\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 119992 characters]",
      "text/plain": [
       "<Figure size 1800x500 with 12 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "_________________________________________________________________\n",
      "depth 1: 40535.0732 Hz\n",
      "depth 2: 40535.0732 Hz\n",
      "target trap frequency x: 50000.00 HZ\n",
      "trapping frequency x 1: 22973.02 Hz\n",
      "trapping frequency x 2: 22973.02 Hz\n",
      "trapping frequency y 1: 53866.66 Hz\n",
      "trapping frequency y 2: 53866.66 Hz\n",
      "trapping frequency z 1: 6983.63 Hz\n",
      "trapping frequency z 2: 6983.63 Hz\n",
      "harmonic oscillator length x: 52.28 nm\n",
      "harmonic oscillator length z: 94.81 nm\n",
      "tunneling distance: 378.50 nm\n",
      "files saved with ...._2025-04-04_01-03-08\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 100400 characters]",
      "text/plain": [
       "<Figure size 1800x500 with 12 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "_________________________________________________________________\n",
      "depth 1: 71359.3610 Hz\n",
      "depth 2: 71359.3610 Hz\n",
      "target trap frequency x: 50000.00 HZ\n",
      "trapping frequency x 1: 26123.49 Hz\n",
      "trapping frequency x 2: 26123.49 Hz\n",
      "trapping frequency y 1: 53514.13 Hz\n",
      "trapping frequency y 2: 53514.13 Hz\n",
      "trapping frequency z 1: 7101.58 Hz\n",
      "trapping frequency z 2: 7101.58 Hz\n",
      "harmonic oscillator length x: 49.02 nm\n",
      "harmonic oscillator length z: 94.02 nm\n",
      "tunneling distance: 436.45 nm\n",
      "files saved with ...._2025-04-04_01-44-32\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 80188 characters]",
      "text/plain": [
       "<Figure size 1800x500 with 12 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "_________________________________________________________________\n",
      "depth 1: 109217.6731 Hz\n",
      "depth 2: 109217.6731 Hz\n",
      "target trap frequency x: 50000.00 HZ\n",
      "trapping frequency x 1: 28699.03 Hz\n",
      "trapping frequency x 2: 28699.03 Hz\n",
      "trapping frequency y 1: 53193.36 Hz\n",
      "trapping frequency y 2: 53193.36 Hz\n",
      "trapping frequency z 1: 7207.89 Hz\n",
      "trapping frequency z 2: 7207.89 Hz\n",
      "harmonic oscillator length x: 46.77 nm\n",
      "harmonic oscillator length z: 93.33 nm\n",
      "tunneling distance: 486.01 nm\n",
      "files saved with ...._2025-04-04_02-27-25\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 81532 characters]",
      "text/plain": [
       "<Figure size 1800x500 with 12 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "_________________________________________________________________\n",
      "depth 1: 153293.6492 Hz\n",
      "depth 2: 153293.6492 Hz\n",
      "target trap frequency x: 50000.00 HZ\n",
      "trapping frequency x 1: 30868.82 Hz\n",
      "trapping frequency x 2: 30868.82 Hz\n",
      "trapping frequency y 1: 52901.37 Hz\n",
      "trapping frequency y 2: 52901.37 Hz\n",
      "trapping frequency z 1: 7304.20 Hz\n",
      "trapping frequency z 2: 7304.20 Hz\n",
      "harmonic oscillator length x: 45.10 nm\n",
      "harmonic oscillator length z: 92.71 nm\n",
      "tunneling distance: 529.65 nm\n",
      "files saved with ...._2025-04-04_03-12-50\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 84548 characters]",
      "text/plain": [
       "<Figure size 1800x500 with 12 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "_________________________________________________________________\n",
      "depth 1: 202862.9695 Hz\n",
      "depth 2: 202862.9695 Hz\n",
      "target trap frequency x: 50000.00 HZ\n",
      "trapping frequency x 1: 32732.07 Hz\n",
      "trapping frequency x 2: 32732.07 Hz\n",
      "trapping frequency y 1: 52635.50 Hz\n",
      "trapping frequency y 2: 52635.50 Hz\n",
      "trapping frequency z 1: 7391.72 Hz\n",
      "trapping frequency z 2: 7391.72 Hz\n",
      "harmonic oscillator length x: 43.79 nm\n",
      "harmonic oscillator length z: 92.16 nm\n",
      "tunneling distance: 568.82 nm\n",
      "files saved with ...._2025-04-04_03-58-07\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 83740 characters]",
      "text/plain": [
       "<Figure size 1800x500 with 12 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "_________________________________________________________________\n"
     ]
    }
   ],
   "source": [
    "#define trap frequencies to look at\n",
    "trap_freqs = np.linspace(2e3,5e4,5)*2*np.pi\n",
    "#find good separation for all frequencies\n",
    "\n",
    "#calculate corresponding power\n",
    "trap_powers = np.zeros_like(trap_freqs)\n",
    "for i, freq in enumerate(trap_freqs):\n",
    "    trap_powers[i] = float(trap.subs(trap.m*trap.waist_tweezer1**4*sp.pi*freq**2/8/trap.a))\n",
    "    harm_osc_len_est = float(trap.subs(sp.sqrt(const.hbar/trap.m/freq)))\n",
    "\n",
    "    trap[trap.power_tweezer1] = trap_powers[i]\n",
    "    trap[trap.power_tweezer2] = trap_powers[i]\n",
    "    \n",
    "    dist0 = float(trap.subs(trap.waist_tweezer1)) + harm_osc_len_est\n",
    "    trap_spacings = np.linspace(dist0 -50*si.nm, dist0 +50*si.nm, 9)\n",
    "    #loop over distances\n",
    "    for j, dist in enumerate(trap_spacings):\n",
    "\n",
    "        trap[trap.distance_tweezers] = dist\n",
    "\n",
    "        \n",
    "        ##################\n",
    "        #print trap parameters\n",
    "        V = trap.subs(trap.get_potential(apply_zero_offset=False))\n",
    "        a = float(trap.subs(trap.distance_tweezers))\n",
    "\n",
    "        #find minima of potential\n",
    "        def V_func(x):\n",
    "            return float(V.subs({trap.x:x, trap.y:0, trap.z:0}))\n",
    "\n",
    "        x_right = minimize_scalar(V_func,bracket=[0,a]).x\n",
    "        x_left = minimize_scalar(V_func,bracket=[-a,0]).x\n",
    "\n",
    "        #catch case where both potentials have already merged\n",
    "        tunneling_dist = abs(x_right-x_left)\n",
    "        if tunneling_dist < 1e-15:\n",
    "            continue\n",
    "            #raise Exception(\"potential has only one minmum\")\n",
    "\n",
    "        #depts of both tweezers\n",
    "        V_1 = abs(V_func(x_left) - V_func(0))\n",
    "        V_2 = abs(V_func(x_right) - V_func(0)) \n",
    "\n",
    "        #trapping frequencies\n",
    "        omega_x1, omega_x2 = trap.get_both_omega(trap.x)\n",
    "        omega_y1, omega_y2 = trap.get_both_omega(trap.y)\n",
    "        omega_z1, omega_z2 = trap.get_both_omega(trap.z)\n",
    "\n",
    "        harm_osc_len_x = float(trap.subs(sp.sqrt(const.hbar/trap.m/omega_x1)))\n",
    "        harm_osc_len_z = float(trap.subs(sp.sqrt(const.hbar/trap.m/omega_z1)))\n",
    "\n",
    "        #print results\n",
    "        print(f\"depth 1: {V_1/const.h:.4f} Hz\")\n",
    "        print(f\"depth 2: {V_2/const.h:.4f} Hz\")\n",
    "        #print(f\"estimated tilt: {abs(V_1 - V_2)/const.h:.2f} Hz\")\n",
    "\n",
    "        print(f\"target trap frequency x: {freq/2/np.pi:.2f} HZ\")\n",
    "        print(f\"trapping frequency x 1: {trap.subs(omega_x1)/2/np.pi:.2f} Hz\")\n",
    "        print(f\"trapping frequency x 2: {trap.subs(omega_x2)/2/np.pi:.2f} Hz\")\n",
    "        print(f\"trapping frequency y 1: {trap.subs(omega_y1)/2/np.pi:.2f} Hz\")\n",
    "        print(f\"trapping frequency y 2: {trap.subs(omega_y2)/2/np.pi:.2f} Hz\")\n",
    "        print(f\"trapping frequency z 1: {trap.subs(omega_z1)/2/np.pi:.2f} Hz\")\n",
    "        print(f\"trapping frequency z 2: {trap.subs(omega_z2)/2/np.pi:.2f} Hz\")\n",
    "\n",
    "        print(f\"harmonic oscillator length x: {harm_osc_len_x/si.nm:.2f} nm\")\n",
    "        print(f\"harmonic oscillator length z: {harm_osc_len_z/si.nm:.2f} nm\")\n",
    "        print(f\"tunneling distance: {tunneling_dist/si.nm:.2f} nm\")\n",
    "\n",
    "        #############\n",
    "        #test 3D diag\n",
    "\n",
    "        n_grid_1D = 75  \n",
    "\n",
    "        n_pot_steps = [n_grid_1D,n_grid_1D,n_grid_1D]\n",
    "        n_levels = 6\n",
    "\n",
    "        left_cutoff = -0.5*initial_distance-3*harm_osc_len_x\n",
    "        right_cutoff = 0.5*initial_distance+3*harm_osc_len_x\n",
    "        back_cutoff = -3*harm_osc_len_x\n",
    "        front_cutoff = 3*harm_osc_len_x\n",
    "        bottom_cutoff = -5*harm_osc_len_z\n",
    "        top_cutoff = 5*harm_osc_len_z\n",
    "\n",
    "        extend = [(left_cutoff,right_cutoff),\n",
    "                (back_cutoff,front_cutoff),\n",
    "                (bottom_cutoff,top_cutoff)]\n",
    "        \n",
    "        # Solve the hamiltonian numerically\n",
    "        energies, states, potential, coords = trap.nstationary_solution(\n",
    "                [trap.x,trap.y,trap.z], extend, n_pot_steps, k=n_levels,\n",
    "                method=\"matrix_free\", export=True)\n",
    "\n",
    "        x = coords[trap.x]\n",
    "        y = coords[trap.y]\n",
    "        z = coords[trap.z]\n",
    "        x3D,y3D,z3D = np.meshgrid(coords[trap.x],coords[trap.y],coords[trap.z],indexing=\"ij\")\n",
    "        pot = potential(x3D,y3D,z3D)\n",
    "\n",
    "        n_states = 6\n",
    "\n",
    "        # Create a 1xn_states grid of subplots (1 row, n_states columns)\n",
    "        fig, axes = plt.subplots(1, n_states, figsize=(18/6*n_states, 5))  # Adjust the size as needed\n",
    "\n",
    "        # Loop over the state numbers from 0 to 5\n",
    "        for state_number, ax in zip(range(n_states), axes):\n",
    "            # Slice through the y-direction and rotate the x-z plane (by swapping x and z)\n",
    "            im = ax.imshow(np.abs(states[state_number, :, int(len(y)/2), :].T)**2, extent=[*extend[0], *extend[2]], origin=\"lower\",\n",
    "                        vmin=np.min(np.abs(states[state_number])**2), vmax=np.max(np.abs(states[state_number])**2))\n",
    "\n",
    "            # Set labels for each subplot\n",
    "            ax.set_xlabel(\"x\")\n",
    "            ax.set_ylabel(\"z\")\n",
    "            ax.set_title(f\"State {state_number}\")\n",
    "            fig.colorbar(im, ax=ax)  \n",
    "\n",
    "        # Adjust layout for better spacing\n",
    "        plt.tight_layout()\n",
    "\n",
    "        # Show the plots\n",
    "        plt.show()\n",
    "\n",
    "        print(\"_________________________________________________________________\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "base",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.12.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
