Skip to content

Commit d6cbea6

Browse files
committed
Merge branch 'feature/tsl-part4' into 'develop'
Feature/tsl part4 See merge request njoy/dryad!121
2 parents 62f95f5 + 6ea617f commit d6cbea6

24 files changed

+4387
-21
lines changed

cmake/unit_testing.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ add_cpp_test( dryad.resonances.SpinGroup
7777
add_cpp_test( dryad.resonances.CompoundSystem dryad/resonances/CompoundSystem.test.cpp )
7878

7979
add_cpp_test( dryad.thermal.TabulatedDebyeWallerIntegral dryad/thermal/TabulatedDebyeWallerIntegral.test.cpp )
80+
add_cpp_test( dryad.thermal.TabulatedEffectiveTemperature dryad/thermal/TabulatedEffectiveTemperature.test.cpp )
8081
add_cpp_test( dryad.thermal.IncoherentElasticScattering dryad/thermal/IncoherentElasticScattering.test.cpp )
8182

8283
add_cpp_test( dryad.Documentation dryad/Documentation.test.cpp )

cmake/unit_testing_python.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ add_python_test( dryad.resonances.SpinGroup dryad/res
6666
add_python_test( dryad.resonances.CompoundSystem dryad/resonances/Test_CompoundSystem.py )
6767

6868
add_python_test( dryad.thermal.TabulatedDebyeWallerIntegral dryad/thermal/Test_TabulatedDebyeWallerIntegral.py )
69+
add_python_test( dryad.thermal.TabulatedEffectiveTemperature dryad/thermal/Test_TabulatedEffectiveTemperature.py )
6970
add_python_test( dryad.thermal.IncoherentElasticScattering dryad/thermal/Test_IncoherentElasticScattering.py )
7071

7172
add_python_test( dryad.Documentation dryad/Test_Documentation.py )

docs/src/dryad/distributions/incoherent_distribution_data.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,13 @@ Read-only Attributes
3030

3131
~IncoherentDistributionData.type
3232

33+
Methods
34+
~~~~~~~
35+
36+
.. autosummary::
37+
:toctree: generated/
38+
39+
~IncoherentDistributionData.normalise
40+
3341

3442

python/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ if(njoy.python)
4444
${CMAKE_CURRENT_SOURCE_DIR}/src/dryad/resonances/CompoundSystem.python.cpp
4545
${CMAKE_CURRENT_SOURCE_DIR}/src/dryad/thermal.python.cpp
4646
${CMAKE_CURRENT_SOURCE_DIR}/src/dryad/thermal/TabulatedDebyeWallerIntegral.python.cpp
47+
${CMAKE_CURRENT_SOURCE_DIR}/src/dryad/thermal/TabulatedEffectiveTemperature.python.cpp
4748
${CMAKE_CURRENT_SOURCE_DIR}/src/dryad/thermal/IncoherentElasticScattering.python.cpp
4849
${CMAKE_CURRENT_SOURCE_DIR}/src/dryad/covariance.python.cpp
4950
${CMAKE_CURRENT_SOURCE_DIR}/src/dryad/covariance/ScalingType.python.cpp

python/src/dryad/IncoherentDistributionData.python.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,12 @@ void wrapIncoherentDistributionData( python::module& module ) {
8181
python::overload_cast<>( &Component::comptonProfiles, python::const_ ),
8282
python::overload_cast< std::optional< std::vector< TabulatedComptonProfile > > >( &Component::comptonProfiles ),
8383
"The compton profiles"
84+
)
85+
.def(
86+
87+
"normalise",
88+
&Component::normalise,
89+
"Normalise the Compton profiles"
8490
);
8591

8692
// add standard equality comparison definitions

python/src/dryad/resonances/CompoundSystem.python.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ void wrapCompoundSystem( python::module& module ) {
6969

7070
"reactions",
7171
python::overload_cast<>( &Component::reactions, python::const_ ),
72-
"The reactions to which this spin group contributes"
72+
"The reactions to which this compound system contributes"
7373
)
7474
.def(
7575

python/src/dryad/thermal.python.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ namespace thermal {
1212

1313
// declarations - components
1414
void wrapTabulatedDebyeWallerIntegral( python::module& );
15+
void wrapTabulatedEffectiveTemperature( python::module& );
1516

1617
void wrapIncoherentElasticScattering( python::module& );
1718
}
@@ -27,6 +28,7 @@ void wrapThermal( python::module& module ) {
2728

2829
// components
2930
thermal::wrapTabulatedDebyeWallerIntegral( submodule );
31+
thermal::wrapTabulatedEffectiveTemperature( submodule );
3032

3133
thermal::wrapIncoherentElasticScattering( submodule );
3234
}

python/src/dryad/thermal/TabulatedDebyeWallerIntegral.python.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,7 @@ void wrapTabulatedDebyeWallerIntegral( python::module& module ) {
3838
" interpolants : list of njoy.dryad.InterpolationType\n"
3939
" the interpolation types of the interpolation regions\n"
4040
" interpolant : njoy.dryad.InterpolationType, default njoy.dryad.InterpolationType.LinearLinear\n"
41-
" the interpolation type (default lin-lin)\n"
42-
" normalise : bool, default false\n"
43-
" option to indicate whether or not to normalise\n"
44-
" all probability data (default: no normalisation)"
41+
" the interpolation type (default lin-lin)"
4542
);
4643

4744
// wrap the component
@@ -73,7 +70,7 @@ void wrapTabulatedDebyeWallerIntegral( python::module& module ) {
7370

7471
"values",
7572
&Component::values,
76-
"The form factor values"
73+
"The integral values"
7774
)
7875
.def_property_readonly(
7976

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
// system includes
2+
#include <pybind11/pybind11.h>
3+
#include <pybind11/stl.h>
4+
5+
// local includes
6+
#include "dryad/definitions.hpp"
7+
#include "njoy/dryad/thermal/TabulatedEffectiveTemperature.hpp"
8+
9+
// namespace aliases
10+
namespace python = pybind11;
11+
12+
namespace dryad {
13+
namespace thermal {
14+
15+
void wrapTabulatedEffectiveTemperature( python::module& module ) {
16+
17+
// type aliases
18+
using Component = njoy::dryad::thermal::TabulatedEffectiveTemperature;
19+
using InterpolationType = njoy::dryad::InterpolationType;
20+
using ToleranceConvergence = njoy::dryad::ToleranceConvergence;
21+
22+
// wrap views created by this component
23+
24+
// create the component
25+
python::class_< Component > component(
26+
27+
module,
28+
"TabulatedEffectiveTemperature",
29+
"An effective temperature table\n\n"
30+
"Parameters\n"
31+
"----------\n"
32+
" moderator_temperatures : list of float\n"
33+
" the moderator temperature values\n"
34+
" values : list of float\n"
35+
" the effective temperature values\n"
36+
" boundaries : list of int\n"
37+
" the boundaries of the interpolation regions\n"
38+
" interpolants : list of njoy.dryad.InterpolationType\n"
39+
" the interpolation types of the interpolation regions\n"
40+
" interpolant : njoy.dryad.InterpolationType, default njoy.dryad.InterpolationType.LinearLinear\n"
41+
" the interpolation type (default lin-lin)"
42+
);
43+
44+
// wrap the component
45+
component
46+
.def(
47+
48+
python::init< std::vector< double >, std::vector< double >,
49+
std::vector< std::size_t >,
50+
std::vector< InterpolationType > >(),
51+
python::arg( "moderator_temperatures" ), python::arg( "values" ),
52+
python::arg( "boundaries" ), python::arg( "interpolants" ),
53+
"Initialise the effective temperature table with multiple interpolation zones"
54+
)
55+
.def(
56+
57+
python::init< std::vector< double >, std::vector< double >,
58+
InterpolationType >(),
59+
python::arg( "moderator_temperatures" ), python::arg( "values" ),
60+
python::arg( "interpolant" ) = InterpolationType::LinearLinear,
61+
"Initialise the effective temperature table with a single interpolation zone"
62+
)
63+
.def_property_readonly(
64+
65+
"moderator_temperatures",
66+
&Component::moderatorTemperatures,
67+
"The moderator temperature values"
68+
)
69+
.def_property_readonly(
70+
71+
"values",
72+
&Component::values,
73+
"The effective temperatur values"
74+
)
75+
.def_property_readonly(
76+
77+
"lower_moderator_temperature_limit",
78+
&Component::lowerModeratorTemperatureLimit,
79+
"The lower moderator temperature limit"
80+
)
81+
.def_property_readonly(
82+
83+
"upper_moderator_temperature_limit",
84+
&Component::upperModeratorTemperatureLimit,
85+
"The upper moderator temperature limit"
86+
)
87+
.def(
88+
89+
"__call__",
90+
[] ( const Component& self, double temperature ) -> decltype(auto)
91+
{ return self( temperature ); },
92+
python::arg( "moderator_temperature" ),
93+
"Evaluate the effective temperature for a given moderator temperature value\n\n"
94+
"Parameters\n"
95+
"----------\n"
96+
" moderator_temperature : float\n"
97+
" the moderator temperature value"
98+
);
99+
100+
// add standard equality comparison definitions
101+
addStandardEqualityComparisonDefinitions< Component >( component );
102+
103+
// add standard tabulated data definitions
104+
addStandardTabulatedDefinitions< Component >( component );
105+
106+
// add standard copy definitions
107+
addStandardCopyDefinitions< Component >( component );
108+
}
109+
110+
} // thermal namespace
111+
} // dryad namespace

0 commit comments

Comments
 (0)