def analyse()

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


    def analyse(self):
        """
        Runs an analysis process on the samples to generate the status of the LED wall before calibration
        """
        target_cs, target_to_screen_cat, native_camera_cs = self._analysis_prep()

        reference_wall_external_white_balance_matrix = None
        if self.led_wall.match_reference_wall and self.led_wall.use_white_point_offset:
            raise OpenVPCalException("Cannot use white point offset and a reference wall")

        if self.led_wall.match_reference_wall:
            if self.led_wall.reference_wall_as_wall:
                reference_wall_processing_results = self.led_wall.reference_wall_as_wall.processing_results
                if not reference_wall_processing_results:
                    raise OpenVPCalException("Reference wall has not been analysed yet")
                reference_wall_external_white_balance_matrix = reference_wall_processing_results.pre_calibration_results[
                    Results.WHITE_BALANCE_MATRIX]

        decoupled_lens_white_samples = None
        if self.led_wall.use_white_point_offset:
            decoupled_lens_white_samples = imaging_utils.get_decoupled_white_samples_from_file(
                self.led_wall.white_point_offset_source)

        default_wall = LedWallSettings("default")

        # In our framework and sampling our samples have already been converted from
        # the input_plate gamut to the working colour space, this is to ensure things
        # like the mac beth detection work as expected, from the framework this means
        # we now set our input_plate_gamut to reference as this is now the colour space
        # the samples are now in
        calibration_results = calibrate.run(
            measured_samples=self.led_wall.processing_results.samples,
            reference_samples=self.led_wall.processing_results.reference_samples,
            input_plate_gamut=self.led_wall.project_settings.reference_gamut,
            native_camera_gamut=native_camera_cs,
            target_gamut=target_cs, target_to_screen_cat=target_to_screen_cat,
            reference_to_target_cat=default_wall.reference_to_target_cat,
            target_max_lum_nits=self.led_wall.target_max_lum_nits,
            target_EOTF=self.led_wall.target_eotf,
            enable_plate_white_balance=self.led_wall.auto_wb_source,
            enable_gamut_compression=False, enable_EOTF_correction=False,
            calculation_order=constants.CalculationOrder.CO_CS_EOTF,
            gamut_compression_shadow_rolloff=default_wall.shadow_rolloff,
            reference_wall_external_white_balance_matrix=reference_wall_external_white_balance_matrix,
            decoupled_lens_white_samples=decoupled_lens_white_samples,
            avoid_clipping=self.led_wall.avoid_clipping,
            reference_gamut=self.led_wall.project_settings.reference_gamut
        )

        self.led_wall.processing_results.pre_calibration_results = calibration_results
        return self.led_wall.processing_results