Olympus Vanta XRF plotting

main
Jeff Moe 2022-05-27 14:22:12 -06:00
parent 1b5e6eec02
commit c4ea8faabf
3 changed files with 29 additions and 28 deletions

View File

@ -3,14 +3,6 @@
AI categorization of spectra from LIBS/XRF analyzers. AI categorization of spectra from LIBS/XRF analyzers.
# Status
Alpha software under development.
Need to check:
* *API: 501 Not Implemented*
https://spacecruft.org/spacecruft/pysalx/issues/2
# Install # Install
## Install Dependencies ## Install Dependencies
Get system dependency and upgrade Python pip. Get system dependency and upgrade Python pip.
@ -35,7 +27,6 @@ cd pysalx/
.. ..
``` ```
## Clone Git Repo ## Clone Git Repo
Get source code with `git`. Get source code with `git`.
@ -43,21 +34,23 @@ The default `requirements.txt` installs a Tensorflow without
GPU support. You can edit the `requirements.txt` file to change GPU support. You can edit the `requirements.txt` file to change
which is supported. The "generic" version supports both. which is supported. The "generic" version supports both.
``` ```
git clone https://spacecruft.org/spacecruft/witzit git clone https://spacecruft.org/spacecruft/witzit
cd witzit/ cd witzit/
pip install --user --upgrade -r requirements.txt pip install --user --upgrade -r requirements.txt
``` ```
# witzit scripts # witzit scripts
* `witzit-load.py` --- Load and text display an example MCA. * `witzit-load-x555` --- Load and text display data from SciAps X-555 XRF.
* `witzit-load-vanta` --- Load and text display data from Olympus Vanta XRF.
Development is most easily done under Jupyter with Tensorboard Development is most easily done under Jupyter with Tensorboard
for training models. These files are in the `notebooks/` directory. for training models. These files are in the `notebooks/` directory.
* `witzit-plot.ipynb` --- witzit Jupyter notebook, plotting application. * `witzit-plot-x555.ipynb` --- witzit Jupyter notebook, plotting application for SciAps X-555 XRF.
* `witzit-plot-vanta.ipynb` --- witzit Jupyter notebook, plotting application for Olympus Vanta XRF.
* `witzit-predict.ipynb` --- witzit Jupyter notebook, prediction application. * `witzit-predict.ipynb` --- witzit Jupyter notebook, prediction application.
* `witzit-train.ipynb` --- witzit Jupyter notebook, training application. * `witzit-train.ipynb` --- witzit Jupyter notebook, training application.
@ -95,7 +88,7 @@ HOWTO USE. Getting closer...
``` ```
# Example: # Example:
debian@workstation:~/spacecruft/witzit$ ./witzit-load.py debian@workstation:~/spacecruft/witzit$ ./witzit-load-x555
energy (eV) 2048 energy (eV) 2048
0 20.590676 0 0 20.590676 0
1 45.021816 0 1 45.021816 0
@ -111,9 +104,12 @@ debian@workstation:~/spacecruft/witzit$ ./witzit-load.py
``` ```
## Jupyter Notebooks ## Jupyter Notebooks
Example plot: Example plot from SciAps X-555 XRF:
![xrf-spectrum](notebooks/xrf-spectrum.png) ![xrf-spectrum-sciaps](notebooks/xrf-spectrum.png)
Example plot from Olympus Vanta XRF:
![xrf-spectrum-vanta](notebooks/xrf-spectrum-vanta.png)
Run jupyter thusly: Run jupyter thusly:
@ -129,6 +125,8 @@ jupyter-lab
* SciAps XRF Analyzer * SciAps XRF Analyzer
* Olympus XRF Analyzer
# Deep Learning Algorithm # Deep Learning Algorithm
Can use lots from `wut`. Can use lots from `wut`.
@ -187,15 +185,6 @@ same as in `wut`, so makes a good reference.
*Feature selection of infrared spectra analysis with convolutional neural network* *Feature selection of infrared spectra analysis with convolutional neural network*
# Misc
Will likely work best with binary categorizations. E.g. like this:
Is it element A or not element A?
Is it element B or not element B?
Is it element C or not element C?
Not "is it element A, B, or C?"
# See Also # See Also
* `pysalx` --- Unofficial scripts for interacting with the SciAps LIBS * `pysalx` --- Unofficial scripts for interacting with the SciAps LIBS
@ -208,6 +197,14 @@ https://spacecruft.org/spacecruft/pysalx/
https://spacecruft.org/spacecruft/satnogs-wut/ https://spacecruft.org/spacecruft/satnogs-wut/
# Status
Alpha software under development.
Need to check:
* *API: 501 Not Implemented*
https://spacecruft.org/spacecruft/pysalx/issues/2
# Unofficial # Unofficial
Unofficial, unaffiliated with SciAps. Unofficial, unaffiliated with SciAps.

View File

@ -61,7 +61,11 @@
"outputs": [], "outputs": [],
"source": [ "source": [
"df = pd.read_csv('examples/olympus-vanta.csv', header = 0,\n", "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])" " skiprows=40,\n",
" names=('eV', 'Counts'),\n",
" usecols = [0, 1])\n",
"\n",
"df['eV'] = df['eV'] * 1000"
] ]
}, },
{ {
@ -82,14 +86,14 @@
"sns.set_theme()\n", "sns.set_theme()\n",
"plt.figure(facecolor='xkcd:off white', figsize=(15, 8))\n", "plt.figure(facecolor='xkcd:off white', figsize=(15, 8))\n",
"# XXX y=\n", "# XXX y=\n",
"g=sns.lineplot(x=\"Date\", y=\"2022-04-08\", data=df, linestyle='-', linewidth=1, color='xkcd:pale orange')\n", "g=sns.lineplot(x=\"eV\", y=\"Counts\", 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_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_xlabel('energy (eV)', color='xkcd:goldenrod', fontsize='large', fontweight='bold')\n",
"g.set_ylabel('Counts', color='xkcd:cerulean', 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.patch.set_alpha(1.0)\n",
"g.set_facecolor('xkcd:powder blue')\n", "g.set_facecolor('xkcd:powder blue')\n",
"plt.tight_layout()\n", "plt.tight_layout()\n",
"plt.savefig(\"xrf-spectrum.png\", dpi=72, transparent=False, facecolor='xkcd:off white', edgecolor=g.get_facecolor())\n", "plt.savefig(\"xrf-spectrum-vanta.png\", dpi=72, transparent=False, facecolor='xkcd:off white', edgecolor=g.get_facecolor())\n",
"plt.show()\n", "plt.show()\n",
"plt.close()" "plt.close()"
] ]

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB