Skip to content

vixues/Hf

Repository files navigation

Hf Isotope Data Processor

中文 | English

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

Requirements

  • Python 3.7 or higher
  • Works on Linux, Windows, macOS, and BSD

Setup

  1. Clone or download this repository

  2. Install dependencies:

    pip install -r requirements-py3.txt

    Or install manually:

    pip install pandas>=1.3.0 numpy>=1.20.0 openpyxl>=3.0.0
  3. Run the application:

    python main.py

Usage

Quick Start

  1. Launch the application by running python main.py
  2. Click "Browse Folder" to select a folder containing .exp files
  3. (Optional) Set the Hf180 Filter Threshold to exclude data points below a certain value
  4. Click "Process Data" to process all .exp files in the selected folder
  5. Review results in the results table
  6. 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 .exp files
  • The application will automatically detect and count all .exp files

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
  • : Two standard errors for β2/3
  • β7/9: Hf mass fractionation correction factor
  • : Two standard errors for β7/9
  • 176Yb/177Hf: Corrected Yb/Hf ratio
  • : Two standard errors for 176Yb/177Hf
  • 176Lu/177Hf: Corrected Lu/Hf ratio
  • : Two standard errors for 176Lu/177Hf
  • 176Hf/177Hf*: Corrected radiogenic Hf ratio
  • : 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 GUI
  • gui.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

  1. File Reading: The application reads measurement cycles from .exp files exported by the Neptune Plus™ instrument. Each cycle contains measurements for isotopes: 172Yb, 173Yb, 175Lu, 176Hf, 177Hf, 178Hf, 179Hf, and 180Hf.

  2. 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 ratio
  • R_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 ratio
  • R_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 signal
  • M_172 = atomic mass of 172Yb (171.936378)
  • M_176 = atomic mass of 176Yb (175.942564)
  • β2/3_mean = mean β2/3 value across all cycles
  • A_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 signal
  • M_175 = atomic mass of 175Lu (174.94077)
  • M_176 = atomic mass of 176Lu (175.942679)
  • β2/3_mean = mean β2/3 value across all cycles
  • A_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:

  1. Mean: Average value across all measurement cycles
  2. Standard Deviation (SD): Measure of data dispersion
  3. Relative Standard Deviation (RSD): SD/Mean, expressed as a percentage
  4. Two Standard Errors (2SE): 2 × (SD / √n), where n is the number of cycles
  5. 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:

  1. Mass Fractionation Corrections:

    • β2/3: Ytterbium mass fractionation correction
    • β7/9: Hafnium mass fractionation correction
  2. Isobaric Interference Corrections:

    • Correction for 176Yb interference on 176Hf
    • Correction for 176Lu interference on 176Hf
    • Calculation of radiogenic 176Hf*
  3. Isotope Ratio Calculations:

    • 176Yb/177Hf (corrected)
    • 176Lu/177Hf (corrected)
    • 176Hf*/177Hf (corrected)
  4. Statistical Analysis:

    • Mean values
    • Standard deviation (SD)
    • Relative standard deviation (RSD)
    • Two standard errors (2SE)
    • Relative standard errors (2RSE)

Supported File Format

  • Instrument: Neptune Plus™ High Resolution Multicollector ICP-MS
  • File Type: .exp (export files from the instrument)
  • Required Columns: Cycle, Time, 172Yb, 173Yb, 175Lu, 176Hf, 177Hf, 178Hf, 179Hf, 180Hf

Scientific Background

This software implements the methods described in:

  1. Iizuka & Hirata (2005): Improvements of precision and accuracy in in situ Hf isotope microanalysis of zircon using the laser ablation-MC-ICPMS technique. Chemical Geology, 220(1-2), 121-137. DOI: 10.1016/j.chemgeo.2005.03.010

  2. Chu et al. (2002): Hf isotope ratio analysis using multi-collector inductively coupled plasma mass spectrometry: An evaluation of isobaric interference corrections. Journal of Analytical Atomic Spectrometry, 17, 1567-1574. DOI: 10.1039/B206707B

The calculation formulas can also be found in the reference spreadsheet in the reference/ folder.

Troubleshooting

Common Issues

Problem: "No .exp files found"

  • Solution: Ensure you've selected the correct folder and that it contains .exp files

Problem: "No data points remaining after filtering"

  • Solution: Lower the Hf180 threshold value or check your data quality

Problem: "Error reading file"

  • Solution: Ensure the file is a valid Neptune Plus™ .exp file and not corrupted

Problem: "Missing required columns"

  • Solution: Verify that your .exp file contains all required isotope columns

Problem: Processing hangs or is slow

  • Solution: Large files may take time. Check the status log for progress updates.

Getting Help

If you encounter issues not listed here:

  1. Check the status log in the application for detailed error messages
  2. Verify your .exp files are in the correct format
  3. Ensure all dependencies are installed correctly

References

  • Iizuka, T., & Hirata, T. (2005). Improvements of precision and accuracy in in situ Hf isotope microanalysis of zircon using the laser ablation-MC-ICPMS technique. Chemical Geology, 220(1-2), 121-137. https://doi.org/10.1016/j.chemgeo.2005.03.010

  • Chu, N.C., Taylor, R.N., Chavagnac, V., Nesbitt, R.W., Boella, R.M., Milton, J.A., Germain, C.R., Bayon, G., & Burton, K. (2002). Hf isotope ratio analysis using multi-collector inductively coupled plasma mass spectrometry: An evaluation of isobaric interference corrections. Journal of Analytical Atomic Spectrometry, 17, 1567-1574. http://dx.doi.org/10.1039/B206707B

Contact

This software is actively maintained. For questions, bug reports, or feature requests, please contact:

Email: [email protected]

Note

In newer versions, the Hf and Sr processing programs have been combined into the Isotope software suite. For more information about the integrated version, please visit the Isotope project page.

License

This project is licensed under the MIT License - see the LICENSE file for details.


Enjoy using Hf Isotope Data Processor!

About

Python Scripts for ICP-MS Hf data processing.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages