-
Notifications
You must be signed in to change notification settings - Fork 125
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add python module for reflectometry constansts
- Loading branch information
1 parent
97ae101
commit 568667b
Showing
5 changed files
with
80 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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 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/polarization_helpers.cpp | ||
) |
9 changes: 8 additions & 1 deletion
9
Framework/PythonInterface/mantid/utils/reflectometry/__init__.py
This file contains 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()) |
26 changes: 26 additions & 0 deletions
26
.../PythonInterface/mantid/utils/reflectometry/src/Exports/PolarizationCorrectionHelpers.cpp
This file contains 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 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@ | ||
} |