quantax.utils.DataTracer#
- class quantax.utils.DataTracer#
Keeps track of a scalar time series, typically an observable (e.g. energy) recorded once per optimization or time-evolution step.
The data points are stored in a growing list and exposed as numpy arrays through
dataandtime.- append(data: ArrayLike | None, time: ArrayLike | None = None) None#
Append a new data point.
- Parameters:
data – The data to be appended, expected to be a scalar.
Noneis ignored, so optional quantities can be appended unconditionally.time – The time of the data point, default to be incremental by 1 in each append.
- uncertainty() floating | None#
Standard error of the mean,
Noneif fewer than 2 data points are stored.
- save(file: str | PathLike[str] | BinaryIO) None#
Save data to file
- save_time(file: str | PathLike[str] | BinaryIO) None#
Save time to file
- plot(start: int | None = None, end: int | None = None, batch: int = 1, logx: bool = False, logy: bool = False, baseline: ArrayLike | None = None) None#
Plot the data
- Parameters:
start – Starting index
end – Ending index
batch – Batch size. The mean value in a whole batch is one data point in the plot
logx – Whether to use log scale in x-axis
logy – Whether to use log scale in y-axis
baseline – Show a dashed line y=baseline