def run_sampling()

in src/open_vp_cal/framework/processing.py [0:0]


    def run_sampling(self):
        """ Runs the sampling process to extract the samples form the image sequences,
        and generates the reference swatches from the results

        """

        self.identify_separation()
        if not self.led_wall.separation_results or not self.led_wall.separation_results.is_valid:
            raise SeparationException(
                "Frame Separation was not successful, please ensure the selected region of interest contains a sizable "
                "selection of the central calibration patch, especially if the auto detection has failed."
                "\nIf the region of interest is correct there is likely a sync or multiplexing issue within "
                "the recording")

        # We get the last slate frame and calculate what it should be based on the
        # separation.
        end_slate_sampler = BaseSamplePatch(
            self.led_wall, self.led_wall.separation_results, constants.PATCHES.END_SLATE)
        _, last_frame = end_slate_sampler.calculate_first_and_last_patch_frame()

        # If our calculated last frame is greater than the length of the sequence
        # we remove the end slate frames (1 x separation) to account for someone not
        # exporting the sequence fully
        if last_frame > self.led_wall.sequence_loader.end_frame:
            last_frame -= self.led_wall.separation_results.separation

        # If the last frame is still greater than the end frame of the sequence
        # then we have to raise an error as someone made a critical mistake
        if last_frame > self.led_wall.sequence_loader.end_frame:
            raise OpenVPCalException(f"Separation Calculation was not successful\n"
                             f"Separation Frames: {self.led_wall.separation_results.separation}\n"
                             f"First Red Frame: {self.led_wall.separation_results.first_red_frame.frame_num}\n"
                             f"First Green Frame: {self.led_wall.separation_results.first_green_frame.frame_num}\n"
                             f"Last Frame Of Sequence: {self.led_wall.sequence_loader.end_frame}\n"
                             f"Calculated End Slate Last Frame: {last_frame}\n"
                             f"Separation result will lead to out of frame range result\n\n"
                             f"Ensure Plate Is In Correct Format {self.led_wall.input_plate_gamut}")

        self.auto_detect_roi(self.led_wall.separation_results)

        self.get_grey_samples(self.led_wall.separation_results)
        self.get_primaries_samples(self.led_wall.separation_results)
        self.get_eotf_ramp_samples(self.led_wall.separation_results)
        self.get_eotf_ramp_signals()
        self.get_macbeth_samples(self.led_wall.separation_results)
        self.get_max_white_samples(self.led_wall.separation_results)
        samples, reference_samples = self.get_additional_samples_data()

        results = ProcessingResults()
        results.samples = samples
        results.reference_samples = reference_samples
        results.sample_buffers = self._sample_frames
        results.sample_reference_buffers = self._reference_frames

        self.led_wall.processing_results = results
        self.generate_sample_swatches()