-
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.
PeakShapeDetectorBin added with boost::python bindings
- Loading branch information
1 parent
8fe9b3d
commit 3454d1c
Showing
11 changed files
with
137 additions
and
52 deletions.
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
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
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
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
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
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
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
42 changes: 42 additions & 0 deletions
42
Framework/PythonInterface/mantid/dataobjects/src/Exports/PeakShapeDetectorBin.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,42 @@ | ||
// 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 "MantidDataObjects/PeakShapeDetectorBin.h" | ||
#include "MantidPythonInterface/core/Converters/PySequenceToVector.h" | ||
#include <boost/python/class.hpp> | ||
#include <boost/python/list.hpp> | ||
#include <boost/python/make_constructor.hpp> | ||
#include <boost/python/tuple.hpp> | ||
#include <vector> | ||
|
||
using namespace boost::python; | ||
using namespace Mantid::DataObjects; | ||
using Mantid::Kernel::SpecialCoordinateSystem; | ||
using Mantid::PythonInterface::Converters::PySequenceToVector; | ||
|
||
PeakShapeDetectorBin *createPeakShapeDetectorBin(const boost::python::list &pyList, SpecialCoordinateSystem frame, | ||
const std::string &algorithmName = std::string(), | ||
int algorithmVersion = -1) { | ||
// Convert Python list of tuples to std::vector<std::tuple<int32_t, double, double>> | ||
std::vector<std::tuple<int32_t, double, double>> detectorBinList; | ||
|
||
for (int i = 0; i < boost::python::len(pyList); ++i) { | ||
boost::python::tuple pyTuple = boost::python::extract<boost::python::tuple>(pyList[i]); | ||
int32_t detectorID = boost::python::extract<int32_t>(pyTuple[0]); | ||
double startX = boost::python::extract<double>(pyTuple[1]); | ||
double endX = boost::python::extract<double>(pyTuple[2]); | ||
detectorBinList.emplace_back(detectorID, startX, endX); | ||
} | ||
|
||
return new PeakShapeDetectorBin(detectorBinList, frame, algorithmName, algorithmVersion); | ||
} | ||
|
||
void export_PeakShapeDetectorBin() { | ||
class_<PeakShapeDetectorBin, bases<Mantid::Geometry::PeakShape>, boost::noncopyable>("PeakShapeDetectorBin", no_init) | ||
.def("__init__", make_constructor(&createPeakShapeDetectorBin, default_call_policies(), | ||
(arg("detectorBinList"), arg("frame") = SpecialCoordinateSystem::None, | ||
arg("algorithmName") = "", arg("algorithmVersion") = -1))); | ||
} |
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
14 changes: 14 additions & 0 deletions
14
docs/source/api/python/mantid/dataobjects/PeakShapeDetectorBin.rst
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,14 @@ | ||
====================== | ||
PeakShapeDetectorBin | ||
====================== | ||
|
||
This is a Python binding to the C++ class Mantid::DataObjects::PeakShapeDetectorBin. | ||
|
||
*bases:* :py:obj:`mantid.geometry.PeakShape` | ||
|
||
.. module:`mantid.dataobjects` | ||
.. autoclass:: mantid.dataobjects.PeakShapeDetectorBin | ||
:members: | ||
:undoc-members: | ||
:inherited-members: |
1 change: 1 addition & 0 deletions
1
docs/source/release/v6.12.0/Diffraction/Single_Crystal/New_features/38254.rst
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 @@ | ||
- A new peak shape named PeakShapeDetectorBin was introduced to save the detector IDs and bin indices of either TOF or dSpacing domains. This peak shape could be used for Overlap detection, Two-step integration and Eventual visualisation on instrument view. |