API Reference
This section provides comprehensive documentation of pyngb's API, including all functions, classes, and modules.
Core Functions
Data Loading
pyngb.read_ngb(path, *, return_metadata=False, baseline_file=None, dynamic_axis='sample_temperature')
read_ngb(
path: str,
*,
return_metadata: Literal[False] = False,
baseline_file: None = None,
dynamic_axis: str = "time",
) -> pa.Table
read_ngb(
path: str,
*,
return_metadata: Literal[True],
baseline_file: None = None,
dynamic_axis: str = "time",
) -> tuple[FileMetadata, pa.Table]
Read NETZSCH NGB file data with optional baseline subtraction.
This is the primary function for loading NGB files. By default, it returns a PyArrow table with embedded metadata. For direct metadata access, use return_metadata=True. When baseline_file is provided, baseline subtraction is performed automatically.
Parameters
path : str Path to the NGB file (.ngb-ss3 or similar extension). Supports absolute and relative paths. return_metadata : bool, default False If False (default), return PyArrow table with embedded metadata. If True, return (metadata, data) tuple. baseline_file : str or None, default None Path to baseline file (.ngb-bs3) for baseline subtraction. If provided, performs automatic baseline subtraction. The baseline file must have an identical temperature program to the sample file. dynamic_axis : str, default "sample_temperature" Axis to use for dynamic segment alignment in baseline subtraction. Options: "time", "sample_temperature", "furnace_temperature"
Returns
pa.Table or tuple[FileMetadata, pa.Table] - If return_metadata=False: PyArrow table with embedded metadata - If return_metadata=True: (metadata dict, PyArrow table) tuple - If baseline_file provided: baseline-subtracted data
Raises
FileNotFoundError If the specified file does not exist NGBStreamNotFoundError If required data streams are missing from the NGB file NGBCorruptedFileError If the file structure is invalid or corrupted zipfile.BadZipFile If the file is not a valid ZIP archive
Examples
Basic usage (recommended for most users):
from pyngb import read_ngb import polars as pl
Load NGB file
data = read_ngb("experiment.ngb-ss3")
Convert to DataFrame for analysis
df = pl.from_arrow(data) print(f"Shape: {df.height} rows x {df.width} columns") Shape: 2500 rows x 8 columns
Access embedded metadata
import json metadata = json.loads(data.schema.metadata[b'file_metadata']) print(f"Sample: {metadata['sample_name']}") print(f"Instrument: {metadata['instrument']}") Sample: Polymer Sample A Instrument: NETZSCH STA 449 F3 Jupiter
Advanced usage (for metadata-heavy workflows):
Get metadata and data separately
metadata, data = read_ngb("experiment.ngb-ss3", return_metadata=True)
Work with metadata directly
print(f"Operator: {metadata.get('operator', 'Unknown')}") print(f"Sample mass: {metadata.get('sample_mass', 0)} mg") print(f"Data points: {data.num_rows}") Operator: Jane Smith Sample mass: 15.2 mg Data points: 2500
Use metadata for data processing
df = pl.from_arrow(data) initial_mass = metadata['sample_mass'] df = df.with_columns( ... (pl.col('mass') / initial_mass * 100).alias('mass_percent') ... )
Data analysis workflow:
Simple analysis
data = read_ngb("sample.ngb-ss3") df = pl.from_arrow(data)
Basic statistics
if "sample_temperature" in df.columns: ... temp_range = df["sample_temperature"].min(), df["sample_temperature"].max() ... print(f"Temperature range: {temp_range[0]:.1f} to {temp_range[1]:.1f} °C") Temperature range: 25.0 to 800.0 °C
Mass loss calculation
if "mass" in df.columns: ... mass_loss = (df["mass"].max() - df["mass"].min()) / df["mass"].max() * 100 ... print(f"Mass loss: {mass_loss:.2f}%") Mass loss: 12.3%
Performance Notes
- Fast binary parsing with NumPy optimization
- Memory-efficient processing with PyArrow
- Typical parsing time: 0.1-10 seconds depending on file size
- Includes file hash for integrity verification
See Also
NGBParser : Low-level parser for custom processing BatchProcessor : Process multiple files efficiently
Source code in src/pyngb/api/loaders.py
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 |
|
Usage Examples
# Basic data loading
from pyngb import read_ngb
# Method 1: Load as PyArrow table with embedded metadata (recommended)
table = read_ngb("sample.ngb-ss3")
print(f"Shape: {table.num_rows} x {table.num_columns}")
# Method 2: Get separate metadata and data
metadata, data = read_ngb("sample.ngb-ss3", return_metadata=True)
print(f"Sample: {metadata.get('sample_name', 'Unknown')}")
Baseline Subtraction
pyngb.subtract_baseline(sample_file, baseline_file, dynamic_axis='sample_temperature')
Subtract baseline data from sample data.
This function loads both sample (.ngb-ss3) and baseline (.ngb-bs3) files, validates that they have identical temperature programs, identifies isothermal and dynamic segments, and performs appropriate baseline subtraction. For isothermal segments, subtraction is done on the time axis. For dynamic segments, the user can choose the alignment axis.
Only the 'mass' and 'dsc_signal' columns are subtracted. All other columns (time, temperatures, flows) are retained from the sample file.
Parameters
sample_file : str Path to the sample file (.ngb-ss3) baseline_file : str Path to the baseline file (.ngb-bs3). Must have identical temperature program to the sample file. dynamic_axis : str, default="sample_temperature" Axis to use for dynamic segment alignment and subtraction. Options: "time", "sample_temperature", "furnace_temperature"
Returns
pl.DataFrame DataFrame with baseline-subtracted data
Raises
ValueError If temperature programs between sample and baseline are incompatible FileNotFoundError If either file does not exist
Examples
Basic subtraction using sample temperature axis for dynamic segments (default)
df = subtract_baseline("sample.ngb-ss3", "baseline.ngb-bs3")
Use time axis for dynamic segment alignment
df = subtract_baseline( ... "sample.ngb-ss3", ... "baseline.ngb-bs3", ... dynamic_axis="time" ... )
Source code in src/pyngb/baseline.py
338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 |
|
pyngb.BaselineSubtractor
Handles baseline subtraction operations for NGB data.
Source code in src/pyngb/baseline.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 |
|
Functions
identify_segments(df, temperature_program)
Identify isothermal and dynamic segments based on temperature program.
Parameters
df : pl.DataFrame The data to analyze temperature_program : dict Temperature program metadata from the file
Returns
tuple[list[tuple[int, int]], list[tuple[int, int]]] (isothermal_segments, dynamic_segments) as lists of (start_idx, end_idx) tuples
Source code in src/pyngb/baseline.py
interpolate_baseline(sample_segment, baseline_segment, axis)
Interpolate baseline data to match sample data points.
Parameters
sample_segment : pl.DataFrame Sample data segment baseline_segment : pl.DataFrame Baseline data segment axis : str Axis to interpolate on ("time", "sample_temperature", or "furnace_temperature")
Returns
pl.DataFrame Interpolated baseline data
Source code in src/pyngb/baseline.py
subtract_segment(sample_segment, baseline_segment, axis)
Subtract baseline from sample for a single segment.
Parameters
sample_segment : pl.DataFrame Sample data segment baseline_segment : pl.DataFrame Baseline data segment axis : str Axis to use for alignment
Returns
pl.DataFrame Sample data with baseline subtracted
Source code in src/pyngb/baseline.py
validate_temperature_programs(sample_metadata, baseline_metadata)
Validate that sample and baseline have compatible temperature programs.
Parameters
sample_metadata : FileMetadata Sample file metadata baseline_metadata : FileMetadata Baseline file metadata
Raises
ValueError If temperature programs are incompatible
Source code in src/pyngb/baseline.py
process_baseline_subtraction(sample_df, baseline_df, sample_metadata, baseline_metadata, dynamic_axis='time')
Process complete baseline subtraction.
Parameters
sample_df : pl.DataFrame Sample data baseline_df : pl.DataFrame Baseline data sample_metadata : FileMetadata Sample file metadata containing temperature program baseline_metadata : FileMetadata Baseline file metadata containing temperature program dynamic_axis : str Axis to use for dynamic segment subtraction
Returns
pl.DataFrame Processed data with baseline subtracted
Raises
ValueError If temperature programs are incompatible
Source code in src/pyngb/baseline.py
250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 |
|
Usage Examples
# Standalone baseline subtraction
from pyngb import subtract_baseline
# Default behavior (sample_temperature axis for dynamic segments)
corrected_df = subtract_baseline("sample.ngb-ss3", "baseline.ngb-bs3")
# Custom axis selection
corrected_df = subtract_baseline(
"sample.ngb-ss3",
"baseline.ngb-bs3",
dynamic_axis="time"
)
# Integrated approach
from pyngb import read_ngb
corrected_data = read_ngb(
"sample.ngb-ss3",
baseline_file="baseline.ngb-bs3"
)
Batch Processing
BatchProcessor Class
pyngb.BatchProcessor
High-performance batch processing for multiple NGB files.
Provides parallel processing, progress tracking, error handling, and flexible output formats for processing collections of NGB files.
Examples:
from pyngb.batch import BatchProcessor >>> >>> processor = BatchProcessor(max_workers=4) >>> results = processor.process_directory("./data/", output_format="parquet") >>> print(f"Processed {len(results)} files") >>> >>> # Custom processing with error handling >>> results = processor.process_files( ... file_list, ... output_dir="./output/", ... skip_errors=True ... )
Source code in src/pyngb/batch.py
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 |
|
Functions
__init__(max_workers=None, verbose=True)
Initialize batch processor.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
max_workers
|
int | None
|
Maximum number of parallel processes (default: CPU count) |
None
|
verbose
|
bool
|
Whether to show progress information |
True
|
Source code in src/pyngb/batch.py
process_directory(directory, pattern='*.ngb-ss3', output_format='parquet', output_dir=None, skip_errors=True)
Process all NGB files in a directory.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
directory
|
Union[str, Path]
|
Directory containing NGB files |
required |
pattern
|
str
|
File pattern to match (default: "*.ngb-ss3") |
'*.ngb-ss3'
|
output_format
|
str
|
Output format ("parquet", "csv", "both") |
'parquet'
|
output_dir
|
Union[str, Path] | None
|
Output directory (default: same as input) |
None
|
skip_errors
|
bool
|
Whether to continue processing if individual files fail |
True
|
Returns:
Type | Description |
---|---|
list[dict[str, str | float | None]]
|
List of processing results with status and metadata |
Examples:
>>> processor = BatchProcessor()
>>> results = processor.process_directory(
... "./experiments/",
... output_format="both",
... skip_errors=True
... )
>>>
>>> # Check for errors
>>> errors = [r for r in results if r['status'] == 'error']
>>> print(f"Failed to process {len(errors)} files")
Source code in src/pyngb/batch.py
process_files(files, output_format='parquet', output_dir=None, skip_errors=True)
Process a list of NGB files with parallel execution.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
files
|
list[Union[str, Path]]
|
List of file paths to process |
required |
output_format
|
str
|
Output format ("parquet", "csv", "both") |
'parquet'
|
output_dir
|
Union[str, Path] | None
|
Output directory |
None
|
skip_errors
|
bool
|
Whether to continue if individual files fail |
True
|
Returns:
Type | Description |
---|---|
list[dict[str, str | float | None]]
|
List of processing results |
Source code in src/pyngb/batch.py
193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 |
|
NGBDataset Class
pyngb.NGBDataset
Dataset management for collections of NGB files.
Provides high-level operations for managing and analyzing collections of NGB files including metadata aggregation, summary statistics, and batch operations.
Examples:
from pyngb.batch import NGBDataset >>> >>> # Create dataset from directory >>> dataset = NGBDataset.from_directory("./experiments/") >>> >>> # Get overview >>> summary = dataset.summary() >>> print(f"Dataset contains {len(dataset)} files") >>> >>> # Export metadata >>> dataset.export_metadata("experiment_summary.csv") >>> >>> # Filter by criteria >>> polymer_samples = dataset.filter_by_metadata( ... lambda meta: 'polymer' in meta.get('material', '').lower() ... )
Source code in src/pyngb/batch.py
307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 |
|
Functions
__init__(files)
Initialize dataset with file list.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
files
|
list[Path]
|
List of NGB file paths |
required |
from_directory(directory, pattern='*.ngb-ss3')
classmethod
Create dataset from directory.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
directory
|
Union[str, Path]
|
Directory containing NGB files |
required |
pattern
|
str
|
File pattern to match |
'*.ngb-ss3'
|
Returns:
Type | Description |
---|---|
NGBDataset
|
NGBDataset instance |
Source code in src/pyngb/batch.py
summary()
Generate dataset summary statistics.
Returns:
Type | Description |
---|---|
dict[str, int | float | list[str] | tuple[float, float] | None]
|
Dictionary with summary information |
Source code in src/pyngb/batch.py
export_metadata(output_path, format='csv')
Export metadata for all files.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
output_path
|
Union[str, Path]
|
Output file path |
required |
format
|
str
|
Output format ("csv", "json", "parquet") |
'csv'
|
Source code in src/pyngb/batch.py
filter_by_metadata(predicate)
Filter dataset by metadata criteria.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
predicate
|
Callable[[FileMetadata], bool]
|
Function that takes metadata dict and returns bool |
required |
Returns:
Type | Description |
---|---|
NGBDataset
|
New NGBDataset with filtered files |
Source code in src/pyngb/batch.py
Convenience Functions
pyngb.process_directory(directory, pattern='*.ngb-ss3', output_format='parquet', max_workers=None)
Process all NGB files in a directory.
Convenience function for quick batch processing.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
directory
|
Union[str, Path]
|
Directory containing NGB files |
required |
pattern
|
str
|
File pattern to match |
'*.ngb-ss3'
|
output_format
|
str
|
Output format ("parquet", "csv", "both") |
'parquet'
|
max_workers
|
int | None
|
Maximum parallel processes |
None
|
Returns:
Type | Description |
---|---|
list[dict[str, str | float | None]]
|
List of processing results |
Examples:
from pyngb.batch import process_directory >>> >>> results = process_directory("./data/", output_format="both") >>> successful = [r for r in results if r['status'] == 'success'] >>> print(f"Successfully processed {len(successful)} files")
Source code in src/pyngb/batch.py
pyngb.process_files(files, output_format='parquet', max_workers=None)
Process a list of NGB files.
Convenience function for batch processing specific files.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
files
|
list[Union[str, Path]]
|
List of file paths |
required |
output_format
|
str
|
Output format ("parquet", "csv", "both") |
'parquet'
|
max_workers
|
int | None
|
Maximum parallel processes |
None
|
Returns:
Type | Description |
---|---|
list[dict[str, str | float | None]]
|
List of processing results |
Source code in src/pyngb/batch.py
Batch Processing Examples
from pyngb import BatchProcessor, NGBDataset, process_directory
# Method 1: Using BatchProcessor class
processor = BatchProcessor(max_workers=4, verbose=True)
results = processor.process_files(
["file1.ngb-ss3", "file2.ngb-ss3"],
output_format="both",
output_dir="./output/"
)
# Method 2: Using convenience functions
results = process_directory(
"./data/",
pattern="*.ngb-ss3",
output_format="parquet",
max_workers=2
)
# Method 3: Dataset management
dataset = NGBDataset.from_directory("./experiments/")
summary = dataset.summary()
dataset.export_metadata("metadata.csv")
Data Validation
Validation Functions
pyngb.validate_sta_data(data, metadata=None)
Quick validation function that returns a list of issues.
Convenience function for basic validation without detailed reporting.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data
|
Union[Table, DataFrame]
|
STA data table or dataframe |
required |
metadata
|
FileMetadata | None
|
Optional metadata dictionary |
None
|
Returns:
Type | Description |
---|---|
list[str]
|
List of validation issues found |
Examples:
from pyngb import read_ngb from pyngb.validation import validate_sta_data >>> >>> table = read_ngb("sample.ngb-ss3") >>> issues = validate_sta_data(table) >>> >>> if issues: ... print("Validation issues found:") ... for issue in issues: ... print(f" - {issue}") ... else: ... print("Data validation passed!")
Source code in src/pyngb/validation.py
QualityChecker Class
pyngb.QualityChecker
Comprehensive quality checking for STA data.
Performs various validation checks on STA data including: - Data completeness and structure - Physical validity of measurements - Temperature profile analysis - Statistical outlier detection - Metadata consistency
Examples:
from pyngb import read_ngb from pyngb.validation import QualityChecker >>> >>> table = read_ngb("sample.ngb-ss3") >>> checker = QualityChecker(table) >>> result = checker.full_validation() >>> >>> if not result.is_valid: ... print("Data validation failed!") ... print(result.report()) >>> >>> # Quick validation >>> issues = checker.quick_check() >>> print(f"Found {len(issues)} issues")
Source code in src/pyngb/validation.py
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 |
|
Functions
__init__(data, metadata=None)
Initialize quality checker.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data
|
Union[Table, DataFrame]
|
STA data table or dataframe |
required |
metadata
|
FileMetadata | None
|
Optional metadata dictionary |
None
|
Source code in src/pyngb/validation.py
quick_check()
Perform quick validation and return list of issues.
Returns:
Type | Description |
---|---|
list[str]
|
List of issue descriptions |
Source code in src/pyngb/validation.py
full_validation()
Perform comprehensive validation of STA data.
Returns:
Type | Description |
---|---|
ValidationResult
|
ValidationResult with detailed findings |
Source code in src/pyngb/validation.py
ValidationResult Class
pyngb.ValidationResult
Container for validation results.
Stores validation issues, warnings, and overall status.
Source code in src/pyngb/validation.py
Attributes
is_valid
property
Return True if no errors were found.
has_warnings
property
Return True if warnings were found.
Functions
summary()
Get validation summary.
Source code in src/pyngb/validation.py
report()
Generate a formatted validation report.
Source code in src/pyngb/validation.py
Validation Examples
from pyngb.validation import QualityChecker, validate_sta_data
import polars as pl
# Load data
table = read_ngb("sample.ngb-ss3")
df = pl.from_arrow(table)
# Method 1: Quick validation
issues = validate_sta_data(df)
print(f"Found {len(issues)} issues")
# Method 2: Comprehensive validation
checker = QualityChecker(df)
result = checker.full_validation()
print(f"Valid: {result.is_valid}")
print(f"Errors: {result.summary()['error_count']}")
print(f"Warnings: {result.summary()['warning_count']}")
# Get detailed report
print(result.report())
Core Parser Classes
NGBParser
pyngb.NGBParser
Main parser for NETZSCH STA NGB files with enhanced error handling.
This is the primary interface for parsing NETZSCH NGB files. It orchestrates the parsing of metadata and measurement data from the various streams within an NGB file.
The parser handles the complete workflow: 1. Opens and validates the NGB ZIP archive 2. Extracts metadata from stream_1.table 3. Processes measurement data from stream_2.table and stream_3.table 4. Returns structured data with embedded metadata
Example
parser = NGBParser() metadata, data_table = parser.parse("sample.ngb-ss3") print(f"Sample: {metadata.get('sample_name', 'Unknown')}") print(f"Data shape: {data_table.num_rows} x {data_table.num_columns}") Sample: Test Sample 1 Data shape: 2500 x 8
Advanced Configuration
config = PatternConfig() config.column_map["custom_id"] = "custom_column" parser = NGBParser(config)
Attributes:
Name | Type | Description |
---|---|---|
config |
Pattern configuration for parsing |
|
markers |
Binary markers for data identification |
|
binary_parser |
Low-level binary parsing engine |
|
metadata_extractor |
Metadata extraction engine |
|
data_processor |
Data stream processing engine |
Thread Safety
This parser is not thread-safe. Create separate instances for concurrent parsing operations.
Source code in src/pyngb/core/parser.py
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 |
|
Functions
__init__(config=None)
Source code in src/pyngb/core/parser.py
parse(path)
Parse NGB file and return metadata and Arrow table.
Opens an NGB file, extracts all metadata and measurement data, and returns them as separate objects for flexible use.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path
|
str
|
Path to the .ngb-ss3 file to parse |
required |
Returns:
Type | Description |
---|---|
FileMetadata
|
Tuple of (metadata_dict, pyarrow_table) where: |
Table
|
|
tuple[FileMetadata, Table]
|
|
Raises:
Type | Description |
---|---|
FileNotFoundError
|
If the specified file doesn't exist |
NGBStreamNotFoundError
|
If required streams are missing |
NGBCorruptedFileError
|
If file structure is invalid |
BadZipFile
|
If file is not a valid ZIP archive |
Example
metadata, data = parser.parse("experiment.ngb-ss3") print(f"Instrument: {metadata.get('instrument', 'Unknown')}") print(f"Columns: {data.column_names}") print(f"Temperature range: {data['sample_temperature'].min()} to {data['sample_temperature'].max()}") Instrument: NETZSCH STA 449 F3 Jupiter Columns: ['time', 'sample_temperature', 'mass', 'dsc_signal', 'purge_flow'] Temperature range: 25.0 to 800.0
Source code in src/pyngb/core/parser.py
Advanced Parser Usage
from pyngb import NGBParser, PatternConfig
# Custom configuration
config = PatternConfig()
config.column_map["custom_id"] = "custom_column"
config.metadata_patterns["custom_field"] = (b"\x99\x99", b"\x88\x88")
# Create parser with custom config
parser = NGBParser(config)
metadata, data = parser.parse("sample.ngb-ss3")
Configuration Classes
PatternConfig
pyngb.PatternConfig
dataclass
Configuration for metadata and column patterns.
This class defines the binary patterns used to locate and extract specific metadata fields, temperature program data, calibration constants, and data columns from NGB files.
The patterns are defined as tuples of (category_bytes, field_bytes) that are used to construct regex patterns for finding specific data fields in the binary stream.
Attributes:
Name | Type | Description |
---|---|---|
metadata_patterns |
dict[str, tuple[bytes, bytes]]
|
Maps field names to (category, field) byte patterns |
temp_prog_patterns |
dict[str, bytes]
|
Patterns for temperature program extraction |
cal_constants_patterns |
dict[str, bytes]
|
Patterns for calibration constant extraction |
column_map |
dict[str, str]
|
Maps hex column IDs to human-readable column names |
Example
config = PatternConfig() config.column_map["8d"] = "time" config.metadata_patterns["sample_id"] = (b"\x30\x75", b"\x98\x08")
Note
Modifying these patterns may break compatibility with certain NGB file versions. Use caution when customizing.
Source code in src/pyngb/constants.py
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 |
|
BinaryMarkers
pyngb.BinaryMarkers
dataclass
Binary markers for parsing NGB files.
These byte sequences mark important boundaries and structures within the binary NGB file format. They are used to locate data sections, separate tables, and identify data types.
Attributes:
Name | Type | Description |
---|---|---|
END_FIELD |
bytes
|
Marks the end of a data field |
TYPE_PREFIX |
bytes
|
Precedes data type identifier |
TYPE_SEPARATOR |
bytes
|
Separates type from value data |
END_TABLE |
bytes
|
Marks the end of a table |
TABLE_SEPARATOR |
bytes
|
Separates individual tables in a stream |
START_DATA |
bytes
|
Marks the beginning of data payload |
END_DATA |
bytes
|
Marks the end of data payload |
Source code in src/pyngb/constants.py
Configuration Examples
from pyngb.constants import PatternConfig, BinaryMarkers
# Examine default configuration
config = PatternConfig()
print("Column mappings:", config.column_map)
print("Metadata patterns:", list(config.metadata_patterns.keys()))
# Binary markers for advanced use
markers = BinaryMarkers()
print("Start data marker:", markers.START_DATA)
print("End data marker:", markers.END_DATA)
Data Types and Enums
DataType Enum
pyngb.DataType
Bases: Enum
Binary data type identifiers used in NGB files.
These constants map to the binary identifiers used in NETZSCH NGB files to specify the data type of values stored in the binary format.
Examples:
Source code in src/pyngb/constants.py
FileMetadata Type
pyngb.FileMetadata
Bases: TypedDict
Type definition for file metadata dictionary.
Mass-related fields grouped together after core identifying fields. Reference masses are structurally derived; crucible_mass pattern also matches reference_crucible_mass and is disambiguated using signature fragments (see SAMPLE_CRUCIBLE_SIG_FRAGMENT / REF_CRUCIBLE_SIG_FRAGMENT).
Source code in src/pyngb/constants.py
Data Type Examples
from pyngb.constants import DataType, FileMetadata
# Data type identifiers
print("Float64 identifier:", DataType.FLOAT64.value)
print("String identifier:", DataType.STRING.value)
# Metadata structure (TypedDict)
metadata_example: FileMetadata = {
"instrument": "NETZSCH STA 449 F3",
"sample_name": "Test Sample",
"sample_mass": 15.5,
"operator": "Lab Technician"
}
Exception Hierarchy
Base Exception
pyngb.NGBParseError
Specific Exceptions
pyngb.NGBCorruptedFileError
Bases: NGBParseError
Raised when NGB file is corrupted or has invalid structure.
pyngb.NGBUnsupportedVersionError
Bases: NGBParseError
Raised when NGB file version is not supported.
pyngb.NGBDataTypeError
Bases: NGBParseError
Raised when encountering unknown or invalid data type.
pyngb.NGBStreamNotFoundError
Bases: NGBParseError
Raised when expected stream is not found in NGB file.
Exception Handling Examples
from pyngb import read_ngb, NGBParseError, NGBCorruptedFileError
try:
table = read_ngb("sample.ngb-ss3")
except NGBCorruptedFileError:
print("File appears to be corrupted")
except NGBParseError as e:
print(f"Parsing error: {e}")
except FileNotFoundError:
print("File not found")
Internal Modules
Binary Parser Module
pyngb.binary.parser.BinaryParser
Handles binary data parsing operations with memory optimization.
This class provides low-level binary parsing functionality for NGB files, including table splitting, data extraction, and value parsing. It uses memory-efficient techniques like memoryview to minimize copying.
The parser maintains compiled regex patterns for performance and includes a pluggable data type registry for extensibility.
Example
parser = BinaryParser() tables = parser.split_tables(binary_stream_data) data = parser.extract_data_array(tables[0], DataType.FLOAT64.value) [1.0, 2.0, 3.0, ...]
Attributes:
Name | Type | Description |
---|---|---|
markers |
Binary markers used for parsing |
|
_compiled_patterns |
dict[str, Pattern[bytes]]
|
Cache of compiled regex patterns |
_data_type_registry |
Registry of data type handlers |
Performance Notes
- Uses memoryview to avoid unnecessary memory copies
- Caches compiled regex patterns for repeated use
- Leverages NumPy frombuffer for fast array parsing
Functions
parse_value(data_type, value)
staticmethod
Parse binary value based on data type.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data_type
|
bytes
|
Data type identifier from DataType enum |
required |
value
|
bytes
|
Binary data to parse |
required |
Returns:
Type | Description |
---|---|
Any
|
Parsed value or None if parsing fails |
Raises:
Type | Description |
---|---|
ValueError
|
If data length doesn't match expected type size |
split_tables(data)
Split binary data into tables using the known separator.
NGB streams contain multiple tables separated by a specific byte sequence. This method efficiently splits the stream into individual tables for further processing.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data
|
bytes
|
Binary data from an NGB stream |
required |
Returns:
Type | Description |
---|---|
list[bytes]
|
List of binary table data chunks |
Example
stream_data = load_stream_from_ngb() tables = parser.split_tables(stream_data) print(f"Found {len(tables)} tables") Found 15 tables
Note
If no separator is found, returns the entire data as a single table.
handle_corrupted_data(data, context='')
Handle corrupted or malformed data gracefully.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data
|
bytes
|
Potentially corrupted binary data |
required |
context
|
str
|
Context information for logging |
''
|
Returns:
Type | Description |
---|---|
list[float]
|
Empty list for corrupted data |
validate_data_integrity(table)
Validate that a table has proper START_DATA and END_DATA markers.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
table
|
bytes
|
Binary table data to validate |
required |
Returns:
Type | Description |
---|---|
bool
|
True if table has valid structure, False otherwise |
extract_data_array(table, data_type)
Extract array of numerical data with memory optimization.
Extracts arrays of floating-point data from binary tables using efficient memory operations and NumPy for fast conversion.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
table
|
bytes
|
Binary table data containing the array |
required |
data_type
|
bytes
|
Data type identifier (from DataType enum) |
required |
Returns:
Type | Description |
---|---|
list[float]
|
List of floating-point values, empty list if no data found |
Raises:
Type | Description |
---|---|
NGBDataTypeError
|
If data type is not supported |
Example
table_data = get_table_from_stream() values = parser.extract_data_array(table_data, DataType.FLOAT64.value) print(f"Extracted {len(values)} data points") Extracted 1500 data points
Performance
Uses NumPy frombuffer which is 10-50x faster than struct.iter_unpack for large arrays.
Binary Handlers Module
pyngb.binary.handlers.DataTypeRegistry
Registry for data type handlers with pluggable architecture.
This registry manages a collection of data type handlers that can process different binary data formats found in NGB files. New handlers can be registered to extend support for additional data types.
The registry uses a chain-of-responsibility pattern to find the appropriate handler for each data type.
Example
registry = DataTypeRegistry() registry.parse_data(b'\x05', binary_data) # Uses Float64Handler [1.0, 2.0, 3.0]
Add custom handler
class CustomHandler: ... def can_handle(self, data_type): return data_type == b'\x06' ... def parse_data(self, data): return [42.0] registry.register(CustomHandler())
Attributes:
Name | Type | Description |
---|---|---|
_handlers |
list[DataTypeHandler]
|
List of registered data type handlers |
Note
Handlers are checked in registration order. Register more specific handlers before more general ones.
Functions
register(handler)
Register a new data type handler.
parse_data(data_type, data)
Parse data using appropriate handler.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data_type
|
bytes
|
Binary data type identifier |
required |
data
|
bytes | memoryview
|
Binary data to parse |
required |
Returns:
Type | Description |
---|---|
list[float]
|
List of parsed float values |
Raises:
Type | Description |
---|---|
NGBDataTypeError
|
If no handler is found for the data type |
pyngb.binary.handlers.Float64Handler
Handler for 64-bit IEEE 754 double precision floating point data.
This handler processes binary data containing arrays of 64-bit doubles stored in little-endian format. Uses NumPy's frombuffer for optimal performance.
Example
handler = Float64Handler() handler.can_handle(b'\x05') # DataType.FLOAT64.value True data = b'\x00\x00\x00\x00\x00\x00\xf0\x3f' # 1.0 as double handler.parse_data(data) [1.0]
pyngb.binary.handlers.Float32Handler
Handler for 32-bit IEEE 754 single precision floating point data.
This handler processes binary data containing arrays of 32-bit floats stored in little-endian format. Uses NumPy's frombuffer for optimal performance.
Example
handler = Float32Handler() handler.can_handle(b'\x04') # DataType.FLOAT32.value True data = b'\x00\x00\x80\x3f' # 1.0 as float handler.parse_data(data) [1.0]
pyngb.binary.handlers.Int32Handler
Handler for 32-bit signed integer data.
This handler processes binary data containing arrays of 32-bit integers stored in little-endian format. Uses NumPy's frombuffer for optimal performance.
Example
handler = Int32Handler() handler.can_handle(b'\x03') # DataType.INT32.value True data = b'\x2a\x00\x00\x00' # 42 as little-endian int32 handler.parse_data(data) [42.0]
Metadata Extraction Module
pyngb.extractors.metadata.MetadataExtractor
Extracts metadata from NGB tables with improved type safety.
Functions
extract_field(table, field_name)
Extract a single metadata field (value only).
extract_metadata(tables)
Extract all metadata from tables with type safety.
Stream Processing Module
pyngb.extractors.streams.DataStreamProcessor
Processes data streams from NGB files with optimized parsing.
Functions
process_stream_2(stream_data)
Process primary data stream (stream_2).
process_stream_3(stream_data, existing_df)
Process secondary data stream (stream_3).
Utility Functions
File Utilities
pyngb.util.get_hash(path, max_size_mb=1000)
Generate file hash for metadata.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path
|
str
|
Path to the file to hash |
required |
max_size_mb
|
int
|
Maximum file size in MB to hash (default: 1000MB) |
1000
|
Returns:
Type | Description |
---|---|
Optional[str]
|
BLAKE2b hash as hex string, or None if hashing fails |
Raises:
Type | Description |
---|---|
OSError
|
If there are file system related errors |
PermissionError
|
If file access is denied |
Source code in src/pyngb/util.py
pyngb.util.set_metadata(tbl, col_meta={}, tbl_meta={})
Store table- and column-level metadata as json-encoded byte strings.
Provided by: https://stackoverflow.com/a/69553667/25195764
Table-level metadata is stored in the table's schema. Column-level metadata is stored in the table columns' fields.
To update the metadata, first new fields are created for all columns. Next a schema is created using the new fields and updated table metadata. Finally a new table is created by replacing the old one's schema, but without copying any data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
tbl
|
Table
|
The table to store metadata in |
required |
col_meta
|
dict[str, Any]
|
A json-serializable dictionary with column metadata in the form { 'column_1': {'some': 'data', 'value': 1}, 'column_2': {'more': 'stuff', 'values': [1,2,3]} } |
{}
|
tbl_meta
|
dict[str, Any]
|
A json-serializable dictionary with table-level metadata. |
{}
|
Returns:
Type | Description |
---|---|
Table
|
pyarrow.Table: The table with updated metadata |
Source code in src/pyngb/util.py
Utility Examples
from pyngb.util import get_hash, set_metadata
import pyarrow as pa
# Generate file hash
file_hash = get_hash("sample.ngb-ss3")
print(f"File hash: {file_hash}")
# Add metadata to PyArrow table
table = pa.table({"data": [1, 2, 3]})
table_with_meta = set_metadata(
table,
tbl_meta={"source": "experiment_1", "version": "1.0"}
)
Advanced Usage Patterns
Custom Data Type Handlers
from pyngb.binary.handlers import DataTypeHandler, DataTypeRegistry
import struct
class CustomFloatHandler(DataTypeHandler):
def can_handle(self, data_type: bytes) -> bool:
return data_type == b'\x99' # Custom type identifier
def parse(self, data: bytes) -> list[float]:
# Parse as 32-bit floats
return [struct.unpack('<f', data[i:i+4])[0]
for i in range(0, len(data), 4)]
# Register custom handler
registry = DataTypeRegistry()
registry.register(CustomFloatHandler())
Custom Validation Rules
from pyngb.validation import QualityChecker, ValidationResult
class CustomQualityChecker(QualityChecker):
def domain_specific_validation(self):
"""Add domain-specific validation rules."""
result = ValidationResult()
# Custom rule: Check for reasonable mass loss
if "mass" in self.data.columns:
mass_col = self.data["mass"]
initial_mass = mass_col.max()
final_mass = mass_col.min()
mass_loss_percent = (initial_mass - final_mass) / initial_mass * 100
if mass_loss_percent > 50:
result.add_warning(f"High mass loss: {mass_loss_percent:.1f}%")
elif mass_loss_percent < 0:
result.add_error("Negative mass loss detected")
else:
result.add_pass(f"Normal mass loss: {mass_loss_percent:.1f}%")
return result
Memory-Efficient Processing
from pyngb import read_ngb
import polars as pl
def process_large_file_efficiently(file_path: str, chunk_size: int = 10000):
"""Process large files in chunks to manage memory."""
table = read_ngb(file_path)
results = []
for i in range(0, table.num_rows, chunk_size):
# Process chunk
chunk = table.slice(i, min(chunk_size, table.num_rows - i))
df_chunk = pl.from_arrow(chunk)
# Perform analysis on chunk
chunk_result = df_chunk.select([
pl.col("time").mean().alias("avg_time"),
pl.col("sample_temperature").mean().alias("avg_temp")
])
results.append(chunk_result)
# Combine results
final_result = pl.concat(results)
return final_result
Performance Considerations
Best Practices
- Use PyArrow Tables: More memory-efficient than Pandas DataFrames
- Batch Processing: Process multiple files in parallel when possible
- Chunk Large Files: Use slicing for very large datasets
- Cache Metadata: Extract metadata once and reuse
- Choose Appropriate Formats: Parquet for storage, CSV for sharing
- Optimize Conversions (v0.0.2+): Pass Polars DataFrames directly to validation functions
Optimized Data Processing (v0.0.2+)
import polars as pl
from pyngb import read_ngb
from pyngb.validation import validate_sta_data, check_temperature_profile
# Efficient workflow with minimal conversions
table = read_ngb("sample.ngb-ss3")
df = pl.from_arrow(table) # Single conversion
# All operations use the DataFrame directly (no additional conversions)
issues = validate_sta_data(df) # Zero conversion overhead
temp_analysis = check_temperature_profile(df) # Zero conversion overhead
# Previous approach (pre-v0.0.2) required multiple conversions:
# validate_sta_data(table) # Internal PyArrow → Polars conversion
# check_temperature_profile(table) # Another PyArrow → Polars conversion
Memory Management
import gc
from pyngb import read_ngb
def memory_conscious_processing(files: list[str]):
"""Process files with explicit memory management."""
for file_path in files:
# Load and process
table = read_ngb(file_path)
# Process immediately
process_table(table)
# Explicitly delete reference
del table
# Force garbage collection periodically
gc.collect()
Parallel Processing
from concurrent.futures import ProcessPoolExecutor
from pyngb import read_ngb
def parallel_file_processing(files: list[str], max_workers: int = 4):
"""Process files in parallel across multiple processes."""
def process_single_file(file_path: str):
table = read_ngb(file_path)
# Perform processing
return {"file": file_path, "rows": table.num_rows}
with ProcessPoolExecutor(max_workers=max_workers) as executor:
results = list(executor.map(process_single_file, files))
return results
Error Handling Patterns
Robust File Processing
from pyngb import read_ngb, NGBParseError
import logging
def robust_file_processing(files: list[str]):
"""Process files with comprehensive error handling."""
results = []
for file_path in files:
try:
table = read_ngb(file_path)
results.append({
"file": file_path,
"status": "success",
"rows": table.num_rows,
"columns": table.num_columns
})
except NGBParseError as e:
logging.error(f"Parse error in {file_path}: {e}")
results.append({
"file": file_path,
"status": "parse_error",
"error": str(e)
})
except FileNotFoundError:
logging.error(f"File not found: {file_path}")
results.append({
"file": file_path,
"status": "not_found"
})
except Exception as e:
logging.error(f"Unexpected error in {file_path}: {e}")
results.append({
"file": file_path,
"status": "error",
"error": str(e)
})
return results
Command Line Interface
pyngb provides a comprehensive CLI for data processing and baseline subtraction:
Basic Usage
Arguments
input
: Path to the input NGB file (required)-o, --output
: Output directory (default: current directory)-f, --format
: Output format:parquet
,csv
, orall
(default:parquet
)-v, --verbose
: Enable verbose logging-b, --baseline
: Path to baseline file for baseline subtraction--dynamic-axis
: Axis for dynamic segment alignment:time
,sample_temperature
, orfurnace_temperature
(default:sample_temperature
)
Examples
# Basic conversion
python -m pyngb sample.ngb-ss3
# CSV output with verbose logging
python -m pyngb sample.ngb-ss3 -f csv -v
# Baseline subtraction with default settings
python -m pyngb sample.ngb-ss3 -b baseline.ngb-bs3
# Baseline subtraction with time axis alignment
python -m pyngb sample.ngb-ss3 -b baseline.ngb-bs3 --dynamic-axis time
# All formats with custom output directory
python -m pyngb sample.ngb-ss3 -b baseline.ngb-bs3 -f all -o ./results/
Output Files
- Without baseline:
{input_name}.{format}
- With baseline:
{input_name}_baseline_subtracted.{format}
For more examples and detailed usage patterns, see the Quick Start Guide and Development Guide.