Lugovtsov/5.2.9-determination-of-atmospheric-composition/plots.ipynb

250 lines
235 KiB
Plaintext
Raw Normal View History

2023-10-05 18:34:18 +03:00
{
"cells": [
{
"cell_type": "code",
2023-10-07 19:36:09 +03:00
"execution_count": 18,
2023-10-05 18:34:18 +03:00
"id": "c14446e5-2129-4747-85de-4784341bfc13",
"metadata": {},
"outputs": [],
"source": [
"# %load /home/glebi/git/experiment-automation/processing_tools.py\n",
"import numpy as np\n",
"from scipy.optimize import curve_fit\n",
"import pandas as pd\n",
"\n",
"import matplotlib.pyplot as plt\n",
"import matplotlib\n",
"import scienceplots\n",
"\n",
"plt.style.use(['science', 'russian-font'])\n",
"\n",
"matplotlib.rcParams.update({\n",
" 'figure.figsize': [10, 4],\n",
" 'savefig.facecolor': 'white',\n",
" 'figure.dpi': 150.0,\n",
" 'font.size': 12.0,\n",
"})\n"
]
},
{
"cell_type": "code",
2023-10-07 19:36:09 +03:00
"execution_count": 19,
2023-10-05 18:34:18 +03:00
"id": "b6e60ac4-5589-4b8f-ab38-42169e7fd345",
"metadata": {},
"outputs": [],
"source": [
"import matplotlib.colors as mcolors\n",
"from scipy.signal import find_peaks"
]
},
{
"cell_type": "code",
2023-10-07 19:36:09 +03:00
"execution_count": 20,
2023-10-05 18:34:18 +03:00
"id": "3de58523-c5e9-427a-8f44-0c2e825fe184",
"metadata": {},
"outputs": [],
"source": [
"df = pd.read_csv(\"data_4.csv\", sep=\"\\t\")\n",
"wl = df[\"ангстремы\"]\n",
"cols = df.columns[1:]\n",
"colors = [\"red\", \"green\", \"green\", \"blue\"]"
]
},
{
"cell_type": "code",
2023-10-07 19:36:09 +03:00
"execution_count": 21,
2023-10-05 18:34:18 +03:00
"id": "0f5054ea-587f-44f7-9f1c-0a13140d0c5f",
"metadata": {},
"outputs": [
{
"data": {
2023-10-07 19:36:09 +03:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAABPcAAAIdCAYAAABRFZgcAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG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jfcO7xOSz6bxF/7mHqQ6i1asF4qYAnIYQQQggpOLOCez4+Pmjbti3u378PAJDJZILzkZGR8PHxwaRJ4lo0ZUFycjJat26N8+fPo3Xr1qL/nJ2d4eTkxI/39PSEq6srlixZIrhPQEAAzp8/X+gmHIQQQkhpdOnpJcnAk6lgVFmg1WrR5Jcm6PtHX6NjkrOTAQBO1k6o+V1NpOamAgCeZjwFAAT9G4R7yfcE11x6eglqjTCQdT3+OtJz0/n9i0+FgTUAiHwaaXQehuONLYu2+soKH+37iN+3trAWjen6W1dM3TcVrVYKVx5ceMKCbV7OXkiYkYDtftsF5/WXA0vhgo+c/x78x29fjrsMAKhRoQYsFZYAWDAQYBmhPX7vgUX/LcKBuwdMPoMQQgghhOhYmHPR0KFDcfDgQXh6esLT0xNOTk58V9jo6GhER0djxowZ6NmzZ5FO9lXx8/NDcnKyyQ63bdu2FezPnDkT4eHhmDhxIhITE5GcnAxPT0/cu3dPEAgkhBBCyiouCwwArBXWqGhXEQ9TH+Ja/DXcTriNeq71TF6fpcrCveR7OBV7Cj+e/RG7RuxCbafa/HmNVoNbz2/B3tIecpkc1SpUK66XIvDfg/9wLf4arsVfw4OUB6jpWFM0hstm44J8nPvJ7IPOY/ePia5Jyk7C7YTb/L6DpQPSctOw+9ZuvNP0HQBATHIMAEAGGbTQZcQlZCbA1dZVdE8uEMb57sx3Rl+XfpZgXEYcLj65iJZVWgI
2023-10-05 18:34:18 +03:00
"text/plain": [
"<Figure size 1500x600 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"for i, col in enumerate(cols):\n",
2023-10-07 19:36:09 +03:00
" plt.plot(wl, df[col], color = colors[i], label=fr\"${col}$\")\n",
"\n",
"plt.ylabel(\"Интенсивность по каждому каналу, у.е.\")\n",
"plt.xlabel(r\"Длина волны, $\\textup{~\\AA}$\")\n",
2023-10-05 18:34:18 +03:00
"plt.legend() \n",
"\n",
"plt.savefig(\"rggb.png\")\n",
"plt.show()"
]
},
{
"cell_type": "code",
2023-10-07 19:36:09 +03:00
"execution_count": 22,
2023-10-05 18:34:18 +03:00
"id": "4d9b0b6e-fc51-4a28-956b-cae2a494dd81",
"metadata": {},
"outputs": [
{
"data": {
2023-10-07 19:36:09 +03:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAABPcAAAIdCAYAAABRFZgcAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjcuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/bCgiHAAAACXBIWXMAABcSAAAXEgFnn9JSAAEAAElEQVR4nOzdeVzUdf7A8RczDNdwDJcnog5qammK2n2pUFnbYYK2bXc/obZa29okKzvWNoWOzdq2tLu1Q6HsPgS1U00E71sG5BAQGIZjOGZg5vfHMCPIPYKM+n4+Hjwe8j3f35nx4O378367Wa1WK0IIIYQQQgghhBBCiFOOoq8DEEIIIYQQQgghhBBCOEeSe0IIIYQQQgghhBBCnKIkuSeEEEIIIYQQQgghxClKkntCCCGEEEIIIYQQQpyiJLknhBBCCCGEEEIIIcQpyr2vAxAtWSwW6urqcHd3x83Nra/DEUIIIYQQQgghhBB9yGq10tDQgJeXFwpF6zo9Se65mLq6OtRqdV+HIYQQQgghhBBCCCFciNFoxMfHp9V2Se65GHf3lm/Jk08+yVNPPdXj9zGbzajVaoxGIyqVqsevf6rHA64Xk6vFA64Xk6vFA64Xk6vFA64Xk6vFA64Xk6vFA64Xk6vFA64Xk6vFA64Xk6vFA64Xk6vFA64Xk6vFA64Xk6vFA64Xk6vFA64Xk6vFA64Xk6vFA64X0/Hx/POf/+S5555z7D8+Z+TYfrICFF1jX4prfyMVCgVKpbLX7qdSqVziA2znavGA68XkavGA68XkavGA68XkavGA68XkavGA68XkavGA68XkavGA68XkavGA68XkavGA68XkavGA68XkavGA68XkavGA68XkavGA68XkavGA68XkavGA68Vkj+eZZ57hqaeeciT92mvfJsk9F+VqH6zeplAoePrpp9tcO95XXC0mV4vHFbnia+RqMblaPK7IFV8j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6vwZD2iEEKcsRYtWoSHhwdqtbrD4yS556KMRiMmk4mFCxf2dShnFK1WC9DphOPg4OAWxwshhBBCCHGyHa2o5Z8p27lwVCjeHu68dvf5VH14Cyv/fjkA/t4qXr5jMhuem8Eve4s599GvWfr93hbXePLTrWzRlfHs7Aks+cukLt33sjEDSNtRKEtzhRCily1cuBCTyYTRaOzwOEnuuSiVSoVKpTp1luSuWAqFuce+L8y1bRNCCCGEEEL0ihW/ZpOZrWdKREirff/9v/NJWxhNiJ8Xvl4qnok9F4AtWWWOY+rNjbyz7hC/PHs1D/9pbJfvGz1+ILllRvYfqTzxhxBCCNEupVLpyA91xP0kxSNOZyuWQuJD8NGr8O5627a7p0J+U/+6W+f1WWhCCCGEEEKcTj7/4zD9Aryormvg6VXbALi4jd53t10W0eL7R647m5svHs6Ux74hv8xIWLCaQ0VVhAX5MHF4232m2+OpUnLByFA2HSxh9OAAp59FCCFEz5Dknjhx02faEnv5OrhmhG1bgxnCtLZ9QgghhBBCCKftyi1na46eqycM5o7Xf2+x7425FzA4yKdL1xkc5MNlYwewdlcRd1wewd4Cg9PJucvH9ufXvcXcecUIp84XQgjRcyS5J07cwHBbxd41I2xJPQB3lW3bwPC+ja0PZWZmsnLlSgwGAwB6vZ45c+YQExPT5vEJCQmkpaVhMBiIj48HoKysjKSkJACioqKIjo52DPNw9j6ZmZksW7YMjUbjOCc2NtYxTESn05GYmMiqVaswGAxotVpiYmJITExsda20tDSSk5NZvnx5hzG25fj7REZGMmfOHMf+nnr24+9jv1ZZWRkGg8Gx3d4zpjffh45e26SkJFJTUx2TmOPi4oiNjSUoKIhly5Y5XmP763T8/VNSUkhNTW3xviYmJjr6R3Z
2023-10-05 18:34:18 +03:00
"text/plain": [
"<Figure size 1500x600 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"sum_int = df[cols].sum(axis=1)\n",
"\n",
"from_idx = 800\n",
"to_idx = -100\n",
"\n",
"y = np.array(sum_int[from_idx:to_idx])\n",
"x = np.array(wl[from_idx:to_idx])\n",
"\n",
"peaks, prop = find_peaks(-y, prominence=5, distance=10)\n",
2023-10-07 19:36:09 +03:00
"plt.plot(x[peaks], y[peaks], \"x\", color=\"C3\", markersize=3, label=\"Полосы поглощения\")\n",
"plt.plot(x, y, lw=.5, label=r\"$R + G_1 + G_2 + B$\")\n",
"\n",
"plt.ylabel(\"Суммарная интенсивность, у.е.\")\n",
"plt.xlabel(r\"Длина волны, $\\textup{~\\AA}$\")\n",
"plt.legend()\n",
2023-10-05 18:34:18 +03:00
"\n",
"plt.savefig(\"sum.png\")\n",
"plt.show()"
]
},
{
"cell_type": "code",
2023-10-07 19:36:09 +03:00
"execution_count": 23,
2023-10-05 18:34:18 +03:00
"id": "e604a87a-9543-431b-bec7-c23737c32be5",
"metadata": {
"jupyter": {
"source_hidden": true
},
"tags": []
},
"outputs": [],
"source": [
"def wavelength_to_rgb(wavelength, gamma=0.8):\n",
" ''' taken from http://www.noah.org/wiki/Wavelength_to_RGB_in_Python\n",
" This converts a given wavelength of light to an \n",
" approximate RGB color value. The wavelength must be given\n",
" in nanometers in the range from 380 nm through 750 nm\n",
" (789 THz through 400 THz).\n",
"\n",
" Based on code by Dan Bruton\n",
" http://www.physics.sfasu.edu/astro/color/spectra.html\n",
" Additionally alpha value set to 0.5 outside range\n",
" '''\n",
" wavelength = float(wavelength)\n",
" if wavelength >= 380 and wavelength <= 750:\n",
" A = 1.\n",
" else:\n",
" A=0.5\n",
" if wavelength < 380:\n",
" wavelength = 380.\n",
" if wavelength >750:\n",
" wavelength = 750.\n",
" if wavelength >= 380 and wavelength <= 440:\n",
" attenuation = 0.3 + 0.7 * (wavelength - 380) / (440 - 380)\n",
" R = ((-(wavelength - 440) / (440 - 380)) * attenuation) ** gamma\n",
" G = 0.0\n",
" B = (1.0 * attenuation) ** gamma\n",
" elif wavelength >= 440 and wavelength <= 490:\n",
" R = 0.0\n",
" G = ((wavelength - 440) / (490 - 440)) ** gamma\n",
" B = 1.0\n",
" elif wavelength >= 490 and wavelength <= 510:\n",
" R = 0.0\n",
" G = 1.0\n",
" B = (-(wavelength - 510) / (510 - 490)) ** gamma\n",
" elif wavelength >= 510 and wavelength <= 580:\n",
" R = ((wavelength - 510) / (580 - 510)) ** gamma\n",
" G = 1.0\n",
" B = 0.0\n",
" elif wavelength >= 580 and wavelength <= 645:\n",
" R = 1.0\n",
" G = (-(wavelength - 645) / (645 - 580)) ** gamma\n",
" B = 0.0\n",
" elif wavelength >= 645 and wavelength <= 750:\n",
" attenuation = 0.3 + 0.7 * (750 - wavelength) / (750 - 645)\n",
" R = (1.0 * attenuation) ** gamma\n",
" G = 0.0\n",
" B = 0.0\n",
" else:\n",
" R = 0.0\n",
" G = 0.0\n",
" B = 0.0\n",
" return (R,G,B,A)"
]
},
{
"cell_type": "code",
2023-10-07 19:36:09 +03:00
"execution_count": 24,
2023-10-05 18:34:18 +03:00
"id": "267ef041-f675-4e84-b431-0a4f2d5e6430",
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAABL8AAAImCAYAAACyxSgmAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjcuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/bCgiHAAAACXBIWXMAABcSAAAXEgFnn9JSAAA/y0lEQVR4nO3dbXBje54X9l9LLTM7YmfV7ixsMSTLqGGp8JCAugfCToakauyiUnkZebrIExWg7TchDySx6qbL2SGqypQcijzwSr4JKUJCqtvOi7xIpSipK5WQ2QW6LZLwVDxYlwVmgSXXfXYWD8vo2sqLbuna1rOttqXjz6fKt2+fc3TOz+f8LJ3++n/OudftdrsBAAAAACmUue0CAAAAAOBDEX4BAAAAkFrCLwAAAABSS/gFAAAAQGoJvwAAAABILeEXAAAAAKkl/AIAAAAgtWYKv5rNZjx+/Dja7faVN9hut2NraysqlUpUKpXY2NiIVqt15fUBAAAAwCj3Jy1QqVSi1WpFsViMdrt9raCq1WrFxsZ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hl+bm5szXY64vb0d29vbI+cXi8XY39+fen0AAAAAcFWu1QIAAAAgtYRfAAAAAKSW8AsAAACA1BJ+AQAAAJBawi8AAAAAUkv4BQAAAEBqCb8AAAAASC3hFwAAAACpJfwCAAAAILWEXwAAAACklvALAAAAgNQSfgEAAACQWvdvu4Dr6HQ6ERGRyWQim83ecjUAAAAA3JTT09M4Ozvr50OjLPXIr3w+HysrK1GtVm+7FAAAAABuULVajZWVlcjn82OXW+qRXyc
"text/plain": [
"<Figure size 1500x600 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"prominences = prop[\"prominences\"]\n",
"\n",
"for i, peak in enumerate(peaks):\n",
" plt.axvline(x[peak], color=wavelength_to_rgb(x[peak] / 10), lw=prominences[i]/25)\n",
"\n",
"# plt.axis(\"x\")\n",
"plt.xlabel(r\"Длина волны, $\\textup{~\\AA}$\")\n",
"\n",
"plt.savefig(\"lines.png\")\n",
"plt.show()"
]
},
{
"cell_type": "code",
2023-10-07 19:36:09 +03:00
"execution_count": 25,
2023-10-05 18:34:18 +03:00
"id": "8cad90df-f11e-45c3-9e0a-b3f570b7e9ef",
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"np.savetxt(\"peaks.csv\", np.vstack((x[peaks], prominences)).T, header=\"wavelength[A],prominence[c.u.]\", comments=\"\", fmt=\"%.4f\", delimiter=\",\")"
]
}
],
"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.10.12"
}
},
"nbformat": 4,
"nbformat_minor": 5
}