Skip to content
Snippets Groups Projects
Commit 9c3775f6 authored by Andre Offringa's avatar Andre Offringa
Browse files

Don't throw exceptions when freq is off

This exception is triggered in some legitimate cases inside WSClean (reported by Bjorn A)
parent 21752ec9
No related tags found
1 merge request!146Don't throw exceptions when freq is off
Pipeline #83880 failed
......@@ -630,14 +630,9 @@ hsize_t SolTab::GetFreqIndex(double freq) const {
if (GetAxis("freq").size == 1) {
return 0;
}
std::vector<double> freqs = GetRealAxis("freq");
double freq_interval = GetFreqInterval(0);
const std::vector<double> freqs = GetRealAxis("freq");
// A full cell width before the first frequency
if (freq < freqs.front() - freq_interval) {
throw std::runtime_error("Frequency " + std::to_string(freq) +
" not found in " + GetName());
}
if (freq < freqs.front()) {
return 0;
}
......@@ -653,15 +648,7 @@ hsize_t SolTab::GetFreqIndex(double freq) const {
}
}
// A full cell width after the last frequency
freq_interval = GetFreqInterval(freqs.size() - 2);
if (freq < freqs.back() + freq_interval) {
return freqs.size() - 1;
}
throw std::runtime_error("Frequency " + std::to_string(freq) +
" not found in " + GetName());
return 0;
return freqs.size() - 1;
}
std::vector<double> SolTab::GetRealAxis(const std::string& axisname) const {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment