You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
405 lines
26 KiB
Plaintext
405 lines
26 KiB
Plaintext
7 months ago
|
{
|
||
|
"cells": [
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 4,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"import time\n",
|
||
|
"import numpy as np\n",
|
||
|
"import tclab"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": null,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": []
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 17,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"TCLab version 1.0.0\n",
|
||
|
"Arduino Leonardo connected on port /dev/cu.usbmodem1301 at 115200 baud.\n",
|
||
|
"TCLab Firmware 2.0.1 Arduino Leonardo/Micro.\n",
|
||
|
"24.218\n",
|
||
|
"23.154\n",
|
||
|
"24.347\n",
|
||
|
"24.411\n",
|
||
|
"24.411\n",
|
||
|
"24.347\n",
|
||
|
"24.314\n",
|
||
|
"24.347\n",
|
||
|
"24.347\n",
|
||
|
"23.896\n",
|
||
|
"24.476\n",
|
||
|
"24.637\n",
|
||
|
"24.669\n",
|
||
|
"24.669\n",
|
||
|
"25.056\n",
|
||
|
"25.088\n",
|
||
|
"24.991\n",
|
||
|
"25.088\n",
|
||
|
"25.217\n",
|
||
|
"25.281\n",
|
||
|
"25.313\n",
|
||
|
"25.668\n",
|
||
|
"25.668\n",
|
||
|
"25.636\n",
|
||
|
"26.022\n",
|
||
|
"25.926\n",
|
||
|
"19.126\n",
|
||
|
"26.248\n",
|
||
|
"26.248\n",
|
||
|
"26.055\n",
|
||
|
"25.152\n",
|
||
|
"26.699\n",
|
||
|
"26.989\n",
|
||
|
"26.957\n",
|
||
|
"27.021\n",
|
||
|
"27.118\n",
|
||
|
"27.247\n",
|
||
|
"27.344\n",
|
||
|
"27.666\n",
|
||
|
"27.183\n",
|
||
|
"27.795\n",
|
||
|
"27.892\n",
|
||
|
"28.021\n",
|
||
|
"28.311\n",
|
||
|
"28.214\n",
|
||
|
"28.504\n",
|
||
|
"28.536\n",
|
||
|
"28.762\n",
|
||
|
"28.826\n",
|
||
|
"28.858\n",
|
||
|
"29.245\n",
|
||
|
"29.181\n",
|
||
|
"29.374\n",
|
||
|
"29.6\n",
|
||
|
"29.567\n",
|
||
|
"29.793\n",
|
||
|
"29.761\n",
|
||
|
"29.89\n",
|
||
|
"30.147\n",
|
||
|
"30.147\n",
|
||
|
"30.438\n",
|
||
|
"30.599\n",
|
||
|
"30.728\n",
|
||
|
"30.856\n",
|
||
|
"30.76\n",
|
||
|
"31.018\n",
|
||
|
"31.114\n",
|
||
|
"31.34\n",
|
||
|
"31.533\n",
|
||
|
"31.501\n",
|
||
|
"31.727\n",
|
||
|
"31.469\n",
|
||
|
"32.017\n",
|
||
|
"32.081\n",
|
||
|
"32.113\n",
|
||
|
"32.5\n",
|
||
|
"32.403\n",
|
||
|
"32.403\n",
|
||
|
"32.693\n",
|
||
|
"32.726\n",
|
||
|
"32.887\n",
|
||
|
"33.016\n",
|
||
|
"33.048\n",
|
||
|
"33.08\n",
|
||
|
"33.37\n",
|
||
|
"33.37\n",
|
||
|
"33.499\n",
|
||
|
"33.725\n",
|
||
|
"33.789\n",
|
||
|
"33.821\n",
|
||
|
"34.047\n",
|
||
|
"34.079\n",
|
||
|
"34.144\n",
|
||
|
"34.305\n",
|
||
|
"34.434\n",
|
||
|
"34.434\n",
|
||
|
"34.659\n",
|
||
|
"34.756\n",
|
||
|
"34.659\n",
|
||
|
"34.691\n",
|
||
|
"34.917\n",
|
||
|
"34.981\n",
|
||
|
"34.981\n",
|
||
|
"35.271\n",
|
||
|
"35.4\n",
|
||
|
"35.336\n",
|
||
|
"35.239\n",
|
||
|
"35.594\n",
|
||
|
"35.626\n",
|
||
|
"35.819\n",
|
||
|
"26.796\n",
|
||
|
"35.948\n",
|
||
|
"27.408\n",
|
||
|
"36.174\n",
|
||
|
"35.304\n",
|
||
|
"36.271\n",
|
||
|
"36.528\n",
|
||
|
"36.561\n",
|
||
|
"36.689\n",
|
||
|
"36.657\n",
|
||
|
"36.979\n",
|
||
|
"36.979\n",
|
||
|
"37.044\n",
|
||
|
"37.205\n",
|
||
|
"37.173\n",
|
||
|
"37.237\n",
|
||
|
"37.205\n",
|
||
|
"37.302\n",
|
||
|
"37.656\n",
|
||
|
"37.56\n",
|
||
|
"37.592\n",
|
||
|
"37.882\n",
|
||
|
"37.882\n",
|
||
|
"37.817\n",
|
||
|
"38.043\n",
|
||
|
"37.173\n",
|
||
|
"38.269\n",
|
||
|
"38.365\n",
|
||
|
"38.397\n",
|
||
|
"38.591\n",
|
||
|
"33.016\n",
|
||
|
"26.022\n",
|
||
|
"38.913\n",
|
||
|
"38.945\n",
|
||
|
"38.913\n",
|
||
|
"38.945\n",
|
||
|
"38.945\n",
|
||
|
"39.235\n",
|
||
|
"39.203\n",
|
||
|
"39.268\n",
|
||
|
"39.3\n",
|
||
|
"39.493\n",
|
||
|
"39.042\n",
|
||
|
"39.59\n",
|
||
|
"39.622\n",
|
||
|
"39.654\n",
|
||
|
"39.815\n",
|
||
|
"39.88\n",
|
||
|
"39.912\n",
|
||
|
"39.912\n",
|
||
|
"40.009\n",
|
||
|
"40.009\n",
|
||
|
"40.234\n",
|
||
|
"40.234\n",
|
||
|
"40.234\n",
|
||
|
"40.363\n",
|
||
|
"40.524\n",
|
||
|
"40.524\n",
|
||
|
"40.557\n",
|
||
|
"40.557\n",
|
||
|
"40.653\n",
|
||
|
"40.814\n",
|
||
|
"40.557\n",
|
||
|
"40.911\n",
|
||
|
"40.879\n",
|
||
|
"41.072\n",
|
||
|
"41.169\n",
|
||
|
"41.104\n",
|
||
|
"41.072\n",
|
||
|
"41.104\n",
|
||
|
"41.137\n",
|
||
|
"41.523\n",
|
||
|
"41.33\n",
|
||
|
"41.523\n",
|
||
|
"41.523\n",
|
||
|
"41.62\n",
|
||
|
"41.813\n",
|
||
|
"41.781\n",
|
||
|
"41.846\n",
|
||
|
"41.813\n",
|
||
|
"41.942\n",
|
||
|
"42.136\n",
|
||
|
"42.136\n",
|
||
|
"42.136\n",
|
||
|
"42.136\n",
|
||
|
"42.104\n",
|
||
|
"42.168\n",
|
||
|
"42.361\n",
|
||
|
"42.458\n",
|
||
|
"42.232\n",
|
||
|
"42.49\n",
|
||
|
"42.361\n",
|
||
|
"42.394\n",
|
||
|
"42.426\n",
|
||
|
"42.394\n",
|
||
|
"42.716\n",
|
||
|
"42.748\n",
|
||
|
"42.813\n",
|
||
|
"42.651\n",
|
||
|
"42.813\n",
|
||
|
"42.748\n",
|
||
|
"42.941\n",
|
||
|
"43.103\n",
|
||
|
"43.135\n",
|
||
|
"43.103\n",
|
||
|
"43.038\n",
|
||
|
"43.135\n",
|
||
|
"43.264\n",
|
||
|
"43.425\n",
|
||
|
"43.328\n",
|
||
|
"43.328\n",
|
||
|
"43.457\n",
|
||
|
"43.457\n",
|
||
|
"43.521\n",
|
||
|
"43.683\n",
|
||
|
"43.779\n",
|
||
|
"43.683\n",
|
||
|
"43.683\n",
|
||
|
"43.715\n",
|
||
|
"43.973\n",
|
||
|
"43.94\n",
|
||
|
"44.102\n",
|
||
|
"44.005\n",
|
||
|
"44.005\n",
|
||
|
"44.005\n",
|
||
|
"44.23\n",
|
||
|
"44.359\n",
|
||
|
"44.424\n",
|
||
|
"44.392\n",
|
||
|
"44.327\n",
|
||
|
"44.327\n",
|
||
|
"44.424\n",
|
||
|
"44.521\n",
|
||
|
"43.779\n",
|
||
|
"44.682\n",
|
||
|
"44.714\n",
|
||
|
"44.649\n",
|
||
|
"44.649\n",
|
||
|
"44.746\n",
|
||
|
"44.778\n",
|
||
|
"44.907\n",
|
||
|
"44.972\n",
|
||
|
"42.2\n",
|
||
|
"44.939\n",
|
||
|
"45.036\n",
|
||
|
"44.907\n",
|
||
|
"44.327\n",
|
||
|
"43.876\n",
|
||
|
"45.004\n",
|
||
|
"45.197\n",
|
||
|
"45.294\n",
|
||
|
"45.358\n",
|
||
|
"45.326\n",
|
||
|
"45.229\n",
|
||
|
"45.358\n",
|
||
|
"45.101\n",
|
||
|
"45.423\n",
|
||
|
"45.391\n",
|
||
|
"45.713\n",
|
||
|
"45.681\n",
|
||
|
"45.616\n",
|
||
|
"45.713\n",
|
||
|
"45.616\n",
|
||
|
"45.713\n",
|
||
|
"45.713\n",
|
||
|
"45.713\n",
|
||
|
"45.745\n",
|
||
|
"45.648\n",
|
||
|
"45.971\n",
|
||
|
"45.938\n",
|
||
|
"45.938\n",
|
||
|
"45.938\n",
|
||
|
"46.067\n",
|
||
|
"45.971\n",
|
||
|
"46.035\n",
|
||
|
"46.132\n",
|
||
|
"46.196\n",
|
||
|
"45.938\n",
|
||
|
"46.164\n",
|
||
|
"46.261\n",
|
||
|
"46.261\n",
|
||
|
"46.229\n",
|
||
|
"46.261\n",
|
||
|
"46.229\n",
|
||
|
"46.229\n",
|
||
|
"46.357\n",
|
||
|
"46.551\n",
|
||
|
"46.519\n",
|
||
|
"46.551\n",
|
||
|
"46.583\n",
|
||
|
"TCLab disconnected successfully.\n"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"n = 300\n",
|
||
|
"t = np.linspace(0,n-1,n)\n",
|
||
|
"T1 = np.empty_like(t)\n",
|
||
|
"with tclab.TCLab() as lab:\n",
|
||
|
" lab.Q1(40)\n",
|
||
|
" for i in range(n):\n",
|
||
|
" T1[i] = lab.T1\n",
|
||
|
" print(T1[i])\n",
|
||
|
" time.sleep(1)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 18,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGg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HTggFRR0nbESST1HJDj2Pi0RPgAg3blrN3JypGPHzPu+8x3zezTnraxZ03VsfaRnrAAifABAegvU9lySvv3tyJZa3C3Ply2L3fiQkQgfAJCuuvfK6O7DD0O/ht0urVwpTZtG3QVihvABAOlq/frIi0jnz5ceeCD+Z6wgoxE+ACCVeddzXLxo9seQpLfeMluhR8Jul556irCBuCN8AECqWrvW7DrqPbths0VeQCrRcAuW4mA5AEhF1dXS8uU9l1WCBQ+bTdq40TwMzuEw77PbzQLS48c53RWWockYAKQal8s8UTaSf767Hx9P8y7EGE3GACBVeZ+vIvmeteJ+/LXXIg8e+/d39eaQaN6FhCJ8AECy8K7hsNnM+wzD/PW8eebtzZsj782xaZNv8AASjPABAMmgulp64omu294zG4ZhFoMG4h1UvO/bsEG6915mOJB0KDgFgERzucwZj2i4z1nZvLmriNThMG8vWJC5wcPlkvbsMb8j6TDzAQBWcLmkffvMX48c2XXGysiRZk+OaGv/DcNsBsZR8V28W8p3L7RFUmC3CwDEWzQnx4bL4TC3yWZy2PDmcknFxb51MVwjS0Ty+c2yCwDEU0ND7IOHu8aDxmA9NTX1LMjt6DBnhJA0WHYBgFhzb5dtbDSLSCMNHt27lNrt0m9+Iw0cKDmd5n0sr/hXUmJer+4zH6NHJ25M6IHwAQCx4A4cu3ZJVVWRH+jm5nCYx9avXGn+H7t7dqN7zQKhw7/CQrPGY/583+vH9Uoq1HwAQG95Fzj2hndxJB1Ie4frZ7l
|
||
|
"text/plain": [
|
||
|
"<Figure size 640x480 with 1 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"import matplotlib.pyplot as plt\n",
|
||
|
"plt.plot(T1, '.r')\n",
|
||
|
"plt.show()"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 21,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"import pandas as pd\n",
|
||
|
"DF = pd.DataFrame(T1)\n",
|
||
|
"DF.to_csv(\"data.csv\", index=False)"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"metadata": {
|
||
|
"kernelspec": {
|
||
|
"display_name": ".venv",
|
||
|
"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.2"
|
||
|
}
|
||
|
},
|
||
|
"nbformat": 4,
|
||
|
"nbformat_minor": 2
|
||
|
}
|