feat: added context manager for scan export
Description
Add decorator to be able to export multiple scans into single csv file.
Example usage:
- direct usages
from bec_lib.utils import scan_to_csv
s = scans.line_scan(...)
scan_to_csv(s, "export.csv")
or for multiple scans
s = scans.line_scan(...)
s2 = scans.grid_scan(...)
scan_to_csv([s,s2], export.csv)
- context manager
with scans.scan_export("export.csv"):
scans.line_scan(...)
scans.grid_scan(...)
Note, using the context manager will only create one output for all executed scans
Related Issues
- closes #81 (closed) and #161 (closed)
Type of Change
- introduces decorator for scan definition
- bugfix for
bec_lib.utils.scan_to_dict
due to new data structure ( see #161 (closed))
Potential side effects
...
Screenshots / GIFs (if applicable)
Additional Comments
merge blocked by #161 (closed)
Definition of Done
-
fix scan_to_dict function -
add tests for scan_report structure -
Test context manager usage for multiple scans -
Add screenshot of example usage -
Documentation is up-to-date.
Edited by appel_c