def update_model_with_results()

in src/open_vp_cal/widgets/graph_widget.py [0:0]


    def update_model_with_results(self, led_wall: LedWallSettings, pre_calibration=False) -> None:
        """ Updates the model with the results from the LED wall, to display the EOTF analysis for the wall.
            We plot the inverse of x & y because the lut values are doing the opposite of what the screen is doing

        Args:
            led_wall: the LED wall, which we are updating the model with the results from
            pre_calibration: Whether we want to get the pre-calibration results or the calibration results
        """
        results_name, results = self.get_display_name_and_results(led_wall, pre_calibration)
        if not results_name or not results:
            return

        plot_data_red_y = results[Results.REFERENCE_EOTF_RAMP]
        plot_data_green_y = results[Results.REFERENCE_EOTF_RAMP]
        plot_data_blue_y = results[Results.REFERENCE_EOTF_RAMP]

        data_source = Results.POST_EOTF_RAMPS
        if pre_calibration:
            data_source = Results.PRE_EOTF_RAMPS

        plot_data_red_x = [max(0, primary[0]) for primary in results[data_source]]
        plot_data_green_x = [max(0, primary[1]) for primary in results[data_source]]
        plot_data_blue_x = [max(0, primary[2]) for primary in results[data_source]]

        data_lines = self._model.get_data()
        if led_wall.name not in data_lines:
            data_lines[led_wall.name] = {}

        if results_name not in data_lines[led_wall.name]:
            data_lines[led_wall.name][results_name] = {}

        # We plot the inverse of the data
        data_lines[led_wall.name][f"{results_name}"]["red"] = {
            "line_colour": [255, 0, 0], "plot_data": (plot_data_red_y, plot_data_red_x)
        }
        data_lines[led_wall.name][f"{results_name}"]["green"] = {
            "line_colour": [0, 255, 0], "plot_data": (plot_data_green_y, plot_data_green_x)
        }
        data_lines[led_wall.name][f"{results_name}"]["blue"] = {
            "line_colour": [0, 0, 255], "plot_data": (plot_data_blue_y, plot_data_blue_x)
        }
        self._model.set_data(data_lines)