Closed prjemian closed 2 years ago
Consider compression.
Note: $(P):cam1:AcquirePeriod
becomes important now.
0 < AcquireTime<= AcquirePeriod
PV | setting |
---|---|
$(P)cam1:AcquireTime |
acquisition time per frame |
$(P)cam1:AcquirePeriod |
time between frame starts |
$(P)cam1:NumImages |
number of frames per acquisition |
$(P)cam1:NumExposures |
(? leave at 1 ?) -- probably unused in ADSimDetector |
$(P)cam1:ImageMode |
Multiple |
$(P)cam1:WaitForPlugins |
Yes |
$(P)HDF1:NumCapture |
same as $(P)cam1:NumImages (or less if images are dropped) |
$(P)HDF1:Compression |
Blosc |
$(P)HDF1:FileWriteMode |
Capture |
Should add compression
as an optional parameter. Default=None
Why is it that when HDF Capture
is moved to the end of the stage_sigs
as:
adsimdet.hdf1.stage_sigs.pop("capture")
adsimdet.hdf1.stage_sigs["lazy_open"] = 1
adsimdet.hdf1.stage_sigs["compression"] = "Blosc"
adsimdet.hdf1.stage_sigs["file_template"] = "%s%s_%3.3d.h5"
adsimdet.hdf1.stage_sigs["capture"] = 1
that the resource_path
is set with {write_path}/{short_uid}_-001.h5
, as in:
DIAGNOSTIC: r = {'spec': 'AD_HDF5', 'root': '/', 'resource_path': 'tmp/docker_ioc/iocbdpad/tmp/adsimdet/2022/04/07/23ef3149-d0a6-4b32-b162_-001.h5', 'resource_kwargs': {'frame_per_point': 1}, 'path_semantics': 'posix', 'uid': '9abf6561-8b80-45b8-976a-6cb8f52ccc19', 'run_start': '71d0360d-ca64-487d-9f79-b1c567be0bf2'}
When the capture
stage_sig is not moved, then is resource_path = {write_path}/{short_uid}_000.h5
The HDF file that is written is {write_path}/{short_uid}_000.h
:
In [1]: !ls /tmp/docker_ioc/iocbdpad/tmp/adsimdet/2022/04/07/23ef3149-d0a6-4b32-b162_-001.h5
ls: cannot access /tmp/docker_ioc/iocbdpad/tmp/adsimdet/2022/04/07/23ef3149-d0a6-4b32-b162_-001.h5: No such file or directory
In [2]: !ls /tmp/docker_ioc/iocbdpad/tmp/adsimdet/2022/04/07/23ef3149-d0a6-4b32-b162_000.h5
/tmp/docker_ioc/iocbdpad/tmp/adsimdet/2022/04/07/23ef3149-d0a6-4b32-b162_000.h5
Perhaps the assumption about the resource_path
(from the resource
document) is not correct. The problem is that the -001
might actually be -1
when the file_template = "%s%s_%3.3d.h5"
is applied:
In [9]: "_%3.3d" % -1
Out[9]: '_-001'
Rather, the resource_path
is from a template and the actual file name must consider content from the datum
document for the image event. See this example:
[('resource',
{'spec': 'AD_HDF5',
'root': '/',
'resource_path': 'tmp/docker_ioc/iocbdpad/tmp/adsimdet/2022/04/07/de0c26a1-d3f1-42a5-a77d_-001.h5',
'resource_kwargs': {'frame_per_point': 1},
'path_semantics': 'posix',
'uid': 'd1b8a908-2a97-49d2-b2b7-2a0ef5acc159',
'run_start': 'fcab67c5-0e7f-4720-a670-c585d2dc0ba0'}),
('datum',
{'datum_id': 'd1b8a908-2a97-49d2-b2b7-2a0ef5acc159/0',
'datum_kwargs': {'point_number': 0},
'resource': 'd1b8a908-2a97-49d2-b2b7-2a0ef5acc159'})]
Get the file name from the area detector HDF5 plugin:
In [10]: adsimdet.hdf1.full_file_name.get()
Out[10]: '/tmp/adsimdet/2022/04/07/de0c26a1-d3f1-42a5-a77d_000.h5'
and then substitute between the AD IOC and Bluesky mount points.
This code produces the correct HDF5 file as seen from the bluesky computer:
path = pathlib.Path(r["root"]) / r["resource_path"]
fname = pathlib.Path(adsimdet.hdf1.full_file_name.get())
hdffile = path.parent / fname.name
Processing of the
take_image()
plan might be too slow to push the limits of the pipeline. Add an n frames per acquisition feature.