File related functions¶
The pninexus.nexus
package adds some useful wrapper functions
around the native HDF5 functions.
- pninexus.nexus.create_file(path, flags=AccessFlags.EXCLUSIVE, fcpl=FileCreationList(), fapl=FileAccessList())¶
A thin wrapper function around
pninexus.h5cpp.file.create()
HDF5 function. It not only creates the file but also creates the required attributes no the root group of the file. Using this function ensures that a file created with it will pass a test withis_nexus_file()
.- Parameters:
path (str) – path to the file
flags (pninexus.h5cpp.file.AccessFlags) – HDF5 flags used to open the file
lcpl (pninexus.h5cpp.property.FileCreationList) – optional file creation list
lapl (pninexus.h5cpp.property.FileAccessList) – optional file access list
- pninexus.nexus.open_file(path, flags=AccessFlags.READONLY, fapl=FileAccessList())¶
A thin wrapper function around
pninexus.h5cpp.file.open()
.- Parameters:
path (str) – path to the file
flags (pninexus.h5cpp.file.AccessFlags) – access flags used to open the file
lapl (pninexus.h5cpp.property.FileAccessList) – optional file access property list
- pninexus.nexus.is_nexus_file(path)¶
Checks if the file referenced by path is a NeXus file. This function is more restrictive than
pninexus.h5cpp.file.is_hdf5_file()
. It not only checks whether or not the file is an HDF5 file but also whether all required attributes are set at the root group of the HDF5 file.- Parameters:
path (str) – path to the file on the file system