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

455 lines
370 KiB
Plaintext
Raw Normal View History

2023-10-05 18:34:18 +03:00
{
"cells": [
{
"cell_type": "code",
2023-10-21 01:37:03 +03:00
"execution_count": 1,
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-21 01:37:03 +03:00
"execution_count": 2,
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-21 01:37:03 +03:00
"execution_count": 3,
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-21 01:37:03 +03:00
"execution_count": 4,
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-21 01:37:03 +03:00
"execution_count": 5,
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-21 01:37:03 +03:00
"execution_count": 6,
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-21 01:37:03 +03:00
"execution_count": 35,
"id": "2783bf6b-3812-4071-87cd-380855c44c1a",
"metadata": {},
"outputs": [],
"source": [
"matplotlib.rcParams.update({\n",
" 'figure.figsize': [10, 2],\n",
"})"
]
},
{
"cell_type": "code",
"execution_count": 36,
2023-10-05 18:34:18 +03:00
"id": "267ef041-f675-4e84-b431-0a4f2d5e6430",
"metadata": {},
"outputs": [
{
"data": {
2023-10-21 01:37:03 +03:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAABJkAAAE2CAYAAADCuEO3AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjcuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/bCgiHAAAACXBIWXMAABcSAAAXEgFnn9JSAAAjKklEQVR4nO3dfWwkaV4f8J89nsuyy0vPDCGb6HLc9gQQAhTRuxwvy5Eo11YUESGUtHcQUYSUaMbij0AUiPs2kWAvUbi0QxAhUhR7hRBCJJq1iYTyru7LC8cdOWbcCAEix8W9OXLA5WDsBrJ3K2bGlT/savdLdbvbjz1+mc9HanW76qmnnq7+ubv8dVX1XJZlWQAAAABAgvmzHgAAAAAA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ABAMiETAAAAAMmETAAAAAAkEzIBAAAAkEzIBAAAAEAyIRMAAAAAyYRMAAAAACQTMgEAAACQTMgEAAAAQDIhEwAAAADJhEwAAAAAJBMyAQAAAJBMyAQAAABAMiETAAAAAMmETAAAAAAkEzIBAAAAkEzIBAAAAEAyIRMAAAAAyYRMAAAAACQTMgEAAACQTMgEAAAAQDIhEwAAAADJhEwAAAAAJBMyAQAAAJBMyAQAAABAMiETAAAAAMmETAAAAAAkEzIBAAAAkEzIBAAAAEAyIRMAAAAAyYRMAAAAACQTMgEAAACQTMgEAAAAQDIhEwAAAADJhEwAAAAAJBMyAQAAAJBMyAQAAABAMiETAAAAAMmETAAAAAAkEzIBAAAAkEzIBAAAAEAyIRMAAAAAyYRMAAA
2023-10-05 18:34:18 +03:00
"text/plain": [
2023-10-21 01:37:03 +03:00
"<Figure size 1500x300 with 1 Axes>"
2023-10-05 18:34:18 +03:00
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"prominences = prop[\"prominences\"]\n",
"\n",
2023-10-21 01:37:03 +03:00
"for lx in np.linspace(x.min(), x.max(), 1000):\n",
" plt.axvline(lx, color=wavelength_to_rgb(lx / 10), lw=1)\n",
"\n",
2023-10-05 18:34:18 +03:00
"for i, peak in enumerate(peaks):\n",
2023-10-21 01:37:03 +03:00
" plt.axvline(x[peak], color='k', lw=prominences[i]/25)\n",
2023-10-05 18:34:18 +03:00
"\n",
"# plt.axis(\"x\")\n",
"plt.xlabel(r\"Длина волны, $\\textup{~\\AA}$\")\n",
2023-10-21 01:37:03 +03:00
"plt.gca().axes.get_yaxis().set_visible(False)\n",
2023-10-05 18:34:18 +03:00
"\n",
"plt.savefig(\"lines.png\")\n",
"plt.show()"
]
},
{
"cell_type": "code",
2023-10-21 01:37:03 +03:00
"execution_count": 37,
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=\",\")"
]
2023-10-21 01:37:03 +03:00
},
{
"cell_type": "markdown",
"id": "69c8119a-2493-4c92-ab19-8d745a683534",
"metadata": {},
"source": [
"### Сопоставление линиям Фраунгофера"
]
},
{
"cell_type": "code",
"execution_count": 38,
"id": "47ca35ac-b45c-480d-874b-3d15335a94f1",
"metadata": {},
"outputs": [],
"source": [
"df_fh = pd.read_csv(\"fraunhofer_lines.csv\", sep=\"\\t\")\n",
"fh_arr = np.array(df_fh)"
]
},
{
"cell_type": "code",
"execution_count": 41,
"id": "57a540bd-40b3-4916-bd58-c871ae3e3dee",
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAABJkAAAE5CAYAAAAz7vFiAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjcuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/bCgiHAAAACXBIWXMAABcSAAAXEgFnn9JSAACOu0lEQVR4nOzdd3iUVfr/8fdMeoEUeofQO4J0EaQjVUAgiooFWXVxdVV09bvWRcXG6voTCwoqSm+KjSIgIB2lSQ+9k056Zub3xzAhwCSZngQ+Ly6uJDPn3OdMcmbmmfs5zzkGi8ViQYpksVh4a91b/GvFv7BQ9K8syC+I1WNW0756ex/0ruQ4lnyMQTMHsf3sdrv3146szcaHNlIxrKKPeyZyrfj0eIbPHc6qI6scrtO4fGPWP7ieiOAI73XMx1KzUhm9cDTf7fvO7v2hAaGsvX8tN1W5ycc9k9IiMSOREfNGsDxueaHljAYjP939E73r9vZRz0RESpYpm6cw/qfxmCymIst+MuATHm7zsA96JSI3CovFwmu/vcZLq1665r4P+33IY+0ec7sNg5JMRcvKzWLcknF8uf1Lp+pVCqvEprGbqBlR00s9K1k2ntjI4FmDOZt2ttBynWt0ZsW9KwjyD/JRz0SutffCXgbOHMjBhINO1+1Ttw9L7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WP7OfUcbJ0JGUkeeBAu2PIjlC0PlWpd7pM7Xwu6z9ny3o7pifZLStkTp+DzWdZEU3H67jeoWhHaNXWs34XdV1hZd2O60wdv99UT5UtLW472xdHfv6PxvNlXb7Ttzdh2vy/qA66zH4h
"text/plain": [
"<Figure size 1500x300 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"for lx in np.linspace(x.min(), x.max(), 1000):\n",
" plt.axvline(lx, color=wavelength_to_rgb(lx / 10), lw=1)\n",
"\n",
"offset = 0\n",
"for (i, fh) in enumerate(fh_arr):\n",
" l = fh[2]*10\n",
" name = fh[1]\n",
" plt.axvline(l, color='k', lw=1)\n",
" \n",
" if (i > 0 and abs(fh[2] - fh_arr[i - 1][2]) < 2):\n",
" offset += 0.2\n",
" else:\n",
" offset = 0\n",
"\n",
" plt.text(l, 0.9-offset, fr\"${name}$\",\n",
" size=12, rotation=40,\n",
" horizontalalignment=\"center\", verticalalignment=\"baseline\",\n",
" rotation_mode=\"anchor\", backgroundcolor=\"g\", color=\"w\")\n",
"\n",
"plt.xlabel(r\"Длина волны, $\\textup{~\\AA}$\")\n",
"plt.gca().axes.get_yaxis().set_visible(False)\n",
"\n",
"plt.savefig(\"fraunhofer_lines.png\")\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 51,
"id": "03ab9c98-670d-4cde-95c5-f42fb0ad41a6",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"name\tdelta\twavelength \n",
"O_2\t0.34\t6276.61\n",
"Na\t0.45\t5895.92\n",
"Na\t0.44\t5889.95\n",
"He\t13.89\t5875.62\n",
"Hg\t2.58\t5460.73\n",
"Fe\t4.59\t5270.39\n",
"Mg\t4.47\t5183.62\n",
"Mg\t6.45\t5172.70\n",
"Fe\t6.62\t5168.91\n",
"Mg\t5.04\t5167.33\n",
"Fe\t0.40\t4957.61\n",
"H\\beta\t2.22\t4861.34\n"
]
}
],
"source": [
"closer_lines = []\n",
"\n",
"print(\"name\\tdelta\\twavelength \")\n",
"for fh in fh_arr:\n",
" l = fh[2]*10\n",
" name = fh[1]\n",
" min_idx = 0\n",
" delta = 2000\n",
" for (i, peak) in enumerate(peaks):\n",
" if (abs(x[peak] - l) < delta):\n",
" min_idx = i\n",
" delta = abs(x[peak] - l)\n",
" if (delta < 20):\n",
" closer_lines.append([name, l, min_idx])\n",
" print(f\"{name}\\t{delta:.2f}\\t{l:.2f}\")"
]
},
{
"cell_type": "code",
"execution_count": 52,
"id": "10d8af20-d6af-4207-8b39-49f22f75b7e8",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[['O_2', 6276.61, 80],\n",
" ['Na', 5895.92, 73],\n",
" ['Na', 5889.95, 72],\n",
" ['He', 5875.6179999999995, 72],\n",
" ['Hg', 5460.73, 54],\n",
" ['Fe', 5270.389999999999, 38],\n",
" ['Mg', 5183.62, 29],\n",
" ['Mg', 5172.7, 29],\n",
" ['Fe', 5168.91, 28],\n",
" ['Mg', 5167.33, 28],\n",
" ['Fe', 4957.610000000001, 10],\n",
" ['H\\\\beta', 4861.34, 1]]"
]
},
"execution_count": 52,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"closer_lines"
]
},
{
"cell_type": "code",
"execution_count": 53,
"id": "d0be8e86-95fa-44b5-81f5-d2ee8f52ac58",
"metadata": {},
"outputs": [],
"source": [
"matplotlib.rcParams.update({\n",
" 'figure.figsize': [10, 4],\n",
"})"
]
},
{
"cell_type": "code",
"execution_count": 54,
"id": "f5e56747-7559-4676-913a-407fbd4a0692",
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAABPcAAAIdCAYAAABRFZgcAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjcuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/bCgiHAAAACXBIWXMAABcSAAAXEgFnn9JSAAEAAElEQVR4nOzdd1zTd/7A8VcSEkYYYboAFVx1C2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kPAvjxjkTey1NitBx9cwIAJLixrF+Z3GfPD4hhOiu3NxcYmNjycjIIDU1lfT0dOd/09PTycnJITY2ttUw1IEuJSUFjUaDVqvtdJ0k9wYok8mE2Wxm6dKl/R2KEEIIIYQQYgAqrarn6cxtnDUuFG+NB/+480xq3r6ZVX+6AAB/bzUv3jaTDc9cxne7jzLtoU946Yvdra7x2Htb2Kyv4Kn501n+m9hu3e95E4aQvb1YtuYKIQaMlStXEhsb60zmtTcMNT09HYDExMQ+js51S5cuxWw2YzKZOl0nyb0BSq1Wo1arZUuuEEIIIYQQol3//T6f3HwDs6JD2tz2r9+dSfbSeEL8vPD1UvNk4jQANudVONc0Wqy8vv4A3z11KX++cmK37zduyjAKK0zsPVJ98g9CCCFO0pIlD5OUlEROTk6Xg1FTU1PJzc0lLS2tj6I7OSqVypkf6owk94QQQgghhBBikFjzy0F+2HOUL7ce5onVWwE4p53ed789P5ozwnXOzx+4ahJ7/nYt3+0qoajCUQFyoKSG8CAfZowO6lEMnmoVc8aG8vP+MpcfhxBCuINl33peeP45UlNTiYmJ6XL9zJkzAVi1alVvh9anZKCGEEI
"text/plain": [
"<Figure size 1500x600 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"plt.plot(x, y, lw=.5)\n",
"for i, closer_line in enumerate(closer_lines):\n",
" plt.axvline(closer_line[1], color=f\"C{i}\", label=f\"${closer_line[0]}$\", lw=.5)\n",
"\n",
"plt.ylabel(\"Суммарная интенсивность, у.е.\")\n",
"plt.xlabel(r\"Длина волны, $\\textup{~\\AA}$\")\n",
"plt.legend()\n",
"\n",
"plt.savefig(\"sum_and_fraunhofer.png\")\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "2102c412-4119-432a-8886-b6b9b95fe98f",
"metadata": {},
"outputs": [],
"source": []
2023-10-05 18:34:18 +03:00
}
],
"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
}