Data Logging
Stanza automatically logs your measurement data in both HDF5 and JSON formats. You don’t need to write separate logging code for each routine - just pass a DataLogger
to RoutineRunner
and your sweep data, parameters, and analysis results are saved automatically.
Quick Start
Enable logging in three steps:
Your data is saved to ./data/characterization/<session_id>/
with both HDF5 and JSONL files.
What Gets Logged Automatically
When you use device.sweep_1d()
or device.sweep_2d()
with a session parameter, Stanza logs:
- Sweep data: Voltage arrays and measured signals
- Labels: Axis labels for plotting
- Metadata: Gate names, contact information, timestamps
- Parameters: Routine parameters from YAML or runtime
Example - this routine automatically logs everything:
When you run this:
Stanza automatically logs:
- The voltage sweep (
v_data
) - The measured currents (
i_data
) - Parameters:
gate="LEFT_BARRIER"
,v_start=-2.0
, etc. - Metadata: timestamp, gate name, contact name
File Organization
Data is organized by routine and session:
Each time you run a routine, a new session directory is created with a timestamp.
Reading Your Data Back
Reading HDF5 Files
HDF5 is great for numerical analysis:
Reading JSONL Files
JSON Lines are easier for quick inspection:
Logging Custom Data
For measurements beyond simple sweeps, log custom data manually:
The analysis results are saved alongside the sweep data.
Example: 2D Charge Stability Diagram
Here’s a complete example of measuring and logging a charge stability diagram:
Run and analyze:
Compression Options
For large datasets, enable compression:
gzip: Best compression (slower) lzf: Fast compression (larger files) None: No compression (fastest)
For a 200×200 charge diagram:
- Uncompressed: ~640 KB
- LZF: ~250 KB
- GZIP: ~180 KB
Working with Multiple Routines
Log data from multiple routines in the same session:
All three measurements are saved in the same session directory.
Batch Processing Logged Data
Process multiple sessions at once:
Tips and Best Practices
Use both HDF5 and JSONL: HDF5 for analysis scripts, JSONL for quick inspection.
Enable compression for large sweeps: A 200×200 charge diagram compresses 3-4x.
Log analysis results: Don’t just save raw data - save what you learned from it.
Use descriptive routine names: routine_name
becomes your top-level directory. Use names like "device_42_characterization"
rather than generic names like "test"
.
Add metadata to analysis: Include information that will help you interpret results later:
Flush periodically for long measurements: Force data to disk during long routines:
Check disk space: HDF5 files can get large. A full day of measurements might generate several GB.
Next Steps
- Routines - Learn how to write routines that log data automatically
- Device Configuration - Configure your device for use with logging
- Drivers - Understand how measurements are performed