PSU Data Logger¶
Timed logging of power supply readings
Data logging for power supply measurements.
Provides CSV-based logging of PSU output measurements over time. Useful for automated testing, characterization, and monitoring.
PSUDataLogger
¶
Logs PSU output measurements to CSV file.
Records voltage, current, power, and mode for all outputs at regular intervals.
Example
psu = PowerSupply('192.168.1.200') psu.connect() logger = PSUDataLogger(psu, "psu_log.csv") logger.start()
... PSU operates ...¶
logger.log_measurement() # Manual logging logger.stop()
Initialize data logger.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
psu
|
PowerSupply
|
PowerSupply instance to log |
required |
filepath
|
str
|
Path to CSV log file |
required |
outputs
|
Optional[List[int]]
|
List of output numbers to log (None = all outputs) |
None
|
Source code in scpi_control/psu_data_logger.py
is_logging
property
¶
Check if logger is currently active.
Returns:
| Type | Description |
|---|---|
bool
|
True if logging, False otherwise |
start
¶
Start logging (open file and write header).
Creates CSV file with timestamp and measurement columns.
Source code in scpi_control/psu_data_logger.py
log_measurement
¶
Log a single measurement from all configured outputs.
Writes timestamp and current measurements to CSV.
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If logger not started |
Source code in scpi_control/psu_data_logger.py
stop
¶
Stop logging and close file.
Source code in scpi_control/psu_data_logger.py
TimedPSULogger
¶
TimedPSULogger(psu: PowerSupply, filepath: str, interval: float = 1.0, outputs: Optional[List[int]] = None)
Timed data logger with automatic periodic measurements.
Uses a background thread to log measurements at regular intervals.
Example
psu = PowerSupply('192.168.1.200') psu.connect() with TimedPSULogger(psu, "psu_log.csv", interval=1.0) as logger: ... time.sleep(10) # Log for 10 seconds
Initialize timed logger.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
psu
|
PowerSupply
|
PowerSupply instance to log |
required |
filepath
|
str
|
Path to CSV log file |
required |
interval
|
float
|
Logging interval in seconds (default: 1.0) |
1.0
|
outputs
|
Optional[List[int]]
|
List of output numbers to log (None = all outputs) |
None
|