swh:1:snp:e6d42e6731ce66e3c09de07ac49964c03139e990
Tip revision: a3d351fb6de40a4726ce169414d81715662c2728 authored by Konrad Werys on 16 November 2018, 12:33:56 UTC
adding calc time to the TomatoOptions
adding calc time to the TomatoOptions
Tip revision: a3d351f
OxTestData.hxx
/*!
* \file OxTestData.hxx
* \author Konrad Werys
* \date 2018/07/30
*/
#ifndef Tomato_OXTESTDATA_HXX
#define Tomato_OXTESTDATA_HXX
namespace Ox {
template< typename MeasureType >
TestData<MeasureType>
::TestData(char* filePath){
Ox::TomatoParser<MeasureType> 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<MeasureType>
::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<MeasureType>
::printVector(std::vector<TYPE> 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<MeasureType>
::copyStrVectorToMemberVector(std::vector<std::string> strVector, std::vector<MeasureType> &memberVector) {
//memberVector.resize(strVector.size());
for (unsigned int i = 0; i < strVector.size(); ++i) {
memberVector.push_back(KWUtil::StringToNumber<MeasureType>(strVector[i]));
}
}
template< typename MeasureType >
void
TestData<MeasureType>
::disp(){
std::cout << std::endl;
printVector<MeasureType>(_signalMag, "signalMag ");
printVector<MeasureType>(_signalPha, "signalPha ");
printVector<MeasureType>(_signs, "signs ");
printVector<MeasureType>(_invTimes, "invTimes ");
printVector<MeasureType>(_resultsMolli, "resultsMolli ");
printVector<MeasureType>(_resultsShmolli, "resultsShmolli ");
};
} // namespace Ox
#endif //Tomato_OXTESTDATA_HXX