From 02f19d989c18beace26fe4c0871312acff046eb2 Mon Sep 17 00:00:00 2001 From: Dominic Dirkx Date: Thu, 3 Oct 2024 19:55:32 +0200 Subject: [PATCH] Corrected IFMS test; minor compiler warning corrections --- .../estimation_setup/observations.h | 4 +-- .../estimation_setup/processOdfFile.h | 11 ++++-- .../estimation_setup/processTrackingTxtFile.h | 21 ++++-------- .../oceanTideEarthDeformation.cpp | 6 ++-- ...unitTestDsnNWayDopplerObservationModel.cpp | 4 +-- .../observation_models/unitTestIfmsMex.cpp | 2 +- .../unitTestObservationsProcessing.cpp | 34 +++++++++---------- 7 files changed, 41 insertions(+), 41 deletions(-) diff --git a/include/tudat/simulation/estimation_setup/observations.h b/include/tudat/simulation/estimation_setup/observations.h index bb2b3a4e3..6a10cc382 100644 --- a/include/tudat/simulation/estimation_setup/observations.h +++ b/include/tudat/simulation/estimation_setup/observations.h @@ -451,7 +451,7 @@ class SingleObservationSet void removeSingleObservation( unsigned int indexToRemove ) { - if ( indexToRemove >= numberOfObservations_ ) + if ( static_cast< int >( indexToRemove ) >= numberOfObservations_ ) { throw std::runtime_error( "Error when removing single observation from SingleObservationSet, index incompatible with number of observations." ); } @@ -810,7 +810,7 @@ class SingleObservationSet { throw std::runtime_error( "Error when moving observation back from filtered observation set, filtered observation set is empty." ); } - if ( index >= getNumberOfFilteredObservations( ) ) + if ( static_cast< int >( index ) >= getNumberOfFilteredObservations( ) ) { throw std::runtime_error( "Error when moving observation back from filtered observation set, index incompatible with number of observations." ); } diff --git a/include/tudat/simulation/estimation_setup/processOdfFile.h b/include/tudat/simulation/estimation_setup/processOdfFile.h index dcd853536..2859d206c 100644 --- a/include/tudat/simulation/estimation_setup/processOdfFile.h +++ b/include/tudat/simulation/estimation_setup/processOdfFile.h @@ -1282,7 +1282,7 @@ std::shared_ptr< observation_models::SingleObservationSet< ObservationScalarType std::vector< Eigen::Vector3d > originalEarthFixedPositions; for ( unsigned int i = 0; i < originalObservationTimesTdb.size( ); ++i ) { - originalEarthFixedPositions.push_back( simulation_setup::getApproximateDsnGroundStationPositions( ).at( originalDopplerData->getLinkEnds( ).at( receiver ).stationName_ ) ); + originalEarthFixedPositions.push_back( simulation_setup::getCombinedApproximateGroundStationPositions( ).at( originalDopplerData->getLinkEnds( ).at( receiver ).stationName_ ) ); } std::vector< TimeType > originalObservationTimesUtc = timeScaleConverter.getCurrentTimes< TimeType >( @@ -1326,10 +1326,17 @@ std::shared_ptr< observation_models::SingleObservationSet< ObservationScalarType } } + std::string stationName = originalDopplerData->getLinkEnds( ).at( receiver ).stationName_; + if( simulation_setup::getCombinedApproximateGroundStationPositions( ).count( stationName ) == 0 ) + { + throw std::runtime_error( "Error in Doppler data compression, could not retrieve approximate station position for " + stationName ); + } + Eigen::Vector3d stationPosition = simulation_setup::getCombinedApproximateGroundStationPositions( ).at( stationName ); + std::vector< Eigen::Vector3d > compressedEarthFixedPositions; for ( unsigned int i = 0; i < compressedObservationTimesUtc.size( ); ++i ) { - compressedEarthFixedPositions.push_back( simulation_setup::getApproximateDsnGroundStationPositions( ).at( originalDopplerData->getLinkEnds( ).at( receiver ).stationName_ ) ); + compressedEarthFixedPositions.push_back( stationPosition ); } std::vector< TimeType > compressedObservationTimesTdb = timeScaleConverter.getCurrentTimes< TimeType >( basic_astrodynamics::utc_scale, basic_astrodynamics::tdb_scale, compressedObservationTimesUtc, compressedEarthFixedPositions ); diff --git a/include/tudat/simulation/estimation_setup/processTrackingTxtFile.h b/include/tudat/simulation/estimation_setup/processTrackingTxtFile.h index bc8dc1e6b..095a9243b 100644 --- a/include/tudat/simulation/estimation_setup/processTrackingTxtFile.h +++ b/include/tudat/simulation/estimation_setup/processTrackingTxtFile.h @@ -536,7 +536,6 @@ class ProcessedTrackingTxtFileContents * @param processedTrackingTxtFileContents * @param observableTypesToProcess * @param ancillarySettings - * @param startAndEndTimesToProcess * @return observation collection */ template< typename ObservationScalarType = double, typename TimeType = double > @@ -544,8 +543,7 @@ std::map > processedTrackingTxtFileContents, std::vector observableTypesToProcess = std::vector(), - const ObservationAncilliarySimulationSettings& ancillarySettings = ObservationAncilliarySimulationSettings(), - const std::pair startAndEndTimesToProcess = std::make_pair(TUDAT_NAN, TUDAT_NAN)) + const ObservationAncilliarySimulationSettings& ancillarySettings = ObservationAncilliarySimulationSettings() ) { // Make sure processing the tracking file was successful @@ -636,8 +634,7 @@ std::shared_ptr > > processedTrackingTxtFileContents, std::vector observableTypesToProcess = std::vector(), - const ObservationAncilliarySimulationSettings& ancillarySettings = ObservationAncilliarySimulationSettings(), - const std::pair startAndEndTimesToProcess = std::make_pair(TUDAT_NAN, TUDAT_NAN)) + const ObservationAncilliarySimulationSettings& ancillarySettings = ObservationAncilliarySimulationSettings()) { std::map > > > > observationSets; @@ -645,7 +642,7 @@ createTrackingTxtFilesObservationCollection( { std::map > > > > processedObervationSet = createTrackingTxtFileObservationSets< ObservationScalarType, TimeType >( - processedTrackingTxtFileContents.at( i ), observableTypesToProcess, ancillarySettings, startAndEndTimesToProcess ); + processedTrackingTxtFileContents.at( i ), observableTypesToProcess, ancillarySettings ); for( auto it : processedObervationSet ) { for( auto it2 : it.second ) @@ -665,11 +662,10 @@ std::shared_ptr > processedTrackingTxtFileContents, std::vector observableTypesToProcess = std::vector(), - const ObservationAncilliarySimulationSettings& ancillarySettings = ObservationAncilliarySimulationSettings(), - const std::pair startAndEndTimesToProcess = std::make_pair(TUDAT_NAN, TUDAT_NAN)) + const ObservationAncilliarySimulationSettings& ancillarySettings = ObservationAncilliarySimulationSettings()) { return createTrackingTxtFilesObservationCollection< ObservationScalarType, TimeType >( - { processedTrackingTxtFileContents }, observableTypesToProcess, ancillarySettings, startAndEndTimesToProcess ); + { processedTrackingTxtFileContents }, observableTypesToProcess, ancillarySettings ); } /*! @@ -679,7 +675,6 @@ createTrackingTxtFileObservationCollection( * @param observableTypesToProcess Vector of observable types that need to be in the collection * @param earthFixedGroundStationPositions map of ground station positions * @param ancillarySettings - * @param startAndEndTimesToProcess * @return observation collection */ template< typename ObservationScalarType = double, typename TimeType = double > @@ -689,8 +684,7 @@ createTrackingTxtFileObservationCollection( const std::string spacecraftName, const std::vector observableTypesToProcess = std::vector(), const std::map earthFixedGroundStationPositions = simulation_setup::getCombinedApproximateGroundStationPositions(), - const ObservationAncilliarySimulationSettings& ancillarySettings = ObservationAncilliarySimulationSettings(), - std::pair startAndEndTimesToProcess = std::make_pair(TUDAT_NAN, TUDAT_NAN)) + const ObservationAncilliarySimulationSettings& ancillarySettings = ObservationAncilliarySimulationSettings()) { // Create processed tracking file contents auto processedTrackingTxtFileContents = std::make_shared >( @@ -699,8 +693,7 @@ createTrackingTxtFileObservationCollection( // Create observation collection and return return createTrackingTxtFileObservationCollection(processedTrackingTxtFileContents, observableTypesToProcess, - ancillarySettings, - startAndEndTimesToProcess); + ancillarySettings); } void setStationFrequenciesFromTrackingData( diff --git a/src/astro/ground_stations/oceanTideEarthDeformation.cpp b/src/astro/ground_stations/oceanTideEarthDeformation.cpp index d0a5b8113..064b14924 100755 --- a/src/astro/ground_stations/oceanTideEarthDeformation.cpp +++ b/src/astro/ground_stations/oceanTideEarthDeformation.cpp @@ -41,8 +41,8 @@ std::vector > > readBlqFile( std::vector > unparsedSiteBlock; unparsedSiteBlock.resize( 11 ); - // Initialized number of parsed sites. - int numberOfSitesParsed = 0; +// // Initialized number of parsed sites. +// int numberOfSitesParsed = 0; // Declare current site characteristics std::string currentSiteName; @@ -114,7 +114,7 @@ std::vector > > readBlqFile( amplitudeMap[ currentSiteName ] = currentDataMatrix.block( 0, 0, 3, 11 ); phaseMap[ currentSiteName ] = convertDegreesToRadians( currentDataMatrix.block( 3, 0, 3, 11 )); - numberOfSitesParsed++; +// numberOfSitesParsed++; } if ( !stream.fail( ) && !stream.eof( )) diff --git a/tests/src/astro/observation_models/unitTestDsnNWayDopplerObservationModel.cpp b/tests/src/astro/observation_models/unitTestDsnNWayDopplerObservationModel.cpp index 2d5fc55e4..5e4014dcd 100644 --- a/tests/src/astro/observation_models/unitTestDsnNWayDopplerObservationModel.cpp +++ b/tests/src/astro/observation_models/unitTestDsnNWayDopplerObservationModel.cpp @@ -145,8 +145,8 @@ BOOST_AUTO_TEST_CASE( testDsnNWayAveragedDopplerModel ) // Compare value of observations // Min/max values from Verma (2022), "A Python-based tool for constructing observables from the DSN’s closed-loop // archival tracking data files", fig. 4 right - std::pair< double, double > vermaFirstBlockMinMaxResidual = std::make_pair( -0.04, 0.10 ); - std::pair< double, double > vermaSecondBlockMinMaxResidual = std::make_pair( -0.06, 0.07 ); +// std::pair< double, double > vermaFirstBlockMinMaxResidual = std::make_pair( -0.04, 0.10 ); +// std::pair< double, double > vermaSecondBlockMinMaxResidual = std::make_pair( -0.06, 0.07 ); // Min/max values obtained with current code std::pair< double, double > firstBlockMinMaxResidual = std::make_pair( -0.080, 0.120 ); std::pair< double, double > secondBlockMinMaxResidual = std::make_pair( -0.08, 0.06 ); diff --git a/tests/src/astro/observation_models/unitTestIfmsMex.cpp b/tests/src/astro/observation_models/unitTestIfmsMex.cpp index 24f9b1605..47cbffd0f 100644 --- a/tests/src/astro/observation_models/unitTestIfmsMex.cpp +++ b/tests/src/astro/observation_models/unitTestIfmsMex.cpp @@ -142,7 +142,7 @@ BOOST_AUTO_TEST_CASE(testIfmsObservationMex) // Create and process observation collection auto observedUncompressedObservationCollection = observation_models::createTrackingTxtFilesObservationCollection< long double, Time>( processedIfmsFiles, {dsn_n_way_averaged_doppler}, ancilliarySettings ); - setTrackingDataInformationInBodies( processedIfmsFiles, bodies, {dsn_n_way_averaged_doppler} ); + setTrackingDataInformationInBodies( processedIfmsFiles, bodies, dsn_n_way_averaged_doppler ); std::shared_ptr< observation_models::ObservationCollection< long double, Time > > observedObservationCollection = createCompressedDopplerCollection( observedUncompressedObservationCollection, 60.0 ); diff --git a/tests/src/astro/orbit_determination/unitTestObservationsProcessing.cpp b/tests/src/astro/orbit_determination/unitTestObservationsProcessing.cpp index 1dbb8d246..276c6f93c 100644 --- a/tests/src/astro/orbit_determination/unitTestObservationsProcessing.cpp +++ b/tests/src/astro/orbit_determination/unitTestObservationsProcessing.cpp @@ -173,7 +173,7 @@ std::shared_ptr< ObservationCollection< double, double > > setUpObservationColle std::vector< double > rangeObsTimes, dopplerObsTimes, angularPositionObsTimes; obsStartTimes = { { one_way_range, initialEphemerisTime + 1000.0 }, { one_way_doppler, initialEphemerisTime + 1000.0 + 86400.0 }, { angular_position, initialEphemerisTime + 1000.0 + 2.0 * 86400.0 } }; - for( unsigned int j = 0; j < numberOfObservations; j++ ) + for( int j = 0; j < numberOfObservations; j++ ) { rangeObsTimes.push_back( initialEphemerisTime + 1000.0 + static_cast< double >( j ) * observationsInterval ); dopplerObsTimes.push_back( initialEphemerisTime + 1000.0 + 86400.0 + static_cast< double >( j ) * observationsInterval ); @@ -223,7 +223,7 @@ BOOST_AUTO_TEST_CASE( test_ObservationCollectionParser ) { const double startTime = double( 1.0E7 ); const int numberOfDaysOfData = 3; - unsigned int nbObs = 300; + unsigned int numberOfObservations = 300; double obsInterval = 20.0; std::vector< LinkEnds > stationReceiverLinkEnds; @@ -231,7 +231,7 @@ BOOST_AUTO_TEST_CASE( test_ObservationCollectionParser ) std::map< ObservableType, double > obsStartTimes; std::map< ObservableType, std::vector< double > > baseTimeList; std::shared_ptr< ObservationCollection< double, double > > simulatedObservations = setUpObservationCollectionToTest( - startTime, numberOfDaysOfData, nbObs, obsInterval, stationReceiverLinkEnds, stationTransmitterLinkEnds, obsStartTimes, baseTimeList ); + startTime, numberOfDaysOfData, numberOfObservations, obsInterval, stationReceiverLinkEnds, stationTransmitterLinkEnds, obsStartTimes, baseTimeList ); // Check full list of observable types std::vector< ObservableType > observableTypes = simulatedObservations->getObservableTypes( ); @@ -277,11 +277,11 @@ BOOST_AUTO_TEST_CASE( test_ObservationCollectionParser ) { if ( it.first != angular_position ) { - trueTimeBoundsList.push_back( std::make_pair( it.second, it.second + ( nbObs - 1 ) * obsInterval ) ); + trueTimeBoundsList.push_back( std::make_pair( it.second, it.second + ( numberOfObservations - 1 ) * obsInterval ) ); } else { - trueTimeBoundsList.push_back( std::make_pair( it.second, it.second + ( nbObs - 1 ) * obsInterval + 2000.0 ) ); + trueTimeBoundsList.push_back( std::make_pair( it.second, it.second + ( numberOfObservations - 1 ) * obsInterval + 2000.0 ) ); } } BOOST_CHECK( timeBoundsList.size( ) == trueTimeBoundsList.size( ) ); @@ -532,7 +532,7 @@ BOOST_AUTO_TEST_CASE( test_ObservationsFiltering ) { const double startTime = double( 1.0E7 ); const int numberOfDaysOfData = 3; - unsigned int nbObs = 300; + unsigned int numberOfObservations = 300; double obsInterval = 20.0; std::vector< LinkEnds > stationReceiverLinkEnds; @@ -540,7 +540,7 @@ BOOST_AUTO_TEST_CASE( test_ObservationsFiltering ) std::map< ObservableType, double > obsStartTimes; std::map< ObservableType, std::vector< double > > baseTimeList; std::shared_ptr< ObservationCollection< double, double > > simulatedObservations = setUpObservationCollectionToTest( - startTime, numberOfDaysOfData, nbObs, obsInterval, stationReceiverLinkEnds, stationTransmitterLinkEnds, obsStartTimes, baseTimeList ); + startTime, numberOfDaysOfData, numberOfObservations, obsInterval, stationReceiverLinkEnds, stationTransmitterLinkEnds, obsStartTimes, baseTimeList ); // Retrieve start indices and sizes for observation sets std::map< ObservableType, std::map< LinkEnds, std::vector< std::pair< int, int > > > > obsSetsStartAndSize = simulatedObservations->getObservationSetStartAndSize( ); @@ -621,11 +621,11 @@ BOOST_AUTO_TEST_CASE( test_ObservationsFiltering ) } if ( observableIt.first == angular_position ) { - BOOST_CHECK( indices.second == 2.0 * nbObs ); + BOOST_CHECK( indices.second == 2.0 * numberOfObservations ); } if ( observableIt.first == one_way_doppler ) { - BOOST_CHECK( indices.second == nbObs ); + BOOST_CHECK( indices.second == static_cast< int >( numberOfObservations ) ); } startIndex += indices.second; } @@ -666,7 +666,7 @@ BOOST_AUTO_TEST_CASE( test_ObservationsFiltering ) // Test filtering based on epoch values and time bounds std::vector< double > rangeObsTimes = baseTimeList.at( one_way_range ); - std::pair< double, double > timeBounds = std::make_pair( rangeObsTimes[ int(nbObs/3) ], rangeObsTimes[ 2*int(nbObs/3) ] ); + std::pair< double, double > timeBounds = std::make_pair( rangeObsTimes[ int(numberOfObservations/3) ], rangeObsTimes[ 2*int(numberOfObservations/3) ] ); std::vector< double > epochsToFilter; std::vector< double > epochsLeft; for ( auto time : rangeObsTimes ) @@ -701,7 +701,7 @@ BOOST_AUTO_TEST_CASE( test_ObservationsFiltering ) remainingObsTimes = simulatedObservations->getObservationTimes( observationParser( one_way_range ) ); for ( unsigned int k = 0 ; k < remainingObsTimes.size( ) ; k++ ) { - BOOST_CHECK( remainingObsTimes.at( k ).size( ) == nbObs ); + BOOST_CHECK( remainingObsTimes.at( k ).size( ) == numberOfObservations ); } @@ -725,7 +725,7 @@ BOOST_AUTO_TEST_CASE( test_ObservationsFiltering ) remainingObsTimes = simulatedObservations->getObservationTimes( observationParser( one_way_range ) ); for ( unsigned int k = 0 ; k < remainingObsTimes.size( ) ; k++ ) { - BOOST_CHECK( remainingObsTimes.at( k ).size( ) == nbObs ); + BOOST_CHECK( remainingObsTimes.at( k ).size( ) == numberOfObservations ); } // Test filtering based on residual values @@ -794,7 +794,7 @@ BOOST_AUTO_TEST_CASE( test_ObservationsSplitting ) const double startTime = double( 1.0E7 ); const int numberOfDaysOfData = 3; - unsigned int nbObs = 300; + unsigned int numberOfObservations = 300; double obsInterval = 20.0; std::vector< LinkEnds > stationReceiverLinkEnds; @@ -802,11 +802,11 @@ BOOST_AUTO_TEST_CASE( test_ObservationsSplitting ) std::map< ObservableType, double > obsStartTimes; std::map< ObservableType, std::vector< double > > baseTimeList; std::shared_ptr< ObservationCollection< double, double > > simulatedObservations = setUpObservationCollectionToTest( - startTime, numberOfDaysOfData, nbObs, obsInterval, stationReceiverLinkEnds, stationTransmitterLinkEnds, obsStartTimes, baseTimeList ); + startTime, numberOfDaysOfData, numberOfObservations, obsInterval, stationReceiverLinkEnds, stationTransmitterLinkEnds, obsStartTimes, baseTimeList ); // Test splitting based on time tags - int indexSplitEpoch = int(nbObs/3); + int indexSplitEpoch = int(numberOfObservations/3); std::vector< double > rangeObsTimes = baseTimeList.at( one_way_range ); double splitEpoch = rangeObsTimes.at( indexSplitEpoch ); std::vector< double > timeTags = { rangeObsTimes.at( 0 ), splitEpoch, rangeObsTimes.back( ) }; @@ -816,7 +816,7 @@ BOOST_AUTO_TEST_CASE( test_ObservationsSplitting ) std::vector< std::shared_ptr< SingleObservationSet< > > > splitObsSets = simulatedObservations->getSingleObservationSets( observationParser( stationTransmitterLinkEnds[ 0 ] ) ); BOOST_CHECK( splitObsSets.size( ) == 2 ); BOOST_CHECK( splitObsSets.at( 0 )->getNumberOfObservables( ) == indexSplitEpoch+1 ); - BOOST_CHECK( splitObsSets.at( 1 )->getNumberOfObservables( ) == nbObs - (indexSplitEpoch+1) ); + BOOST_CHECK( splitObsSets.at( 1 )->getNumberOfObservables( ) == numberOfObservations - (indexSplitEpoch+1) ); // Check that all observations in the first set occur before splitEpoch for ( auto time : splitObsSets.at( 0 )->getObservationTimes( ) ) @@ -840,7 +840,7 @@ BOOST_AUTO_TEST_CASE( test_ObservationsSplitting ) BOOST_CHECK( splitObsSets.size( ) == 3 ); BOOST_CHECK( splitObsSets.at( 0 )->getNumberOfObservables( ) == indexSplitEpoch ); BOOST_CHECK( splitObsSets.at( 1 )->getNumberOfObservables( ) == indexSplitEpoch ); - BOOST_CHECK( splitObsSets.at( 2 )->getNumberOfObservables( ) == nbObs - (2*indexSplitEpoch+1) ); + BOOST_CHECK( splitObsSets.at( 2 )->getNumberOfObservables( ) == numberOfObservations - (2*indexSplitEpoch+1) ); // Check that the time span of the new observation set meets the threshold for ( unsigned int i = 0 ; i < 3 ; i++ )