Closed prjemian closed 2 weeks ago
I can reproduce this situation (when scan ID is not tied to a PV):
In [1]: RE.md["scan_id"]
Out[1]: 701
In [2]: newSpecFile("dev_spec_file.dat", scan_id=1)
I Wed-16:46:00 - SPEC file name : 02_21_dev_spec_file_dat.dat
I Wed-16:46:00 - File will be created at end of next bluesky scan.
In [3]: RE.md["scan_id"]
Out[3]: 701
In [4]: RE.md["scan_id"] = 1
In [5]: RE.md["scan_id"]
Out[5]: 1
That's a bug.
That code needs better unit testing. And for the new case when RE is tied to a PV.
Checking manually to make sure this test case is covered. The setup:
from bluesky import RunEngine
RE = RunEngine()
from instrument.callbacks.spec_data_file_writer import newSpecFile, specwriter
manual test:
In [3]: RE.md["scan_id"] = 1234
In [4]: newSpecFile('zztestbp', scan_id=1)
In [5]: RE.md["scan_id"]
Out[5]: 1234
Confirmed: :fly:
Actually: newSpecFile('zztestbp', scan_id=1, RE=RE)
works. Since this was a bug report from a user, the design should change.
As Zhan Zhang (APS) reported: