Hi Michael,
What you would like to do with flat and data images is exactly what we are currently doing at the tomography beamlines at the APS. We are using the Python package called tomoscan:
################################
# Location for data in HDF5 file
################################
record(stringout, "$(P)$(R)HDF5ProjectionLocation")
{
field(VAL, "/exchange/data")
}
record(stringout, "$(P)$(R)HDF5DarkLocation")
{
field(VAL, "/exchange/data_dark")
}
record(stringout, "$(P)$(R)HDF5FlatLocation")
{
field(VAL, "/exchange/data_white")
}
record(stringout, "$(P)$(R)HDF5Location")
{
}
It contains the following. The first line means that the NDArray attribute HDF5FrameLocation defines the location of the data in the
HDF5 via the global detector_data_destination which is understood by NDFileHDF5.
<global name="detector_data_destination" ndattribute="HDF5FrameLocation" />
<group name="exchange">
<dataset name="frame_type" source="ndattribute" ndattribute="FrameType" when="OnFileClose" />
<dataset name="data" source="detector">
<!-- SaveDest = 0 : /exchange/data -->
<attribute name="description" source="constant" value="ImageData" type="string" />
<attribute name="axes" source="constant" value="theta:y:x" type="string" />
<attribute name="units" source="constant" value="counts" type="string" />
</dataset>
<dataset name="data_dark" source="detector">
<!-- SaveDest = 1 : /exchange/data_dark -->
<attribute name="description" source="constant" value="DarkData" type="string" />
<attribute name="axes" source="constant" value="theta:y:x" type="string" />
<attribute name="units" source="constant" value="counts" type="string" />
</dataset>
<dataset name="data_white" source="detector">
<!-- SaveDest = 2 : /exchange/data_white -->
<attribute name="description" source="constant" value="WhiteData" type="string" />
<attribute name="axes" source="constant" value="theta:y:x" type="string" />
<attribute name="units" source="constant" value="counts" type="string" />
</dataset>
tomoDetectorAttributes.xml is the detector attribute XML file for this detector.
It contains this line:
<Attribute name="HDF5FrameLocation" type="EPICS_PV" source="$(TS)HDF5Location" dbrtype="DBR_STRING"
description="Where
to store frame in HDF5 file"/>
The Python code sets the location of the data in the HDF file:
This sets the data to be stored in /exchange/data_white for the flat fields:
self.epics_pvs['HDF5Location'].put(self.epics_pvs['HDF5FlatLocation'].value)
Mark
From: Tech-talk <tech-talk-bounces at aps.anl.gov> on behalf of Sintschuk, Michael via Tech-talk <tech-talk at aps.anl.gov>
Sent: Wednesday, December 8, 2021 10:54 AM
To: tech-talk at aps.anl.gov <tech-talk at aps.anl.gov>
Subject: AreaDetector NDFileHDF5 dynamic frame-placement within an opened H5-file
Hello EPICS-community,
as the title of this thread says, I’m wondering if it is possible to dynamically select where an incoming frame is placed within the HDF5-Files structure. For example, while capturing frames in Stream-mode with the default HDF5-Files structure
layout, all incoming frames are placed to:
entry -> instrument -> detector -> data
Now I want to load an individual hdf5-layout.xml with the additional location “flat”:
entry -> instrument -> detector -> flat
Is there a way that I can switch (via an EPICS-PV) the location where the next frame is stored, either “entry -> instrument -> detector -> data” or “entry -> instrument -> detector -> flat”, while the h5-files is still opened? Example scan
with a total of 1000 frames, all should go into one h5-file:
-
h5-files is opened
-
the first 20 frames are placed to entry -> instrument -> detector -> flat
-
the next 960 frames are placed to entry -> instrument -> detector -> data
-
the last 20 frames are placed to entry -> instrument -> detector -> flat
-
h5-files is closed
In the AreaDetector user-guide there is the following section:
https://areadetector.github.io/master/ADCore/NDFileHDF5.html#selective-positional-placement-of-individual-frames
I switched on the Position mode and put Index N to 0 (or 1) and put Name N to “flat” but I get a Write error status. I think I don’t understand the handling of the dataset dimensions within the h5-file and don’t know if my frame-placement
sequence is actually realizable. Can someone help?
Thanks!
Michael
Michael Sintschuk
Bundesanstalt für Materialforschung und –prüfung (BAM)
8.5 Mikro-ZfP
Unter den Eichen 87
12205 Berlin
GERMANY
P: +49 30 8062-15063 (BESSY, Adlershof)
P: +49 30 8104-4065 (BAM, Steglitz)
michael.sintschuk at bam.de
michael.sintschuk at helmholtz-berlin.de
|