sandialabs / SpecUtils

A library for opening, manipulating, and exporting gamma spectral files
GNU Lesser General Public License v2.1
27 stars 9 forks source link

No args() method? in recent Boost.python #10

Closed furutaka closed 1 year ago

furutaka commented 1 year ago

Hi,

Sorry for just reporting without providing the resolusion...

I want to use the library to read .N42 data and process the data using python using python binding of the library. My main systems are Linux boxes (Fedora, x86_64), and have boost-python3-1.78.0-9.fc37.x86_64 rpm installed. I did CMaking as $ cmake -DSpecUtils_PYTHON_BINDINGS=ON -DBoost_PYTHON_LIBRARY=/usr/lib64/libboost_python311.so.1.78.0 -DPYTHON_LIBRARY=/usr/lib64/libpython3.so -DPYTHON_INCLUDE_DIR=/usr/include/python3.11 ../SpecUtils.git/

The make failed like the following: [ 2%] Building CXX object CMakeFiles/SpecUtils.dir/src/SpecFile.cpp.o [ 5%] Building CXX object CMakeFiles/SpecUtils.dir/src/SpecFile_pcf.cpp.o [ 8%] Building CXX object CMakeFiles/SpecUtils.dir/src/SpecFile_cnf.cpp.o [ 11%] Building CXX object CMakeFiles/SpecUtils.dir/src/SpecFile_n42.cpp.o [ 14%] Building CXX object CMakeFiles/SpecUtils.dir/src/SpecFile_spc.cpp.o [ 17%] Building CXX object CMakeFiles/SpecUtils.dir/src/SpecFile_chn.cpp.o [ 20%] Building CXX object CMakeFiles/SpecUtils.dir/src/SpecFile_spe.cpp.o [ 23%] Building CXX object CMakeFiles/SpecUtils.dir/src/SpecFile_csv.cpp.o [ 26%] Building CXX object CMakeFiles/SpecUtils.dir/src/SpecFile_gr135.cpp.o [ 29%] Building CXX object CMakeFiles/SpecUtils.dir/src/SpecFile_aram.cpp.o [ 32%] Building CXX object CMakeFiles/SpecUtils.dir/src/SpecFile_lis.cpp.o [ 35%] Building CXX object CMakeFiles/SpecUtils.dir/src/SpecFile_lzs.cpp.o [ 38%] Building CXX object CMakeFiles/SpecUtils.dir/src/SpecFile_phd.cpp.o [ 41%] Building CXX object CMakeFiles/SpecUtils.dir/src/SpecFile_tka.cpp.o [ 44%] Building CXX object CMakeFiles/SpecUtils.dir/src/SpecFile_lsrm.cpp.o [ 47%] Building CXX object CMakeFiles/SpecUtils.dir/src/SpecFile_mca.cpp.o [ 50%] Building CXX object CMakeFiles/SpecUtils.dir/src/SpecFile_spmdf.cpp.o [ 52%] Building CXX object CMakeFiles/SpecUtils.dir/src/SpecFile_mps.cpp.o [ 55%] Building CXX object CMakeFiles/SpecUtils.dir/src/SpecFile_multiact.cpp.o [ 58%] Building CXX object CMakeFiles/SpecUtils.dir/src/SpecFile_uraider.cpp.o [ 61%] Building CXX object CMakeFiles/SpecUtils.dir/src/SpecFile_xml_other.cpp.o [ 64%] Building CXX object CMakeFiles/SpecUtils.dir/src/SpecFile_json.cpp.o [ 67%] Building CXX object CMakeFiles/SpecUtils.dir/src/SpecUtilsAsync.cpp.o [ 70%] Building CXX object CMakeFiles/SpecUtils.dir/src/SerialToDetectorModel.cpp.o [ 73%] Building CXX object CMakeFiles/SpecUtils.dir/src/EnergyCalibration.cpp.o [ 76%] Building CXX object CMakeFiles/SpecUtils.dir/src/CubicSpline.cpp.o [ 79%] Building CXX object CMakeFiles/SpecUtils.dir/src/StringAlgo.cpp.o [ 82%] Building CXX object CMakeFiles/SpecUtils.dir/src/Filesystem.cpp.o [ 85%] Building CXX object CMakeFiles/SpecUtils.dir/src/DateTime.cpp.o [ 88%] Building CXX object CMakeFiles/SpecUtils.dir/src/ParseUtils.cpp.o [ 91%] Building CXX object CMakeFiles/SpecUtils.dir/src/SpecFile_location.cpp.o [ 94%] Building CXX object CMakeFiles/SpecUtils.dir/src/D3SpectrumExport.cpp.o [ 97%] Building CXX object CMakeFiles/SpecUtils.dir/bindings/python/SpecFile_py.cpp.o /home/furutaka/res/SpecUtils/SpecUtils.git/bindings/python/SpecFile_py.cpp: In function ‘void init_module_SpecUtils()’: /home/furutaka/res/SpecUtils/SpecUtils.git/bindings/python/SpecFilepy.cpp:1109:7: error: no matching function for call to ‘boost::python::class::def(const char [14], , boost::python::detail::keywords<3>, const char [77])’ 1087 | class_("EnergyCalibration") | ~~~~~~~~~~~~~ 1088 | .def( "type", &SpecUtils::EnergyCalibration::type, | ~~~~~~~~~~ 1089 | "Returns the energy calibration type" ) | ~~~~~~~~~~~ 1090 | .def( "valid", &SpecUtils::EnergyCalibration::valid, | ~~~~~~~~~~~~ 1091 | "Returns if the energy calibration is valid." ) | ~~~~~~~~~~~ 1092 | .def( "coefficients", &SpecUtils::EnergyCalibration::coefficients, return_internal_reference<>(), | ~~~~~~~~~~~~~~~~~~~~~ 1093 | "Returns the list of energy calibration coeficients.\n" | ~~~~~~~~~~~ 1094 | "Will only be empty for SpecUtils.EnergyCalType.InvalidEquationType." ) | ~~~~~~~~~~~~~~~ 1095 | // TODO: I think we should put a wrapper around channel_energies, and return a proper python list | ~~~~~~~~~~~~~~~~~~~~~ 1096 | .def( "channelEnergies", &SpecUtils::EnergyCalibration::channel_energies, return_internal_reference<>(), | ~~~~~~~~~~~~~~~~~~~~~~~~ 1097 | "Returns lower channel energies; will have one more entry than the number of channels." ) | ~~~~~~~~~~~~~~~~~~~~~ 1098 | .def( "deviationPairs", &SpecUtils::EnergyCalibration::deviation_pairs, return_internal_reference<>() ) | ~~~~~~~~~~~~~~~~~~~~~~~ 1099 | .def( "numChannels", &SpecUtils::EnergyCalibration::num_channels, | ~~~~~~~~~~~~~ 1100 | "Returns the number of channels this energy calibration is for." ) | ~~~~~~~~~~~~~~ 1101 | .def( "channelForEnergy", &SpecUtils::EnergyCalibration::channel_for_energy, | ~~~~~~~~~~~~~~~~ 1102 | "Returns channel number (as a double) for the specified energy." ) | ~~~~~~~~~~~~~~ 1103 | .def( "energyForChannel", &SpecUtils::EnergyCalibration::energy_for_channel, | ~~~~~~~~~~~~~~~~ 1104 | "Returns energy for the specified (as double) channel number." ) | ~~~~~~~~~~~~~~~~ 1105 | .def( "lowerEnergy", &SpecUtils::EnergyCalibration::lower_energy, | ~~~~~~~~~~~~~ 1106 | "Returns lowest energy of this energy calibration." ) | ~~~~~~~~~~~~~ 1107 | .def( "upperEnergy", &SpecUtils::EnergyCalibration::upper_energy, | ~~~~~~~~~~~~~ 1108 | "Returns highest energy of this energy calibration." ) | ~~~~~~~~~~~~~~ 1109 | .def( "setPolynomial", &SpecUtils::EnergyCalibration::set_polynomial, | ~~^~~~~~~~~~~~~~~ 1110 | args( "NumChannels", "Coeffiecients", "DeviationPairs" ), | ~~~~~~~~~~~~~ 1111 | "Sets the energy calibration information from Polynomial defined coefficents." ) | ~~~~~~~~~~~~~~~~ In file included from /usr/include/boost/python.hpp:18, from /home/furutaka/res/SpecUtils/SpecUtils.git/bindings/python/SpecFilepy.cpp:51: /usr/include/boost/python/class.hpp:219:11: note: candidate: ‘template boost::python::class<T, X1, X2, X3>::self& boost::python::class_<T, X1, X2, X3>::def(const boost::python::def_visitor&) [with W = SpecUtils::EnergyCalibration; X1 = boost::python::detail::not_specified; X2 = boost::python::detail::not_specified; X3 = boost::python::detail::not_specified]’ 219 | self& def(def_visitor const& visitor) | ^~~ /usr/include/boost/python/class.hpp:219:11: note: template argument deduction/substitution failed: /home/furutaka/res/SpecUtils/SpecUtils.git/bindings/python/SpecFile_py.cpp:1109:7: note: mismatched types ‘const boost::python::defvisitor’ and ‘const char [14]’ 1087 | class("EnergyCalibration") | ~~~~~~~~~~~~~ 1088 | .def( "type", &SpecUtils::EnergyCalibration::type, | ~~~~~~~~~~ 1089 | "Returns the energy calibration type" ) | ~~~~~~~~~~~ 1090 | .def( "valid", &SpecUtils::EnergyCalibration::valid, | ~~~~~~~~~~~~ 1091 | "Returns if the energy calibration is valid." ) | ~~~~~~~~~~~ 1092 | .def( "coefficients", &SpecUtils::EnergyCalibration::coefficients, return_internal_reference<>(), | ~~~~~~~~~~~~~~~~~~~~~ 1093 | "Returns the list of energy calibration coeficients.\n" | ~~~~~~~~~~~ 1094 | "Will only be empty for SpecUtils.EnergyCalType.InvalidEquationType." ) | ~~~~~~~~~~~~~~~ 1095 | // TODO: I think we should put a wrapper around channel_energies, and return a proper python list | ~~~~~~~~~~~~~~~~~~~~~ 1096 | .def( "channelEnergies", &SpecUtils::EnergyCalibration::channel_energies, return_internal_reference<>(), | ~~~~~~~~~~~~~~~~~~~~~~~~ 1097 | "Returns lower channel energies; will have one more entry than the number of channels." ) | ~~~~~~~~~~~~~~~~~~~~~ 1098 | .def( "deviationPairs", &SpecUtils::EnergyCalibration::deviation_pairs, return_internal_reference<>() ) | ~~~~~~~~~~~~~~~~~~~~~~~ 1099 | .def( "numChannels", &SpecUtils::EnergyCalibration::num_channels, | ~~~~~~~~~~~~~ 1100 | "Returns the number of channels this energy calibration is for." ) | ~~~~~~~~~~~~~~ 1101 | .def( "channelForEnergy", &SpecUtils::EnergyCalibration::channel_for_energy, | ~~~~~~~~~~~~~~~~ 1102 | "Returns channel number (as a double) for the specified energy." ) | ~~~~~~~~~~~~~~ 1103 | .def( "energyForChannel", &SpecUtils::EnergyCalibration::energy_for_channel, | ~~~~~~~~~~~~~~~~ 1104 | "Returns energy for the specified (as double) channel number." ) | ~~~~~~~~~~~~~~~~ 1105 | .def( "lowerEnergy", &SpecUtils::EnergyCalibration::lower_energy, | ~~~~~~~~~~~~~ 1106 | "Returns lowest energy of this energy calibration." ) | ~~~~~~~~~~~~~ 1107 | .def( "upperEnergy", &SpecUtils::EnergyCalibration::upper_energy, | ~~~~~~~~~~~~~ 1108 | "Returns highest energy of this energy calibration." ) | ~~~~~~~~~~~~~~ 1109 | .def( "setPolynomial", &SpecUtils::EnergyCalibration::setpolynomial, | ~~^~~~~~~~~~~~~~~ 1110 | args( "NumChannels", "Coeffiecients", "DeviationPairs" ), | ~~~~~~~~~~~~~ 1111 | "Sets the energy calibration information from Polynomial defined coefficents." ) | ~~~~~~~~~~~~~~~~ /usr/include/boost/python/class.hpp:229:11: note: candidate: ‘template boost::python::class<T, X1, X2, X3>::self& boost::python::class_<T, X1, X2, X3>::def(const char, F) [with W = SpecUtils::EnergyCalibration; X1 = boost::python::detail::not_specified; X2 = boost::python::detail::not_specified; X3 = boost::python::detail::not_specified]’ 229 | self& def(char const name, F f) | ^~~ /usr/include/boost/python/class.hpp:229:11: note: template argument deduction/substitution failed: /home/furutaka/res/SpecUtils/SpecUtils.git/bindings/python/SpecFilepy.cpp:1109:7: note: candidate expects 2 arguments, 4 provided 1087 | class("EnergyCalibration") | ~~~~~~~~~~~~~ 1088 | .def( "type", &SpecUtils::EnergyCalibration::type, | ~~~~~~~~~~ 1089 | "Returns the energy calibration type" ) | ~~~~~~~~~~~ 1090 | .def( "valid", &SpecUtils::EnergyCalibration::valid, | ~~~~~~~~~~~~ 1091 | "Returns if the energy calibration is valid." ) | ~~~~~~~~~~~ 1092 | .def( "coefficients", &SpecUtils::EnergyCalibration::coefficients, return_internal_reference<>(), | ~~~~~~~~~~~~~~~~~~~~~ 1093 | "Returns the list of energy calibration coeficients.\n" | ~~~~~~~~~~~ 1094 | "Will only be empty for SpecUtils.EnergyCalType.InvalidEquationType." ) | ~~~~~~~~~~~~~~~ 1095 | // TODO: I think we should put a wrapper around channel_energies, and return a proper python list | ~~~~~~~~~~~~~~~~~~~~~ 1096 | .def( "channelEnergies", &SpecUtils::EnergyCalibration::channel_energies, return_internal_reference<>(), | ~~~~~~~~~~~~~~~~~~~~~~~~ 1097 | "Returns lower channel energies; will have one more entry than the number of channels." ) | ~~~~~~~~~~~~~~~~~~~~~ 1098 | .def( "deviationPairs", &SpecUtils::EnergyCalibration::deviation_pairs, return_internal_reference<>() ) | ~~~~~~~~~~~~~~~~~~~~~~~ 1099 | .def( "numChannels", &SpecUtils::EnergyCalibration::num_channels, | ~~~~~~~~~~~~~ 1100 | "Returns the number of channels this energy calibration is for." ) | ~~~~~~~~~~~~~~ 1101 | .def( "channelForEnergy", &SpecUtils::EnergyCalibration::channel_for_energy, | ~~~~~~~~~~~~~~~~ 1102 | "Returns channel number (as a double) for the specified energy." ) | ~~~~~~~~~~~~~~ 1103 | .def( "energyForChannel", &SpecUtils::EnergyCalibration::energy_for_channel, | ~~~~~~~~~~~~~~~~ 1104 | "Returns energy for the specified (as double) channel number." ) | ~~~~~~~~~~~~~~~~ 1105 | .def( "lowerEnergy", &SpecUtils::EnergyCalibration::lower_energy, | ~~~~~~~~~~~~~ 1106 | "Returns lowest energy of this energy calibration." ) | ~~~~~~~~~~~~~ 1107 | .def( "upperEnergy", &SpecUtils::EnergyCalibration::upper_energy, | ~~~~~~~~~~~~~ 1108 | "Returns highest energy of this energy calibration." ) | ~~~~~~~~~~~~~~ 1109 | .def( "setPolynomial", &SpecUtils::EnergyCalibration::setpolynomial, | ~~^~~~~~~~~~~~~~~ 1110 | args( "NumChannels", "Coeffiecients", "DeviationPairs" ), | ~~~~~~~~~~~~~ 1111 | "Sets the energy calibration information from Polynomial defined coefficents." ) | ~~~~~~~~~~~~~~~~ /usr/include/boost/python/class.hpp:238:11: note: candidate: ‘template<class A1, class A2> boost::python::class<T, X1, X2, X3>::self& boost::python::class_<T, X1, X2, X3>::def(const char, A1, const A2&) [with A2 = A1; W = SpecUtils::EnergyCalibration; X1 = boost::python::detail::not_specified; X2 = boost::python::detail::not_specified; X3 = boost::python::detail::not_specified]’ 238 | self& def(char const name, A1 a1, A2 const& a2) | ^~~ /usr/include/boost/python/class.hpp:238:11: note: template argument deduction/substitution failed: /home/furutaka/res/SpecUtils/SpecUtils.git/bindings/python/SpecFilepy.cpp:1109:7: note: candidate expects 3 arguments, 4 provided 1087 | class("EnergyCalibration") | ~~~~~~~~~~~~~ 1088 | .def( "type", &SpecUtils::EnergyCalibration::type, | ~~~~~~~~~~ 1089 | "Returns the energy calibration type" ) | ~~~~~~~~~~~ 1090 | .def( "valid", &SpecUtils::EnergyCalibration::valid, | ~~~~~~~~~~~~ 1091 | "Returns if the energy calibration is valid." ) | ~~~~~~~~~~~ 1092 | .def( "coefficients", &SpecUtils::EnergyCalibration::coefficients, return_internal_reference<>(), | ~~~~~~~~~~~~~~~~~~~~~ 1093 | "Returns the list of energy calibration coeficients.\n" | ~~~~~~~~~~~ 1094 | "Will only be empty for SpecUtils.EnergyCalType.InvalidEquationType." ) | ~~~~~~~~~~~~~~~ 1095 | // TODO: I think we should put a wrapper around channel_energies, and return a proper python list | ~~~~~~~~~~~~~~~~~~~~~ 1096 | .def( "channelEnergies", &SpecUtils::EnergyCalibration::channel_energies, return_internal_reference<>(), | ~~~~~~~~~~~~~~~~~~~~~~~~ 1097 | "Returns lower channel energies; will have one more entry than the number of channels." ) | ~~~~~~~~~~~~~~~~~~~~~ 1098 | .def( "deviationPairs", &SpecUtils::EnergyCalibration::deviation_pairs, return_internal_reference<>() ) | ~~~~~~~~~~~~~~~~~~~~~~~ 1099 | .def( "numChannels", &SpecUtils::EnergyCalibration::num_channels, | ~~~~~~~~~~~~~ 1100 | "Returns the number of channels this energy calibration is for." ) | ~~~~~~~~~~~~~~ 1101 | .def( "channelForEnergy", &SpecUtils::EnergyCalibration::channel_for_energy, | ~~~~~~~~~~~~~~~~ 1102 | "Returns channel number (as a double) for the specified energy." ) | ~~~~~~~~~~~~~~ 1103 | .def( "energyForChannel", &SpecUtils::EnergyCalibration::energy_for_channel, | ~~~~~~~~~~~~~~~~ 1104 | "Returns energy for the specified (as double) channel number." ) | ~~~~~~~~~~~~~~~~ 1105 | .def( "lowerEnergy", &SpecUtils::EnergyCalibration::lower_energy, | ~~~~~~~~~~~~~ 1106 | "Returns lowest energy of this energy calibration." ) | ~~~~~~~~~~~~~ 1107 | .def( "upperEnergy", &SpecUtils::EnergyCalibration::upper_energy, | ~~~~~~~~~~~~~ 1108 | "Returns highest energy of this energy calibration." ) | ~~~~~~~~~~~~~~ 1109 | .def( "setPolynomial", &SpecUtils::EnergyCalibration::setpolynomial, | ~~^~~~~~~~~~~~~~~ 1110 | args( "NumChannels", "Coeffiecients", "DeviationPairs" ), | ~~~~~~~~~~~~~ 1111 | "Sets the energy calibration information from Polynomial defined coefficents." ) | ~~~~~~~~~~~~~~~~ /usr/include/boost/python/class.hpp:245:11: note: candidate: ‘template<class Fn, class A1, class A2> boost::python::class<T, X1, X2, X3>::self& boost::python::class_<T, X1, X2, X3>::def(const char, Fn, const A1&, const A2&) [with A1 = Fn; A2 = A1; W = SpecUtils::EnergyCalibration; X1 = boost::python::detail::not_specified; X2 = boost::python::detail::not_specified; X3 = boost::python::detail::not_specified]’ 245 | self& def(char const name, Fn fn, A1 const& a1, A2 const& a2) | ^~~ /usr/include/boost/python/class.hpp:245:11: note: template argument deduction/substitution failed: /home/furutaka/res/SpecUtils/SpecUtils.git/bindings/python/SpecFilepy.cpp:1109:7: note: couldn’t deduce template parameter ‘Fn’ 1087 | class("EnergyCalibration") | ~~~~~~~~~~~~~ 1088 | .def( "type", &SpecUtils::EnergyCalibration::type, | ~~~~~~~~~~ 1089 | "Returns the energy calibration type" ) | ~~~~~~~~~~~ 1090 | .def( "valid", &SpecUtils::EnergyCalibration::valid, | ~~~~~~~~~~~~ 1091 | "Returns if the energy calibration is valid." ) | ~~~~~~~~~~~ 1092 | .def( "coefficients", &SpecUtils::EnergyCalibration::coefficients, return_internal_reference<>(), | ~~~~~~~~~~~~~~~~~~~~~ 1093 | "Returns the list of energy calibration coeficients.\n" | ~~~~~~~~~~~ 1094 | "Will only be empty for SpecUtils.EnergyCalType.InvalidEquationType." ) | ~~~~~~~~~~~~~~~ 1095 | // TODO: I think we should put a wrapper around channel_energies, and return a proper python list | ~~~~~~~~~~~~~~~~~~~~~ 1096 | .def( "channelEnergies", &SpecUtils::EnergyCalibration::channel_energies, return_internal_reference<>(), | ~~~~~~~~~~~~~~~~~~~~~~~~ 1097 | "Returns lower channel energies; will have one more entry than the number of channels." ) | ~~~~~~~~~~~~~~~~~~~~~ 1098 | .def( "deviationPairs", &SpecUtils::EnergyCalibration::deviation_pairs, return_internal_reference<>() ) | ~~~~~~~~~~~~~~~~~~~~~~~ 1099 | .def( "numChannels", &SpecUtils::EnergyCalibration::num_channels, | ~~~~~~~~~~~~~ 1100 | "Returns the number of channels this energy calibration is for." ) | ~~~~~~~~~~~~~~ 1101 | .def( "channelForEnergy", &SpecUtils::EnergyCalibration::channel_for_energy, | ~~~~~~~~~~~~~~~~ 1102 | "Returns channel number (as a double) for the specified energy." ) | ~~~~~~~~~~~~~~ 1103 | .def( "energyForChannel", &SpecUtils::EnergyCalibration::energy_for_channel, | ~~~~~~~~~~~~~~~~ 1104 | "Returns energy for the specified (as double) channel number." ) | ~~~~~~~~~~~~~~~~ 1105 | .def( "lowerEnergy", &SpecUtils::EnergyCalibration::lower_energy, | ~~~~~~~~~~~~~ 1106 | "Returns lowest energy of this energy calibration." ) | ~~~~~~~~~~~~~ 1107 | .def( "upperEnergy", &SpecUtils::EnergyCalibration::upper_energy, | ~~~~~~~~~~~~~ 1108 | "Returns highest energy of this energy calibration." ) | ~~~~~~~~~~~~~~ 1109 | .def( "setPolynomial", &SpecUtils::EnergyCalibration::setpolynomial, | ~~^~~~~~~~~~~~~~~ 1110 | args( "NumChannels", "Coeffiecients", "DeviationPairs" ), | ~~~~~~~~~~~~~ 1111 | "Sets the energy calibration information from Polynomial defined coefficents." ) | ~~~~~~~~~~~~~~~~ /usr/include/boost/python/class.hpp:261:11: note: candidate: ‘template<class Fn, class A1, class A2, class A3> boost::python::class<T, X1, X2, X3>::self& boost::python::class_<T, X1, X2, X3>::def(const char, Fn, const A1&, const A2&, const A3&) [with A1 = Fn; A2 = A1; A3 = A2; W = SpecUtils::EnergyCalibration; X1 = boost::python::detail::not_specified; X2 = boost::python::detail::not_specified; X3 = boost::python::detail::not_specified]’ 261 | self& def(char const name, Fn fn, A1 const& a1, A2 const& a2, A3 const& a3) | ^~~ /usr/include/boost/python/class.hpp:261:11: note: template argument deduction/substitution failed: /home/furutaka/res/SpecUtils/SpecUtils.git/bindings/python/SpecFilepy.cpp:1109:7: note: candidate expects 5 arguments, 4 provided 1087 | class("EnergyCalibration") | ~~~~~~~~~~~~~ 1088 | .def( "type", &SpecUtils::EnergyCalibration::type, | ~~~~~~~~~~ 1089 | "Returns the energy calibration type" ) | ~~~~~~~~~~~ 1090 | .def( "valid", &SpecUtils::EnergyCalibration::valid, | ~~~~~~~~~~~~ 1091 | "Returns if the energy calibration is valid." ) | ~~~~~~~~~~~ 1092 | .def( "coefficients", &SpecUtils::EnergyCalibration::coefficients, return_internal_reference<>(), | ~~~~~~~~~~~~~~~~~~~~~ 1093 | "Returns the list of energy calibration coeficients.\n" | ~~~~~~~~~~~ 1094 | "Will only be empty for SpecUtils.EnergyCalType.InvalidEquationType." ) | ~~~~~~~~~~~~~~~ 1095 | // TODO: I think we should put a wrapper around channel_energies, and return a proper python list | ~~~~~~~~~~~~~~~~~~~~~ 1096 | .def( "channelEnergies", &SpecUtils::EnergyCalibration::channel_energies, return_internal_reference<>(), | ~~~~~~~~~~~~~~~~~~~~~~~~ 1097 | "Returns lower channel energies; will have one more entry than the number of channels." ) | ~~~~~~~~~~~~~~~~~~~~~ 1098 | .def( "deviationPairs", &SpecUtils::EnergyCalibration::deviation_pairs, return_internal_reference<>() ) | ~~~~~~~~~~~~~~~~~~~~~~~ 1099 | .def( "numChannels", &SpecUtils::EnergyCalibration::num_channels, | ~~~~~~~~~~~~~ 1100 | "Returns the number of channels this energy calibration is for." ) | ~~~~~~~~~~~~~~ 1101 | .def( "channelForEnergy", &SpecUtils::EnergyCalibration::channel_for_energy, | ~~~~~~~~~~~~~~~~ 1102 | "Returns channel number (as a double) for the specified energy." ) | ~~~~~~~~~~~~~~ 1103 | .def( "energyForChannel", &SpecUtils::EnergyCalibration::energy_for_channel, | ~~~~~~~~~~~~~~~~ 1104 | "Returns energy for the specified (as double) channel number." ) | ~~~~~~~~~~~~~~~~ 1105 | .def( "lowerEnergy", &SpecUtils::EnergyCalibration::lower_energy, | ~~~~~~~~~~~~~ 1106 | "Returns lowest energy of this energy calibration." ) | ~~~~~~~~~~~~~ 1107 | .def( "upperEnergy", &SpecUtils::EnergyCalibration::upper_energy, | ~~~~~~~~~~~~~ 1108 | "Returns highest energy of this energy calibration." ) | ~~~~~~~~~~~~~~ 1109 | .def( "setPolynomial", &SpecUtils::EnergyCalibration::set_polynomial, | ~~^~~~~~~~~~~~~~~ 1110 | args( "NumChannels", "Coeffiecients", "DeviationPairs" ), | ~~~~~~~~~~~~~ 1111 | "Sets the energy calibration information from Polynomial defined coefficents." ) | ~~~~~~~~~~~~~~~~ make[2]: [CMakeFiles/SpecUtils.dir/build.make:524: CMakeFiles/SpecUtils.dir/bindings/python/SpecFile_py.cpp.o] Error 1 make[1]: [CMakeFiles/Makefile2:83: CMakeFiles/SpecUtils.dir/all] Error 2 make: *** [Makefile:91: all] Error 2

It seems to me that there are no args() method in the present version of Boost.python or the one I use; indeed, it was alread deprecated in the oldest version that we can read its documentation....

How can we fix this? (I'm sorry at present I don't find the resolution)

Kazuyoshi

wcjohns commented 1 year ago

Dr. Furutaka,

Thank you for reporting this - and sorry you hit this issue!

This looks to maybe be caused by the recent commit, 81e418f4be63439f62f866b78a8575be07c369b9, where I added an overloaded function, EnergyCalibration::set_polynomial, which then caused the function resolution inside boost python to become confused over which version of the function to use.

Commit 053b85e244b00bb07c1afec16faa877eb5a6d5e5 should hopefully fix this issue; it also updated a few other minor things lagging in the Python bindings.

It would be appreciated if you could let me know if this fixes your issue.

FWIW, I have recently been working on a CI/CD setup for InterSpec, and plan to do it for this library next, to hopefully automatically catch these type of issues.

-will

furutaka commented 1 year ago

Dear Dr. Johnson,

Commit 053b85e should hopefully fix this issue; it also updated a few other minor things lagging in the Python bindings.

It would be appreciated if you could let me know if this fixes your issue.

Thanks! With the commit, I could compile the library (log attached). Then, my guess that the failure was caused by the use of deprecated method seems to totally miss the point... Anyway, now I will start using it.

By the way, is it possible to get files that are used in bindings/python/test_python.py (say, "Cal.pcf") to learn how to use the library?

Thanks again... Kazuyoshi make.log

wcjohns commented 1 year ago

I'm glad this worked for you.

I couldnt add the Cal.pcf file I was using, but I did just make some small changes so it will work with passthrough.n42 that is available with InterSpec.

Note I also made a few other small changes, so you would need to recompile the C++ as well.