def _generate_ocio_config()

in src/open_vp_cal/core/ocio_config.py [0:0]


    def _generate_ocio_config(
            self, led_walls: List[LedWallSettings], colour_space_function: typing.Callable,
            output_file=None, base_ocio_config=None,
            preview_export_filter=True, export_lut_for_aces_cct=False) -> str:
        """ Generate an OCIO config for the necessary colour spaces and transforms retrieved by the given function

        Args:
            led_walls: The LED walls we want the colour spaces for
            colour_space_function: The function to get the colour spaces

        Returns: The file path to the ocio config we write out

        """
        reference_spaces = []
        led_walls = [led_wall for led_wall in led_walls if not led_wall.is_verification_wall]
        if not led_walls:
            raise ValueError("No LED walls found to generate OCIO config")

        for led_wall in led_walls:
            if led_wall.processing_results:
                if led_wall.processing_results.calibration_results:
                    reference_spaces.append(
                        led_wall.processing_results.calibration_results[constants.Results.OCIO_REFERENCE_GAMUT]
                    )
                else:
                    if led_wall.processing_results.pre_calibration_results:
                        reference_spaces.append(
                            led_wall.processing_results.pre_calibration_results[constants.Results.OCIO_REFERENCE_GAMUT]
                        )

        ocio_config_reference_space_names = list(set(reference_spaces))
        if not ocio_config_reference_space_names:
            ocio_config_reference_space_names.append(
                led_walls[0].project_settings.reference_gamut
            )

        if len(ocio_config_reference_space_names) != 1:
            raise ValueError("Multiple reference colour spaces found for the ocio config")

        colour_spaces = {}
        for led_wall in led_walls:
            led_wall_colour_spaces = colour_space_function(
                led_wall, preview_export_filter=preview_export_filter, export_lut_for_aces_cct=export_lut_for_aces_cct)
            led_wall.processing_results.led_wall_colour_spaces = led_wall_colour_spaces
            colour_spaces[led_wall.name] = led_wall_colour_spaces

        return self.write_config(
            colour_spaces,
            output_file,
            ocio_config_reference_space_names[0],
            base_ocio_config,
            preview_export_filter=preview_export_filter
        )