From c8bb7ab8faded70d2b12e1b80636224295877abe Mon Sep 17 00:00:00 2001 From: MarieFayolle Date: Tue, 24 Sep 2024 11:23:46 +0200 Subject: [PATCH] re-introdouced deprecated functions for backward compatibility. --- .../orbit_determination/podInputOutputTypes.h | 539 ++++++++---------- .../orbitDeterminationTestCases.h | 27 - .../unitTestDesaturationDeltaVsEstimation.cpp | 7 - .../unitTestHybridArcStateEstimation.cpp | 5 - .../unitTestTimeBiasEstimation.cpp | 4 - ...nitTestVehicleReferencePointEstimation.cpp | 6 - ...tMultiArcMultiBodyVariationalEquations.cpp | 7 +- 7 files changed, 231 insertions(+), 364 deletions(-) diff --git a/include/tudat/astro/orbit_determination/podInputOutputTypes.h b/include/tudat/astro/orbit_determination/podInputOutputTypes.h index 9dd95d51c..bafe6fd1e 100644 --- a/include/tudat/astro/orbit_determination/podInputOutputTypes.h +++ b/include/tudat/astro/orbit_determination/podInputOutputTypes.h @@ -48,7 +48,7 @@ class CovarianceAnalysisInput saveDesignMatrix_( true ), printOutput_( true ) { - weightsMatrixDiagonals_ = observationCollection->getConcatenatedWeights( ); // getConcatenatedWeightVector( ); // Eigen::VectorXd::Zero( observationCollection->getTotalObservableSize( ) ); +// weightsMatrixDiagonals_ = observationCollection->getConcatenatedWeights( ); // setConstantWeightsMatrix( 1.0 ); considerParametersIncluded_ = false; @@ -60,311 +60,229 @@ class CovarianceAnalysisInput virtual ~CovarianceAnalysisInput( ){ } -// //! Function to set a constant values for all observation weights -// /*! -// * Function to set a constant values for all observation weights -// * \param constantWeight Constant weight that is to be set for all observations -// */ -// void setConstantWeightsMatrix( const double constantWeight = 1.0 ) -// { -// observationCollections_->setConstantWeight( constantWeight ); -// } -// -//// void setWeightsFromObservationCollection( ) -//// { -//// weightsMatrixDiagonals_ = observationCollection_->getConcatenatedWeightVector( ); // getWeightsFromSingleObservationSets( ); -//// } -// -// //! Set constant scalar weight for all observables of given type -// void setConstantSingleObservableWeights( -// const observation_models::ObservableType currentObservable, -// const double weight ) -// { -// std::map< observation_models::ObservableType, std::pair< int, int > > observationTypeStartAndSize = -// observationCollection_->getObservationTypeStartAndSize( ); -// -// if( observationTypeStartAndSize.count( currentObservable) == 0 ) -// { -// std::cerr<< "Warning when setting weights for data type "<< std::to_string( currentObservable) << ". " << -// " No data of given type found." < indicesToUse = observationTypeStartAndSize.at( currentObservable ); -// -// weightsMatrixDiagonals_.segment( indicesToUse.first, indicesToUse.second ) = -// Eigen::VectorXd::Constant( indicesToUse.second, weight ); -// } -// } -// -// //! Set constant vector weight for all observables of given type -// void setConstantSingleObservableVectorWeights( -// const observation_models::ObservableType currentObservable, -// const Eigen::VectorXd weight ) -// { -// std::map< observation_models::ObservableType, std::pair< int, int > > observationTypeStartAndSize = -// observationCollection_->getObservationTypeStartAndSize( ); -// -// if( observationTypeStartAndSize.count( currentObservable) == 0 ) -// { -// std::cerr<< "Warning when setting weights for data type "<< std::to_string( currentObservable) << ". " << -// " No data of given type found." < indicesToUse = observationTypeStartAndSize.at( currentObservable ); -// -// int observableSize = observation_models::getObservableSize( currentObservable ); -// if( observableSize != weight.rows( ) ) -// { -// throw std::runtime_error( "Error when setting weight vector for observable, size should be " + -// std::to_string( observableSize ) + " but is " + std::to_string( weight.rows( ) ) ); -// } -// int numberOfObservations = indicesToUse.second / observableSize; -// -// weightsMatrixDiagonals_.segment( indicesToUse.first, indicesToUse.second ) = -// utilities::getSuccesivelyConcatenatedVector( weight, numberOfObservations ); -// } -// } -// -// //! Set constant scalar weight for all observables of given type and link ends -// void setConstantSingleObservableAndLinkEndsWeights( -// const observation_models::ObservableType currentObservable, -// const observation_models::LinkEnds currentLinkEnds, -// const double weight ) -// { -//// std::map< observation_models::ObservableType, -//// std::map< observation_models::LinkEnds, std::pair< int, int > > > observationLinkEndStartAndSize = -//// observationCollection_->getObservationTypeAndLinkEndStartAndSize( ); -//// -//// if( observationLinkEndStartAndSize.count( currentObservable) == 0 ) -//// { -//// std::cerr<< "Warning when setting weights for data type "<< std::to_string( currentObservable) << ". " << -//// " No data of given type found." < indicesToUse = observationLinkEndStartAndSize.at( currentObservable ).at( currentLinkEnds ); -//// weightsMatrixDiagonals_.segment( indicesToUse.first, -//// indicesToUse.second ) = -//// Eigen::VectorXd::Constant( indicesToUse.second, weight ); -//// } -// observationCollection_->setConstantWeightPerObservable( observationParser( std::vector< std::shared_ptr< observation_models::ObservationCollectionParser > >( -// { observationParser( currentObservable ), observationParser( currentLinkEnds ) } ) ), weight ); -// } + //! Function to set a constant values for all observation weights + /*! + * Function to set a constant values for all observation weights + * \param constantWeight Constant weight that is to be set for all observations + */ + void setConstantWeightsMatrix( const double constantWeight = 1.0 ) + { + observationCollection_->setConstantWeight( constantWeight ); + } -// //! Set constant vector weight for all observables of given type and link ends -// void setConstantSingleObservableAndLinkEndsVectorWeights( -// const observation_models::ObservableType currentObservable, -// const observation_models::LinkEnds currentLinkEnds, -// const Eigen::VectorXd weight ) -// { -//// std::map< observation_models::ObservableType, -//// std::map< observation_models::LinkEnds, std::pair< int, int > > > observationLinkEndStartAndSize = -//// observationCollection_->getObservationTypeAndLinkEndStartAndSize( ); -//// -//// if( observationLinkEndStartAndSize.count( currentObservable) == 0 ) -//// { -//// std::cerr<< "Warning when setting weights for data type "<< std::to_string( currentObservable) << ". " << -//// " No data of given type found." < indicesToUse = -//// observationLinkEndStartAndSize.at( currentObservable ).at( currentLinkEnds ); -//// -//// int observableSize = observation_models::getObservableSize( currentObservable ); -//// if( observableSize != weight.rows( ) ) -//// { -//// throw std::runtime_error( "Error when setting weight vector for observable, size should be " + -//// std::to_string( observableSize ) + " but is " + std::to_string( weight.rows( ) ) ); -//// } -//// int numberOfObservations = indicesToUse.second / observableSize; -//// -//// -//// weightsMatrixDiagonals_.segment( indicesToUse.first, -//// indicesToUse.second ) = -//// utilities::getSuccesivelyConcatenatedVector( weight, numberOfObservations ); -//// } -// observationCollection_->setConstantWeightPerObservable( observationParser( std::vector< std::shared_ptr< observation_models::ObservationCollectionParser > >( -// { observationParser( currentObservable ), observationParser( currentLinkEnds ) } ) ), weight ); -// } -// -// //! Set constant vector weight for alweightsMatrixDiagonals_l observables of given type and link ends -// void setTabulatedSingleObservableAndLinkEndsWeights( -// const observation_models::ObservableType currentObservable, -// const observation_models::LinkEnds currentLinkEnds, -// const Eigen::VectorXd weight ) -// { -//// std::map< observation_models::ObservableType, -//// std::map< observation_models::LinkEnds, std::pair< int, int > > > observationLinkEndStartAndSize = -//// observationCollection_->getObservationTypeAndLinkEndStartAndSize( ); -//// -//// if( observationLinkEndStartAndSize.count( currentObservable) == 0 ) -//// { -//// std::cerr<< "Warning when setting weights for data type "<< std::to_string( currentObservable) << ". " << -//// " No data of given type found." < indicesToUse = -//// observationLinkEndStartAndSize.at( currentObservable ).at( currentLinkEnds ); -//// -//// if( indicesToUse.second != weight.rows( ) ) -//// { -//// throw std::runtime_error( "Error when setting total weight vector for observable and link ends, size should be " + -//// std::to_string( indicesToUse.second ) + " but is " + std::to_string( weight.rows( ) ) ); -//// } -//// -//// weightsMatrixDiagonals_.segment( indicesToUse.first, -//// indicesToUse.second ) = weight; -//// } -// -// observationCollection_->setTabulatedWeights( observationParser( std::vector< std::shared_ptr< observation_models::ObservationCollectionParser > >( -// { observationParser( currentObservable ), observationParser( currentLinkEnds ) } ) ), weight ); -// } -// -// -// //! Function to set a values for observation weights, constant per observable type -// /*! -// * Function to set a values for observation weights, constant per observable type -// * \param weightPerObservable Values for observation weights, constant per observable type -// */ -// void setConstantPerObservableWeightsMatrix( -// const std::map< observation_models::ObservableType, double > weightPerObservable ) -// { -// std::map< std::shared_ptr< observation_models::ObservationCollectionParser >, double > weightsPerObservationParser; -// for( auto observableIt : weightPerObservable ) -// { -// weightsPerObservationParser[ observationParser( observableIt.first ) ] = observableIt.second; -// } -// observationCollection_->setConstantWeightPerObservable( weightsPerObservationParser ); -// } -//// -// void setConstantPerObservableVectorWeightsMatrix( -// const std::map< observation_models::ObservableType, Eigen::VectorXd > weightPerObservable ) -// { -// std::map< std::shared_ptr< observation_models::ObservationCollectionParser >, Eigen::VectorXd > weightsPerObservationParser; -// for( auto observableIt : weightPerObservable ) -// { -// weightsPerObservationParser[ observationParser( observableIt.first ) ] = observableIt.second; -// } -// observationCollection_->setConstantWeightPerObservable( weightsPerObservationParser ); -// } + //! Set constant scalar weight for all observables of given type + void setConstantSingleObservableWeights( + const observation_models::ObservableType currentObservable, + const double weight ) + { + std::cerr << "Warning, function setConstantSingleObservableWeights is deprecated, " + "weights should preferably be defined at the observation collection level."; -// //! Function to set a values for observation weights, constant per observable type and link ends type -// /*! -// * Function to set a values for observation weights, constant per observable type and link ends type -// * \param weightPerObservableAndLinkEnds Values for observation weights, constant per observable type and link ends type -// */ -// void setConstantPerObservableAndLinkEndsWeights( -// const std::map< observation_models::ObservableType, -// std::map< observation_models::LinkEnds, double > > weightPerObservableAndLinkEnds ) -// { -// std::map< std::shared_ptr< observation_models::ObservationCollectionParser >, double > weightPerObservationParser; -// for ( auto observableIt : weightPerObservableAndLinkEnds ) -// { -// for ( auto linkEndsIt : observableIt.second ) -// { -// weightPerObservationParser[ observationParser( std::vector< std::shared_ptr< observation_models::ObservationCollectionParser > >( -// { observationParser( observableIt.first ), observationParser( linkEndsIt.first ) } ) ) ] = linkEndsIt.second; -// } -// } -// observationCollection_->setConstantWeightPerObservable( weightPerObservationParser ); -// } -// -// void setConstantPerObservableAndLinkEndsVectorWeights( -// const std::map< observation_models::ObservableType, -// std::map< observation_models::LinkEnds, Eigen::VectorXd > > weightPerObservableAndLinkEnds ) -// { -// std::map< std::shared_ptr< observation_models::ObservationCollectionParser >, Eigen::VectorXd > weightPerObservationParser; -// for ( auto observableIt : weightPerObservableAndLinkEnds ) -// { -// for ( auto linkEndsIt : observableIt.second ) -// { -// weightPerObservationParser[ observationParser( std::vector< std::shared_ptr< observation_models::ObservationCollectionParser > >( -// { observationParser( observableIt.first ), observationParser( linkEndsIt.first ) } ) ) ] = linkEndsIt.second; -// } -// } -// observationCollection_->setConstantWeightPerObservable( weightPerObservationParser ); -// } + std::map< observation_models::ObservableType, std::pair< int, int > > observationTypeStartAndSize = + observationCollection_->getObservationTypeStartAndSize( ); + if( observationTypeStartAndSize.count( currentObservable) == 0 ) + { + std::cerr<< "Warning when setting weights for data type "<< std::to_string( currentObservable) << ". " << + " No data of given type found." <setConstantWeight( weight, observationParser( currentObservable ) ); + } + } -// void setConstantPerObservableAndLinkEndsWeights( -// const observation_models::ObservableType observableType, -// const std::vector< observation_models::LinkEnds >& linkEnds, -// const double weight ) -// { -// std::map< observation_models::ObservableType, std::map< observation_models::LinkEnds, double > > weightPerObservableAndLinkEnds; -// for( unsigned int i = 0; i < linkEnds.size( ); i++ ) -// { -// weightPerObservableAndLinkEnds[ observableType ][ linkEnds.at( i ) ] = weight; -// } -// setConstantPerObservableAndLinkEndsWeights( weightPerObservableAndLinkEnds ); -// } -// -// void setConstantPerObservableAndLinkEndsVectorWeights( -// const observation_models::ObservableType observableType, -// const std::vector< observation_models::LinkEnds >& linkEnds, -// const Eigen::VectorXd weight ) -// { -// std::map< observation_models::ObservableType, std::map< observation_models::LinkEnds, Eigen::VectorXd > > weightPerObservableAndLinkEnds; -// for( unsigned int i = 0; i < linkEnds.size( ); i++ ) -// { -// weightPerObservableAndLinkEnds[ observableType ][ linkEnds.at( i ) ] = weight; -// } -// setConstantPerObservableAndLinkEndsVectorWeights( weightPerObservableAndLinkEnds ); -// } -// -// void setTabulatedPerObservableAndLinkEndsWeights( -// const std::map< observation_models::ObservableType, -// std::map< observation_models::LinkEnds, Eigen::VectorXd > > weightsPerObservableAndLinkEnds ) -// { -// std::map< observation_models::ObservationCollectionParser, Eigen::VectorXd > weightPerObservableParser; -// for ( auto observableIt : weightsPerObservableAndLinkEnds ) -// { -// for ( auto linkEndsIt : observableIt.second ) -// { -// weightPerObservableParser[ observationParser( std::vector< std::shared_ptr< observation_models::ObservationCollectionParser > >( { -// observationParser( observableIt.first ), observationParser( linkEndsIt.first ) } ) ) ] = linkEndsIt.second; -// } -// } -// observationCollection_->setTabulatedWeights( weightPerObservableParser ); -// } -// -// void setTabulatedPerObservableAndLinkEndsWeights( -// const observation_models::ObservableType observableType, -// const std::vector< observation_models::LinkEnds >& linkEnds, -// const Eigen::VectorXd weights ) -// { -// std::map< observation_models::ObservableType, std::map< observation_models::LinkEnds, Eigen::VectorXd > > weightsPerObservableAndLinkEnds; -// for( unsigned int i = 0; i < linkEnds.size( ); i++ ) -// { -// weightsPerObservableAndLinkEnds[ observableType ][ linkEnds.at( i ) ] = weights; -// } -// setTabulatedPerObservableAndLinkEndsWeights( weightsPerObservableAndLinkEnds ); -// -// std::shared_ptr< observation_models::ObservationCollectionParser > parser = observationParser( -// std::vector< std::shared_ptr< observation_models::ObservationCollectionParser > >( { observationParser( observableType ), observationParser( linkEnds ) } ) ); -// observationCollection_->setTabulatedWeights( parser, weights ); -// } + //! Set constant vector weight for all observables of given type + void setConstantSingleObservableVectorWeights( + const observation_models::ObservableType currentObservable, + const Eigen::VectorXd weight ) + { + std::cerr << "Warning, function setConstantSingleObservableVectorWeights is deprecated, " + "weights should preferably be defined at the observation collection level."; + + std::map< observation_models::ObservableType, std::pair< int, int > > observationTypeStartAndSize = + observationCollection_->getObservationTypeStartAndSize( ); + if( observationTypeStartAndSize.count( currentObservable) == 0 ) + { + std::cerr<< "Warning when setting weights for data type "<< std::to_string( currentObservable) << ". " << + " No data of given type found." <setConstantWeight( weight, observationParser( currentObservable ) ); + } + } + + //! Set constant scalar weight for all observables of given type and link ends + void setConstantSingleObservableAndLinkEndsWeights( + const observation_models::ObservableType currentObservable, + const observation_models::LinkEnds currentLinkEnds, + const double weight ) + { + std::cerr << "Warning, function setConstantSingleObservableAndLinkEndsWeights is deprecated, " + "weights should preferably be defined at the observation collection level."; + observationCollection_->setConstantWeightPerObservable( observationParser( std::vector< std::shared_ptr< observation_models::ObservationCollectionParser > >( + { observationParser( currentObservable ), observationParser( currentLinkEnds ) } ) ), weight ); + } + + //! Set constant vector weight for all observables of given type and link ends + void setConstantSingleObservableAndLinkEndsVectorWeights( + const observation_models::ObservableType currentObservable, + const observation_models::LinkEnds currentLinkEnds, + const Eigen::VectorXd weight ) + { + std::cerr << "Warning, function setConstantSingleObservableAndLinkEndsVectorWeights is deprecated, " + "weights should preferably be defined at the observation collection level."; + observationCollection_->setConstantWeightPerObservable( observationParser( std::vector< std::shared_ptr< observation_models::ObservationCollectionParser > >( + { observationParser( currentObservable ), observationParser( currentLinkEnds ) } ) ), weight ); + } + + //! Set constant vector weight for all observables of given type and link ends + void setTabulatedSingleObservableAndLinkEndsWeights( + const observation_models::ObservableType currentObservable, + const observation_models::LinkEnds currentLinkEnds, + const Eigen::VectorXd weight ) + { + std::cerr << "Warning, function setTabulatedSingleObservableAndLinkEndsWeights is deprecated, " + "weights should preferably be defined at the observation collection level."; + observationCollection_->setTabulatedWeights( observationParser( std::vector< std::shared_ptr< observation_models::ObservationCollectionParser > >( + { observationParser( currentObservable ), observationParser( currentLinkEnds ) } ) ), weight ); + } + + + //! Function to set a values for observation weights, constant per observable type + /*! + * Function to set a values for observation weights, constant per observable type + * \param weightPerObservable Values for observation weights, constant per observable type + */ + void setConstantPerObservableWeightsMatrix( + const std::map< observation_models::ObservableType, double > weightPerObservable ) + { + std::cerr << "Warning, function setConstantPerObservableWeightsMatrix is deprecated, " + "weights should preferably be defined at the observation collection level."; + std::map< std::shared_ptr< observation_models::ObservationCollectionParser >, double > weightsPerObservationParser; + for( auto observableIt : weightPerObservable ) + { + weightsPerObservationParser[ observationParser( observableIt.first ) ] = observableIt.second; + } + observationCollection_->setConstantWeightPerObservable( weightsPerObservationParser ); + } + + void setConstantPerObservableVectorWeightsMatrix( + const std::map< observation_models::ObservableType, Eigen::VectorXd > weightPerObservable ) + { + std::cerr << "Warning, function setConstantPerObservableVectorWeightsMatrix is deprecated, " + "weights should preferably be defined at the observation collection level."; + std::map< std::shared_ptr< observation_models::ObservationCollectionParser >, Eigen::VectorXd > weightsPerObservationParser; + for( auto observableIt : weightPerObservable ) + { + weightsPerObservationParser[ observationParser( observableIt.first ) ] = observableIt.second; + } + observationCollection_->setConstantWeightPerObservable( weightsPerObservationParser ); + } + + //! Function to set a values for observation weights, constant per observable type and link ends type + /*! + * Function to set a values for observation weights, constant per observable type and link ends type + * \param weightPerObservableAndLinkEnds Values for observation weights, constant per observable type and link ends type + */ + void setConstantPerObservableAndLinkEndsWeights( + const std::map< observation_models::ObservableType, + std::map< observation_models::LinkEnds, double > > weightPerObservableAndLinkEnds ) + { + std::cerr << "Warning, function setConstantPerObservableAndLinkEndsWeights is deprecated, " + "weights should preferably be defined at the observation collection level."; + std::map< std::shared_ptr< observation_models::ObservationCollectionParser >, double > weightPerObservationParser; + for ( auto observableIt : weightPerObservableAndLinkEnds ) + { + for ( auto linkEndsIt : observableIt.second ) + { + weightPerObservationParser[ observationParser( std::vector< std::shared_ptr< observation_models::ObservationCollectionParser > >( + { observationParser( observableIt.first ), observationParser( linkEndsIt.first ) } ) ) ] = linkEndsIt.second; + } + } + observationCollection_->setConstantWeightPerObservable( weightPerObservationParser ); + } + + void setConstantPerObservableAndLinkEndsVectorWeights( + const std::map< observation_models::ObservableType, + std::map< observation_models::LinkEnds, Eigen::VectorXd > > weightPerObservableAndLinkEnds ) + { + std::cerr << "Warning, function setConstantPerObservableAndLinkEndsVectorWeights is deprecated, " + "weights should preferably be defined at the observation collection level."; + std::map< std::shared_ptr< observation_models::ObservationCollectionParser >, Eigen::VectorXd > weightPerObservationParser; + for ( auto observableIt : weightPerObservableAndLinkEnds ) + { + for ( auto linkEndsIt : observableIt.second ) + { + weightPerObservationParser[ observationParser( std::vector< std::shared_ptr< observation_models::ObservationCollectionParser > >( + { observationParser( observableIt.first ), observationParser( linkEndsIt.first ) } ) ) ] = linkEndsIt.second; + } + } + observationCollection_->setConstantWeightPerObservable( weightPerObservationParser ); + } + + void setConstantPerObservableAndLinkEndsWeights( + const observation_models::ObservableType observableType, + const std::vector< observation_models::LinkEnds >& linkEnds, + const double weight ) + { + std::cerr << "Warning, function setConstantPerObservableAndLinkEndsWeights is deprecated, " + "weights should preferably be defined at the observation collection level."; + std::map< observation_models::ObservableType, std::map< observation_models::LinkEnds, double > > weightPerObservableAndLinkEnds; + for( unsigned int i = 0; i < linkEnds.size( ); i++ ) + { + weightPerObservableAndLinkEnds[ observableType ][ linkEnds.at( i ) ] = weight; + } + setConstantPerObservableAndLinkEndsWeights( weightPerObservableAndLinkEnds ); + } + + void setConstantPerObservableAndLinkEndsVectorWeights( + const observation_models::ObservableType observableType, + const std::vector< observation_models::LinkEnds >& linkEnds, + const Eigen::VectorXd weight ) + { + std::cerr << "Warning, function setConstantPerObservableAndLinkEndsVectorWeights is deprecated, " + "weights should preferably be defined at the observation collection level."; + std::map< observation_models::ObservableType, std::map< observation_models::LinkEnds, Eigen::VectorXd > > weightPerObservableAndLinkEnds; + for( unsigned int i = 0; i < linkEnds.size( ); i++ ) + { + weightPerObservableAndLinkEnds[ observableType ][ linkEnds.at( i ) ] = weight; + } + setConstantPerObservableAndLinkEndsVectorWeights( weightPerObservableAndLinkEnds ); + } + + void setTabulatedPerObservableAndLinkEndsWeights( + const std::map< observation_models::ObservableType, + std::map< observation_models::LinkEnds, Eigen::VectorXd > > weightsPerObservableAndLinkEnds ) + { + std::cerr << "Warning, function setTabulatedPerObservableAndLinkEndsWeights is deprecated, " + "weights should preferably be defined at the observation collection level."; + std::map< std::shared_ptr< observation_models::ObservationCollectionParser >, Eigen::VectorXd > weightPerObservableParser; + for ( auto observableIt : weightsPerObservableAndLinkEnds ) + { + for ( auto linkEndsIt : observableIt.second ) + { + weightPerObservableParser[ observationParser( std::vector< std::shared_ptr< observation_models::ObservationCollectionParser > >( { + observationParser( observableIt.first ), observationParser( linkEndsIt.first ) } ) ) ] = linkEndsIt.second; + } + } + observationCollection_->setTabulatedWeights( weightPerObservableParser ); + } + + void setTabulatedPerObservableAndLinkEndsWeights( + const observation_models::ObservableType observableType, + const std::vector< observation_models::LinkEnds >& linkEnds, + const Eigen::VectorXd weights ) + { + std::cerr << "Warning, function setTabulatedPerObservableAndLinkEndsWeights is deprecated, " + "weights should preferably be defined at the observation collection level."; + std::map< observation_models::ObservableType, std::map< observation_models::LinkEnds, Eigen::VectorXd > > weightsPerObservableAndLinkEnds; + for( unsigned int i = 0; i < linkEnds.size( ); i++ ) + { + weightsPerObservableAndLinkEnds[ observableType ][ linkEnds.at( i ) ] = weights; + } + setTabulatedPerObservableAndLinkEndsWeights( weightsPerObservableAndLinkEnds ); + } //! Function to return the total data structure of observations and associated times/link ends/type (by reference) /*! @@ -437,13 +355,16 @@ class CovarianceAnalysisInput */ Eigen::VectorXd getWeightsMatrixDiagonals( ) { - return weightsMatrixDiagonals_; + return observationCollection_->getConcatenatedWeights( ); } -// void setWeightsMatrixDiagonals( const Eigen::VectorXd& weightsMatrixDiagonals ) -// { + void setWeightsMatrixDiagonals( const Eigen::VectorXd& weightsMatrixDiagonals ) + { + std::cerr << "Warning, function setWeightsMatrixDiagonals is deprecated, " + "weights should preferably be defined at the observation collection level."; + observationCollection_->setTabulatedWeights( weightsMatrixDiagonals ); // weightsMatrixDiagonals_ = weightsMatrixDiagonals; -// } + } //! Function to return the boolean denoting whether the dynamics and variational equations are reintegrated on first iteration /*! @@ -518,8 +439,8 @@ class CovarianceAnalysisInput double limitConditionNumberForWarning_; - //! Weight matrix diagonals, sorted by link ends and observable type - Eigen::VectorXd weightsMatrixDiagonals_; +// //! Weight matrix diagonals, sorted by link ends and observable type +// Eigen::VectorXd weightsMatrixDiagonals_; //! Boolean denoting whether the dynamics and variational equations are to be reintegrated on first iteration bool reintegrateEquationsOnFirstIteration_; diff --git a/include/tudat/simulation/estimation_setup/orbitDeterminationTestCases.h b/include/tudat/simulation/estimation_setup/orbitDeterminationTestCases.h index 07109f308..87e2fde82 100644 --- a/include/tudat/simulation/estimation_setup/orbitDeterminationTestCases.h +++ b/include/tudat/simulation/estimation_setup/orbitDeterminationTestCases.h @@ -287,13 +287,6 @@ std::pair< std::shared_ptr< EstimationOutput< StateScalarType, TimeType > >, Eig if( observableType == 4 ) { -// std::map< observation_models::ObservableType, double > weightPerObservable; -// weightPerObservable[ one_way_range ] = 1.0 / ( 1.0 * 1.0 ); -// weightPerObservable[ angular_position ] = 1.0 / ( 1.0E-9 * 1.0E-9 ); -// weightPerObservable[ one_way_doppler ] = 1.0 / ( 1.0E-12 * 1.0E-12 ); -// -// simulatedObservations->setConstantPerObservableWeightsMatrix( weightPerObservable ); - std::map< std::shared_ptr< observation_models::ObservationCollectionParser >, double > weightsPerObservationParser; weightsPerObservationParser[ observationParser( one_way_range ) ] = 1.0 / ( 1.0 * 1.0 ); weightsPerObservationParser[ observationParser( angular_position ) ] = 1.0 / ( 1.0E-9 * 1.0E-9 ); @@ -302,7 +295,6 @@ std::pair< std::shared_ptr< EstimationOutput< StateScalarType, TimeType > >, Eig } else { -// simulatedObservations->setConstantWeightsMatrix( weight ); simulatedObservations->setConstantWeight( weight ); } @@ -331,8 +323,6 @@ std::pair< std::shared_ptr< EstimationOutput< StateScalarType, TimeType > >, Eig covarianceInput->defineCovarianceSettings( true, true, true, false ); estimationInput->applyFinalParameterCorrection_ = false; -// std::cout << "weights" << "\n\n"; -// std::cout << estimationInput->getWeightsMatrixDiagonals( ).transpose( ) << "\n\n"; // Perform estimation std::shared_ptr< EstimationOutput< StateScalarType, TimeType > > estimationOutput = orbitDeterminationManager.estimateParameters( @@ -610,13 +600,6 @@ Eigen::VectorXd executeEarthOrbiterParameterEstimation( std::shared_ptr< ObservationCollection< StateScalarType, TimeType > > simulatedObservations = simulateObservations< StateScalarType, TimeType >( measurementSimulationInput, orbitDeterminationManager.getObservationSimulators( ), bodies ); -// std::map< observation_models::ObservableType, double > weightPerObservable; -// weightPerObservable[ one_way_range ] = 1.0 / ( 1.0 * 1.0 ); -// weightPerObservable[ angular_position ] = 1.0 / ( 1.0E-5 * 1.0E-5 ); -// weightPerObservable[ one_way_doppler ] = 1.0 / ( 1.0E-11 * 1.0E-11 * SPEED_OF_LIGHT * SPEED_OF_LIGHT ); -// -// simulatedObservations->setConstantPerObservableWeightsMatrix( weightPerObservable ); - std::map< std::shared_ptr< observation_models::ObservationCollectionParser >, double > weightsPerObservationParser; weightsPerObservationParser[ observationParser( one_way_range ) ] = 1.0 / ( 1.0 * 1.0 ); weightsPerObservationParser[ observationParser( angular_position ) ] = 1.0 / ( 1.0E-5 * 1.0E-5 ); @@ -650,8 +633,6 @@ Eigen::VectorXd executeEarthOrbiterParameterEstimation( simulatedObservations ); estimationInput->defineEstimationSettings( true, true, true, true, false ); estimationInput->setConvergenceChecker( std::make_shared< EstimationConvergenceChecker >( numberOfIterations ) ); -// std::cout << "weights: " << "\n\n"; -// std::cout << estimationInput->getWeightsMatrixDiagonals( ).transpose( ) << "\n\n"; // Perform estimation std::shared_ptr< EstimationOutput< StateScalarType > > estimationOutput = orbitDeterminationManager.estimateParameters( @@ -1193,14 +1174,6 @@ std::pair< Eigen::VectorXd, bool > executeEarthOrbiterBiasEstimation( std::shared_ptr< ObservationCollection< StateScalarType, TimeType > > simulatedObservations = simulateObservations< StateScalarType, TimeType >( measurementSimulationInput, orbitDeterminationManager.getObservationSimulators( ), bodies ); -// std::map< observation_models::ObservableType, double > weightPerObservable; -// weightPerObservable[ one_way_range ] = 1.0 / ( 1.0 * 1.0 ); -// weightPerObservable[ n_way_range ] = 1.0 / ( 1.0 * 1.0 ); -// -// weightPerObservable[ one_way_doppler ] = 1.0 / ( 1.0E-12 * 1.0E-12 * SPEED_OF_LIGHT * SPEED_OF_LIGHT ); -//// weightPerObservable[ two_way_doppler ] = 1.0 / ( 1.0E-12 * 1.0E-12 * SPEED_OF_LIGHT * SPEED_OF_LIGHT ); -// simulatedObservations->setConstantPerObservableWeightsMatrix( weightPerObservable ); - std::map< std::shared_ptr< observation_models::ObservationCollectionParser >, double > weightsPerObservationParser; weightsPerObservationParser[ observationParser( one_way_range ) ] = 1.0 / ( 1.0 * 1.0 ); weightsPerObservationParser[ observationParser( n_way_range ) ] = 1.0 / ( 1.0 * 1.0 ); diff --git a/tests/src/astro/orbit_determination/unitTestDesaturationDeltaVsEstimation.cpp b/tests/src/astro/orbit_determination/unitTestDesaturationDeltaVsEstimation.cpp index 5f8742a0d..4a33d6f9a 100644 --- a/tests/src/astro/orbit_determination/unitTestDesaturationDeltaVsEstimation.cpp +++ b/tests/src/astro/orbit_determination/unitTestDesaturationDeltaVsEstimation.cpp @@ -288,13 +288,6 @@ BOOST_AUTO_TEST_CASE( test_DesaturationDeltaVsEstimation ) measurementSimulationInput, orbitDeterminationManager.getObservationSimulators( ), bodies ); // Set weights -// std::map< observation_models::ObservableType, double > weightPerObservable; -// weightPerObservable[ one_way_range ] = 1.0 / ( 1.0 * 1.0 ); -// weightPerObservable[ angular_position ] = 1.0 / ( 1.0E-5 * 1.0E-5 ); -// weightPerObservable[ one_way_doppler ] = 1.0 / ( 1.0E-11 * 1.0E-11 * physical_constants::SPEED_OF_LIGHT * physical_constants::SPEED_OF_LIGHT ); -// -// observationsAndTimes->setConstantPerObservableWeightsMatrix( weightPerObservable ); - std::map< std::shared_ptr< observation_models::ObservationCollectionParser >, double > weightsPerObservationParser; weightsPerObservationParser[ observationParser( one_way_range ) ] = 1.0 / ( 1.0 * 1.0 ); weightsPerObservationParser[ observationParser( angular_position ) ] = 1.0 / ( 1.0E-5 * 1.0E-5 ); diff --git a/tests/src/astro/orbit_determination/unitTestHybridArcStateEstimation.cpp b/tests/src/astro/orbit_determination/unitTestHybridArcStateEstimation.cpp index 71a1af4ba..ee0b5a104 100644 --- a/tests/src/astro/orbit_determination/unitTestHybridArcStateEstimation.cpp +++ b/tests/src/astro/orbit_determination/unitTestHybridArcStateEstimation.cpp @@ -312,11 +312,6 @@ Eigen::VectorXd executeParameterEstimation( measurementSimulationInput, orbitDeterminationManager.getObservationSimulators( ), bodies ); // Set weights -// std::map< observation_models::ObservableType, double > weightPerObservable; -// weightPerObservable[ one_way_range ] = 1.0E-4; -// weightPerObservable[ angular_position ] = 1.0E-20; -// observationsAndTimes->setConstantPerObservableWeightsMatrix( weightPerObservable ); - std::map< std::shared_ptr< observation_models::ObservationCollectionParser >, double > weightPerObservationParser; weightPerObservationParser[ observationParser( one_way_range ) ] = 1.0E-4; weightPerObservationParser[ observationParser( angular_position ) ] = 1.0E-20; diff --git a/tests/src/astro/orbit_determination/unitTestTimeBiasEstimation.cpp b/tests/src/astro/orbit_determination/unitTestTimeBiasEstimation.cpp index 19b58a4f2..a256467ab 100644 --- a/tests/src/astro/orbit_determination/unitTestTimeBiasEstimation.cpp +++ b/tests/src/astro/orbit_determination/unitTestTimeBiasEstimation.cpp @@ -220,10 +220,6 @@ int main( ) std::shared_ptr< ObservationCollection< double, double > > simulatedObservations = simulateObservations< double, double >( measurementSimulationInput, orbitDeterminationManager.getObservationSimulators( ), bodies ); -// std::map< observation_models::ObservableType, double > weightPerObservable; -// weightPerObservable[ one_way_doppler ] = 1.0 / ( 0.1 * 0.1 ); -// simulatedObservations->setConstantPerObservableWeightsMatrix( weightPerObservable ); - std::map< std::shared_ptr< observation_models::ObservationCollectionParser >, double > weightPerObservationParser; weightPerObservationParser[ observationParser( one_way_doppler ) ] = 1.0 / ( 0.1 * 0.1 ); simulatedObservations->setConstantWeightPerObservable( weightPerObservationParser ); diff --git a/tests/src/astro/orbit_determination/unitTestVehicleReferencePointEstimation.cpp b/tests/src/astro/orbit_determination/unitTestVehicleReferencePointEstimation.cpp index 6a74d5f00..435e1e260 100644 --- a/tests/src/astro/orbit_determination/unitTestVehicleReferencePointEstimation.cpp +++ b/tests/src/astro/orbit_determination/unitTestVehicleReferencePointEstimation.cpp @@ -224,12 +224,6 @@ BOOST_AUTO_TEST_CASE( test_ReferencePointEstimation ) measurementSimulationInput, orbitDeterminationManager.getObservationSimulators( ), bodies ); // Set observation weights -// std::map< observation_models::ObservableType, double > weightPerObservable; -// weightPerObservable[ one_way_range ] = 1.0 / ( 1.0 * 1.0 ); -// weightPerObservable[ angular_position ] = 1.0 / ( 1.0E-5 * 1.0E-5 ); -// weightPerObservable[ one_way_doppler ] = 1.0 / ( 1.0E-11 * 1.0E-11 * physical_constants::SPEED_OF_LIGHT * physical_constants::SPEED_OF_LIGHT ); -// observationsAndTimes->setConstantPerObservableWeightsMatrix( weightPerObservable ); - std::map< std::shared_ptr< observation_models::ObservationCollectionParser >, double > weightsPerObservationParser; weightsPerObservationParser[ observationParser( one_way_range ) ] = 1.0 / ( 1.0 * 1.0 ); weightsPerObservationParser[ observationParser( angular_position ) ] = 1.0 / ( 1.0E-5 * 1.0E-5 ); diff --git a/tests/src/astro/propagators/unitTestMultiArcMultiBodyVariationalEquations.cpp b/tests/src/astro/propagators/unitTestMultiArcMultiBodyVariationalEquations.cpp index 52e170f5c..aee2d44a4 100644 --- a/tests/src/astro/propagators/unitTestMultiArcMultiBodyVariationalEquations.cpp +++ b/tests/src/astro/propagators/unitTestMultiArcMultiBodyVariationalEquations.cpp @@ -863,12 +863,7 @@ BOOST_AUTO_TEST_CASE( testMultiArcMultiBodyVariationalEquationCalculation1 ) std::shared_ptr< ObservationCollection< > > observationsAndTimes = simulateObservations< double, double >( measurementSimulationInput, orbitDeterminationManager.getObservationSimulators( ), bodies ); -// // Set observations weights. -// std::map< observation_models::ObservableType, double > weightPerObservable; -// weightPerObservable[ position_observable ] = 1.0 / ( 1.0 * 1.0 ); -// weightPerObservable[ one_way_range ] = 1.0 / ( 1.0 * 1.0 ); -// observationsAndTimes->setConstantPerObservableWeightsMatrix( weightPerObservable ); - + // Set observations weights. std::map< std::shared_ptr< observation_models::ObservationCollectionParser >, double > weightPerObservationParser; weightPerObservationParser[ observationParser( position_observable ) ] = 1.0 / ( 1.0 * 1.0 ); weightPerObservationParser[ observationParser( one_way_range ) ] = 1.0 / ( 1.0 * 1.0 );