summaryrefslogtreecommitdiff
path: root/creator.py
diff options
context:
space:
mode:
authorMarius Peter <blendoit@gmail.com>2019-06-12 15:13:23 -0700
committerMarius Peter <blendoit@gmail.com>2019-06-12 15:13:23 -0700
commit09fd81eac3f5861b043e00d4865fa205deba5319 (patch)
tree9a857b18884dd44137ebe2c5fd2d327d28288c42 /creator.py
parent47b6bcca3455ea0d0e3996d31188ac34dcaa1f49 (diff)
debug messages for plotting and saving coordinates
Diffstat (limited to 'creator.py')
-rw-r--r--creator.py18
1 files changed, 11 insertions, 7 deletions
diff --git a/creator.py b/creator.py
index aa8001f..a2626d0 100644
--- a/creator.py
+++ b/creator.py
@@ -92,12 +92,16 @@ class Coordinates:
file_name = '{}_{}.txt'.format(self, number)
full_path = os.path.join(save_dir_path, file_name)
- # sys.stdout = open(full_path, 'w')
- # self.print_coord(2)
- with open(full_path, 'w') as sys.stdout:
- self.print_coord(2)
- # Following line required to reset value of sys.stdout
- sys.stdout = sys.__stdout__
+ try:
+ with open(full_path, 'w') as sys.stdout:
+ self.print_coord(2)
+ # This line required to reset behavior of sys.stdout
+ sys.stdout = sys.__stdout__
+ print('Successfully wrote to file {}'.format(full_path))
+ except:
+ print('Unable to write {} to specified directory.\n'
+ .format(file_name),
+ 'Was the full path passed to the function?')
# It is cleaner to use this context guard to ensure file is closed
return None
@@ -385,7 +389,7 @@ def plot(airfoil, spar, stringer):
x = (spar.x_u[_], spar.x_l[_])
y = (spar.y_u[_], spar.y_l[_])
plt.plot(x, y, '.-', color='b')
- plt.legend()
+ # plt.legend()
except:
print('Did not plot spars. Were they added?')
Copyright 2019--2024 Marius PETER