Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HOWTO: EPICS area detector and HDF5 master:external file pattern #223

Open
prjemian opened this issue Aug 7, 2023 · 4 comments
Open

HOWTO: EPICS area detector and HDF5 master:external file pattern #223

prjemian opened this issue Aug 7, 2023 · 4 comments
Labels
documentation Improvements or additions to documentation
Milestone

Comments

@prjemian
Copy link
Contributor

prjemian commented Aug 7, 2023

A thread on the Nikea Slack website started with a request how Bluesky should writefiles that comply with the NeXus NXsas application definition. Quickly, the discussion pointed towards how to write NeXus-compliant files in general, and more specifically using EPICS and area detector. (NXsas files are raw data using a 2-D detector. Other geometries are proposed but that's the way it stands now.)

One proposition was to use the apstools.callbacks.NXWriter() class to write a master NeXus/HDF5 file that makes external file links to the NeXus/HDF5 file create by the EPICS area detector IOC. This might better fit the original question since the questioner uses PyTango.

On Slack, I wrote:

image

Using the master:external style of HDF5 file writing is actually easier than waiting for the run to finish, then reading the image data and writing all to one HDF5 file. Why, you might ask? The AD HDF5 plugin is not done until it is unstaged. The bluesky run must be complete before any and all are devices are unstaged. The classic standoff of you first. To get this done, you might launch a separate thread that does this work after the run is closed. Which has some additional consequences I ran into during unit testing.

Just keep in mind that it is easiest if the master and external file are in the same directory or that you identify the external file's directory by a path that is relative to the master file rather than absolute. With an absolute directory path, the pair of files become locked to the file system, assuming that no else will have exactly the same absolute directory paths.

@prjemian prjemian added the documentation Improvements or additions to documentation label Aug 7, 2023
@prjemian
Copy link
Contributor Author

prjemian commented Aug 7, 2023

Keep in mind:

Since the original question concerned PyTango (and not EPICS), a document showing how to write a master NeXus/HDF5 file from Bluesky that makes external file links to image data in another HDF5 file will be more useful.

Where the software that writes the image data is actually irrelevant to the HowTo, other than it provides the directory, file name, and HDF5 address to the image data.

@prjemian prjemian added this to the v1.0.2 milestone Aug 21, 2023
@prjemian
Copy link
Contributor Author

Work on #240 before this one.

@prjemian
Copy link
Contributor Author

f["/entry/data"] = h5py.ExternalLink("image.hdf5", "/entry/data")

@prjemian
Copy link
Contributor Author

Consider using one extension for the master files and a different one for the external data files. It helps to keep things recognizable and understandable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

1 participant