heat_transfer_plot_temperature.py
def save_results_to_png_file(self,
                                 material: str,
                                 method: str) -> None:
        """
        Outputs the (semi)results of a simulation into a PNG file and names it
            accordingly.
        """

        # TODO: discuss the possible filename structure

        # Getting the data from plot - to inuquely identify the plot condition
        # (for the complete plot being different from non-complete one)
        try:
            lines = self.figure.gca().get_lines()
            time_data = lines[0].get_data()[0]

            file_name = "Temperature-{}-{}-{}s.png".format(method,
                                                           material,
                                                           int(time_data[-1]))

            base_path = os.path.dirname(os.path.realpath(__file__))
            absolute_path = os.path.join(base_path, file_name)

            # If for some reason there was already the same file, rather not
            #   overwrite it, but create a new file a timestamp as an identifier
            if os.path.isfile(absolute_path):
                absolute_path = "{}-{}.png".format(absolute_path.split(".")[0],
                                                   int(time.time()))

            self.fig.savefig(absolute_path)
        except IndexError:
            # IndexError happens when there is no calculated data yet
            # (When user clicks STOP button right after RUN button)
            pass

        Outputs the (semi)results of a simulation into a PNG file and names it
            accordingly.
        
Outputs the (semi)results of a simulation into a PNG file and names it
accordingly.
Outputs the ( semi ) results of a simulation into a PNG file and names it accordingly .
def save_results_to_png_file(self,
                                 material: str,
                                 method: str) -> None:
        try:
            lines = self.figure.gca().get_lines()
            time_data = lines[0].get_data()[0]
            file_name = "Temperature-{}-{}-{}s.png".format(method,
                                                           material,
                                                           int(time_data[-1]))
            base_path = os.path.dirname(os.path.realpath(__file__))
            absolute_path = os.path.join(base_path, file_name)
            if os.path.isfile(absolute_path):
                absolute_path = "{}-{}.png".format(absolute_path.split(".")[0],
                                                   int(time.time()))
            self.fig.savefig(absolute_path)
        except IndexError:
            pass
def save_results_to_png_file ( self , material : str , method : str ) -> None : try : lines = self . figure . gca ( ) . get_lines ( ) time_data = lines [ 0 ] . get_data ( ) [ 0 ] file_name = "Temperature-{}-{}-{}s.png" . format ( method , material , int ( time_data [ - 1 ] ) ) base_path = os . path . dirname ( os . path . realpath ( __file__ ) ) absolute_path = os . path . join ( base_path , file_name ) if os . path . isfile ( absolute_path ) : absolute_path = "{}-{}.png" . format ( absolute_path . split ( "." ) [ 0 ] , int ( time . time ( ) ) ) self . fig . savefig ( absolute_path ) except IndexError : pass
Outputs the (semi)results of a simulation into a PNG file and names it
accordingly.
Outputs the ( semi ) results of a simulation into a PNG file and names it accordingly .
"""
        Outputs the (semi)results of a simulation into a PNG file and names it
            accordingly.
        """ # TODO: discuss the possible filename structure # Getting the data from plot - to inuquely identify the plot condition # (for the complete plot being different from non-complete one) # If for some reason there was already the same file, rather not #   overwrite it, but create a new file a timestamp as an identifier # IndexError happens when there is no calculated data yet # (When user clicks STOP button right after RUN button)
self
material
str
method
str