From 9780f7eabdce984692994250b8a179cff1dc135c Mon Sep 17 00:00:00 2001 From: Marius Peter Date: Fri, 21 Jun 2019 19:45:20 -0700 Subject: change print_info and save_info to info_print and info_save ere --- creator.py | 14 +++++++------- evaluator.py | 6 +++--- main.py | 16 ++++++++-------- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/creator.py b/creator.py index fd09e2c..a468c2d 100644 --- a/creator.py +++ b/creator.py @@ -69,7 +69,7 @@ class Coordinates: def __str__(self): return type(self).__name__ - def print_info(self, round): + def info_print(self, round): ''' Print all the component's coordinates to the terminal. @@ -91,7 +91,7 @@ class Coordinates: print('z_l the lower z-coordinates:\n', np.around(self.z_l, round)) return None - def save_info(self, save_dir_path, number): + def info_save(self, save_dir_path, number): ''' Save all the object's coordinates (must be full path). ''' @@ -100,7 +100,7 @@ class Coordinates: full_path = os.path.join(save_dir_path, file_name) try: with open(full_path, 'w') as sys.stdout: - self.print_info(6) + self.info_print(6) # This line required to reset behavior of sys.stdout sys.stdout = sys.__stdout__ print('Successfully wrote to file {}'.format(full_path)) @@ -218,8 +218,8 @@ class Airfoil(Coordinates): def add_mass(self, mass): self.mass = mass - def print_info(self, round): - super().print_info(round) + def info_print(self, round): + super().info_print(round) print('x_c the camber x-coordinates:\n', np.around(self.x_u, round)) print('z_c the camber z-coordinates:\n', np.around(self.x_u, round)) return None @@ -408,8 +408,8 @@ class Stringer(Coordinates): self.mass = len(self.x_u) * mass + len(self.x_l) * mass return None - def print_info(self, round): - super().print_info(round) + def info_print(self, round): + super().info_print(round) print('Stringer Area:\n', np.around(self.area, round)) return None diff --git a/evaluator.py b/evaluator.py index c21ca2e..9a54120 100644 --- a/evaluator.py +++ b/evaluator.py @@ -53,7 +53,7 @@ class Airfoil: # Drag self.drag = [] - def print_info(self, round): + def info_print(self, round): ''' Print all the component's evaluated data to the terminal. @@ -78,14 +78,14 @@ class Airfoil: print('Drag:\n', np.around(self.drag, round)) return None - def save_info(self, save_dir_path, number): + def info_save(self, save_dir_path, number): '''Save all the object's coordinates (must be full path).''' file_name = 'airfoil_{}_eval.txt'.format(number) full_path = os.path.join(save_dir_path, file_name) try: with open(full_path, 'w') as sys.stdout: - self.print_info(6) + self.info_print(6) # This line required to reset behavior of sys.stdout sys.stdout = sys.__stdout__ print('Successfully wrote to file {}'.format(full_path)) diff --git a/main.py b/main.py index 8805f11..a59fcff 100644 --- a/main.py +++ b/main.py @@ -58,8 +58,8 @@ def main(): # Define NACA airfoil coordinates and mass af.add_naca(NACA_NUM) af.add_mass(AIRFOIL_MASS) - # af.print_info(2) - # af.save_info(SAVE_PATH, _) + # af.info_print(2) + # af.info_save(SAVE_PATH, _) # Create spar instance af.spar = creator.Spar() @@ -67,8 +67,8 @@ def main(): af.spar.add_coord(af.coord, 0.15) af.spar.add_coord(af.coord, 0.55) af.spar.add_mass(SPAR_MASS) - # af.spar.print_info(2) - # af.spar.save_info(SAVE_PATH, _) + # af.spar.info_print(2) + # af.spar.info_save(SAVE_PATH, _) # Create stringer instance af.stringer = creator.Stringer() @@ -76,8 +76,8 @@ def main(): af.stringer.add_coord(af.coord, af.spar.coord, 4, 7, 5, 6) af.stringer.add_area(STRINGER_AREA) af.stringer.add_mass(STRINGER_MASS) - # af.stringer.print_info(2) - # af.stringer.save_info(SAVE_PATH, _) + # af.stringer.info_print(2) + # af.stringer.info_save(SAVE_PATH, _) # Plot components with matplotlib # af.plot() @@ -86,8 +86,8 @@ def main(): eval = evaluator.Airfoil(af) # The analysis is performed in the evaluator.py module. eval.analysis() - eval.print_info(2) - # eval.save_info(SAVE_PATH, _) + eval.info_print(2) + # eval.info_save(SAVE_PATH, _) # eval.plot() # Print final execution time -- cgit v1.2.3