Multi-scan workbench#
The scans namespace is built for working with many scans at once — the
"compare a whole series" workflow. The scans you tick in the UI are the working
set (scans.selected); iterating scans walks them. Each scan loads its data
lazily and exposes friendly accessors (.signal, .spectrum, .peaks,
.metadata, .label, .id).
A classic task — build a value-versus-temperature series across the selected scans:
temperatures, areas = [], []
for scan in scans: # the UI-selected working set
scan.analyze() # process + detect peaks (in memory only)
tallest = max(scan.peaks, key=lambda p: p.height)
temperatures.append(scan.metadata.temperature)
areas.append(tallest.normalized_area)
print(list(zip(temperatures, areas)))
You can also enumerate and load scans directly instead of relying on the selection:
for scan in scans.find(project="MyProject"): # all scans in a project
print(scan.label or scan.id, scan.timestamp)
scan = scans.load(some_scan_id) # pull one into the working set
spec = scan.spectrum # its processed spectrum
peaks = scan.perform_analysis() # detect peaks + integrate, just on this scan
The currently-acquiring scan stays separate as scans.current and is never
disturbed by anything you do to the analysis set.
To run a saved processing graph over every scan in the set:
results = scans.apply_graph("my_processor") # name of a saved processor
for label, result in results.items():
print(label, "→", result.spectrum)
Plot the series you built with a custom figure, or feed the per-temperature rates into correlation-time analysis.