-
Notifications
You must be signed in to change notification settings - Fork 9
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
DOC: need HOW to use NXWriter documentation #983
Labels
Milestone
Comments
From a recent conversation (involving master & ExternalLink file sets):
The NXWriter has a newer templates feature. Here's a quick demo in a bluesky plan: templates = [
["/entry/full_file_name=", adsimdet.hdf1.full_file_name.get()],
]
md = {"title": "APS POLAR", nxwriter.template_key: json.dumps(templates)}
def outer(detectors, motors, **md):
_md = {}
_md.update(md)
nxwriter.file_name = "polar_templates.hdf5"
print(f"{md=!r}")
print(f"{_md=!r}")
@bpp.subs_decorator(nxwriter.receiver) # collect the data
@bpp.stage_decorator(list(detectors) + motors)
@bpp.run_decorator(md=_md)
def inner():
# assume adsimdet has already collected its image file
yield from bps.null()
yield from inner()
print(f"{nxwriter.file_path=!r}")
print(f"{nxwriter.file_name=!r}")
RE(outer([adsimdet], [m1, m2], **md)) Here's what the first part of the HDF5 file looks like:
|
Update to the NXwriter local modifications. This update repositions the external links to image and fast positioners data, according to the NeXus schema def write_entry(self):
"""Called after stop document has been received."""
nxentry = super().write_entry()
print(f"{nxentry=!r}")
nxinstrument = nxentry["instrument"]
if self.ad_file_name is not None:
# https://manual.nexusformat.org/classes/base_classes/NXdetector.html
nxdetector = nxinstrument.create_group("detector")
nxdetector.attrs["NX_class"] = "NXdetector"
nxdetector["data"] = h5py.ExternalLink(
str(self.ad_file_name),
"/entry/data", # link to the data group with the image dataset
)
nxdetector["data_file"] = adsimdet.hdf1.full_file_name.get()
if self.position_file_name is not None:
# https://manual.nexusformat.org/classes/base_classes/NXcollection.html
group = nxinstrument.create_group("fast_positions")
group.attrs["NX_class"] = "NXcollection"
group["root"] = h5py.ExternalLink(
str(self.position_file_name),
"/", # link to the root of the file
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Existing documentation is very limited, it seems. Need some concrete advice for beam line staff how to use and customize the NXWriter.
The text was updated successfully, but these errors were encountered: