Skip to content

Commit

Permalink
Merge pull request #1205 from harryswift01/fix-motioncor2-1.6-parsing
Browse files Browse the repository at this point in the history
Fix motioncor2 1.6 parsing
  • Loading branch information
biochem-fan authored Nov 22, 2024
2 parents 167a174 + 91a6a5c commit 0c429e1
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions src/motioncorr_runner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -689,6 +689,34 @@ void MotioncorrRunner::getShiftsMotioncor2(FileName fn_log, Micrograph &mic)
}
}
}

// If no shifts were found with the version 1.5 method, attempt the version 1.6 method
if (!have_found_final)
{
// Reset and start parsing for version 1.6 style data
in.clear();
in.seekg(0);

while (getline(in, line))
{
if (line.find("Frame") != std::string::npos && line.find("x Shift") != std::string::npos)
{
while (getline(in, line) && !line.empty())
{
std::istringstream ss(line);
float x_shift, y_shift;
ss >> frame >> x_shift >> y_shift;
if (ss.fail())
{
std::cerr << " fn_log= " << fn_log << std::endl;
REPORT_ERROR("Error: Unexpected line format in 1.6 global shifts: " + line);
}
mic.setGlobalShift(frame, x_shift, y_shift);
}
break;
}
}
}
in.close();

mic.first_frame = first_frame_sum;
Expand Down

0 comments on commit 0c429e1

Please sign in to comment.