A high-performance Python library for parsing NETZSCH STA (Simultaneous Thermal Analysis) NGB files with comprehensive metadata extraction and analysis tools.
- Strict Binary Parsing: a record-grammar tokenizer parses every byte of the file — no pattern-match guessing (tens of milliseconds per file)
- Complete Metadata: Extract instrument settings, sample info, and experimental conditions
- Baseline Correction: Automatic baseline subtraction with validation
- DTG Analysis: Derivative thermogravimetry calculation with smoothing options
- Batch Processing: Parallel processing of multiple files
- Data Export: Convert data to Parquet or CSV; export metadata to JSON
- CLI Support: Command-line interface for automation
pip install pyngbfrom pyngb import read_ngb
import polars as pl
import json
# Load NGB file with embedded metadata
table = read_ngb("experiment.ngb-ss3")
df = pl.from_arrow(table)
# Access data
print(f"Loaded {df.height} data points")
print(f"Temperature range: {df['sample_temperature'].min():.1f} to {df['sample_temperature'].max():.1f} °C")
# Access metadata
metadata = json.loads(table.schema.metadata[b'file_metadata'])
print(f"Sample: {metadata.get('sample_name', 'Unknown')}")
# Baseline correction
corrected = read_ngb("sample.ngb-ss3", baseline_file="baseline.ngb-bs3")
# DTG analysis
from pyngb.api.analysis import add_dtg
table_with_dtg = add_dtg(table, method="savgol", smooth="medium")The CLI is available as the pyngb console script (or equivalently python -m pyngb):
# Convert single file
pyngb convert sample.ngb-ss3
# Batch processing with baseline correction
pyngb convert *.ngb-ss3 -b baseline.ngb-bs3 -f parquet -o ./processed/
# Inspect file structure / run data-quality checks
pyngb inspect sample.ngb-ss3
pyngb validate sample.ngb-ss3
# Get help
pyngb --help- Getting Started - Installation and first steps
- User Guide - Core functionality and examples
- API Reference - Complete function documentation
- Troubleshooting - Common issues and solutions
- Contributing - Development guidelines
MIT License. See LICENSE for details.
- Issues: GitHub Issues
- Discussions: GitHub Discussions
Made with ❤️ for the scientific community