/*! * \file OxTestData.hxx * \author Konrad Werys * \date 2018/07/30 */ #ifndef Tomato_OXTESTDATA_HXX #define Tomato_OXTESTDATA_HXX namespace Ox { template< typename MeasureType > TestData ::TestData(char* filePath){ Ox::TomatoParser parser; parser._filePath = filePath; // tokens to be parsed parser._sequences["invTimes"]; parser._sequences["signalMag"]; parser._sequences["signalPha"]; parser._sequences["signs"]; parser._sequences["resultsMolli"]; parser._sequences["resultsShmolli"]; parser.parse(); copyStrVectorToMemberVector(parser._sequences["signalMag"], _signalMag); copyStrVectorToMemberVector(parser._sequences["signalPha"], _signalPha); copyStrVectorToMemberVector(parser._sequences["signs"], _signs); copyStrVectorToMemberVector(parser._sequences["invTimes"], _invTimes); copyStrVectorToMemberVector(parser._sequences["resultsMolli"], _resultsMolli); copyStrVectorToMemberVector(parser._sequences["resultsShmolli"], _resultsShmolli); _nSamples = _invTimes.size(); calcSignal(); } template< typename MeasureType > void TestData ::calcSignal(){ _signal.resize(_nSamples); for (int i = 0; i < _nSamples; ++i){ _signal[i] = _signalMag[i] * _signs[i]; } } template< typename MeasureType > template< typename TYPE > void TestData ::printVector(std::vector myVector, std::string myVectorName){ std::cout << myVectorName << " ="; for (int i = 0; i < myVector.size(); ++i) { std::cout << std::setw(7) << myVector[i]; } std::cout << std::endl; } template< typename MeasureType > void TestData ::copyStrVectorToMemberVector(std::vector strVector, std::vector &memberVector) { //memberVector.resize(strVector.size()); for (unsigned int i = 0; i < strVector.size(); ++i) { memberVector.push_back(KWUtil::StringToNumber(strVector[i])); } } template< typename MeasureType > void TestData ::disp(){ std::cout << std::endl; printVector(_signalMag, "signalMag "); printVector(_signalPha, "signalPha "); printVector(_signs, "signs "); printVector(_invTimes, "invTimes "); printVector(_resultsMolli, "resultsMolli "); printVector(_resultsShmolli, "resultsShmolli "); }; } // namespace Ox #endif //Tomato_OXTESTDATA_HXX