381 lines
252 KiB
Plaintext
381 lines
252 KiB
Plaintext
|
{
|
||
|
"cells": [
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 109,
|
||
|
"id": "f8d06107",
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"# -*- coding: utf-8 -*-\n",
|
||
|
"\"\"\"\n",
|
||
|
"Created on Tue Aug 24 16:24:52 2021\n",
|
||
|
"\n",
|
||
|
"@author: Joschka\n",
|
||
|
"\"\"\"\n",
|
||
|
"\n",
|
||
|
"import matplotlib.pyplot as plt\n",
|
||
|
"import numpy as np\n",
|
||
|
"import sys\n",
|
||
|
"sys.path.insert(0,'..')\n",
|
||
|
"\n",
|
||
|
"from src import coil_class as BC\n",
|
||
|
"from src import physical_constants as cs\n",
|
||
|
"\n",
|
||
|
"#from IPython import get_ipython\n",
|
||
|
"#get_ipython().run_line_magic('matplotlib', 'qt')\n",
|
||
|
"#get_ipython().run_line_magic('matplotlib', 'inline')\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
"from scipy.optimize import curve_fit\n",
|
||
|
"plt.rcParams['axes.grid'] = True\n",
|
||
|
"plt.rcParams['grid.alpha'] = 0.5"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"id": "99eb6ef1-8920-4f7d-9b58-fd00c731d2bc",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"## Set up coils"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 274,
|
||
|
"id": "199e2602-bec6-429a-a639-6ea35ababb86",
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"HH = 1\n",
|
||
|
"I = 5\n",
|
||
|
"\n",
|
||
|
"d_coils = 50\n",
|
||
|
"Radius = 30\n",
|
||
|
"\n",
|
||
|
"layers = 4\n",
|
||
|
"windings = 4\n",
|
||
|
"wire_width = 1\n",
|
||
|
"wire_height = 1\n",
|
||
|
"\n",
|
||
|
"Coil = BC.BCoil(HH,d_coils,Radius, layers, windings, wire_width, wire_height)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 287,
|
||
|
"id": "40cee79d-d6ef-4df4-ae03-5e82785433e8",
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"20\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAkcAAAGwCAYAAACjPMHLAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAA9hAAAPYQGoP6dpAAEAAElEQVR4nOyddVxU2fvHPzMMjYB0qIgidq/djY3da7drrx3Y2Lq2ssbatYrdIipgYICCiqAgJSkdE8/vD35zvyAhA/eKuuf9evkS7tz5nDNnhrnPfc4TIiIiMBgMBoPBYDAAAOKSngCDwWAwGAzGjwQzjhgMBoPBYDCywYwjBoPBYDAYjGww44jBYDAYDAYjG8w4YjAYDAaDwcgGM44YDAaDwWAwssGMIwaDwWAwGIxsSEp6Aj8jCoUC4eHhKFWqFEQiUUlPh8FgMBgMRiEgIiQlJcHKygpicf7+IWYcFYHw8HCULVu2pKfBYDAYDAajCHz69AllypTJ93FmHBWBUqVKAchaXH19fd505XI5AgMDUbFiRaipqfGmy/g2bO1LDrb2JQdb+5KDrX3JkJiYiLJly3LX8fxgxlERUG6l6evr824c6enpQV9fn/2xfGfY2pccbO1LDrb2JQdb+5LlWyExLCCbwWAwGAwGIxvMOGIwGAwGg8HIBjOOGAwGg8FgMLLBjCMGg8FgMBiMbDDjiMFgMBgMBiMbzDhiMBgMBoPByAYzjhgMBoPBYDCywYwjBoPBYDAYjGww44jBYDAYDAYjG8w4+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qFOnDhQKhaBZa0FBQbC1tRU0U0L
|
||
|
"text/plain": [
|
||
|
"<Figure size 640x480 with 1 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"z = np.arange(-100,100,10)\n",
|
||
|
"print(np.size(z))\n",
|
||
|
"r = np.arange(1e-15,100,5)\n",
|
||
|
"\n",
|
||
|
"B, B_tot = Coil.B_multiple_3d(I, r,z,raster = 4)\n",
|
||
|
"\n",
|
||
|
"z_m, r_m = np.meshgrid(z,r)\n",
|
||
|
"\n",
|
||
|
"#plt.figure(figsize=(16,10))\n",
|
||
|
"plt.quiver(r_m,z_m,B[:,:,1],B[:,:,0])\n",
|
||
|
"plt.xlabel(\"radius r [m]\")\n",
|
||
|
"plt.ylabel(\"z-axis [m]\")\n",
|
||
|
"plt.show()"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 276,
|
||
|
"id": "28dcdd21-f4b6-49e6-a935-4012a941f186",
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"z = np.arange(-100,100,1)\n",
|
||
|
"r = np.arange(1e-3,100,1)\n",
|
||
|
"\n",
|
||
|
"B, B_tot = Coil.B_multiple_3d(I, r,z,raster = 2)\n",
|
||
|
"\n",
|
||
|
"z_m, r_m = np.meshgrid(z,r)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 277,
|
||
|
"id": "ad02e8cd-e92a-4d27-845d-cc7e22d6e7e5",
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"x = np.concatenate((-np.flip(r),r))\n",
|
||
|
"B_tot_x = np.concatenate((np.flip(B_tot[:,len(z)//2]),B_tot[:,len(z)//2]))\n",
|
||
|
"B_tot_z = B_tot[0,:]\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 278,
|
||
|
"id": "52475c2c-e2f0-4615-a5f4-9f0a86155a3e",
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAjMAAAGwCAYAAABcnuQpAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAA9hAAAPYQGoP6dpAABgt0lEQVR4nO3deXxTVfo/8M9N0qRbkm50XygtWymbbIrKKiAqDjoq6gzujoqoiMvI1w0YGdRxFBVRUQZxHBVnUH7uCMqiIvu+lW60dKN0Tde0Tc7vjzTB0oWkTXuzfN6vV1+Qm5ub5/SmyZNznnuOJIQQICIiInJTCrkDICIiIuoKJjNERETk1pjMEBERkVtjMkNERERujckMERERuTUmM0REROTWmMwQERGRW1PJHUB3M5vNKCgogFarhSRJcodDREREdhBCoKqqCtHR0VAoOu578fhkpqCgAHFxcXKHQURERJ1w+vRpxMbGdriPxyczWq0WgOWXodPpunw8k8mEzMxMJCUlQalUdvl4roht9Axso2dgGz0D2+g4g8GAuLg42+d4Rzw+mbEOLel0OqclM4GBgdDpdB79gmQb3R/b6BnYRs/ANnaePSUiLAAmIiIit8ZkhoiIiNwakxkiIiJya0xmiIiIyK0xmSEiIiK3xmSGiIiI3BqTGSIiInJrTGaIiIjIrTGZISIiIrfGZIaIiIjcGpMZIiIicmtMZoiIiMitMZkhIrdkNguU1zagtLYJxiaz3OEQkYw8ftVsIvIMZ6uM+O5IIXZll2F/bgUKK+tgFtZ7c6DzVWFwrB4jEkIwZWAEUmN0dq22S0Tuj8kMEbm0nVmleP+XbPx0ohimc9mLjQRAADDUN+HXjFL8mlGKN35Mx4BILf58cQJuGhkHtYqd0ESejMkMEbmk9DNVePG7E/jxRLFt27C4IEweEI4RvYORHB4IrVqJ7KwMRMT2xpmqRuz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7PFbGNnqEn2yiEwOrtll6ZOy9NhL/Gp9ufE+i5Nt4zrg8+2pWLbeklyC6tRXJ4zy2WydeqZ2AbHePIMVy2r+vnn39GcXEx4uPjoVKpoFKpkJOTg8ceewy9e/eWOzwiOs9vWaU4UVQFPx8lbh4VL3c4TpcQGoArBkYAAFb/ekreYIioBZdNZmbPno1Dhw7hwIEDtp/o6Gg88cQT2LBhg9zhEdF5/vXLKQDADSNioffvmV6Znmad/G/dvjxU1DbIHA0RWck6zFRdXY2MjAzb7ezsbBw4cAAhISGIj49HaGhoi/19fHwQGRmJ/v3dZ40XIm9wqqQGP56wTCp3x6W95Q2mG13cJwQDo3Q4XmjAJ7tO44EJSXKHRESQuWdmz549GD58OIYPHw4AmD9/PoYPH47nnntOzrCIyEEf7ciBEMCE/r2Q1KvrVw26KkmScFdzsvbRjhyYzJxEj8gVyNozM2HCBIdm1Dx16lT3BUNEnWJsMmHdvjwAwG2XJMgcTfebMTQaL3xzHPkVddiWfhYT+4fLHRKR13PZmhkicg8bjp5BeW0jovS+GN/P8z/YfX2UuG54DADg0125MkdDRACTGSLqok92Wj7QbxoZ5/ZLF9jrltGWq7V+PF6MYkO9zNEQEZMZIuq07JIa/JZVCkkCbhoVJ3c4PaZ/pBYXxQehySzw3715codD5PWYzBBRp32629IrM75fL8QE+ckcTc+6ubl3Zu3u0zCzEJhIVkxmiKhTTGaBz/flA4BHTpJ3IdcMiYJWo0JuWS12nyqTOxwir8Zkhog6ZXtmCc5WGRHk74NJAzy/8Pd8/moVpg+OBACsP5AvczRE3o3JDBF1yhf7LR/g1wyJgrqbF5R0VTObr2r6+lAh6htNMkdD5L288x2IiLqktqEJG44UAYDtMmVvdHFiKKL0vqiqb8LmE8Vyh0P
|
||
|
"text/plain": [
|
||
|
"<Figure size 640x480 with 1 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
},
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0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FbTyYiZSL1UY7tzW4WNWAt35tKRz/OaUPXOyvruvr7566vqWg+jYpH2nFNUY9N5ElYQFEZIU2HcqGulmLAT3dMC6qh9HPPyaqByZG+0KjFbHyuzMcEG2Al386j9pGDeKC3TEjzngtc21iAt1wXV9fAMAn+3lHGFkvFkBEVqahSYPPDmUCgEkXMl1xQzTsbBT4PbUUey4Um+Q15OZ0XiW2tc7YvHJavy7f9XUl97dOjvi/o7ko+8uCqkTWhAUQkZX5NikPJTWNCHCzx9T+/iZ7nWAvR8xpnRvo1V+SOQGfHl7b0TIu56bYgKuakuBKhod5on+gG9TNWvzfoSyTvQ6ROWMBRGRFRFHEx/tauj3uHRV2ybWkjOWR8RFwVtngTH4VfjhVYNLXsnSH00uRkFwMG4WAJRNNu3q7IAi6VqCNB7PQ0KQx6esRmSMWQERW5EBaKVKKauBkp8SsYUEmfz1PJzs80LoK+es7L6BJozX5a1oiURTxyi8trT+zhgYh1NvJ5K85tb8/AtzsUVKjxk+nWZyS9WEBRGRFvkzMAQBMjwuEq5HvLrqU+aPD4OVkh4ySWnzNFck7tedCMY5mlcPeVoHHJkR2y2vaKhW4Y1jLoqpfHsntltckMicsgIisRGVdE346XQgAmDnE9K0/bZxVNnhobEsr0PsJadBwLFA7oijizdbb3u8eHgJfV/tue+1bB/eEIAAH00uRVVrbba9LZA5YABFZie0n8tDYrEUfPxcM6OnWra991/AQuDvaIqOkFj9yLFA7+1N
|
||
|
"text/plain": [
|
||
|
"<Figure size 640x480 with 1 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
},
|
||
|
{
|
||
|
"data": {
|
||
|
"text/plain": [
|
||
|
"'\\nplt.plot(x,np.gradient(B_tot_x,x))\\nplt.xlabel(\"radius r [mm]\")\\nplt.ylabel(\"total field B_tot [G]\")\\n#plt.xlim(0,0.01)\\nplt.show()\\nplt.plot(z,np.gradient(B_tot[0,:],z))\\nplt.xlabel(\"z_axis [mm]\")\\nplt.ylabel(\"total field B_tot [G]\")\\nplt.show()\\n'"
|
||
|
]
|
||
|
},
|
||
|
"execution_count": 278,
|
||
|
"metadata": {},
|
||
|
"output_type": "execute_result"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"plt.plot(x,B_tot_x)\n",
|
||
|
"plt.xlabel(\"radius r [mm]\")\n",
|
||
|
"plt.ylabel(\"total field B_tot [G]\")\n",
|
||
|
"#plt.xlim(-0.1,0.1)\n",
|
||
|
"plt.show()\n",
|
||
|
"plt.plot(z,B_tot_z)\n",
|
||
|
"plt.xlabel(\"z_axis [mm]\")\n",
|
||
|
"plt.ylabel(\"total field B_tot [G]\")\n",
|
||
|
"plt.show()\n",
|
||
|
"\n",
|
||
|
"\"\"\"\n",
|
||
|
"plt.plot(x,np.gradient(B_tot_x,x))\n",
|
||
|
"plt.xlabel(\"radius r [mm]\")\n",
|
||
|
"plt.ylabel(\"total field B_tot [G]\")\n",
|
||
|
"#plt.xlim(0,0.01)\n",
|
||
|
"plt.show()\n",
|
||
|
"plt.plot(z,np.gradient(B_tot[0,:],z))\n",
|
||
|
"plt.xlabel(\"z_axis [mm]\")\n",
|
||
|
"plt.ylabel(\"total field B_tot [G]\")\n",
|
||
|
"plt.show()\n",
|
||
|
"\"\"\""
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"id": "37c71478-cae2-40ea-8712-b2f751c6c54d",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"## Fit harmonic function"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 279,
|
||
|
"id": "443f51a2-a502-4d4a-8692-15610c193cc7",
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"def func(x,a,b):\n",
|
||
|
" return a*x**2+b\n",
|
||
|
"\n",
|
||
|
"x_SI = 1e-3 * x\n",
|
||
|
"z_SI = 1e-3 * z\n",
|
||
|
"\n",
|
||
|
"B_tot_x_SI = 1e-4*B_tot_x\n",
|
||
|
"B_tot_z_SI = 1e-4*B_tot_z\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 280,
|
||
|
"id": "59145c9b-aac3-4bea-ba79-b2a3992d05f6",
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"nr_points = 20\n",
|
||
|
"a = 100-nr_points//2\n",
|
||
|
"b = 100+ nr_points//2\n",
|
||
|
"popt_x, pcov = curve_fit(func,x_SI[a:b],B_tot_x_SI[a:b])"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 286,
|
||
|
"id": "49c6fb78-ba74-41e3-9a2a-c4dca7109643",
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAkAAAAG2CAYAAACXuTmvAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAA9hAAAPYQGoP6dpAACHfUlEQVR4nOzdd3hT1RvA8W+S7t1SuqC0Bcoue8heskUQBy6GuBBQEf2hqCiIggtERUUcgCKCylRBhrL33qOF0jJaChS6V5L7++NCsXaQQNOkzft5nj7e3HvOzRtOa9+ee4ZGURQFIYQQQgg7orV2AEIIIYQQZU0SICGEEELYHUmAhBBCCGF3JAESQgghhN2RBEgIIYQQdkcSICGEEELYHUmAhBBCCGF3JAESQgghhN2RBEgIIYQQdkcSICGEEELYHasmQFOmTKFFixZ4enoSEBBA//79OXHiRIEyiqIwYcIEQkJCcHV1pVOnThw5cuSW9160aBH16tXD2dmZevXqsWTJEkt9DCGEEEKUM1ZNgDZs2MDIkSPZvn07a9asQa/X0717dzIyMvLLfPjhh0ybNo0ZM2awa9cugoKC6NatG2lpacXed9u2bQwcO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DC7kgCJIQQQgi7IwmQEEIIIeyOJEBCCCGEsDuSAAkhhBDC7kgCJIQQQgi7IwmQEEIIIeyOJEBCCCGEsDuSAAkhhBDC7kgCJIQQQgi7I7vBCyGEEBVMeno6np6e1g6jVFhqxy7pARJCCCEqmNWrV3PgwAEURTH5y2g0kpmZidF
|
||
|
"text/plain": [
|
||
|
"<Figure size 640x480 with 1 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"plt.plot(1e3*x_SI,1e4*func(x_SI,popt_x[0],popt_x[1]),label = \"harmonic fit\")\n",
|
||
|
"plt.plot(1e3*x_SI,1e4*B_tot_x_SI, label = r\"$ B_{tot} = \\sqrt{r^2 + z^2} $\" )\n",
|
||
|
"#plt.ylim(0,8)\n",
|
||
|
"#plt.xlim(-0.01,0.01)\n",
|
||
|
"plt.xlabel(\"x-axis [mm]\")\n",
|
||
|
"plt.xlim(-50,50)\n",
|
||
|
"plt.ylim(0,20)\n",
|
||
|
"plt.ylabel(\"B_tot [G]\")\n",
|
||
|
"plt.legend()\n",
|
||
|
"plt.show()"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 282,
|
||
|
"id": "77c981bb-02be-4de9-8990-849b6a7fbee1",
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"nr_points = 20\n",
|
||
|
"a = 100-nr_points//2\n",
|
||
|
"b = 100+ nr_points//2\n",
|
||
|
"popt_z, pcov = curve_fit(func,z_SI[a:b],B_tot_z_SI[a:b])"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 285,
|
||
|
"id": "f1f7cdd7-f13c-41e2-be5e-a375dc5e4d06",
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhE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3YLRYfTzvLdx1hzpaDVscREREpU0ez8vhw/g4AHu3VEC8P60sJ6xO4uYhg38IR3K/O2IzTqd4ZERGpuD6Yt4OMnAIaRwZxZYsoq+MAKmZKxQPx9Qny9WRzcgY/rdlvdRwREZEykZKRw6S/EwF4vHcj7HabtYGOUzFTCkL9vRnc1Zz18I1ZW8grcFqcSEREpPS9+9d2svMdtKwdSs8m4VbHKaRippScWI9iT2o2XyzdbXUcERGRUrX3SBZTl5h/34Zf1gibzTV6ZUDFTKnx9/bkkR4NAHh7dgLHcgssTiQiIlJ63vozgTyHkw71qtIptprVcYpQMVOKbr64NjFV/TmUmcf/5u+0Oo6IiEip2H4wk29X7gPgicsaWZzmVCpmSpGXh53He5uN/NH8HRzOzLU4kYiIyIV7c9ZWHE6DHo3DaRNdxeo4p1AxU8r6Na9Bs6hgMnMLeOev7VbHERERuSAb96fzy9okgMIv7K5GxUwps9ttPNmnMWCuW7H3SJbFiURERM7fa79vBuCKFjVoGhVscZrTUzFTBjo3qEaHelXJczh5c1aC1XFERETOy8Lth/hry0E87TYe69XQ6jhnpGKmDNhsNp683Oyd+W7VXrYkZ1icSEREpGScToNXfjN7ZW5rX4d61QMtTnRmKmbKSKvaofRpFolhwGu/b7E6joiISIn8si6JtXvTCPD24OHjU4+4KhUzZeiJyxpht8Efmw6wYleq1XFERESKJbfAUThWZlDX+lQL9LE
|
||
|
"text/plain": [
|
||
|
"<Figure size 640x480 with 1 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"plt.plot(1e3*z_SI,1e4*func(z_SI,popt_z[0],popt_z[1]),label = \"harmonic fit\")\n",
|
||
|
"plt.plot(1e3*z_SI,1e4*B_tot_z_SI, label = r\"$ B_{tot} = \\sqrt{r^2 + z^2} $\")\n",
|
||
|
"plt.xlabel(\"x-axis [mm]\")\n",
|
||
|
"plt.xlim(-50,50)\n",
|
||
|
"plt.ylim(0,50)\n",
|
||
|
"plt.ylabel(\"B_tot [G]\")\n",
|
||
|
"plt.legend()\n",
|
||
|
"plt.show()"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 289,
|
||
|
"id": "624fbda5-4658-4f9e-ba0f-33168c27e5c8",
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"T_expansion = T/4 = 66.2961644033217 ms\n",
|
||
|
"omega_x = 23.69362301623883\n",
|
||
|
"Magnification for t_tof = 20.0 ms: M = 0.47387246032477665\n",
|
||
|
"for z_start = 1 μm after T_expansion z_end = 1.4110642480981759 μm\n"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"m = 2.69e-25\n",
|
||
|
"\n",
|
||
|
"k_x = -2*popt_x[0]*9.9*cs.mu_B\n",
|
||
|
"\n",
|
||
|
"omega = np.sqrt(k_x/m)\n",
|
||
|
"f = omega/(2*np.pi)\n",
|
||
|
"\n",
|
||
|
"T = 1/f\n",
|
||
|
"T_exp = T/4\n",
|
||
|
"print(f\"T_expansion = T/4 = {T_exp*1e3} ms\" )\n",
|
||
|
"print(f\"omega_x = {omega}\") \n",
|
||
|
"\n",
|
||
|
"t_tof = 20e-3\n",
|
||
|
"M = omega * t_tof\n",
|
||
|
"\n",
|
||
|
"print(f\"Magnification for t_tof = {t_tof*1e3} ms: M = {M}\")\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
"start_z = 1e-6\n",
|
||
|
"d_t = 1e-3\n",
|
||
|
"def force(z):\n",
|
||
|
" return 2*0.248*z*9.9*cs.mu_B\n",
|
||
|
"z = start_z\n",
|
||
|
"v = 0\n",
|
||
|
"for t in np.arange(0,T_exp,d_t):\n",
|
||
|
" v = v + force(z)/m * d_t\n",
|
||
|
" #print(v)\n",
|
||
|
" z = z + v * d_t\n",
|
||
|
"print(f\"for z_start = 1 μm after T_expansion z_end = {z*1e6} μm\")\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": null,
|
||
|
"id": "1561200c-5630-4c8a-b0b5-b6a535805eef",
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": []
|
||
|
}
|
||
|
],
|
||
|
"metadata": {
|
||
|
"kernelspec": {
|
||
|
"display_name": "Python 3",
|
||
|
"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.8.8"
|
||
|
}
|
||
|
},
|
||
|
"nbformat": 4,
|
||
|
"nbformat_minor": 5
|
||
|
}
|