Skip to content

Commit 7080daf

Browse files
authored
Merge pull request #38402 from mantidproject/isis_orso_docs_update
Document module mantid.utils.reflectometry.orso_helper
2 parents 2d60eda + c9c89de commit 7080daf

File tree

4 files changed

+93
-4
lines changed

4 files changed

+93
-4
lines changed

docs/source/api/python/mantid/utils/index.rst

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
.. _mantid.utils:
22

3+
34
====================
45
:mod:`mantid.utils`
56
====================
@@ -10,10 +11,10 @@ can be used as a library to pull internal functions from an algorithm
1011
so that the code can be shared with external software needing the
1112
same functionality without the need to duplicate code.
1213

13-
Unit tests for functions in this module should be placed in the
14-
``Framework/PythonInterface/test/python/mantid/utils/`` directory and
15-
added to its ``CMakeLists.txt`` to make sure the testing code gets
16-
registered with Mantid.
14+
.. toctree::
15+
:maxdepth: 1
16+
17+
reflectometry
1718

1819

1920
Calling functions from ``utils``
@@ -69,3 +70,12 @@ can be called from different algorithms.
6970
element_size=2, # integration element cube in mm
7071
cache_dir="/tmp", # cache diretory for speeding up repeated calculation
7172
)
73+
74+
75+
Testing ``utils``
76+
=================
77+
78+
Unit tests for functions in this module should be placed in the
79+
``Framework/PythonInterface/test/python/mantid/utils/`` directory and
80+
added to its ``CMakeLists.txt`` to make sure the testing code gets
81+
registered with Mantid.
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
.. _mantid.utils.reflectometry:
2+
3+
Reflectometry Utilities
4+
=======================
5+
6+
7+
ORSO format IO
8+
--------------
9+
10+
The ``mantid.utils.reflectometry.orso_helper`` module provides functionality for reading and saving
11+
reflectivity data in the ORSO standard [#ORSO]_ format.
12+
The orsopy library [#orsopy]_ is used to collect numerical data as well as metadata into meaningful data structures
13+
which are later assembled and written out to file.
14+
The file's format can be ASCII (``.ort``) or binary Nexus (``.orb``).
15+
16+
The ``orso_helper`` module defines classes such as ``MantidORSOSaver``, ``MantidORSODataset``,
17+
and ``MantidORSODataColumns`` to facilitate the creation, manipulation, and saving of ORSO datasets.
18+
The ``MantidORSOSaver`` class manages the saving of datasets in ASCII or Nexus formats,
19+
while the ``MantidORSODataset`` class constructs the dataset with necessary metadata and data columns.
20+
Finally, the ``MantidORSODataColumns`` class handles the addition and management of data columns and their
21+
associated metadata.
22+
23+
24+
.. image:: /images/orso_helper.png
25+
:alt: Class diagram showing the main classes and their relationships
26+
:width: 50%
27+
28+
This module integrates with the rest of the Mantid framework to ensure that reflectivity is standardized
29+
and shared in compliance with ORSO specifications.
30+
For instance, the module provides the backend functionality for the implementation of algorithm
31+
:ref:`algm-SaveISISReflectometryORSO`.
32+
33+
34+
References
35+
----------
36+
37+
.. [#ORSO] ORSO file format specification: `https://www.reflectometry.org/file_format/specification <https://www.reflectometry.org/file_format/specification>`_
38+
.. [#orsopy] orsopy Python library: `https://orsopy.readthedocs.io/en/latest/ <https://orsopy.readthedocs.io/en/latest/>`_

docs/source/images/orso_helper.png

54.7 KB
Loading
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
@startuml
2+
3+
class orsopy.Column {}
4+
5+
class orsopy.ErrorColumn {}
6+
7+
class orsopy.OrsoDataset{}
8+
9+
class orsopy.Orso{}
10+
11+
class orsopy.Header{}
12+
13+
class MantidORSOSaver {
14+
- _datasets: List[MantidORSODataset]
15+
+ add_dataset(dataset: MantidORSODataset)
16+
+ save_orso_ascii()
17+
+ save_orso_nexus()
18+
}
19+
20+
class MantidORSODataset {
21+
- _data_columns: MantidORSODataColumns
22+
- _header: orsopy.Orso(_data_columns.header_info,...)
23+
+ dataset() : OrsoDataset(_header, _data_columns.data)
24+
}
25+
26+
class MantidORSODataColumns {
27+
+ data: np.ndarray
28+
+ header_info: List[Union[Column, ErrorColumn]]
29+
}
30+
31+
orsopy.Orso <-- orsopy.Header
32+
33+
MantidORSOSaver "1" *-- "0..*" MantidORSODataset
34+
MantidORSODataset *-- MantidORSODataColumns
35+
MantidORSODataset *-- orsopy.Orso
36+
MantidORSODataset ..> orsopy.OrsoDataset : returns
37+
38+
MantidORSODataColumns "1" *-- "0..*" orsopy.Column
39+
MantidORSODataColumns "1" *-- "0..*" orsopy.ErrorColumn
40+
41+
@enduml

0 commit comments

Comments
 (0)