lyse.open_file

lyse.open_file(mode)[source]

Decorator for lyse functions to allow using previously opened file with context manager.

If multiple read/write operations happen on a Run in a single shot, opening the h5file once via the context manager open can speed up the analysis execution time by limiting the number of times the file must be opened/closed.

Note that an opened h5py.File can only be in modes 'r' or 'r+'. All other mode opening options differ in file creation logic only. In particular, all mode opening options except 'r' are considered 'r+' once the file is open.

Parameters

mode (str) – which h5py.File mode to open the h5 file with. Must be ‘r’, ‘a’, ‘r+’, ‘w’, ‘w-‘, or ‘x’. Lyse typically only uses ‘r’ and ‘r+’.

Returns

Decorator for Run methods that need to read/write the shot file

Raises

PermissionError – If the Run is set as read-only but a write mode is requested