diff --git a/inc/LauDecayTimeResolution.hh b/inc/LauDecayTimeResolution.hh index efafa63..ead1ff1 100644 --- a/inc/LauDecayTimeResolution.hh +++ b/inc/LauDecayTimeResolution.hh @@ -1,332 +1,327 @@ /* Copyright 2021 University of Warwick Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ /* Laura++ package authors: John Back Paul Harrison Thomas Latham */ /*! \file LauDecayTimeResolution.hh \brief File containing declaration of LauDecayTimeResolution class. */ #ifndef LAU_DECAYTIME_RESOLUTION #define LAU_DECAYTIME_RESOLUTION #include "LauAbsRValue.hh" #include "LauJsonTools.hh" #include "Rtypes.h" #include "TString.h" #include #include #include #include #include /*! \class LauDecayTimeResolution \brief Class for defining the model for decay time resolution */ class LauDecayTimeResolution final { public: /*! \enum ScalingType \brief Define the types of per-event error scaling that can be performed */ enum class ScalingType { None, //!< No scaling is performed Global, //!< All means and widths are scaled PerGaussian, //!< Scaling is enabled/disabled for each Gaussian PerParameter //!< Scaling is enabled/disabled for individual parameters }; //! Constructor /*! \param nGauss the number of Gaussians in the resolution model \param resolutionParams the parameters of the resolution model \param scale if true all means and widths are scaled by per-event decay time error, if false none are scaled */ LauDecayTimeResolution( const std::size_t nGauss, std::vector> resolutionParams, const bool scale = false ); //! Constructor /*! \param nGauss the number of Gaussians in the resolution model \param resolutionParams the parameters of the resolution model \param scale for each Gaussian, if true its mean and width are both scaled by per-event decay time error, if false neither are scaled */ LauDecayTimeResolution( const std::size_t nGauss, std::vector> resolutionParams, const std::vector& scale ); //! Constructor /*! \param nGauss the number of Gaussians in the resolution model \param resolutionParams the parameters of the resolution model \param scaleMeans for each Gaussian, if true its mean is scaled by per-event decay time error, if false its mean is not scaled \param scaleWidths for each Gaussian, if true its width is scaled by per-event decay time error, if false its width is not scaled */ LauDecayTimeResolution( const std::size_t nGauss, std::vector> resolutionParams, const std::vector& scaleMeans, const std::vector& scaleWidths ); //! Retrieve the parameters of the resolution model so that they can be loaded into a fit /*! \return the parameters of the resolution model */ std::vector getParameters() { return params_; } //! Retrieve the number of Gaussians in the model /*! \return the number of Gaussians */ const std::size_t& nGauss() const { return nGauss_; } //! Retrieve the scaling type /*! \return the scaling type */ ScalingType getScalingType() const { return scalingType_; } //! Retrieve whether any of the parameters of the resolution function scaled by the per-event error /*! \return whether scaling or not */ bool scaleWithPerEventError() const { return scaleWithPerEventError_; } //! Retrieve whether the mean of each Gaussian is scaled by the per-event decay time error /*! \return the mean scaling flags */ const std::vector& scaleMeans() const { return scaleMeans_; } //! Retrieve whether the width of each Gaussian is scaled by the per-event decay time error /*! \return the width scaling flags */ const std::vector& scaleWidths() const { return scaleWidths_; } //! Retrieve the up-to-date values of the means /*! \return the mean values */ const std::vector& getMeanValues() const { return meanVals_; } //! Retrieve the up-to-date values of the widths /*! \return the width values */ const std::vector& getWidthValues() const { return widthVals_; } //! Retrieve the up-to-date values of the fractions /*! \return the fraction values */ const std::vector& getFractionValues() const { return fractionVals_; } //! Retrieve whether any of the parameter values have changed in the last fit iteration /*! \return the any param changed flag */ const bool& anythingChanged() const { return anythingChanged_; } //! Initialise the parameter cache /*! Must be called prior to starting fitting or generation */ void initialise(); //! Propagate any updates to parameters and recalculate information as neeeded /*! Should be called at each fit iteration */ void propagateParUpdates(); //! Construct a collection of resolution model objects based on values read from a JSON value /*! The JSON value should be an Object, which must contain the following elements: - "parameters", an Array, which contains an Object for each parameter of the models to be constructed - "signalModel", an Object, which contains: + "nGauss", a Number_Unsigned to specify the number of Gaussian functions in the model + "scalingType", a String to specify the scaling type (must match a state of ScalingType) + "parameters", an Array of Strings that specifies the parameters from the top-level "parameters" Array to be used to build the signal model - "backgroundModels", an Array, which contains Objects for each background component, each of which contain: + "name", a String specifying the background component name + "model", an Object to define the model (definition as per the "signalModel" entry above) \param [in] j the JSON value to deserialise \return the collection of newly constructed models */ static std::map> readFromJson( const nlohmann::json& j ); //! Construct a collection of resolution model objects based on values read from a JSON file /*! The JSON value structure is as defined in readFromJson(nlohmann::json) \param [in] fileName the name of the file from which the JSON should be read \param [in] elementName the optional name of the JSON element that contains the definitions (defaults to using the root record) \return the collection of newly constructed models */ static std::map> readFromJson( const TString& fileName, const TString& elementName = "" ); //! Write a collection of physics model objects to a JSON file /*! \tparam ResModelPtr a pointer-like type that points to LauDecayTimeResolution objects \param [in] models the collection of models to be written out \param [in] fileName the name of the file to which the JSON should be written \param [in] elementName the (optional) name of the JSON element to which the coefficients should be written \param [in] append if true, append the spline to the existing JSON within the file - if using this option it is then mandatory to provide elementName \param [in] indent the indentation level to use in the output in number of spaces (defaults to 4) */ template static void writeToJson( const std::map& models, const TString& fileName, const TString& elementName = "", const bool append = false, const int indent = 4 ); //! Retrieve the specified parameter /*! \param [in] parName the parameter to retrieve */ const LauAbsRValue* findParameter(const TString& parName) const; //! Retrieve the specified parameter /*! \param [in] parName the parameter to retrieve */ LauAbsRValue* findParameter(const TString& parName); private: //! Resize the internal vectors to match nGauss_ void resizeVectors(); //! Do an initial sanity check of our setup void checkSetup(); //! Update the cached parameter values void updateParameterCache(); //! Read the resolution model part of the JSON serialisation /*! \param [in] j the JSON value from which to read the model \param [in] parameters the collection of parameters, some of which should be used to construct the model \return the newly constructed signal model */ static std::unique_ptr readResolutionModelFromJson( const nlohmann::json& j, std::vector>& parameters ); //! Read the background models part of the JSON serialisation /*! \param [in] j the JSON value from which to read the model \param [in] parameters the collection of parameters, which should be used to construct the models \return the newly constructed background models */ static std::map> readBackgroundModelsFromJson( const nlohmann::json& j, std::vector>& parameters ); + //! Write this model to JSON objects + /*! + \param [in,out] model the JSON record to which to write this model + \param [in,out] parameters the JSON record to which to write the parameters + */ + void serialiseToJson( nlohmann::json& model, nlohmann::json& parameters ) const; + //! The number of Gaussians in the resolution function const std::size_t nGauss_; //! Are any of the parameters of the resolution function scaled by the per-event error? const bool scaleWithPerEventError_{false}; //! Scale the mean of each Gaussian by the per-event decay time error? const std::vector scaleMeans_; //! Scale the width of each Gaussian by the per-event decay time error? const std::vector scaleWidths_; //! Scaling type - const ScalingType scalingType_; + const ScalingType scalingType_{ScalingType::None}; //! Store of all parameters of the resolution function std::vector> paramsOwned_; //! Store of all parameters of the resolution function std::vector params_; //! Fraction parameter for each Gaussian in the resolution function std::vector fractions_; //! Mean parameter for each Gaussian in the resolution function std::vector means_; //! Width parameter for each Gaussian in the resolution function std::vector widths_; //! Fraction of each Gaussian in the resolution function std::vector fractionVals_; //! Mean of each Gaussian in the resolution function std::vector meanVals_; //! Width of each Gaussian in the resolution function std::vector widthVals_; //! Is any parameter floating in the fit? bool anythingFloating_{false}; //! Has any floating parameter changed in the last fit iteration? bool anythingChanged_{false}; ClassDef(LauDecayTimeResolution, 0) }; //! \cond DOXYGEN_IGNORE // map LauDecayTimeResolution::ScalingType values to JSON as strings NLOHMANN_JSON_SERIALIZE_ENUM( LauDecayTimeResolution::ScalingType, { {LauDecayTimeResolution::ScalingType::None, "None"}, {LauDecayTimeResolution::ScalingType::Global, "Global"}, {LauDecayTimeResolution::ScalingType::PerGaussian, "PerGaussian"}, {LauDecayTimeResolution::ScalingType::PerParameter, "PerParameter"}, }) //! \endcond DOXYGEN_IGNORE template void LauDecayTimeResolution::writeToJson( const std::map& models, const TString& fileName, const TString& elementName, const bool append, const int indent ) { using nlohmann::json; // Check for a signal model auto iter { models.find("signal") }; if ( iter == models.end() ) { std::cerr << "ERROR in LauDecayTimeResolution::writeToJson : cannot locate the signal model in the collection, aborting" << std::endl; return; } json j; json& parameters = j["parameters"] = json::array(); json& signalModel = j["signalModel"] = json::object(); json& backgroundModels = j["backgroundModels"] = json::array(); for ( const auto& [ name, model ] : models ) { if ( name == "signal" ) { - signalModel["scalingType"] = model->getScalingType(); - signalModel["nGauss"] = model->nGauss(); - json& sigPars = signalModel["parameters"] = json::array(); - for ( auto par : model->getParameters() ) { - sigPars.push_back( par->name() ); - parameters.push_back( *par ); - } + model->serialiseToJson( signalModel, parameters ); } else { json modelDef = json::object(); modelDef["name"] = name; json& bkgndModel = modelDef["model"] = json::object(); - bkgndModel["scalingType"] = model->getScalingType(); - bkgndModel["nGauss"] = model->nGauss(); - json& bkgndPars = bkgndModel["parameters"] = json::array(); - for ( auto par : model->getParameters() ) { - bkgndPars.push_back( par->name() ); - parameters.push_back( *par ); - } + model->serialiseToJson( bkgndModel, parameters ); backgroundModels.push_back( modelDef ); } } const bool writeOK { LauJsonTools::writeJsonFile( j, fileName.Data(), elementName.Data(), append, indent ) }; if ( ! writeOK ) { std::cerr << "ERROR in LauDecayTimePhysicsModel::writeToJson : could not successfully write to file \"" << fileName << std::endl; } } #endif diff --git a/src/LauDecayTimeResolution.cc b/src/LauDecayTimeResolution.cc index 4ca371d..7ac1887 100644 --- a/src/LauDecayTimeResolution.cc +++ b/src/LauDecayTimeResolution.cc @@ -1,349 +1,372 @@ /* Copyright 2021 University of Warwick Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ /* Laura++ package authors: John Back Paul Harrison Thomas Latham */ /*! \file LauDecayTimeResolution.cc \brief File containing implementation of LauDecayTimeResolution class. */ #include #include #include #include #include "TString.h" #include "TSystem.h" #include "LauAbsRValue.hh" #include "LauDecayTimeResolution.hh" ClassImp(LauDecayTimeResolution); LauDecayTimeResolution::LauDecayTimeResolution( const std::size_t nGauss, std::vector> resolutionParams, const bool scale ) : nGauss_{nGauss}, scaleWithPerEventError_{scale}, scaleMeans_(nGauss_,scale), scaleWidths_(nGauss_,scale), scalingType_{scaleWithPerEventError_ ? ScalingType::Global : ScalingType::None}, paramsOwned_{std::move(resolutionParams)} { this->checkSetup(); } LauDecayTimeResolution::LauDecayTimeResolution( const std::size_t nGauss, std::vector> resolutionParams, const std::vector& scale ) : nGauss_{nGauss}, scaleWithPerEventError_( std::accumulate( scale.begin(), scale.end(), false, std::logical_or() ) ), scaleMeans_{scale}, scaleWidths_{scale}, scalingType_{scaleWithPerEventError_ ? ScalingType::PerGaussian : ScalingType::None}, paramsOwned_{std::move(resolutionParams)} { this->checkSetup(); } LauDecayTimeResolution::LauDecayTimeResolution( const std::size_t nGauss, std::vector> resolutionParams, const std::vector& scaleMeans, const std::vector& scaleWidths ) : nGauss_{nGauss}, scaleWithPerEventError_( std::accumulate( scaleMeans.begin(), scaleMeans.end(), false, std::logical_or() ) || std::accumulate( scaleWidths.begin(), scaleWidths.end(), false, std::logical_or() ) ), scaleMeans_{scaleMeans}, scaleWidths_{scaleWidths}, scalingType_{scaleWithPerEventError_ ? ScalingType::PerParameter : ScalingType::None}, paramsOwned_{std::move(resolutionParams)} { this->checkSetup(); } void LauDecayTimeResolution::resizeVectors() { params_.resize( paramsOwned_.size() ); std::transform( paramsOwned_.begin(), paramsOwned_.end(), params_.begin(), [](std::unique_ptr& par){return par.get();} ); fractions_.assign( nGauss_-1, nullptr ); means_.assign( nGauss_, nullptr ); widths_.assign( nGauss_, nullptr ); fractionVals_.assign( nGauss_, 0.0 ); meanVals_.assign( nGauss_, 0.0 ); widthVals_.assign( nGauss_, 0.0 ); } void LauDecayTimeResolution::checkSetup() { if ( nGauss_ == 0 ) { std::cerr << "ERROR in LauDecayTimeResolution::checkSetup : number of Gaussians is zero!" << std::endl; gSystem->Exit(EXIT_FAILURE); } if ( scaleWithPerEventError_ ) { // if we're scaling by the per-event error, check that the scale vectors are the right length if ( scaleMeans_.size() != nGauss_ || scaleWidths_.size() != nGauss_ ) { std::cerr << "ERROR in LauDecayTimeResolution::checkSetup : number of Gaussians = " << nGauss_ << " but scale vectors are of length " << scaleMeans_.size() << " and " << scaleWidths_.size() << ", cannot continue!" << std::endl; gSystem->Exit(EXIT_FAILURE); } } this->resizeVectors(); const TString meanNameBase{"mean_"}; const TString sigmaNameBase{"sigma_"}; const TString fracNameBase{"frac_"}; bool foundParams{true}; for (std::size_t i{0}; i < nGauss_; ++i) { TString tempName{meanNameBase}; tempName += i; TString tempName2{sigmaNameBase}; tempName2 += i; TString tempName3{fracNameBase}; tempName3 += i; means_[i] = this->findParameter(tempName); foundParams &= (means_[i] != nullptr); widths_[i] = this->findParameter(tempName2); foundParams &= (widths_[i] != nullptr); if (i!=0) { fractions_[i-1] = this->findParameter(tempName3); foundParams &= (fractions_[i-1] != nullptr); } } if ( ! foundParams ) { std::cerr << "ERROR in LauDecayTimeResolution::checkSetup : decay time resolution function with " << nGauss_ << " Gaussians requires:\n"; std::cerr << " - 2 parameters per Gaussian (i): \"mean_i\" and \"sigma_i\"\n"; std::cerr << " - " << nGauss_-1 << " fractions: \"frac_i\", where i!=0" << std::endl; gSystem->Exit(EXIT_FAILURE); } } LauAbsRValue* LauDecayTimeResolution::findParameter(const TString& parName) { for ( LauAbsRValue* par : params_ ) { if ( par && par->name().Contains(parName) ) { return par; } } std::cerr << "ERROR in LauDecayTimeResolution::findParameter : Parameter \"" << parName << "\" not found." << std::endl; return nullptr; } const LauAbsRValue* LauDecayTimeResolution::findParameter(const TString& parName) const { for ( const LauAbsRValue* par : params_ ) { if ( par && par->name().Contains(parName) ) { return par; } } std::cerr << "ERROR in LauDecayTimeResolution::findParameter : Parameter \"" << parName << "\" not found." << std::endl; return nullptr; } void LauDecayTimeResolution::initialise() { anythingFloating_ = false; for ( std::size_t i{0}; i < nGauss_; ++i ) { const bool meanFloating { not means_[i]->fixed() }; const bool widthFloating { not widths_[i]->fixed() }; anythingFloating_ |= (meanFloating or widthFloating); std::cout << "INFO in LauDecayTimeResolution::initialise : mean[" << i << "] floating set to: " << (meanFloating ? "True" : "False") << std::endl; std::cout << "INFO in LauDecayTimeResolution::initialise : width[" << i << "] floating set to: " << (widthFloating ? "True" : "False") << std::endl; if ( i < (nGauss_ - 1) ) { const bool fracFloating { not fractions_[i]->fixed() }; anythingFloating_ |= fracFloating; std::cout << "INFO in LauDecayTimeResolution::initialise : fraction[" << i << "] floating set to: " << (fracFloating ? "True" : "False") << std::endl; } } this->updateParameterCache(); } void LauDecayTimeResolution::updateParameterCache() { static auto assignValue = [](const LauAbsRValue* par){return par->unblindValue();}; std::transform( means_.begin(), means_.end(), meanVals_.begin(), assignValue ); std::transform( widths_.begin(), widths_.end(), widthVals_.begin(), assignValue ); std::transform( fractions_.begin(), fractions_.end(), fractionVals_.begin()+1, assignValue ); fractionVals_[0] = std::accumulate( fractionVals_.begin()+1, fractionVals_.end(), 1.0, std::minus{} ); } void LauDecayTimeResolution::propagateParUpdates() { // If none of the parameters are floating there's nothing to do if ( not anythingFloating_ ) { return; } // Otherwise, determine whether any of the floating parameters have changed and act accordingly static auto checkEquality = [](const LauAbsRValue* par, const Double_t cacheVal){return par->unblindValue() == cacheVal;}; anythingChanged_ = false; anythingChanged_ |= not std::equal( means_.begin(), means_.end(), meanVals_.begin(), checkEquality ); anythingChanged_ |= not std::equal( widths_.begin(), widths_.end(), widthVals_.begin(), checkEquality ); anythingChanged_ |= not std::equal( fractions_.begin(), fractions_.end(), fractionVals_.begin()+1, checkEquality ); if ( anythingChanged_ ) { this->updateParameterCache(); } } std::map> LauDecayTimeResolution::readFromJson( const TString& fileName, const TString& elementName) { // NB deliberately not using uniform initialisation here because of this issue: // https://json.nlohmann.me/home/faq/#brace-initialization-yields-arrays const nlohmann::json j = LauJsonTools::readJsonFile( fileName.Data(), elementName.Data(), LauJsonTools::JsonType::Object ); if ( j.is_null() ) { if ( elementName != "" ) { std::cerr << "ERROR in LauDecayTimeResolution::readFromJson : unable to retrieve JSON object from element \"" << elementName << "\" in file \"" << fileName << "\"" << std::endl; } else { std::cerr << "ERROR in LauDecayTimeResolution::readFromJson : unable to retrieve JSON object from root element of file \"" << fileName << "\"" << std::endl; } return {}; } return readFromJson( j ); } std::map> LauDecayTimeResolution::readFromJson( const nlohmann::json& j ) { using JsonType = LauJsonTools::JsonType; // the object should have the following elements: // - an array of parameter objects // - an object for the signal model settings // - an array of background model settings const std::vector mandatoryElements { std::make_pair("parameters", JsonType::Array), std::make_pair("signalModel", JsonType::Object), std::make_pair("backgroundModels", JsonType::Array) }; if ( ! LauJsonTools::checkObjectElements( j, mandatoryElements ) ) { std::cerr << "ERROR in LauDecayTimeResolution::readFromJson : JSON object does not contain required elements: \"parameters\" (array), \"signalModel\" (object) and \"backgroundModels\" (array)" << std::endl; return {}; } auto parameters { LauAbsRValue::readFromJson( j.at("parameters") ) }; auto sigModel { readResolutionModelFromJson( j.at("signalModel"), parameters ) }; if ( ! sigModel ) { return {}; } auto backgroundModels { readBackgroundModelsFromJson( j.at("backgroundModels"), parameters ) }; if ( backgroundModels.size() != j.at("backgroundModels").size() ) { return {}; } backgroundModels.insert( std::make_pair( "signal", std::move(sigModel) ) ); return backgroundModels; } std::unique_ptr LauDecayTimeResolution::readResolutionModelFromJson( const nlohmann::json& j, std::vector>& parameters ) { using JsonType = LauJsonTools::JsonType; // the object should have the following elements: // - an unsigned integer specifying the number of Gaussians in the model // - a string representing the LauDecayTimeResolution::ScalingType function type // - an array of strings specifying the parameters we need const std::vector mandatoryElements { std::make_pair("nGauss", JsonType::Number_Unsigned), std::make_pair("scalingType", JsonType::String), std::make_pair("parameters", JsonType::Array) }; if ( ! LauJsonTools::checkObjectElements( j, mandatoryElements ) ) { std::cerr << "ERROR in LauDecayTimeResolution::readResolutionModelFromJson : JSON object from \"signalModel\" element does not contain required elements: \"nGauss\" (unsigned), \"scalingType\" (string) and \"parameters\" (array)" << std::endl; return {}; } auto nGauss { LauJsonTools::getValue( j, "nGauss" ) }; auto scalingType { LauJsonTools::getValue( j, "scalingType" ) }; auto parNames { LauJsonTools::getValue>( j, "parameters" ) }; std::vector> params; params.reserve( parNames.size() ); for ( const auto& name : parNames ) { auto iter { std::find_if( parameters.begin(), parameters.end(), [&name]( std::unique_ptr& par ){ return par->name() == name; } ) }; if ( iter == parameters.end() ) { const TString errMsg {"ERROR in LauDecayTimeResolution::readResolutionModelFromJson : Cannot locate parameter \"" + name + "\""}; throw LauJsonTools::InvalidJson{errMsg.Data()}; } params.emplace_back( std::move(*iter) ); parameters.erase(iter); } switch ( scalingType ) { case ScalingType::None : return std::make_unique( nGauss, std::move(params), false ); case ScalingType::Global : return std::make_unique( nGauss, std::move(params), true ); case ScalingType::PerGaussian : return std::make_unique( nGauss, std::move(params), LauJsonTools::getValue>( j, "scale" ) ); case ScalingType::PerParameter : return std::make_unique( nGauss, std::move(params), LauJsonTools::getValue>( j, "scaleMeans" ), LauJsonTools::getValue>( j, "scaleWidths" ) ); } // we shouldn't ever reach here return {}; } std::map> LauDecayTimeResolution::readBackgroundModelsFromJson( const nlohmann::json& j, std::vector>& parameters ) { using LauJsonTools::JsonType; using LauJsonTools::checkObjectElements; using LauJsonTools::getValue; // each object in the array should have the following elements: // - a string for the name of the background component // - an object defining the model const std::vector mandatoryElements { std::make_pair("name", JsonType::String), std::make_pair("model", JsonType::Object) }; for ( const auto& comp : j ) { if ( ! checkObjectElements( comp, mandatoryElements ) ) { std::cerr << "ERROR in LauDecayTimeResolution::readBackgroundModelsFromJson : JSON object in \"backgroundModels\" array does not contain required elements: \"name\" (string) and \"model\" (object)" << std::endl; return {}; } } std::map> models; for ( const auto& comp : j ) { auto name { getValue( comp, "name" ) }; models[name] = readResolutionModelFromJson( comp.at("model"), parameters ); } return models; } + +void LauDecayTimeResolution::serialiseToJson( nlohmann::json& model, nlohmann::json& parameters ) const +{ + using nlohmann::json; + + model["nGauss"] = nGauss_; + model["scalingType"] = scalingType_; + json& parNames = model["parameters"] = json::array(); + for ( auto& par : params_ ) { + parNames.push_back( par->name() ); + parameters.push_back( *par ); + } + switch ( scalingType_ ) { + case ScalingType::None : + case ScalingType::Global : + break; + case ScalingType::PerGaussian : + model["scale"] = scaleMeans_; + case ScalingType::PerParameter : + model["scaleMeans"] = scaleMeans_; + model["scaleWidths"] = scaleWidths_; + } +}