diff --git a/Mercury_iTC/202605_iTC_TempAndRes_PiALaserRoom_1.ipynb b/Mercury_iTC/202605_iTC_TempAndRes_PiALaserRoom_1.ipynb new file mode 100644 index 0000000..f8b2cb9 --- /dev/null +++ b/Mercury_iTC/202605_iTC_TempAndRes_PiALaserRoom_1.ipynb @@ -0,0 +1,425 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "id": "ba5dc10a", + "metadata": {}, + "outputs": [], + "source": [ + "import numpy as np\n", + "import matplotlib.pyplot as plt\n", + "import matplotlib.animation as animation\n", + "import itertools" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "7b745cfa", + "metadata": {}, + "outputs": [], + "source": [ + "from mercuryitc import MercuryITC\n", + "\n", + "### in laser room \n", + "m1 = MercuryITC(\"TCPIP0::129.129.180.104::7020::SOCKET\")\n", + "mod_index = 1\n", + "\n", + "### backup one \"lent\" \n", + "# m1 = MercuryITC(\"TCPIP0::129.129.180.95::7020::SOCKET\")\n", + "# mod_index = -1" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "id": "5bb3a598", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'180150228'" + ] + }, + "execution_count": 3, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "m1.serl" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "id": "468918c4", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[)>,\n", + " )>]" + ] + }, + "execution_count": 4, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "m1.modules" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "id": "f96ac280-3d06-494f-b9a6-376942bf3efe", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "((295.6272, 'K'), (74.1056, 'R'), (0.0328, 'V'), (0.0, 'A'))" + ] + }, + "execution_count": 5, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "m1.modules[mod_index].temp, m1.modules[mod_index].res, m1.modules[0].volt, m1.modules[0].curr\n", + "# m1.modules[mod_index].temp[0]" + ] + }, + { + "cell_type": "raw", + "id": "7bc187b1-b807-4661-a39e-8146e06a51f6", + "metadata": {}, + "source": [ + "### read Temperature only\n", + "\n", + "# %matplotlib notebook\n", + "%matplotlib tk\n", + "\n", + "\n", + "def data_gen():\n", + " for cnt in itertools.count():\n", + " t = cnt * interval_iTC\n", + " temp = m1.modules[mod_index].temp[0] # check index = 1 or -1 \n", + " yield t, temp\n", + "\n", + " \n", + "def init():\n", + " ax.set_ylim(2, 305)\n", + " ax.set_ylabel('Temp/K')\n", + " ax.set_xlim(0, 30)\n", + " ax.set_xlabel('Time/s')\n", + " del xdata[:]\n", + " del ydata[:]\n", + " line.set_data(xdata, ydata)\n", + " return line,\n", + "\n", + "\n", + "def update(frame):\n", + " t, y = frame\n", + " xdata.append(t)\n", + " ydata.append(y)\n", + " xmin, xmax = ax.get_xlim()\n", + "\n", + " if t >= xmax:\n", + " ax.set_xlim(max(xmin, t-1000), t+30)\n", + " ax.figure.canvas.draw()\n", + " \n", + " show_points = int(1000/interval_iTC)\n", + " ax.set_ylim(min(ydata[-show_points:])-1, max(ydata[-show_points:])+1)\n", + " ax.figure.canvas.draw()\n", + " \n", + " line.set_data(xdata, ydata)\n", + " return line,\n", + "\n", + "\n", + "fig, ax = plt.subplots()\n", + "xdata, ydata = [], []\n", + "line, = ax.plot([], [], lw=2)\n", + "ax.grid()\n", + "\n", + "interval_iTC = 2 # s \n", + "\n", + "# Only save last 100 frames, but run forever\n", + "ani = animation.FuncAnimation(fig, update, frames=data_gen, interval=interval_iTC*1000, init_func=init, blit=True,\n", + " save_count=300)\n", + "plt.show()" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "id": "ab621065-a9b2-4706-ab99-49453ea470a7", + "metadata": {}, + "outputs": [], + "source": [ + "### read both Temperature and Resistance\n", + "\n", + "# %matplotlib notebook\n", + "%matplotlib tk\n", + "\n", + "\n", + "def data_gen():\n", + " for cnt in itertools.count():\n", + " t = cnt * interval_iTC\n", + " temp = m1.modules[mod_index].temp[0] # check index = 1 or -1 \n", + " res = m1.modules[mod_index].res[0] # check index = 1 or -1 \n", + " yield t, temp, res\n", + "\n", + " \n", + "def init():\n", + " ax.set_ylim(2, 305)\n", + " ax.set_ylabel('Temperature/K')\n", + " # ax.set_xlim(0, 30)\n", + " # ax.set_xlabel('Time/s')\n", + "\n", + " axR.set_ylim(70, 100)\n", + " axR.set_ylabel('Resistance/Ohm')\n", + " axR.set_xlim(0, 30)\n", + " axR.set_xlabel('Time/s')\n", + " \n", + " del xdata[:]\n", + " del ydata[:]\n", + " del rdata[:]\n", + " line.set_data(xdata, ydata)\n", + " lineR.set_data(xdata, rdata)\n", + " return line, lineR, \n", + "\n", + "\n", + "def update(frame):\n", + " t, y, r = frame\n", + " xdata.append(t)\n", + " ydata.append(y)\n", + " rdata.append(r)\n", + " xmin, xmax = ax.get_xlim()\n", + "\n", + " if t >= xmax:\n", + " show_xrange = 600\n", + " ax.set_xlim(max(xmin, t-show_xrange), t+30)\n", + " ax.figure.canvas.draw()\n", + " \n", + " show_points = int(show_xrange/interval_iTC)\n", + " ax.set_ylim(min(ydata[-show_points:])-1, max(ydata[-show_points:])+1)\n", + " ax.figure.canvas.draw()\n", + "\n", + " axR.set_ylim(min(rdata[-show_points:])*0.95, max(rdata[-show_points:])*1.05)\n", + " axR.figure.canvas.draw()\n", + " \n", + " line.set_data(xdata, ydata)\n", + " lineR.set_data(xdata, rdata)\n", + " return line, lineR, \n", + "\n", + "\n", + "fig, (ax, axR) = plt.subplots(nrows=2, sharex=True, figsize=[9*2,6*2])\n", + "xdata, ydata, rdata = [], [], []\n", + "\n", + "line, = ax.plot([], [], lw=2)\n", + "ax.grid()\n", + "lineR, = axR.plot([], [], lw=2)\n", + "axR.grid()\n", + "\n", + "interval_iTC = 2 # s \n", + "\n", + "# Only save last 100 frames, but run forever\n", + "ani = animation.FuncAnimation(fig, update, frames=data_gen, interval=interval_iTC*1000, init_func=init, blit=True,\n", + " save_count=300)\n", + "\n", + "fig.tight_layout()\n", + "plt.show()\n" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "id": "506adde7", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
Time/sTemp/KRes/Ohm
04500293.946774.5006
14502293.944474.4991
24504293.950474.5002
34506293.942574.5006
44508293.944374.5002
............
14580336604.28164615.6528
14581336624.28024615.8411
14582336644.28134614.5352
14583336664.28124613.0924
14584336684.28344611.2716
\n", + "

14585 rows × 3 columns

\n", + "
" + ], + "text/plain": [ + " Time/s Temp/K Res/Ohm\n", + "0 4500 293.9467 74.5006\n", + "1 4502 293.9444 74.4991\n", + "2 4504 293.9504 74.5002\n", + "3 4506 293.9425 74.5006\n", + "4 4508 293.9443 74.5002\n", + "... ... ... ...\n", + "14580 33660 4.2816 4615.6528\n", + "14581 33662 4.2802 4615.8411\n", + "14582 33664 4.2813 4614.5352\n", + "14583 33666 4.2812 4613.0924\n", + "14584 33668 4.2834 4611.2716\n", + "\n", + "[14585 rows x 3 columns]" + ] + }, + "execution_count": 8, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "import pandas as pd\n", + "\n", + "iTC_curve = pd.DataFrame({'Time/s': xdata, 'Temp/K': ydata, 'Res/Ohm': rdata})\n", + "\n", + "# iTC_curve.to_csv(\"P:/Tianyang/Data_Thibaut_2026/20260527/cooling_sample.csv\", sep=',', header=True, index=False)\n", + "# iTC_curve.to_csv(\"C:/RE_qubit_TS/SNSPD_UZH/20260515_DAQ_counts_compare/cooling_full.csv\", sep=',', header=True, index=False)\n", + "\n", + "iTC_curve" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "d11b7072", + "metadata": {}, + "outputs": [], + "source": [ + "%matplotlib inline\n", + "%matplotlib tk\n", + "\n", + "plt.plot(iTC_curve['Time/s'], iTC_curve['Temp/K'])\n", + "plt.plot(iTC_curve['Time/s'], iTC_curve['Res/Ohm'])\n", + "plt.grid()\n", + "plt.ylim(3, 20)\n", + "plt.show()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "67dcf7d4", + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "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.7" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/Mercury_iTC/202605_iTC_TempAndRes_PiALaserRoom_backup.ipynb b/Mercury_iTC/202605_iTC_TempAndRes_PiALaserRoom_backup.ipynb new file mode 100644 index 0000000..48ae031 --- /dev/null +++ b/Mercury_iTC/202605_iTC_TempAndRes_PiALaserRoom_backup.ipynb @@ -0,0 +1,431 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 8, + "id": "ba5dc10a", + "metadata": {}, + "outputs": [], + "source": [ + "import numpy as np\n", + "import matplotlib.pyplot as plt\n", + "import matplotlib.animation as animation\n", + "import itertools" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "id": "7b745cfa", + "metadata": {}, + "outputs": [], + "source": [ + "from mercuryitc import MercuryITC\n", + "\n", + "### in laser room \n", + "# m1 = MercuryITC(\"TCPIP0::129.129.180.104::7020::SOCKET\")\n", + "# mod_index = 1\n", + "\n", + "### backup one \"lent\" \n", + "m1 = MercuryITC(\"TCPIP0::129.129.180.95::7020::SOCKET\")\n", + "mod_index = -1" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "id": "5bb3a598", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'191650089'" + ] + }, + "execution_count": 10, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "m1.serl" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "id": "468918c4", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[)>,\n", + " )>,\n", + " )>,\n", + " )>,\n", + " )>,\n", + " )>,\n", + " )>,\n", + " )>]" + ] + }, + "execution_count": 11, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "m1.modules" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "id": "f96ac280-3d06-494f-b9a6-376942bf3efe", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "((265.5432, 'K'), (95.8373, 'R'), (0.0437, 'V'), (0.0, 'A'))" + ] + }, + "execution_count": 12, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "m1.modules[mod_index].temp, m1.modules[mod_index].res, m1.modules[0].volt, m1.modules[0].curr\n", + "# m1.modules[mod_index].temp[0]" + ] + }, + { + "cell_type": "raw", + "id": "7bc187b1-b807-4661-a39e-8146e06a51f6", + "metadata": {}, + "source": [ + "### read Temperature only\n", + "\n", + "# %matplotlib notebook\n", + "%matplotlib tk\n", + "\n", + "\n", + "def data_gen():\n", + " for cnt in itertools.count():\n", + " t = cnt * interval_iTC\n", + " temp = m1.modules[mod_index].temp[0] # check index = 1 or -1 \n", + " yield t, temp\n", + "\n", + " \n", + "def init():\n", + " ax.set_ylim(2, 305)\n", + " ax.set_ylabel('Temp/K')\n", + " ax.set_xlim(0, 30)\n", + " ax.set_xlabel('Time/s')\n", + " del xdata[:]\n", + " del ydata[:]\n", + " line.set_data(xdata, ydata)\n", + " return line,\n", + "\n", + "\n", + "def update(frame):\n", + " t, y = frame\n", + " xdata.append(t)\n", + " ydata.append(y)\n", + " xmin, xmax = ax.get_xlim()\n", + "\n", + " if t >= xmax:\n", + " ax.set_xlim(max(xmin, t-1000), t+30)\n", + " ax.figure.canvas.draw()\n", + " \n", + " show_points = int(1000/interval_iTC)\n", + " ax.set_ylim(min(ydata[-show_points:])-1, max(ydata[-show_points:])+1)\n", + " ax.figure.canvas.draw()\n", + " \n", + " line.set_data(xdata, ydata)\n", + " return line,\n", + "\n", + "\n", + "fig, ax = plt.subplots()\n", + "xdata, ydata = [], []\n", + "line, = ax.plot([], [], lw=2)\n", + "ax.grid()\n", + "\n", + "interval_iTC = 2 # s \n", + "\n", + "# Only save last 100 frames, but run forever\n", + "ani = animation.FuncAnimation(fig, update, frames=data_gen, interval=interval_iTC*1000, init_func=init, blit=True,\n", + " save_count=300)\n", + "plt.show()" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "id": "ab621065-a9b2-4706-ab99-49453ea470a7", + "metadata": {}, + "outputs": [], + "source": [ + "### read both Temperature and Resistance\n", + "\n", + "# %matplotlib notebook\n", + "%matplotlib tk\n", + "\n", + "\n", + "def data_gen():\n", + " for cnt in itertools.count():\n", + " t = cnt * interval_iTC\n", + " temp = m1.modules[mod_index].temp[0] # check index = 1 or -1 \n", + " res = m1.modules[mod_index].res[0] # check index = 1 or -1 \n", + " yield t, temp, res\n", + "\n", + " \n", + "def init():\n", + " ax.set_ylim(2, 305)\n", + " ax.set_ylabel('Temperature/K')\n", + " # ax.set_xlim(0, 30)\n", + " # ax.set_xlabel('Time/s')\n", + "\n", + " axR.set_ylim(70, 100)\n", + " axR.set_ylabel('Resistance/Ohm')\n", + " axR.set_xlim(0, 30)\n", + " axR.set_xlabel('Time/s')\n", + " \n", + " del xdata[:]\n", + " del ydata[:]\n", + " del rdata[:]\n", + " line.set_data(xdata, ydata)\n", + " lineR.set_data(xdata, rdata)\n", + " return line, lineR, \n", + "\n", + "\n", + "def update(frame):\n", + " t, y, r = frame\n", + " xdata.append(t)\n", + " ydata.append(y)\n", + " rdata.append(r)\n", + " xmin, xmax = ax.get_xlim()\n", + "\n", + " if t >= xmax:\n", + " show_xrange = 600\n", + " ax.set_xlim(max(xmin, t-show_xrange), t+30)\n", + " ax.figure.canvas.draw()\n", + " \n", + " show_points = int(show_xrange/interval_iTC)\n", + " ax.set_ylim(min(ydata[-show_points:])-1, max(ydata[-show_points:])+1)\n", + " ax.figure.canvas.draw()\n", + "\n", + " axR.set_ylim(min(rdata[-show_points:])*0.95, max(rdata[-show_points:])*1.05)\n", + " axR.figure.canvas.draw()\n", + " \n", + " line.set_data(xdata, ydata)\n", + " lineR.set_data(xdata, rdata)\n", + " return line, lineR, \n", + "\n", + "\n", + "fig, (ax, axR) = plt.subplots(nrows=2, sharex=True, figsize=[9*2,6*2])\n", + "xdata, ydata, rdata = [], [], []\n", + "\n", + "line, = ax.plot([], [], lw=2)\n", + "ax.grid()\n", + "lineR, = axR.plot([], [], lw=2)\n", + "axR.grid()\n", + "\n", + "interval_iTC = 2 # s \n", + "\n", + "# Only save last 100 frames, but run forever\n", + "ani = animation.FuncAnimation(fig, update, frames=data_gen, interval=interval_iTC*1000, init_func=init, blit=True,\n", + " save_count=300)\n", + "\n", + "fig.tight_layout()\n", + "plt.show()\n" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "id": "506adde7", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
Time/sTemp/KRes/Ohm
00260.291097.9353
12257.254699.1750
24254.2851100.3421
36251.1206101.7072
48247.9910103.1198
............
4979943.82497741.1092
4989963.81947748.9180
4999983.82057735.3276
50010003.82207747.5457
50110023.82197760.5151
\n", + "

502 rows × 3 columns

\n", + "
" + ], + "text/plain": [ + " Time/s Temp/K Res/Ohm\n", + "0 0 260.2910 97.9353\n", + "1 2 257.2546 99.1750\n", + "2 4 254.2851 100.3421\n", + "3 6 251.1206 101.7072\n", + "4 8 247.9910 103.1198\n", + ".. ... ... ...\n", + "497 994 3.8249 7741.1092\n", + "498 996 3.8194 7748.9180\n", + "499 998 3.8205 7735.3276\n", + "500 1000 3.8220 7747.5457\n", + "501 1002 3.8219 7760.5151\n", + "\n", + "[502 rows x 3 columns]" + ] + }, + "execution_count": 7, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "import pandas as pd\n", + "\n", + "iTC_curve = pd.DataFrame({'Time/s': xdata, 'Temp/K': ydata, 'Res/Ohm': rdata})\n", + "\n", + "# iTC_curve.to_csv(\"P:/Tianyang/Data_Thibaut_2026/20260527/cooling_SNSPD.csv\", sep=',', header=True, index=False)\n", + "iTC_curve.to_csv(\"C:/RE_qubit_TS/SNSPD_UZH/20260529_/cooling_oscillating1.csv\", sep=',', header=True, index=False)\n", + "\n", + "iTC_curve" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "d11b7072", + "metadata": {}, + "outputs": [], + "source": [ + "%matplotlib inline\n", + "%matplotlib tk\n", + "\n", + "plt.plot(iTC_curve['Time/s'], iTC_curve['Temp/K'])\n", + "plt.plot(iTC_curve['Time/s'], iTC_curve['Res/Ohm'])\n", + "plt.grid()\n", + "plt.ylim(3, 20)\n", + "plt.show()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "67dcf7d4", + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "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.7" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +}