Example #1
0
    def create_output_dir(self):
        """

        :return:
        """

        mkdir_p(self.output_directory)
    def output_screenshots(self, mcs: int) -> None:
        """
        outputs screenshots. Called from SimpleTabView:handleCompletedStep{Regular,CML*}
        :param mcs:
        :return:
        """

        bsd = self.get_basic_simulation_data()

        screenshot_directory_name = self.get_screenshot_dir_name()

        mcs_formatted_number = str(mcs).zfill(self.screenshot_number_of_digits)

        for i, screenshot_name in enumerate(self.screenshotDataDict.keys()):
            screenshot_data = self.screenshotDataDict[screenshot_name]

            if not screenshot_name:
                screenshot_name = 'screenshot_' + str(i)

            screenshot_dir = os.path.join(screenshot_directory_name, screenshot_name)

            # will create screenshot directory if directory does not exist
            if not os.path.isdir(screenshot_dir):
                mkdir_p(screenshot_dir)

            screenshot_fname = os.path.join(screenshot_dir, screenshot_name + "_" + mcs_formatted_number + ".png")

            self.gd.clear_display()
            self.gd.draw(screenshot_data=screenshot_data, bsd=bsd, screenshot_name=screenshot_name)
            self.gd.output_screenshot(screenshot_fname=screenshot_fname, file_format="png", screenshot_data=screenshot_data)
 def safe_write_screenshot_description_file(self, out_fname):
     """
     writes screenshot descr file in a safe mode. any problems are reported via warning
     :param out_fname: {str}
     :return: None
     """
     mkdir_p(dirname(out_fname))
     self.write_screenshot_description_file(out_fname)
    def create_storage_dir(self) -> None:
        """
        Creates storage dir for fields. Initializes self.output_dir_name
        :return:
        """
        screenshot_directory = cc3d.CompuCellSetup.persistent_globals.output_directory
        self.output_dir_name = join(screenshot_directory, 'LatticeData')

        mkdir_p(self.output_dir_name)
    def output_screenshots_impl(self, mcs: int, screenshot_label_list: list):
        """
        implementation function ofr taking screenshots
        :param mcs:
        :param screenshot_label_list:
        :return
        """
        if self.output_error_flag:
            return

        bsd = self.get_basic_simulation_data()

        screenshot_directory_name = self.get_screenshot_dir_name()

        mcs_formatted_number = str(mcs).zfill(self.screenshot_number_of_digits)

        for i, screenshot_name in enumerate(screenshot_label_list):
            screenshot_data = self.screenshotDataDict[screenshot_name]
            # we are inserting a flag into scene metadata that informs the rest
            # of the visualization pipeline that we are dealing with actual screenshop
            # and if so we will use e.g. colors from screenshot description file, and not from settings
            screenshot_data.metadata['actual_screenshot'] = True

            if not screenshot_name:
                screenshot_name = 'screenshot_' + str(i)

            screenshot_dir = os.path.join(screenshot_directory_name,
                                          screenshot_name)

            # will create screenshot directory if directory does not exist
            if not os.path.isdir(screenshot_dir):
                mkdir_p(screenshot_dir)

            screenshot_fname = os.path.join(
                screenshot_dir,
                screenshot_name + "_" + mcs_formatted_number + ".png")

            self.gd.clear_display()
            self.gd.draw(screenshot_data=screenshot_data,
                         bsd=bsd,
                         screenshot_name=screenshot_name)
            self.gd.output_screenshot(screenshot_fname=screenshot_fname,
                                      file_format="png",
                                      screenshot_data=screenshot_data)
    def output_screenshots_impl(self, mcs: int, screenshot_label_list: list):
        """
        implementation function ofr taking screenshots
        :param mcs:
        :param screenshot_label_list:
        :return
        """
        if self.output_error_flag:
            return

        bsd = self.get_basic_simulation_data()

        screenshot_directory_name = self.get_screenshot_dir_name()

        mcs_formatted_number = str(mcs).zfill(self.screenshot_number_of_digits)

        for i, screenshot_name in enumerate(screenshot_label_list):
            screenshot_data = self.screenshotDataDict[screenshot_name]

            if not screenshot_name:
                screenshot_name = 'screenshot_' + str(i)

            screenshot_dir = os.path.join(screenshot_directory_name,
                                          screenshot_name)

            # will create screenshot directory if directory does not exist
            if not os.path.isdir(screenshot_dir):
                mkdir_p(screenshot_dir)

            screenshot_fname = os.path.join(
                screenshot_dir,
                screenshot_name + "_" + mcs_formatted_number + ".png")

            self.gd.clear_display()
            self.gd.draw(screenshot_data=screenshot_data,
                         bsd=bsd,
                         screenshot_name=screenshot_name)
            self.gd.output_screenshot(screenshot_fname=screenshot_fname,
                                      file_format="png",
                                      screenshot_data=screenshot_data)