TAS-GS: An Extended TAS Diagram Software Based on Adaptive Bandwidth Gaussian Kernel Density Estimation and Softmax Probabilistic Discrimination
TAS-GS is a software for constructing TAS diagrams, which is based on adaptive bandwidth Gaussian kernel density estimation and softmax probabilistic discrimination. It can provide more accurate and reliable results for the analysis of geochemical data.
Version: 1.0.0
TAS-GS is an extended TAS diagram software based on Adaptive Bandwidth Gaussian Kernel Density Estimation (Gaussian KDE) and Softmax Probabilistic Discrimination. The classic TAS diagram is a technique for classifying unamed igneous rocks by plotting the relationship between total alkali and silica.
The traditional TAS method is based on the correlation between total alkali and silica in igneous rocks, and it intuitively divides rock types on a 2D diagram. This method is simple and easy to operate. However, with the increase of data set size and diversity, the traditional boundary distinguishing method may become blurred or unstable.
The TAS-GS version developed on this basis introduces Adaptive Bandwidth Gaussian Kernel Density Estimation (Gaussian KDE) and Softmax Probabilistic Discrimination. The GS part represents this improvement. The data sample is based on the GEOROC global igneous rock database. The data method is based on the experience summarized in the teaching and research work of data science and big data analysis.
In the TAS-GS system, each sample to be classified will be determined according to the probability distribution obtained from the GEOROC database. This inherits the classification boundaries of the traditional classic TAS method, ensuring the forward compatibility of the new method with the classic diagram. Based on the probability field, the software introduces adaptive bandwidth technology for Gaussian Kernel Density Estimation, which takes into account both data shape and classification stability, avoids overfitting to the original data, and maintains numerical stability in terms of availability. As the data volume accumulates, the adaptive bandwidth will reach a basic level of stability, and the Gaussian kernel density estimation based on this will reach second-order stability, making the model more robust and providing more accurate classification solutions for igneous rocks.
The development environment for this software is as follows:
| Library Name | Version Number | Function Description |
|---|---|---|
| PySide6 | 6.6.2 | Qt binding library for GUI development in Python |
| beeware | 0.3.0 | Native cross-platform mobile and desktop app development tool |
| matplotlib | 3.8.3 | Data visualization library for creating high-quality charts |
| numpy | 1.26.4 | Scientific computing library with a wide range of mathematical functions and array operations |
| pandas | 2.2.1 | Data analysis library with DataFrame and other data structures |
| scipy | 1.12.0 | Scientific computing library with advanced mathematical algorithms |
| toga | 0.4.2 | Python UI toolkit for building cross-platform native GUI apps |
| toga-chart | 0.2.0 | An extension for Toga library to create charts and data visualizations |
| scikit-learn | 1.4.1 | Machine learning library with a variety of supervised and unsupervised learning algorithms |
Note: Some important components, such as scikit-learn, must strictly adhere to the required version number. If other versions are installed, the software may not work properly.
The minimum hardware configuration required for this software to run is as follows:
| Configuration Item | Minimum Requirement |
|---|---|
| Processor | 2 GHz or faster processor |
| Memory (RAM) | 4 GB or more |
| Free Hard Disk Space | 1 GB or more |
| Display Resolution | 1920 x 1080 resolution |
This software combines PySide6 and BeeWare, which is a cross-platform GUI application development solution. It uses PySide6 to build the interface and leverages BeeWare's Briefcase for one-click packaging and running. This ensures that the application can run natively on popular operating systems such as Windows, GNU/Linux, etc.
The recommended operating system for this software is as follows:
| Operating System | Version Number | Architecture | Minimum Version Requirement | Recommended Version Requirement |
|---|---|---|---|---|
| Windows | 10 | x64 | 10 | 11 |
| Linux | Ubuntu 22.04 | x64 | Ubuntu 20.04 | Ubuntu 22.04 |
For Windows users, the installation is particularly simple.
Download link: https://pan.baidu.com/s/1Ja0kuJncBAuVbYVmSFLLVg?pwd=wzc2 Extraction code: wzc2
Please note that the currently provided installation package is only suitable for the latest mainstream Windows operating system versions, such as Windows 10 and Windows 11. For earlier versions of the operating system, due to the lack of corresponding environment for developers and ineffective testing, the software and its dependent packages may not run properly on these older versions of the system.
After downloading the installation package from the provided link (e.g., "TAS-GS-1.0.0.msi"), you can proceed with the installation by double-clicking the file.
During the installation process, you will be prompted to choose between two installation modes: one for the current user and another for the entire system.
The installation may take a few minutes, so please be patient.
Once the installation is successful, you will see a prompt indicating that the installation is complete.
After installation, you can find the installed application in the Start menu.
If you need to uninstall the software at any point, you can do so through the Application Management.
In the provided link, you will also find a file named "TAS-GS-1.0.0.zip". Download and extract this file to generate an independent folder. To ensure that the built-in interpreter can run normally, please ensure that it is stored in a folder with a full English path and avoid any spaces in the path.
After ensuring the path is correct, look for an file called "TAS-GS.exe" within the extracted folder and double-click it to run the program.
This method is suitable for GNU/Linux and macOS users, as well as Windows users, but it might be a bit troublesome for Windows users.
To run the application software of this project, you need to use git to clone the code, so you need to install git and have access to the internet to access github and obtain the code. After cloning the code, you will need a Python version 3.10 or above to run the cloned file.
In addition to the above-mentioned files, you may need to install some other system-level dependencies.
Here, taking the specific operating system environment of the developer's Ubuntu 22.04.3 LTS as an example, the following commands are used to install the required dependencies:
sudo apt update
sudo apt install build-essential git pkg-config python3-dev python3-venv libgirepository1.0-dev libcairo2-dev gir1.2-webkit2-4.0 libcanberra-gtk3-module libxkbcommon0 qtwayland5 libegl1-mesaIf you skip the above steps, you may encounter errors when installing pycairo, and thus cannot complete the installation of the dependent environment.
To clone the code and install the required packages using pip, please follow the commands below:
Clone the code from GitHub:
git clone https://github.com/GeoPyTool/TAS-GS.git
cd TAS-GS
pip install -r requirement.txtIf the dependency installation is completed, you will see information similar to the following, sometimes there may be some warnings, but this will not be a big problem, as long as it is not an error, it should be basically fine.
Remain in the cloned code path and find the subfolder 'tasgs'. Use the 'cd' command to enter it and then run 'briefcase run' to start the application.
cd tasgs
briefcase runThe first run may require updating some program templates, so it might take some time. Patience is a virtue, and there's nothing you can do but wait. Additionally, you'll need a stable internet connection to access GitHub.
These very time-consuming steps mainly just appear during the first run and won't have too many similar issues later on when running the code again, which will save a significant amount of time in the future.
The operation and use of TAS-GS are designed to be very simple, so it should be easy for users to get started.
TAS-GS supports CSV and Excel files, and the specific settings can be referred to from the following screenshots:
The required columns are Label,SiO2(wt%),K2O(wt%),Na2O(wt%), where Label is your sample label, and SiO2(wt%) and K2O(wt%)+Na2O(wt%) are the data you want to plot.
Note that you should use the data normalized after adding all oxides and then calibrating, which is more reliable.
To simplify the running process and reduce design complexity, TAS-GS itself no longer provides the function of data normalization, which can be done in Excel or WPS, and is not troublesome.
This time, TAS-GS does not require any additional settings, and the program can automatically assign different colors to groups of data based on their labels, refer to the data sample data_samples/TAS.csv.
No matter how it is installed and run, the overall graphical interface is basically the same:
Just select a CSV or Excel file to load it into the program interface.
There are two buttons on the main interface: Plot Data and Export Result.
Click on the former to generate a plot:
Click on the latter to pop up the classification results:
This operation process is very intuitive, and there is basically no learning cost. With a little exploration, you can quickly get started.
The judgment result table that pops up can be saved as a file, refer to /data_samples/TAS_Result.csv for the actual data, which adds the following columns to the left of the original data file:
| Label| Max_Ratio Classification| Max_Ratio Probability| Soft-Max Classification| Soft-Max Probability| TAS as VOL| | ------------ | --------------------- | --------------------- | --------------------- | --------------------- | | Zhang SH2016 | Basalt | 1 | Tholeiite | 0.047926 | Basalt | | Zhang SH2016 | Picrite | 0.684 | Picrite | 0.046181 | Basalt | | Zhang SH2016 | Basalt | 0.792 | Basalt | 0.046446 | Basalt | | Zhang SH2016 | Basalt | 0.655 | Basalt | 0.046292 | Basalt | | Zhang SH2016 | Adakite | 1 | Andesite | 0.046458 | Basaltic Andesite | | Zhang SH2016 | Basalt | 0.967 | Tholeiite | 0.047371 | Basalt | | Zhang SH2016 | Basalt | 0.905 | Basalt | 0.046621 | Basalt | | Zhang SH2016 | Tephrite | 0.964 | Basanite | 0.046108 | Basalt | | Zhang SH2016 | Picrite | 0.73 | Picrite | 0.046225 | Basalt | | Zhang SH2016 | Picrite | 0.603 | Picrite | 0.046105 | Basalt | | Zhang SH2016 | Basalt | 0.699 | Basalt | 0.046336 | Basalt | | Zhang SH2016 | Picrite | 0.862 | Picrite | 0.046412 | Basalt | | Zhang SH2016 | Komatiite | 1 | Picrite | 0.046572 | Basalt | | Zhang SH2016 | Picrite | 0.684 | Picrite | 0.046204 | Basalt | | Zhang SH2016 | Nephelinite | 0.542 | Picrite | 0.045982 | Basalt | | Zhang SH2016 | Picrite | 0.863 | Picrite | 0.046397 | Basalt | | Zhang SH2016 | Boninite | 1 | Tholeiite | 0.04698 | Basalt | | Wang chong 2016 | Basalt | 0.757 | Tholeiite | 0.047483 | Basalt | | Wang chong 2016 | Picrite | 0.803 | Tholeiite | 0.047129 | Basalt | | Wang chong 2016 | Basalt | 0.85 | Tholeiite | 0.047751 | Basalt | | Wang chong 2016 | Picrite | 0.795 | Tholeiite | 0.047208 | Basalt | | Wang chong 2016 | Basalt | 0.961 | Tholeiite | 0.048203 | Basalt | | Wang chong 2016 | Tholeiite | 1 | Tholeiite | 0.048437 | Basalt | | Wang chong 2016 | Basalt | 0.747 | Basalt | 0.046416 | Basalt | | Wang chong 2016 | Basalt | 0.903 | Tholeiite | 0.046841 | Basalt |
After adjusting the plot to your satisfaction, you can click the Save Plot button on the main interface to save the current plot:
The program provides four save formats: JPG and PNG are bitmap formats, while PDF and SVG are vector formats. If you plan to use CorelDraw or Adobe Illustrator, you may prefer to save the plot as a PDF. If you intend to use Ink Scape or Affinity Designer

















