-
Notifications
You must be signed in to change notification settings - Fork 128
Add polarisation spin state to ISIS ORSO file metadata #38468
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
Merged
Merged
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
8a39876
Retrieve spin state form sample logs and add to ReflectometryDataSet …
adriazalvarez a9083af
Add instrument settings header file if polarization is present, also …
adriazalvarez 95307da
Add spin state to logs in polarization efficiencies correction algorithm
adriazalvarez eb1963c
Add test for checking polarization state is correctly saved on orso file
adriazalvarez 2f78dee
Add release notes
adriazalvarez a8b1269
Add test for checking dataset names with different polarization/angles
adriazalvarez e2e4d7d
Update SaveISISReflectomtryORSO entry on docs
adriazalvarez 556b237
Add polarization in orso_helper_test
adriazalvarez 7d3df69
Don' print ws name when data is polarized
adriazalvarez 331a3d6
Fix tests printing output name when data is polarized
adriazalvarez 01c54dd
Update system tests data files for save orso
adriazalvarez 2e64f74
Add python module for reflectometry constansts
adriazalvarez 87cd34a
Add dependency on the interface:
adriazalvarez 0b6f38b
change python destination path
adriazalvarez fb62ad2
Add tests to check that ReflectometryReductionAuto is adding logs if …
adriazalvarez 8470c7d
Add polarized parameter as is_polarized and as optional
adriazalvarez 4393325
Correct unique dataset names for Stitched workspaces
adriazalvarez 1c44c20
Add constants from cpp PolarizationCorrectionHelpers
adriazalvarez 40f0cb4
Add constants from cpp PolarizationCorrectionHelpers
adriazalvarez adaaa8f
Add test for python module of polarization constants
adriazalvarez 0679b9e
Use cpp defined polarization constants
adriazalvarez 859036f
Update date
adriazalvarez 4f8aed9
Remove duplicate line:
adriazalvarez 8b7f125
Use polarization correction constants to refer to orso logs
adriazalvarez 3925735
Update documentation with new naming convention for polarized and not…
adriazalvarez File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
Framework/PythonInterface/mantid/utils/reflectometry/CMakeLists.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# _polarization_helpers Python module | ||
|
||
set(MODULE_TEMPLATE src/polarization_helpers.cpp.in) | ||
|
||
# Files containing export definitions, these are automatically processed -- Do NOT sort this list. The order defines the | ||
# order in which the export definitions occur and some depend on their base classes being exported first -- | ||
set(EXPORT_FILES src/Exports/PolarizationCorrectionHelpers.cpp) | ||
|
||
set(MODULE_DEFINITION ${CMAKE_CURRENT_BINARY_DIR}/polarization_helpers.cpp) | ||
create_module(${MODULE_TEMPLATE} ${MODULE_DEFINITION} ${EXPORT_FILES}) | ||
|
||
# Create the target for this directory | ||
add_library(PythonReflHelpersModule ${MODULE_DEFINITION} ${EXPORT_FILES} ${PYTHON_INSTALL_FILES}) | ||
add_library(PythonReflectometryHelpersModule ALIAS PythonReflHelpersModule) | ||
|
||
set_python_properties(PythonReflHelpersModule _polarization_helpers) | ||
|
||
# Add the required dependencies | ||
target_link_libraries(PythonReflHelpersModule PRIVATE Mantid::Algorithms Mantid::PythonInterfaceCore) | ||
|
||
# Installation settings | ||
set_target_properties(PythonReflHelpersModule PROPERTIES INSTALL_RPATH "${EXT_INSTALL_RPATH}") | ||
mtd_install_shared_library( | ||
TARGETS PythonReflHelpersModule DESTINATION ${Python_SITELIB_RELPATH}/mantid/utils/reflectometry | ||
) |
9 changes: 8 additions & 1 deletion
9
Framework/PythonInterface/mantid/utils/reflectometry/__init__.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,13 @@ | ||
# Mantid Repository : https://github.com/mantidproject/mantid | ||
# | ||
# Copyright © 2023 ISIS Rutherford Appleton Laboratory UKRI, | ||
# Copyright © 2024 ISIS Rutherford Appleton Laboratory UKRI, | ||
# NScD Oak Ridge National Laboratory, European Spallation Source, | ||
# Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS | ||
# SPDX - License - Identifier: GPL - 3.0 + | ||
|
||
############################################################################### | ||
# Load the C++ library and register the C++ class exports | ||
############################################################################### | ||
from mantid.utils import import_mantid_cext | ||
|
||
import_mantid_cext("._polarization_helpers", "mantid.utils.reflectometry", globals()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
.../PythonInterface/mantid/utils/reflectometry/src/Exports/PolarizationCorrectionHelpers.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// Mantid Repository : https://github.com/mantidproject/mantid | ||
// | ||
// Copyright © 2024 ISIS Rutherford Appleton Laboratory UKRI, | ||
// NScD Oak Ridge National Laboratory, European Spallation Source, | ||
// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS | ||
// SPDX - License - Identifier: GPL - 3.0 + | ||
|
||
#include "MantidAlgorithms/PolarizationCorrections/PolarizationCorrectionsHelpers.h" | ||
#include <boost/python/class.hpp> | ||
|
||
namespace { | ||
class SpinStatesORSO {}; | ||
} // namespace | ||
|
||
void export_SpinStatesORSO() { | ||
using namespace boost::python; | ||
|
||
class_<SpinStatesORSO>("SpinStatesORSO") | ||
.def_readonly("PP", &Mantid::Algorithms::SpinStatesORSO::PP) | ||
.def_readonly("PM", &Mantid::Algorithms::SpinStatesORSO::PM) | ||
.def_readonly("MP", &Mantid::Algorithms::SpinStatesORSO::MP) | ||
.def_readonly("MM", &Mantid::Algorithms::SpinStatesORSO::MM) | ||
.def_readonly("PO", &Mantid::Algorithms::SpinStatesORSO::PO) | ||
.def_readonly("MO", &Mantid::Algorithms::SpinStatesORSO::MO) | ||
.def_readonly("LOG_NAME", &Mantid::Algorithms::SpinStatesORSO::LOG_NAME); | ||
} |
20 changes: 20 additions & 0 deletions
20
Framework/PythonInterface/mantid/utils/reflectometry/src/polarization_helpers.cpp.in
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Mantid Repository : https://github.com/mantidproject/mantid | ||
// | ||
// Copyright © 2024 ISIS Rutherford Appleton Laboratory UKRI, | ||
// NScD Oak Ridge National Laboratory, European Spallation Source, | ||
// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS | ||
// SPDX - License - Identifier: GPL - 3.0 + | ||
|
||
@AUTO_GENERATE_WARNING@ | ||
/********** Source = polarization_helpers.cpp.in **********************************************************/ | ||
|
||
#include <boost/python/def.hpp> | ||
#include <boost/python/module.hpp> | ||
|
||
// Forward declare | ||
@EXPORT_DECLARE@ | ||
|
||
BOOST_PYTHON_MODULE(_polarization_helpers) | ||
{ | ||
@EXPORT_FUNCTIONS@ | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
Framework/PythonInterface/test/python/mantid/utils/reflectometry/CMakeLists.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
...ework/PythonInterface/test/python/mantid/utils/reflectometry/polarization_helpers_test.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Mantid Repository : https://github.com/mantidproject/mantid | ||
# | ||
# Copyright © 2024 ISIS Rutherford Appleton Laboratory UKRI, | ||
# NScD Oak Ridge National Laboratory, European Spallation Source, | ||
# Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS | ||
# SPDX - License - Identifier: GPL - 3.0 + | ||
import unittest | ||
|
||
from mantid.utils.reflectometry import SpinStatesORSO | ||
|
||
|
||
class PolarizationHelpersTest(unittest.TestCase): | ||
def test_ORSO_spin_state_definitions_are_imported_correctly(self): | ||
self.assertEqual("pp", SpinStatesORSO.PP) | ||
self.assertEqual("pm", SpinStatesORSO.PM) | ||
self.assertEqual("mp", SpinStatesORSO.MP) | ||
self.assertEqual("mm", SpinStatesORSO.MM) | ||
self.assertEqual("po", SpinStatesORSO.PO) | ||
self.assertEqual("mo", SpinStatesORSO.MO) | ||
self.assertEqual("spin_state_ORSO", SpinStatesORSO.LOG_NAME) | ||
|
||
|
||
if __name__ == "__main__": | ||
unittest.main() |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here I have decided to return early because if the dataset is polarized is not necessary to prepend the ws name for unique datasets and in some cases the ws name would be repeated.