Parse Thermo Scientific VGD files for XPS (X-ray Photoelectron Spectroscopy) analysis
Project description
VGD Reader
A Python library for reading Thermo Scientific VGD (VG Data) binary files commonly used in X-ray Photoelectron Spectroscopy (XPS).
Features
- Parse single-spectrum and multi-spectrum VGD files
- Extract binding energy, kinetic energy, and intensity data
- Access acquisition parameters (pass energy, dwell time, source energy, etc.)
- Export to Excel format with metadata
- Convert to pandas DataFrame
- No wxPython or GUI dependencies - pure data processing
Installation
pip install vgd-reader
With optional dependencies for Excel export and pandas support:
pip install vgd-reader[all]
Quick Start
Basic Usage
from vgd_reader import read_vgd
# Read a VGD file
data = read_vgd("O1s_Scan.vgd")
# Access data arrays
print(data.binding_energy) # BE values (numpy array)
print(data.intensity) # Raw intensity counts
print(data.corrected_intensity) # Normalized intensity
# Access metadata
print(data.core_level) # e.g., "O1s"
print(data.acquisition.pass_energy)
print(data.acquisition.source_energy)
Working with Multi-Spectrum Files
from vgd_reader import read_vgd
vgd = read_vgd("multi_spectrum.vgd")
print(f"Found {vgd.num_spectra} spectra")
for spectrum in vgd.spectra:
print(f"{spectrum.core_level} - Index {spectrum.spectrum_index}")
print(f" BE range: {spectrum.be_start:.2f} to {spectrum.be_end:.2f} eV")
print(f" Pass energy: {spectrum.pass_energy} eV")
Export to Excel
from vgd_reader import read_vgd
data = read_vgd("sample.vgd")
data.to_excel("output.xlsx", include_metadata=True)
Convert to pandas DataFrame
from vgd_reader import read_vgd
data = read_vgd("sample.vgd")
df = data.to_dataframe()
print(df.head())
Low-Level API
For more control, use the low-level parsing functions:
from vgd_reader import parse_vgd_file, calculate_spectrum_data
# Parse raw data
parsed = parse_vgd_file("sample.vgd")
print(parsed['source_energy'])
print(parsed['pass_energy'])
print(parsed['metadata'])
# Calculate spectrum data for a specific index
calc = calculate_spectrum_data(parsed, spectrum_index=0)
be_values = calc['be_values']
intensities = calc['intensities']
API Reference
read_vgd(filepath)
Main entry point. Returns a VGDFile object.
VGDFile
filepath: Path to the VGD filespectra: List ofVGDSpectrumobjectsnum_spectra: Number of spectra in filecore_level: Primary core level name from filenamebinding_energy: BE array (first spectrum)intensity: Raw intensity array (first spectrum)corrected_intensity: Corrected intensity array (first spectrum)metadata:VGDMetadataobjectacquisition:VGDAcquisitionParamsobjectto_dataframe(): Convert to pandas DataFrameto_excel(path): Export to Excel file
VGDSpectrum
binding_energy: numpy array of BE valueskinetic_energy: numpy array of KE valuesintensity: numpy array of raw countscorrected_intensity: numpy array of normalized datacore_level: Core level name (e.g., "O1s")spectrum_index: Index in multi-spectrum filesbe_start,be_end,be_step: Energy range infosource_energy,pass_energy: Acquisition parameterssample_id,title,author: Metadatato_dict(): Convert to dictionary
extract_core_level_name(filename)
Extract clean core level name from filename:
"O1s_Scan.VGD"→"O1s""Sr3d Scan.VGD"→"Sr3d"
File Format
VGD files use Microsoft OLE2 Compound File format (similar to older .doc files). The library extracts:
- VGData: Raw intensity values (64-bit floats)
- VGDataAxes: Spectrum dimensions for multi-spectrum files
- VGSpaceAxes: Kinetic energy start and step values
- Property Stream: Acquisition parameters (source energy, pass energy, dwell time, etc.)
Binding energy is calculated from kinetic energy using:
BE = Source_Energy - KE
Requirements
- Python ≥ 3.8
- numpy ≥ 1.20.0
- olefile ≥ 0.46
- openpyxl ≥ 3.0.0 (optional, for Excel export)
- pandas ≥ 1.3.0 (optional, for DataFrame conversion)
License
MIT License
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Related Projects
- KherveFitting - Open-source XPS data analysis software
- LMFITXPS - XPS peak fitting with lmfit
- LG4X - Line shape functions for XPS
Acknowledgments
This library was developed as part of the KherveFitting project for XPS data analysis.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file vgd_reader-0.1.0.tar.gz.
File metadata
- Download URL: vgd_reader-0.1.0.tar.gz
- Upload date:
- Size: 13.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8ea11d2f5aabd25fcaa5609a71aa2a915a01896c26e0c478d4caa1f5907aea54
|
|
| MD5 |
175f0c35b5683ec1fe917403141c42db
|
|
| BLAKE2b-256 |
50a38af14d4dc6f0a8941f59d40b90eaddae482f3b27064c2e2ac4fbab3575e7
|
File details
Details for the file vgd_reader-0.1.0-py3-none-any.whl.
File metadata
- Download URL: vgd_reader-0.1.0-py3-none-any.whl
- Upload date:
- Size: 11.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b7ee6246ae6af79be609eb9c4ec9aac976b9cedb86ccc56c911b182b643005bf
|
|
| MD5 |
5cf727de079c50238733d4649fd321ff
|
|
| BLAKE2b-256 |
8916e389c382afecd9402e85f1ef6a3332ad547963bbbb656e8d8076837b0cfd
|