quick & dirty Olympus Vanta plotting example

main
Jeff Moe 2022-05-27 13:30:43 -06:00
parent 96a4b76db5
commit 6f3ce9e4c4
1 changed files with 119 additions and 0 deletions

View File

@ -0,0 +1,119 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"# witzit-plot-vanta --- What In The Zap Is That? AI categorization of spectra from LIBS/XRF analyzers.\n",
"#\n",
"# Copyright (C) 2019-2022, Jeff Moe\n",
"#\n",
"# This program is free software: you can redistribute it and/or modify\n",
"# it under the terms of the GNU General Public License as published by\n",
"# the Free Software Foundation, either version 3 of the License, or\n",
"# (at your option) any later version.\n",
"#\n",
"# This program is distributed in the hope that it will be useful,\n",
"# but WITHOUT ANY WARRANTY; without even the implied warranty of\n",
"# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n",
"# GNU General Public License for more details.\n",
"#\n",
"# You should have received a copy of the GNU General Public License\n",
"# along with this program. If not, see <http://www.gnu.org/licenses/>.\n",
"#\n",
"# Plotting Application.\n",
"# https://spacecruft.org/spacecruft/witzit\n",
"#\n",
"# Based on wut?\n",
"# https://spacecruft.org/spacecruft/satnogs-wut"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"import matplotlib.pyplot as plt\n",
"import seaborn as sns\n",
"import locale"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"locale.setlocale(locale.LC_ALL, \"en_US.utf8\")\n",
"plt.rcParams['axes.formatter.use_locale'] = True"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"df = pd.read_csv('examples/olympus-vanta.csv', header = 0,\n",
" skiprows=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40], usecols = [0, 1])"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"print(df)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"sns.set_theme()\n",
"plt.figure(facecolor='xkcd:off white', figsize=(15, 8))\n",
"# XXX y=\n",
"g=sns.lineplot(x=\"Date\", y=\"2022-04-08\", data=df, linestyle='-', linewidth=1, color='xkcd:pale orange')\n",
"g.set_title('XRF Spectrum'.format('seaborn'), color='xkcd:cornflower blue', fontsize='large', fontweight='bold')\n",
"g.set_xlabel('energy (keV)', color='xkcd:goldenrod', fontsize='large', fontweight='bold')\n",
"g.set_ylabel('Counts', color='xkcd:cerulean', fontsize='large', fontweight='bold')\n",
"g.patch.set_alpha(1.0)\n",
"g.set_facecolor('xkcd:powder blue')\n",
"plt.tight_layout()\n",
"plt.savefig(\"xrf-spectrum.png\", dpi=72, transparent=False, facecolor='xkcd:off white', edgecolor=g.get_facecolor())\n",
"plt.show()\n",
"plt.close()"
]
}
],
"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.4"
}
},
"nbformat": 4,
"nbformat_minor": 4
}