Skip to content

GraysonBellamy/pyngb

pyNGB - NETZSCH STA File Parser

PyPI version Python 3.10+ License: MIT Tests

A high-performance Python library for parsing NETZSCH STA (Simultaneous Thermal Analysis) NGB files with comprehensive metadata extraction and analysis tools.

⚠️ Disclaimer: This package is not affiliated with NETZSCH-Gerätebau GmbH. NETZSCH is a trademark of NETZSCH-Gerätebau GmbH.

Features

  • Fast Binary Parsing: Optimized parsing with NumPy and PyArrow (0.1-1 sec/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 to Parquet, CSV, and JSON formats
  • CLI Support: Command-line interface for automation

Installation

pip install pyngb

Quick Example

from 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")

Command Line Usage

# Convert single file
python -m pyngb sample.ngb-ss3

# Batch processing with baseline correction
python -m pyngb *.ngb-ss3 -b baseline.ngb-bs3 -f parquet -o ./processed/

# Get help
python -m pyngb --help

Documentation

License

MIT License. See LICENSE for details.

Support


Made with ❤️ for the scientific community

About

Python package for retrieving data from Netzsch STA files

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages