Skip to content

Commit 77fbe0a

Browse files
committed
Make open_nexus_file public
1 parent c0fd1ef commit 77fbe0a

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

src/ess/reduce/nexus/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
load_all_components,
2121
load_component,
2222
load_data,
23+
open_nexus_file,
2324
)
2425
from .workflow import GenericNeXusWorkflow
2526

@@ -31,5 +32,6 @@
3132
'load_all_components',
3233
'load_component',
3334
'load_data',
35+
'open_nexus_file',
3436
'types',
3537
]

src/ess/reduce/nexus/_nexus_loader.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,29 @@ def open_nexus_file(
119119
*,
120120
locking: bool | str | None | NoLockingIfNeededType = NoLockingIfNeeded,
121121
) -> AbstractContextManager[snx.Group]:
122+
"""Open a NeXus file.
123+
124+
Parameters
125+
----------
126+
file_path:
127+
Path of the file to open or a NeXus file or group handle.
128+
definitions:
129+
If set, application definitions to use for the file.
130+
If ``file_path`` is a NeXus file or group, this must be unset or match
131+
the existing definitions.
132+
locking:
133+
This is an advanced feature to work around a limitation of the DMSC file system.
134+
It may be removed in the future.
135+
136+
This flag can disable or force locking the HDF5 file.
137+
By default, the file is locked if possible but may remain unlocked
138+
if it is on a read-only filesystem.
139+
140+
Returns
141+
-------
142+
:
143+
A context manager for the opened file.
144+
"""
122145
if isinstance(file_path, getattr(NeXusGroup, '__supertype__', type(None))):
123146
if (
124147
definitions is not NoNewDefinitions

0 commit comments

Comments
 (0)