Data I/O Guide

Learning Objectives

After completing this section, you will be able to:

  1. Load data from multiple instrument formats (TRIOS, Anton Paar, CSV, Excel)

  2. Use auto-detection for unknown file formats

  3. Save results in HDF5 and Excel formats

  4. Handle chunked reading for large files (>1GB)

Prerequisites

Quick Reference

Auto-detection (recommended):

from rheojax.io.readers import auto_read

data = auto_read('experiment.txt')  # Detects format automatically

Specific readers:

from rheojax.io.readers import read_trios, read_csv, read_excel, read_anton_paar

data = read_trios('stress_relaxation.txt')
data = read_csv('data.csv', x_column='Time', y_column='Stress')
data = read_excel('results.xlsx', sheet_name='SAOS')

Writers:

from rheojax.io.writers import write_hdf5, write_excel

write_hdf5(data, 'results.h5')  # Full fidelity
write_excel(data, 'results.xlsx', sheet_name='Analysis')

Supported Formats

Format

Reader Function

Notes

TA Instruments TRIOS

load_trios()

Auto-detects test mode, auto-chunks large files. See TA Instruments TRIOS Format

Anton Paar

read_anton_paar()

RheoCompass export

CSV

read_csv()

Specify column names

Excel

read_excel()

.xlsx, .xls supported

HDF5

read_hdf5()

RheoJAX native format

Chunked Reading (Large Files)

For TRIOS files > 5 MB, auto-chunking is enabled by default (v0.4.0+):

from rheojax.io.readers import load_trios
from rheojax.io.readers.trios import load_trios_chunked

# Auto-chunking for files > 5 MB (default behavior)
data = load_trios('large_file.txt')

# Explicit chunked generator for memory-constrained processing
for chunk in load_trios_chunked('large_file.txt', chunk_size=10000):
    process(chunk)

See TA Instruments TRIOS Format for detailed chunked reading documentation.

Summary

RheoJAX supports multiple instrument formats with auto-detection. Use auto_read() for convenience, or specific readers for fine control. Save in HDF5 for full fidelity or Excel for sharing.

Further Reading