@@ -979,6 +979,17 @@ bool loadFromUri_wrapper(SpecUtils::SpecFile* info, py::object pystream) {
979979 info->set_parse_warnings ( remarks );
980980 }
981981
982+ py::list cal_channel_energies_wrapper ( const SpecUtils::EnergyCalibration *cal )
983+ {
984+ py::list l;
985+ if ( !cal->channel_energies () )
986+ return l;
987+
988+ for ( auto p : *cal->channel_energies () )
989+ l.append ( p );
990+ return l;
991+ }
992+
982993std::shared_ptr<SpecUtils::EnergyCalibration> energyCalFromPolynomial_wrapper ( const size_t num_channels,
983994 py::list py_coefs )
984995{
@@ -1373,9 +1384,8 @@ py::class_<SpecUtils::EnergyCalibration>(m, "EnergyCalibration")
13731384 .def ( " coefficients" , &SpecUtils::EnergyCalibration::coefficients, py::rv_policy::reference_internal,
13741385 " Returns the list of energy calibration coeficients.\n "
13751386 " Will only be empty for SpecUtils.EnergyCalType.InvalidEquationType." )
1376- // TODO: I think we should put a wrapper around channel_energies, and return a proper python list
1377- .def ( " channelEnergies" , &SpecUtils::EnergyCalibration::channel_energies, py::rv_policy::reference_internal,
1378- " Returns lower channel energies; will have one more entry than the number of channels." )
1387+ .def ( " channelEnergies" , &cal_channel_energies_wrapper,
1388+ " Returns lower channel energies; will have one more entry than the number of channels." )
13791389 .def ( " deviationPairs" , &SpecUtils::EnergyCalibration::deviation_pairs, py::rv_policy::reference_internal )
13801390 .def ( " numChannels" , &SpecUtils::EnergyCalibration::num_channels,
13811391 " Returns the number of channels this energy calibration is for." )
0 commit comments