Skip to content

Commit

Permalink
import cal files
Browse files Browse the repository at this point in the history
  • Loading branch information
psmokotnin committed Jan 12, 2025
1 parent 74b1342 commit 9c8f798
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion qml/main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ ApplicationWindow {
folder: (typeof shortcuts !== 'undefined' ? shortcuts.home : Filesystem.StandardFolder.Home)
defaultSuffix: "txt"
nameFilters: [
"txt transfer data file (*.txt)",
"txt transfer data file (*.txt *.cal)",
"csv transfer data file (*.csv)",
"txt impulse data file (*.txt)",
"csv impulse data file (*.csv)",
Expand Down
7 changes: 6 additions & 1 deletion src/sourcelist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -457,12 +457,17 @@ bool SourceList::importFile(const QUrl &fileName, QString separator)
frequency = list[0].replace(",", ".").toFloat(&fOk);
magnitude = list[1].replace("*", "0").replace(",", ".").toFloat(&mOk);
phase.polar(M_PI * (list.size() > 2 ? list[2].replace("*", "0").replace(",", ".").toFloat() : 0) / 180.f);
coherence = (list.size() > 3 ? list[3].replace("*", "0").replace(",", ".").toFloat() : 1);

bool coherenceOk = false;
coherence = (list.size() > 3 ? list[3].replace("*", "0").replace(",", ".").toFloat(&coherenceOk) : 1);

if (fOk && mOk && list.size() > 1) {
if (magnitude > maxMagnitude) {
maxMagnitude = magnitude;
}
if (!coherenceOk) {
coherence = 1;
}

d.push_back({
frequency,
Expand Down

0 comments on commit 9c8f798

Please sign in to comment.