Hf
Python Scripts for ICP-MS Hf data processing.
Install / Use
/learn @vixues/HfREADME
Hf Isotope Data Processor
A modern Python application for processing ICP-MS Hf (Hafnium) isotope data from Neptune Plus™ High Resolution Multicollector ICP-MS instruments.
All code is released under an MIT open-source license.
Features
- Modern GUI: Clean, intuitive interface with real-time progress feedback
- Batch Processing: Process multiple .exp files in a single operation
- Data Filtering: Filter data based on Hf180 threshold values
- Statistical Analysis: Automatic calculation of means, standard deviations, and standard errors
- Export Results: Save processed results to Excel format
- Error Handling: Comprehensive error handling with detailed user feedback
Table of Contents
- Installation
- Usage
- Project Structure
- Features in Detail
- Scientific Background
- Troubleshooting
- References
- Contact
Installation
Requirements
- Python 3.7 or higher
- Works on Linux, Windows, macOS, and BSD
Setup
-
Clone or download this repository
-
Install dependencies:
pip install -r requirements-py3.txtOr install manually:
pip install pandas>=1.3.0 numpy>=1.20.0 openpyxl>=3.0.0 -
Run the application:
python main.py
Usage
Quick Start
- Launch the application by running
python main.py - Click "Browse Folder" to select a folder containing
.expfiles - (Optional) Set the Hf180 Filter Threshold to exclude data points below a certain value
- Click "Process Data" to process all
.expfiles in the selected folder - Review results in the results table
- Click "Save Results" to export results to an Excel file
Detailed Workflow
Step 1: Select Data Folder
- Click the "Browse Folder" button
- Navigate to the folder containing your
.expfiles - The application will automatically detect and count all
.expfiles
Step 2: Configure Filter (Optional)
- Set the Hf180 threshold value (default: 0)
- Data points with Hf180 ≤ threshold will be excluded from calculations
- This helps remove low-quality measurements
Step 3: Process Data
- Click "Process Data" to start batch processing
- Progress is shown in real-time in the status log
- Results appear in the table as each file is processed
- Green checkmarks indicate successful processing
- Red X marks indicate errors (check the log for details)
Step 4: Review Results
The results table displays:
- Sample: File name (without .exp extension)
- β2/3: Yb mass fractionation correction factor
- 2σ: Two standard errors for β2/3
- β7/9: Hf mass fractionation correction factor
- 2σ: Two standard errors for β7/9
- 176Yb/177Hf: Corrected Yb/Hf ratio
- 2σ: Two standard errors for 176Yb/177Hf
- 176Lu/177Hf: Corrected Lu/Hf ratio
- 2σ: Two standard errors for 176Lu/177Hf
- 176Hf/177Hf*: Corrected radiogenic Hf ratio
- 2σ: Two standard errors for 176Hf*/177Hf
- Cycles: Number of measurement cycles used
Step 5: Export Results
- Click "Save Results" to export all results to an Excel file
- Choose the save location and filename
- The exported file contains all calculated parameters for all processed samples
Project Structure
Hf/
├── main.py # Application entry point
├── gui.py # Modern GUI implementation
├── calculation.py # Hf isotope calculation engine
├── Napture.py # .exp file reader
├── requirements-py3.txt # Python dependencies
├── data/ # Sample .exp files for testing
├── reference/ # Reference spreadsheet
└── README.md # This file
Module Descriptions
main.py: Application entry point that initializes the GUIgui.py: Modern, user-friendly graphical interface with:- Real-time progress tracking
- Status logging
- Results table with sorting
- Export functionality
calculation.py: Core calculation engine implementing:- Mass fractionation corrections (β2/3 and β7/9)
- Isobaric interference corrections
- Statistical analysis
Napture.py: File parser for Neptune Plus™ .exp files
Calculation Process
The Hf isotope data processing involves several sequential steps to correct for mass fractionation and isobaric interferences. The following sections detail each step of the calculation process.
Step 1: Data Loading and Filtering
-
File Reading: The application reads measurement cycles from
.expfiles exported by the Neptune Plus™ instrument. Each cycle contains measurements for isotopes: 172Yb, 173Yb, 175Lu, 176Hf, 177Hf, 178Hf, 179Hf, and 180Hf. -
Quality Filtering: Data points are filtered based on the Hf180 threshold value. Only cycles where Hf180 > threshold are retained for analysis. This removes low-quality measurements that may affect the accuracy of calculations.
Step 2: Mass Fractionation Correction Factors
Mass fractionation occurs during ICP-MS analysis due to the preferential transmission of heavier isotopes. Two correction factors (beta values) are calculated:
β2/3 (Ytterbium Mass Fractionation Correction)
The β2/3 factor corrects for mass fractionation in Yb measurements using the ratio of 172Yb/173Yb:
β2/3 = ln(R_measured / R_true) / ln(M_172 / M_173)
Where:
R_measured= measured 172Yb/173Yb ratioR_true= true natural abundance ratio (1.35274)M_172= atomic mass of 172Yb (171.936378)M_173= atomic mass of 173Yb (172.938208)
This factor is calculated for each measurement cycle and then averaged across all cycles.
β7/9 (Hafnium Mass Fractionation Correction)
The β7/9 factor corrects for mass fractionation in Hf measurements using the ratio of 177Hf/179Hf:
β7/9 = ln(R_measured / R_true) / ln(M_177 / M_178)
Where:
R_measured= measured 177Hf/179Hf ratioR_true= true natural abundance ratio (1/0.7325)M_177= atomic mass of 177Hf (176.943217)M_178= atomic mass of 178Hf (178.945812)
Like β2/3, this factor is calculated per cycle and then averaged.
Step 3: Isobaric Interference Corrections
The 176Hf peak suffers from isobaric interferences from 176Yb and 176Lu, which have the same nominal mass. These interferences must be corrected before calculating accurate Hf isotope ratios.
Correction for 176Yb Interference
The contribution of 176Yb to the 176Hf signal is calculated using:
176Yb = 172Yb × (M_172 / M_176)^β2/3_mean × A_176
Where:
172Yb= measured 172Yb signalM_172= atomic mass of 172Yb (171.936378)M_176= atomic mass of 176Yb (175.942564)β2/3_mean= mean β2/3 value across all cyclesA_176= natural abundance of 176Yb (0.588596)
Correction for 176Lu Interference
The contribution of 176Lu to the 176Hf signal is calculated using:
176Lu = 175Lu × (M_175 / M_176)^β2/3_mean × A_176
Where:
175Lu= measured 175Lu signalM_175= atomic mass of 175Lu (174.94077)M_176= atomic mass of 176Lu (175.942679)β2/3_mean= mean β2/3 value across all cyclesA_176= natural abundance of 176Lu (0.02658)
Calculation of Radiogenic 176Hf*
The radiogenic 176Hf* (the portion of 176Hf that is not from interference) is calculated by subtracting the interferences:
176Hf* = 176Hf - 176Yb - 176Lu
Step 4: Corrected Isotope Ratio Calculations
After correcting for interferences, the isotope ratios are calculated and corrected for mass fractionation.
176Yb/177Hf (Corrected)
176Yb/177Hf = (176Yb / 177Hf) × (M_176_Yb / M_177_Hf)^β7/9
This ratio indicates the Yb contamination level in the sample.
176Lu/177Hf (Corrected)
176Lu/177Hf = (176Lu / 177Hf) × (M_176_Lu / M_177_Hf)^β7/9
This ratio indicates the Lu contamination level in the sample.
176Hf*/177Hf (Corrected)
176Hf*/177Hf = (176Hf* / 177Hf) × (M_176_Hf / M_177_Hf)^β7/9_mean
This is the primary result, representing the corrected radiogenic Hf isotope ratio, where:
M_176_Hf= atomic mass of 176Hf (175.941406)M_177_Hf= atomic mass of 177Hf (176.943217)β7/9_mean= mean β7/9 value across all cycles
Step 5: Statistical Analysis
For each calculated parameter, the following statistics are computed:
- Mean: Average value across all measurement cycles
- Standard Deviation (SD): Measure of data dispersion
- Relative Standard Deviation (RSD): SD/Mean, expressed as a percentage
- Two Standard Errors (2SE): 2 × (SD / √n), where n is the number of cycles
- Relative Standard Errors (2RSE): 2SE/Mean
The 2SE values are reported in the results table and represent the 95% confidence interval for the mean values.
Summary of Physical Constants
The calculations use the following physical constants:
-
Yb Isotopes:
- 172Yb/173Yb natural ratio: 1.35274
- Atomic masses: 172Yb = 171.936378, 173Yb = 172.938208, 176Yb = 175.942564
- 176Yb natural abundance: 0.588596
-
Lu Isotopes:
- Atomic masses: 175Lu = 174.94077, 176Lu = 175.942679
- 176Lu natural abundance: 0.02658
-
Hf Isotopes:
- 179Hf/177Hf natural ratio: 0.7325
- Atomic masses: 176Hf = 175.941406, 177Hf = 176.943217, 178Hf = 178.945812
Features in Detail
Data Processing Summary
The application performs the following calculations:
-
Mass Fractionation Corrections:
- β2/3: Ytterbium mass fractionation correction
- β7/9: Hafnium mass fractionation correction
-
Isobaric Interference Corrections:
- Correction for 176Yb interference on 176Hf
- Correction for 176Lu interference on 176Hf
- Calculation of radiogenic 176Hf*
-
Isotope Ratio Calculations:
- 176Yb/177Hf (corrected)
- 176Lu/177Hf (corrected)
- 176Hf*/177Hf (corrected)
-
Statistical Analysis:
- Mean values
- Standar
