{
 "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: 15238.5Hz, omega_r2: 15238.5Hz\n",
      "omega_z1: 1285.0Hz, omega_z2: 1285.0Hz\n"
     ]
    }
   ],
   "source": [
    "initial_power = 7000* si.uW\n",
    "initial_waist = 2* 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: 766.5567 Hz\n",
      "depth 2: 766.5567 Hz\n",
      "target trap frequency x: 2000.00 HZ\n",
      "trapping frequency x 1: 1171.20 Hz\n",
      "trapping frequency x 2: 1171.20 Hz\n",
      "trapping frequency y 1: 2124.69 Hz\n",
      "trapping frequency y 2: 2124.69 Hz\n",
      "trapping frequency z 1: 144.66 Hz\n",
      "trapping frequency z 2: 144.66 Hz\n",
      "harmonic oscillator length x: 231.52 nm\n",
      "harmonic oscillator length z: 658.77 nm\n",
      "tunneling distance: 995.01 nm\n",
      "files saved with ...._2025-04-06_10-38-48\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 192820 characters]",
      "text/plain": [
       "<Figure size 1800x500 with 12 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "_________________________________________________________________\n",
      "depth 1: 907.7119 Hz\n",
      "depth 2: 907.7119 Hz\n",
      "target trap frequency x: 2000.00 HZ\n",
      "trapping frequency x 1: 1214.49 Hz\n",
      "trapping frequency x 2: 1214.49 Hz\n",
      "trapping frequency y 1: 2118.85 Hz\n",
      "trapping frequency y 2: 2118.85 Hz\n",
      "trapping frequency z 1: 145.62 Hz\n",
      "trapping frequency z 2: 145.62 Hz\n",
      "harmonic oscillator length x: 227.36 nm\n",
      "harmonic oscillator length z: 656.59 nm\n",
      "tunneling distance: 1038.58 nm\n",
      "files saved with ...._2025-04-06_11-11-14\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 182484 characters]",
      "text/plain": [
       "<Figure size 1800x500 with 12 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "_________________________________________________________________\n",
      "depth 1: 1057.9231 Hz\n",
      "depth 2: 1057.9231 Hz\n",
      "target trap frequency x: 2000.00 HZ\n",
      "trapping frequency x 1: 1254.58 Hz\n",
      "trapping frequency x 2: 1254.58 Hz\n",
      "trapping frequency y 1: 2113.28 Hz\n",
      "trapping frequency y 2: 2113.28 Hz\n",
      "trapping frequency z 1: 146.54 Hz\n",
      "trapping frequency z 2: 146.54 Hz\n",
      "harmonic oscillator length x: 223.70 nm\n",
      "harmonic oscillator length z: 654.53 nm\n",
      "tunneling distance: 1079.81 nm\n",
      "files saved with ...._2025-04-06_11-45-07\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 186948 characters]",
      "text/plain": [
       "<Figure size 1800x500 with 12 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "_________________________________________________________________\n",
      "depth 1: 1216.6445 Hz\n",
      "depth 2: 1216.6445 Hz\n",
      "target trap frequency x: 2000.00 HZ\n",
      "trapping frequency x 1: 1291.79 Hz\n",
      "trapping frequency x 2: 1291.79 Hz\n",
      "trapping frequency y 1: 2107.96 Hz\n",
      "trapping frequency y 2: 2107.96 Hz\n",
      "trapping frequency z 1: 147.42 Hz\n",
      "trapping frequency z 2: 147.42 Hz\n",
      "harmonic oscillator length x: 220.45 nm\n",
      "harmonic oscillator length z: 652.59 nm\n",
      "tunneling distance: 1118.94 nm\n",
      "files saved with ...._2025-04-06_12-19-04\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 185768 characters]",
      "text/plain": [
       "<Figure size 1800x500 with 12 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "_________________________________________________________________\n",
      "depth 1: 1383.3611 Hz\n",
      "depth 2: 1383.3611 Hz\n",
      "target trap frequency x: 2000.00 HZ\n",
      "trapping frequency x 1: 1326.48 Hz\n",
      "trapping frequency x 2: 1326.48 Hz\n",
      "trapping frequency y 1: 2102.89 Hz\n",
      "trapping frequency y 2: 2102.89 Hz\n",
      "trapping frequency z 1: 148.25 Hz\n",
      "trapping frequency z 2: 148.25 Hz\n",
      "harmonic oscillator length x: 217.55 nm\n",
      "harmonic oscillator length z: 650.75 nm\n",
      "tunneling distance: 1156.23 nm\n",
      "files saved with ...._2025-04-06_12-53-12\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 180308 characters]",
      "text/plain": [
       "<Figure size 1800x500 with 12 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "_________________________________________________________________\n",
      "depth 1: 1557.5860 Hz\n",
      "depth 2: 1557.5860 Hz\n",
      "target trap frequency x: 2000.00 HZ\n",
      "trapping frequency x 1: 1358.90 Hz\n",
      "trapping frequency x 2: 1358.90 Hz\n",
      "trapping frequency y 1: 2098.05 Hz\n",
      "trapping frequency y 2: 2098.05 Hz\n",
      "trapping frequency z 1: 149.05 Hz\n",
      "trapping frequency z 2: 149.05 Hz\n",
      "harmonic oscillator length x: 214.94 nm\n",
      "harmonic oscillator length z: 649.00 nm\n",
      "tunneling distance: 1191.86 nm\n",
      "files saved with ...._2025-04-06_13-27-33\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 185004 characters]",
      "text/plain": [
       "<Figure size 1800x500 with 12 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "_________________________________________________________________\n",
      "depth 1: 1738.8589 Hz\n",
      "depth 2: 1738.8589 Hz\n",
      "target trap frequency x: 2000.00 HZ\n",
      "trapping frequency x 1: 1389.31 Hz\n",
      "trapping frequency x 2: 1389.31 Hz\n",
      "trapping frequency y 1: 2093.43 Hz\n",
      "trapping frequency y 2: 2093.43 Hz\n",
      "trapping frequency z 1: 149.81 Hz\n",
      "trapping frequency z 2: 149.81 Hz\n",
      "harmonic oscillator length x: 212.57 nm\n",
      "harmonic oscillator length z: 647.35 nm\n",
      "tunneling distance: 1226.02 nm\n",
      "files saved with ...._2025-04-06_14-01-52\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 180936 characters]",
      "text/plain": [
       "<Figure size 1800x500 with 12 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "_________________________________________________________________\n",
      "depth 1: 1926.7440 Hz\n",
      "depth 2: 1926.7440 Hz\n",
      "target trap frequency x: 2000.00 HZ\n",
      "trapping frequency x 1: 1417.86 Hz\n",
      "trapping frequency x 2: 1417.86 Hz\n",
      "trapping frequency y 1: 2089.02 Hz\n",
      "trapping frequency y 2: 2089.02 Hz\n",
      "trapping frequency z 1: 150.54 Hz\n",
      "trapping frequency z 2: 150.54 Hz\n",
      "harmonic oscillator length x: 210.42 nm\n",
      "harmonic oscillator length z: 645.77 nm\n",
      "tunneling distance: 1258.82 nm\n",
      "files saved with ...._2025-04-06_14-33-24\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 174960 characters]",
      "text/plain": [
       "<Figure size 1800x500 with 12 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "_________________________________________________________________\n",
      "depth 1: 2120.8283 Hz\n",
      "depth 2: 2120.8283 Hz\n",
      "target trap frequency x: 2000.00 HZ\n",
      "trapping frequency x 1: 1444.73 Hz\n",
      "trapping frequency x 2: 1444.73 Hz\n",
      "trapping frequency y 1: 2084.81 Hz\n",
      "trapping frequency y 2: 2084.81 Hz\n",
      "trapping frequency z 1: 151.24 Hz\n",
      "trapping frequency z 2: 151.24 Hz\n",
      "harmonic oscillator length x: 208.46 nm\n",
      "harmonic oscillator length z: 644.28 nm\n",
      "tunneling distance: 1290.38 nm\n",
      "files saved with ...._2025-04-06_15-04-46\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 170528 characters]",
      "text/plain": [
       "<Figure size 1800x500 with 12 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "_________________________________________________________________\n",
      "depth 1: 794.5863 Hz\n",
      "depth 2: 794.5863 Hz\n",
      "target trap frequency x: 14000.00 HZ\n",
      "trapping frequency x 1: 3313.74 Hz\n",
      "trapping frequency x 2: 3313.74 Hz\n",
      "trapping frequency y 1: 15330.32 Hz\n",
      "trapping frequency y 2: 15330.32 Hz\n",
      "trapping frequency z 1: 935.21 Hz\n",
      "trapping frequency z 2: 935.21 Hz\n",
      "harmonic oscillator length x: 137.64 nm\n",
      "harmonic oscillator length z: 259.09 nm\n",
      "tunneling distance: 377.73 nm\n",
      "files saved with ...._2025-04-06_15-31-39\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 142984 characters]",
      "text/plain": [
       "<Figure size 1800x500 with 12 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "_________________________________________________________________\n",
      "depth 1: 2348.0448 Hz\n",
      "depth 2: 2348.0448 Hz\n",
      "target trap frequency x: 14000.00 HZ\n",
      "trapping frequency x 1: 4313.58 Hz\n",
      "trapping frequency x 2: 4313.58 Hz\n",
      "trapping frequency y 1: 15268.26 Hz\n",
      "trapping frequency y 2: 15268.26 Hz\n",
      "trapping frequency z 1: 946.04 Hz\n",
      "trapping frequency z 2: 946.04 Hz\n",
      "harmonic oscillator length x: 120.64 nm\n",
      "harmonic oscillator length z: 257.61 nm\n",
      "tunneling distance: 495.47 nm\n",
      "files saved with ...._2025-04-06_16-02-14\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 155548 characters]",
      "text/plain": [
       "<Figure size 1800x500 with 12 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "_________________________________________________________________\n",
      "depth 1: 4667.0657 Hz\n",
      "depth 2: 4667.0657 Hz\n",
      "target trap frequency x: 14000.00 HZ\n",
      "trapping frequency x 1: 5086.03 Hz\n",
      "trapping frequency x 2: 5086.03 Hz\n",
      "trapping frequency y 1: 15209.10 Hz\n",
      "trapping frequency y 2: 15209.10 Hz\n",
      "trapping frequency z 1: 956.24 Hz\n",
      "trapping frequency z 2: 956.24 Hz\n",
      "harmonic oscillator length x: 111.10 nm\n",
      "harmonic oscillator length z: 256.23 nm\n",
      "tunneling distance: 588.58 nm\n",
      "files saved with ...._2025-04-06_16-30-42\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 160840 characters]",
      "text/plain": [
       "<Figure size 1800x500 with 12 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "_________________________________________________________________\n",
      "depth 1: 7705.3746 Hz\n",
      "depth 2: 7705.3746 Hz\n",
      "target trap frequency x: 14000.00 HZ\n",
      "trapping frequency x 1: 5725.92 Hz\n",
      "trapping frequency x 2: 5725.92 Hz\n",
      "trapping frequency y 1: 15152.71 Hz\n",
      "trapping frequency y 2: 15152.71 Hz\n",
      "trapping frequency z 1: 965.87 Hz\n",
      "trapping frequency z 2: 965.87 Hz\n",
      "harmonic oscillator length x: 104.71 nm\n",
      "harmonic oscillator length z: 254.95 nm\n",
      "tunneling distance: 667.52 nm\n",
      "files saved with ...._2025-04-06_16-56-56\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 151212 characters]",
      "text/plain": [
       "<Figure size 1800x500 with 12 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "_________________________________________________________________\n",
      "depth 1: 11419.6693 Hz\n",
      "depth 2: 11419.6693 Hz\n",
      "target trap frequency x: 14000.00 HZ\n",
      "trapping frequency x 1: 6275.41 Hz\n",
      "trapping frequency x 2: 6275.41 Hz\n",
      "trapping frequency y 1: 15098.94 Hz\n",
      "trapping frequency y 2: 15098.94 Hz\n",
      "trapping frequency z 1: 974.97 Hz\n",
      "trapping frequency z 2: 974.97 Hz\n",
      "harmonic oscillator length x: 100.02 nm\n",
      "harmonic oscillator length z: 253.76 nm\n",
      "tunneling distance: 736.87 nm\n",
      "files saved with ...._2025-04-06_17-23-22\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 119132 characters]",
      "text/plain": [
       "<Figure size 1800x500 with 12 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "_________________________________________________________________\n",
      "depth 1: 15769.3824 Hz\n",
      "depth 2: 15769.3824 Hz\n",
      "target trap frequency x: 14000.00 HZ\n",
      "trapping frequency x 1: 6758.13 Hz\n",
      "trapping frequency x 2: 6758.13 Hz\n",
      "trapping frequency y 1: 15047.67 Hz\n",
      "trapping frequency y 2: 15047.67 Hz\n",
      "trapping frequency z 1: 983.58 Hz\n",
      "trapping frequency z 2: 983.58 Hz\n",
      "harmonic oscillator length x: 96.38 nm\n",
      "harmonic oscillator length z: 252.64 nm\n",
      "tunneling distance: 799.19 nm\n",
      "files saved with ...._2025-04-06_17-50-00\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 102396 characters]",
      "text/plain": [
       "<Figure size 1800x500 with 12 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "_________________________________________________________________\n",
      "depth 1: 20716.4675 Hz\n",
      "depth 2: 20716.4675 Hz\n",
      "target trap frequency x: 14000.00 HZ\n",
      "trapping frequency x 1: 7189.05 Hz\n",
      "trapping frequency x 2: 7189.05 Hz\n",
      "trapping frequency y 1: 14998.76 Hz\n",
      "trapping frequency y 2: 14998.76 Hz\n",
      "trapping frequency z 1: 991.76 Hz\n",
      "trapping frequency z 2: 991.76 Hz\n",
      "harmonic oscillator length x: 93.45 nm\n",
      "harmonic oscillator length z: 251.60 nm\n",
      "tunneling distance: 856.09 nm\n",
      "files saved with ...._2025-04-06_18-16-41\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 97764 characters]",
      "text/plain": [
       "<Figure size 1800x500 with 12 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "_________________________________________________________________\n",
      "depth 1: 26225.2040 Hz\n",
      "depth 2: 26225.2040 Hz\n",
      "target trap frequency x: 14000.00 HZ\n",
      "trapping frequency x 1: 7577.73 Hz\n",
      "trapping frequency x 2: 7577.73 Hz\n",
      "trapping frequency y 1: 14952.12 Hz\n",
      "trapping frequency y 2: 14952.12 Hz\n",
      "trapping frequency z 1: 999.51 Hz\n",
      "trapping frequency z 2: 999.51 Hz\n",
      "harmonic oscillator length x: 91.02 nm\n",
      "harmonic oscillator length z: 250.62 nm\n",
      "tunneling distance: 908.57 nm\n",
      "files saved with ...._2025-04-06_18-43-36\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 100560 characters]",
      "text/plain": [
       "<Figure size 1800x500 with 12 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "_________________________________________________________________\n",
      "depth 1: 32262.0204 Hz\n",
      "depth 2: 32262.0204 Hz\n",
      "target trap frequency x: 14000.00 HZ\n",
      "trapping frequency x 1: 7931.52 Hz\n",
      "trapping frequency x 2: 7931.52 Hz\n",
      "trapping frequency y 1: 14907.62 Hz\n",
      "trapping frequency y 2: 14907.62 Hz\n",
      "trapping frequency z 1: 1006.88 Hz\n",
      "trapping frequency z 2: 1006.88 Hz\n",
      "harmonic oscillator length x: 88.97 nm\n",
      "harmonic oscillator length z: 249.70 nm\n",
      "tunneling distance: 957.42 nm\n",
      "files saved with ...._2025-04-06_19-13-17\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 104240 characters]",
      "text/plain": [
       "<Figure size 1800x500 with 12 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "_________________________________________________________________\n",
      "depth 1: 1301.3475 Hz\n",
      "depth 2: 1301.3475 Hz\n",
      "target trap frequency x: 26000.00 HZ\n",
      "trapping frequency x 1: 5124.44 Hz\n",
      "trapping frequency x 2: 5124.44 Hz\n",
      "trapping frequency y 1: 28521.40 Hz\n",
      "trapping frequency y 2: 28521.40 Hz\n",
      "trapping frequency z 1: 1727.88 Hz\n",
      "trapping frequency z 2: 1727.88 Hz\n",
      "harmonic oscillator length x: 110.68 nm\n",
      "harmonic oscillator length z: 190.61 nm\n",
      "tunneling distance: 313.50 nm\n",
      "files saved with ...._2025-04-06_19-42-53\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 141968 characters]",
      "text/plain": [
       "<Figure size 1800x500 with 12 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "_________________________________________________________________\n",
      "depth 1: 5482.9587 Hz\n",
      "depth 2: 5482.9587 Hz\n",
      "target trap frequency x: 26000.00 HZ\n",
      "trapping frequency x 1: 7288.72 Hz\n",
      "trapping frequency x 2: 7288.72 Hz\n",
      "trapping frequency y 1: 28403.76 Hz\n",
      "trapping frequency y 2: 28403.76 Hz\n",
      "trapping frequency z 1: 1748.51 Hz\n",
      "trapping frequency z 2: 1748.51 Hz\n",
      "harmonic oscillator length x: 92.81 nm\n",
      "harmonic oscillator length z: 189.49 nm\n",
      "tunneling distance: 449.35 nm\n",
      "files saved with ...._2025-04-06_20-13-27\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 160508 characters]",
      "text/plain": [
       "<Figure size 1800x500 with 12 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "_________________________________________________________________\n",
      "depth 1: 12376.3137 Hz\n",
      "depth 2: 12376.3137 Hz\n",
      "target trap frequency x: 26000.00 HZ\n",
      "trapping frequency x 1: 8871.09 Hz\n",
      "trapping frequency x 2: 8871.09 Hz\n",
      "trapping frequency y 1: 28291.64 Hz\n",
      "trapping frequency y 2: 28291.64 Hz\n",
      "trapping frequency z 1: 1767.93 Hz\n",
      "trapping frequency z 2: 1767.93 Hz\n",
      "harmonic oscillator length x: 84.12 nm\n",
      "harmonic oscillator length z: 188.44 nm\n",
      "tunneling distance: 551.04 nm\n",
      "files saved with ...._2025-04-06_20-41-05\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 147544 characters]",
      "text/plain": [
       "<Figure size 1800x500 with 12 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "_________________________________________________________________\n",
      "depth 1: 21817.1780 Hz\n",
      "depth 2: 21817.1780 Hz\n",
      "target trap frequency x: 26000.00 HZ\n",
      "trapping frequency x 1: 10151.16 Hz\n",
      "trapping frequency x 2: 10151.16 Hz\n",
      "trapping frequency y 1: 28184.76 Hz\n",
      "trapping frequency y 2: 28184.76 Hz\n",
      "trapping frequency z 1: 1786.25 Hz\n",
      "trapping frequency z 2: 1786.25 Hz\n",
      "harmonic oscillator length x: 78.64 nm\n",
      "harmonic oscillator length z: 187.47 nm\n",
      "tunneling distance: 635.24 nm\n",
      "files saved with ...._2025-04-06_21-06-25\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 101224 characters]",
      "text/plain": [
       "<Figure size 1800x500 with 12 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "_________________________________________________________________\n",
      "depth 1: 33651.9397 Hz\n",
      "depth 2: 33651.9397 Hz\n",
      "target trap frequency x: 26000.00 HZ\n",
      "trapping frequency x 1: 11236.58 Hz\n",
      "trapping frequency x 2: 11236.58 Hz\n",
      "trapping frequency y 1: 28082.86 Hz\n",
      "trapping frequency y 2: 28082.86 Hz\n",
      "trapping frequency z 1: 1803.57 Hz\n",
      "trapping frequency z 2: 1803.57 Hz\n",
      "harmonic oscillator length x: 74.75 nm\n",
      "harmonic oscillator length z: 186.57 nm\n",
      "tunneling distance: 708.29 nm\n",
      "files saved with ...._2025-04-06_21-32-22\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 94184 characters]",
      "text/plain": [
       "<Figure size 1800x500 with 12 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "_________________________________________________________________\n",
      "depth 1: 47736.7584 Hz\n",
      "depth 2: 47736.7584 Hz\n",
      "target trap frequency x: 26000.00 HZ\n",
      "trapping frequency x 1: 12182.01 Hz\n",
      "trapping frequency x 2: 12182.01 Hz\n",
      "trapping frequency y 1: 27985.69 Hz\n",
      "trapping frequency y 2: 27985.69 Hz\n",
      "trapping frequency z 1: 1819.94 Hz\n",
      "trapping frequency z 2: 1819.94 Hz\n",
      "harmonic oscillator length x: 71.79 nm\n",
      "harmonic oscillator length z: 185.73 nm\n",
      "tunneling distance: 773.38 nm\n",
      "files saved with ...._2025-04-06_21-58-44\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 110664 characters]",
      "text/plain": [
       "<Figure size 1800x500 with 12 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "_________________________________________________________________\n",
      "depth 1: 63936.7940 Hz\n",
      "depth 2: 63936.7940 Hz\n",
      "target trap frequency x: 26000.00 HZ\n",
      "trapping frequency x 1: 13020.75 Hz\n",
      "trapping frequency x 2: 13020.75 Hz\n",
      "trapping frequency y 1: 27893.02 Hz\n",
      "trapping frequency y 2: 27893.02 Hz\n",
      "trapping frequency z 1: 1835.47 Hz\n",
      "trapping frequency z 2: 1835.47 Hz\n",
      "harmonic oscillator length x: 69.44 nm\n",
      "harmonic oscillator length z: 184.94 nm\n",
      "tunneling distance: 832.44 nm\n",
      "files saved with ...._2025-04-06_22-24-40\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 105532 characters]",
      "text/plain": [
       "<Figure size 1800x500 with 12 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "_________________________________________________________________\n",
      "depth 1: 82125.5072 Hz\n",
      "depth 2: 82125.5072 Hz\n",
      "target trap frequency x: 26000.00 HZ\n",
      "trapping frequency x 1: 13773.95 Hz\n",
      "trapping frequency x 2: 13773.95 Hz\n",
      "trapping frequency y 1: 27804.63 Hz\n",
      "trapping frequency y 2: 27804.63 Hz\n",
      "trapping frequency z 1: 1850.19 Hz\n",
      "trapping frequency z 2: 1850.19 Hz\n",
      "harmonic oscillator length x: 67.51 nm\n",
      "harmonic oscillator length z: 184.21 nm\n",
      "tunneling distance: 886.69 nm\n",
      "files saved with ...._2025-04-06_22-50-52\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 104952 characters]",
      "text/plain": [
       "<Figure size 1800x500 with 12 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "_________________________________________________________________\n",
      "depth 1: 206.0294 Hz\n",
      "depth 2: 206.0294 Hz\n",
      "target trap frequency x: 38000.00 HZ\n",
      "trapping frequency x 1: 3927.45 Hz\n",
      "trapping frequency x 2: 3927.45 Hz\n",
      "trapping frequency y 1: 41806.76 Hz\n",
      "trapping frequency y 2: 41806.76 Hz\n",
      "trapping frequency z 1: 2503.79 Hz\n",
      "trapping frequency z 2: 2503.79 Hz\n",
      "harmonic oscillator length x: 126.43 nm\n",
      "harmonic oscillator length z: 158.35 nm\n",
      "tunneling distance: 163.52 nm\n",
      "files saved with ...._2025-04-06_23-20-48\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 120440 characters]",
      "text/plain": [
       "<Figure size 1800x500 with 12 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "_________________________________________________________________\n",
      "depth 1: 4990.1882 Hz\n",
      "depth 2: 4990.1882 Hz\n",
      "target trap frequency x: 38000.00 HZ\n",
      "trapping frequency x 1: 8648.91 Hz\n",
      "trapping frequency x 2: 8648.91 Hz\n",
      "trapping frequency y 1: 41629.10 Hz\n",
      "trapping frequency y 2: 41629.10 Hz\n",
      "trapping frequency z 1: 2535.23 Hz\n",
      "trapping frequency z 2: 2535.23 Hz\n",
      "harmonic oscillator length x: 85.20 nm\n",
      "harmonic oscillator length z: 157.36 nm\n",
      "tunneling distance: 362.93 nm\n",
      "files saved with ...._2025-04-06_23-54-05\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 134136 characters]",
      "text/plain": [
       "<Figure size 1800x500 with 12 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "_________________________________________________________________\n",
      "depth 1: 15819.1999 Hz\n",
      "depth 2: 15819.1999 Hz\n",
      "target trap frequency x: 38000.00 HZ\n",
      "trapping frequency x 1: 11457.87 Hz\n",
      "trapping frequency x 2: 11457.87 Hz\n",
      "trapping frequency y 1: 41459.80 Hz\n",
      "trapping frequency y 2: 41459.80 Hz\n",
      "trapping frequency z 1: 2564.79 Hz\n",
      "trapping frequency z 2: 2564.79 Hz\n",
      "harmonic oscillator length x: 74.02 nm\n",
      "harmonic oscillator length z: 156.45 nm\n",
      "tunneling distance: 484.49 nm\n",
      "files saved with ...._2025-04-07_00-21-25\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 131008 characters]",
      "text/plain": [
       "<Figure size 1800x500 with 12 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "_________________________________________________________________\n",
      "depth 1: 32325.6944 Hz\n",
      "depth 2: 32325.6944 Hz\n",
      "target trap frequency x: 38000.00 HZ\n",
      "trapping frequency x 1: 13603.48 Hz\n",
      "trapping frequency x 2: 13603.48 Hz\n",
      "trapping frequency y 1: 41298.43 Hz\n",
      "trapping frequency y 2: 41298.43 Hz\n",
      "trapping frequency z 1: 2592.66 Hz\n",
      "trapping frequency z 2: 2592.66 Hz\n",
      "harmonic oscillator length x: 67.93 nm\n",
      "harmonic oscillator length z: 155.61 nm\n",
      "tunneling distance: 579.54 nm\n",
      "files saved with ...._2025-04-07_00-46-22\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 90884 characters]",
      "text/plain": [
       "<Figure size 1800x500 with 12 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "_________________________________________________________________\n",
      "depth 1: 54166.3348 Hz\n",
      "depth 2: 54166.3348 Hz\n",
      "target trap frequency x: 38000.00 HZ\n",
      "trapping frequency x 1: 15371.52 Hz\n",
      "trapping frequency x 2: 15371.52 Hz\n",
      "trapping frequency y 1: 41144.59 Hz\n",
      "trapping frequency y 2: 41144.59 Hz\n",
      "trapping frequency z 1: 2618.95 Hz\n",
      "trapping frequency z 2: 2618.95 Hz\n",
      "harmonic oscillator length x: 63.91 nm\n",
      "harmonic oscillator length z: 154.83 nm\n",
      "tunneling distance: 659.70 nm\n",
      "files saved with ...._2025-04-07_01-11-17\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 100996 characters]",
      "text/plain": [
       "<Figure size 1800x500 with 12 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "_________________________________________________________________\n",
      "depth 1: 81019.8726 Hz\n",
      "depth 2: 81019.8726 Hz\n",
      "target trap frequency x: 38000.00 HZ\n",
      "trapping frequency x 1: 16885.27 Hz\n",
      "trapping frequency x 2: 16885.27 Hz\n",
      "trapping frequency y 1: 40997.91 Hz\n",
      "trapping frequency y 2: 40997.91 Hz\n",
      "trapping frequency z 1: 2643.80 Hz\n",
      "trapping frequency z 2: 2643.80 Hz\n",
      "harmonic oscillator length x: 60.98 nm\n",
      "harmonic oscillator length z: 154.10 nm\n",
      "tunneling distance: 729.92 nm\n",
      "files saved with ...._2025-04-07_01-38-34\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 105072 characters]",
      "text/plain": [
       "<Figure size 1800x500 with 12 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "_________________________________________________________________\n",
      "depth 1: 112585.3863 Hz\n",
      "depth 2: 112585.3863 Hz\n",
      "target trap frequency x: 38000.00 HZ\n",
      "trapping frequency x 1: 18212.51 Hz\n",
      "trapping frequency x 2: 18212.51 Hz\n",
      "trapping frequency y 1: 40858.04 Hz\n",
      "trapping frequency y 2: 40858.04 Hz\n",
      "trapping frequency z 1: 2667.32 Hz\n",
      "trapping frequency z 2: 2667.32 Hz\n",
      "harmonic oscillator length x: 58.71 nm\n",
      "harmonic oscillator length z: 153.42 nm\n",
      "tunneling distance: 792.90 nm\n",
      "files saved with ...._2025-04-07_02-06-53\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 93196 characters]",
      "text/plain": [
       "<Figure size 1800x500 with 12 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "_________________________________________________________________\n",
      "depth 1: 148580.6854 Hz\n",
      "depth 2: 148580.6854 Hz\n",
      "target trap frequency x: 38000.00 HZ\n",
      "trapping frequency x 1: 19395.58 Hz\n",
      "trapping frequency x 2: 19395.58 Hz\n",
      "trapping frequency y 1: 40724.64 Hz\n",
      "trapping frequency y 2: 40724.64 Hz\n",
      "trapping frequency z 1: 2689.63 Hz\n",
      "trapping frequency z 2: 2689.63 Hz\n",
      "harmonic oscillator length x: 56.89 nm\n",
      "harmonic oscillator length z: 152.78 nm\n",
      "tunneling distance: 850.31 nm\n",
      "files saved with ...._2025-04-07_02-35-03\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 91992 characters]",
      "text/plain": [
       "<Figure size 1800x500 with 12 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "_________________________________________________________________\n",
      "depth 1: 3876.0284 Hz\n",
      "depth 2: 3876.0284 Hz\n",
      "target trap frequency x: 50000.00 HZ\n",
      "trapping frequency x 1: 9342.06 Hz\n",
      "trapping frequency x 2: 9342.06 Hz\n",
      "trapping frequency y 1: 54871.23 Hz\n",
      "trapping frequency y 2: 54871.23 Hz\n",
      "trapping frequency z 1: 3318.89 Hz\n",
      "trapping frequency z 2: 3318.89 Hz\n",
      "harmonic oscillator length x: 81.98 nm\n",
      "harmonic oscillator length z: 137.54 nm\n",
      "tunneling distance: 296.97 nm\n",
      "files saved with ...._2025-04-07_03-06-08\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 135040 characters]",
      "text/plain": [
       "<Figure size 1800x500 with 12 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "_________________________________________________________________\n",
      "depth 1: 18340.7518 Hz\n",
      "depth 2: 18340.7518 Hz\n",
      "target trap frequency x: 50000.00 HZ\n",
      "trapping frequency x 1: 13678.88 Hz\n",
      "trapping frequency x 2: 13678.88 Hz\n",
      "trapping frequency y 1: 54643.95 Hz\n",
      "trapping frequency y 2: 54643.95 Hz\n",
      "trapping frequency z 1: 3358.79 Hz\n",
      "trapping frequency z 2: 3358.79 Hz\n",
      "harmonic oscillator length x: 67.75 nm\n",
      "harmonic oscillator length z: 136.72 nm\n",
      "tunneling distance: 438.20 nm\n",
      "files saved with ...._2025-04-07_03-33-39\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 138040 characters]",
      "text/plain": [
       "<Figure size 1800x500 with 12 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "_________________________________________________________________\n",
      "depth 1: 42894.8300 Hz\n",
      "depth 2: 42894.8300 Hz\n",
      "target trap frequency x: 50000.00 HZ\n",
      "trapping frequency x 1: 16796.67 Hz\n",
      "trapping frequency x 2: 16796.67 Hz\n",
      "trapping frequency y 1: 54427.33 Hz\n",
      "trapping frequency y 2: 54427.33 Hz\n",
      "trapping frequency z 1: 3396.37 Hz\n",
      "trapping frequency z 2: 3396.37 Hz\n",
      "harmonic oscillator length x: 61.14 nm\n",
      "harmonic oscillator length z: 135.96 nm\n",
      "tunneling distance: 542.15 nm\n",
      "files saved with ...._2025-04-07_03-58-23\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 86736 characters]",
      "text/plain": [
       "<Figure size 1800x500 with 12 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "_________________________________________________________________\n",
      "depth 1: 76926.9241 Hz\n",
      "depth 2: 76926.9241 Hz\n",
      "target trap frequency x: 50000.00 HZ\n",
      "trapping frequency x 1: 19302.73 Hz\n",
      "trapping frequency x 2: 19302.73 Hz\n",
      "trapping frequency y 1: 54220.84 Hz\n",
      "trapping frequency y 2: 54220.84 Hz\n",
      "trapping frequency z 1: 3431.79 Hz\n",
      "trapping frequency z 2: 3431.79 Hz\n",
      "harmonic oscillator length x: 57.03 nm\n",
      "harmonic oscillator length z: 135.25 nm\n",
      "tunneling distance: 627.68 nm\n",
      "files saved with ...._2025-04-07_04-25-38\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 98856 characters]",
      "text/plain": [
       "<Figure size 1800x500 with 12 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "_________________________________________________________________\n",
      "depth 1: 119865.3000 Hz\n",
      "depth 2: 119865.3000 Hz\n",
      "target trap frequency x: 50000.00 HZ\n",
      "trapping frequency x 1: 21420.65 Hz\n",
      "trapping frequency x 2: 21420.65 Hz\n",
      "trapping frequency y 1: 54023.98 Hz\n",
      "trapping frequency y 2: 54023.98 Hz\n",
      "trapping frequency z 1: 3465.27 Hz\n",
      "trapping frequency z 2: 3465.27 Hz\n",
      "harmonic oscillator length x: 54.14 nm\n",
      "harmonic oscillator length z: 134.60 nm\n",
      "tunneling distance: 701.64 nm\n",
      "files saved with ...._2025-04-07_04-52-55\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 88372 characters]",
      "text/plain": [
       "<Figure size 1800x500 with 12 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "_________________________________________________________________\n",
      "depth 1: 171174.6504 Hz\n",
      "depth 2: 171174.6504 Hz\n",
      "target trap frequency x: 50000.00 HZ\n",
      "trapping frequency x 1: 23261.68 Hz\n",
      "trapping frequency x 2: 23261.68 Hz\n",
      "trapping frequency y 1: 53836.25 Hz\n",
      "trapping frequency y 2: 53836.25 Hz\n",
      "trapping frequency z 1: 3496.94 Hz\n",
      "trapping frequency z 2: 3496.94 Hz\n",
      "harmonic oscillator length x: 51.95 nm\n",
      "harmonic oscillator length z: 133.99 nm\n",
      "tunneling distance: 767.40 nm\n",
      "files saved with ...._2025-04-07_05-20-25\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 96852 characters]",
      "text/plain": [
       "<Figure size 1800x500 with 12 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "_________________________________________________________________\n",
      "depth 1: 230353.2166 Hz\n",
      "depth 2: 230353.2166 Hz\n",
      "target trap frequency x: 50000.00 HZ\n",
      "trapping frequency x 1: 24892.25 Hz\n",
      "trapping frequency x 2: 24892.25 Hz\n",
      "trapping frequency y 1: 53657.23 Hz\n",
      "trapping frequency y 2: 53657.23 Hz\n",
      "trapping frequency z 1: 3526.94 Hz\n",
      "trapping frequency z 2: 3526.94 Hz\n",
      "harmonic oscillator length x: 50.22 nm\n",
      "harmonic oscillator length z: 133.42 nm\n",
      "tunneling distance: 826.98 nm\n",
      "files saved with ...._2025-04-07_05-48-12\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 95916 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*tunneling_dist-5*harm_osc_len_x\n",
    "        right_cutoff = 0.5*tunneling_dist+5*harm_osc_len_x\n",
    "        back_cutoff = -5*harm_osc_len_x\n",
    "        front_cutoff = 5*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
}
