Commit 3defde8f authored by Purves, Murray's avatar Purves, Murray
Browse files

Amending SPE format to use float instead of int values for counts

parent 265fca61
Pipeline #16206 passed with stages
in 9 minutes and 15 seconds
......@@ -202,7 +202,7 @@ bool SpectrumSPEStream<data_type>::write_to(const std::string &file) const
fprintf(stream, "0 %d\n", numberOfChannels - 1);
for (int i = 0; i < countsByChannel.size(); ++i)
{
fprintf(stream, "%d\n", int(countsByChannel[i]));
fprintf(stream, "%10.6f\n", countsByChannel[i]);
}
radix_line(" Wrote " << countsByChannel.size() << " data entries");
......@@ -321,7 +321,7 @@ void SpectrumSPEStream<data_type>::readData(std::ifstream &stream,
std::getline(stream, line);
try
{
countsByChannel.push_back(std::stoi(trim_string(line)));
countsByChannel.push_back(std::stof(trim_string(line)));
}
catch (...)
{
......
......@@ -292,7 +292,8 @@ TEST(RadixIO, PCFToSPE)
ASSERT_EQ(countsByChannel1.size(), countsByChannel2.size());
for (size_t j = 0; j < countsByChannel1.size(); ++j)
{
EXPECT_NEAR(int(countsByChannel1[j]), int(countsByChannel2[j]), 1);
EXPECT_NEAR(countsByChannel1[j], countsByChannel2[j],
fabs(countsByChannel1[j] * tolerance));
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment