Skip to content

Commit

Permalink
add better regex matching to recover outputs - useful in the edge cas…
Browse files Browse the repository at this point in the history
…e that columns bleed into each other
  • Loading branch information
peterdsharpe committed Feb 28, 2024
1 parent 0a18bc4 commit f54c791
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion aerosandbox/aerodynamics/aero_2D/xfoil.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import tempfile
import warnings
import os
import re


class XFoil(ExplicitAnalysis):
Expand Down Expand Up @@ -405,7 +406,9 @@ def str_to_float(s: str) -> float:
}

for pointno, line in enumerate(data_lines):
data = [str_to_float(entry) for entry in line.split()]
float_pattern = r"-?\d+\.\d+"
entries = re.findall(float_pattern, line)
data = [str_to_float(entry) for entry in entries]

if len(data) == 10 and len(columns) == 8:
# This is a monkey-patch for a bug in XFoil v6.99, which causes polar output files to be malformed
Expand Down

0 comments on commit f54c791

Please sign in to comment.