Skip to content

Commit

Permalink
Merge pull request #18 from Netflix-Skunkworks/dev
Browse files Browse the repository at this point in the history
RC 10
  • Loading branch information
davisadam10 authored Jan 27, 2024
2 parents 869f294 + 19d2db8 commit 1780b91
Show file tree
Hide file tree
Showing 495 changed files with 270,644 additions and 98 deletions.
2 changes: 1 addition & 1 deletion src/open_vp_cal/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""
Init Module defines a few module level variables
"""
__version__ = "1.0.0-rc.9"
__version__ = "1.0.0-rc.10"
__authors__ = [
"Adam Davis", "Adrian Pueyo", "Carol Payne", "Francesco Luigi Giardiello"
]
Expand Down
18 changes: 17 additions & 1 deletion src/open_vp_cal/application_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
CLI classes which implement the methods to display the results to the user.
"""
import os
from typing import List, Dict, Tuple
from typing import List, Dict, Tuple, Any

from open_vp_cal.core import constants, utils
from open_vp_cal.framework.configuraton import Configuration
Expand All @@ -20,11 +20,17 @@ class OpenVPCalBase:
export of the LED walls. This class is inherited by the UI and used by the CLI or directly via custom python
scripts
"""

def __init__(self):
self._errors = []
self._warnings = []
self._infos = []

def error_messages(self) -> list[Any]:
""" Returns the list of error messages which have been logged
"""
return self._errors

def error_message(self, message) -> None:
""" Logs an error message and stores it within the class
Expand All @@ -33,6 +39,11 @@ def error_message(self, message) -> None:
"""
self._errors.append(message)

def warning_messages(self) -> list[Any]:
""" Returns the list of warning messages which have been logged
"""
return self._warnings

def warning_message(self, message: str, yes_text: str = "Yes", no_text: str = "No") -> bool:
""" Logs a warning message and stores it within the class
Expand All @@ -47,6 +58,11 @@ def warning_message(self, message: str, yes_text: str = "Yes", no_text: str = "N
self._warnings.append(message)
return True

def info_messages(self) -> list[Any]:
""" Returns the list of warning messages which have been logged
"""
return self._infos

def info_message(self, message) -> None:
""" Logs an info message and stores it within the class
Expand Down
6 changes: 4 additions & 2 deletions src/open_vp_cal/core/ocio_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ def create_inverse_eotf_group(tgt_eotf: str) -> ocio.GroupTransform:
elif tgt_eotf == EOTF.EOTF_SRGB:
inverse_eotf_group_transform.appendTransform(
ocio.ExponentWithLinearTransform(
gamma=2.4, offset=0.055,
gamma=[2.4, 2.4, 2.4, 2.4], offset=[0.055, 0.055, 0.055, 0.055],
direction=ocio.TransformDirection.TRANSFORM_DIR_INVERSE,
)
)
Expand Down Expand Up @@ -324,7 +324,9 @@ def transfer_function_only_cs_metadata(led_wall_settings: LedWallSettings) -> tu
Returns: The transfer function only colour space name and description
"""
transfer_function_only_cs_name = f"{led_wall_settings.target_eotf} - Curve"
eotf_name = "OpenVPCal_sRGB" \
if led_wall_settings.target_eotf == EOTF.EOTF_SRGB else led_wall_settings.target_eotf
transfer_function_only_cs_name = f"{eotf_name} - Curve"
transfer_function_only_cs_description = "OpenVPCal EOTF Only"
return transfer_function_only_cs_name, transfer_function_only_cs_description

Expand Down
14 changes: 13 additions & 1 deletion src/open_vp_cal/framework/processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from open_vp_cal.led_wall_settings import LedWallSettings
from open_vp_cal.framework.identify_separation import IdentifySeparation, SeparationResults
from open_vp_cal.project_settings import ProjectSettings
from open_vp_cal.framework.sample_patch import SamplePatch, SampleRampPatches, MacBethSample
from open_vp_cal.framework.sample_patch import SamplePatch, SampleRampPatches, MacBethSample, BaseSamplePatch
from open_vp_cal.framework.auto_roi import AutoROI, AutoROIResults


Expand Down Expand Up @@ -109,6 +109,18 @@ def run_sampling(self):
"\nIf the region of interest is correct there is likely a sync or multiplexing issue within "
"the recording")

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 last_frame > self.led_wall.sequence_loader.end_frame:
raise ValueError(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")

self.auto_detect_roi(self.led_wall.separation_results)

self.get_grey_samples(self.led_wall.separation_results)
Expand Down
5 changes: 3 additions & 2 deletions src/open_vp_cal/imaging/imaging_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -805,9 +805,10 @@ def detect_green(values: np.array, colour_space: str = "ACES2065-1") -> bool:
"""
numpy_array_xyY = _get_xyY_values(values, colour_space=colour_space)
green_threshold = 0.5
green_threshold = 0.45
red_threshold = 0.3

if numpy_array_xyY[1] > green_threshold:
if numpy_array_xyY[0] < red_threshold and numpy_array_xyY[1] > green_threshold:
return True
return False

Expand Down
34 changes: 27 additions & 7 deletions src/open_vp_cal/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
import sys
import time
import traceback
from typing import Dict

import open_vp_cal
from open_vp_cal.application_base import OpenVPCalBase
from open_vp_cal.core import constants
from open_vp_cal.core.resource_loader import ResourceLoader
from open_vp_cal.framework.processing import Processing
from open_vp_cal.framework.utils import generate_patterns_for_led_walls
from open_vp_cal.led_wall_settings import LedWallSettings
from open_vp_cal.project_settings import ProjectSettings


Expand Down Expand Up @@ -148,7 +148,7 @@ def generate_patterns(project_settings_file_path: str, output_folder: str) -> st
def run_cli(
project_settings_file_path: str,
output_folder: str,
ocio_config_path: str = None) -> Dict:
ocio_config_path: str = None) -> dict[str, LedWallSettings]:
""" Runs the application in CLI mode to process the given project settings file.
Args:
Expand Down Expand Up @@ -178,11 +178,31 @@ def run_cli(

# Now we have everything lets sort the led walls so they are in the correct order
open_vp_cal_base = OpenVPCalBase()
open_vp_cal_base.analyse(project_settings.led_walls)
open_vp_cal_base.post_analysis_validations(project_settings.led_walls)
open_vp_cal_base.calibrate(project_settings.led_walls)
_, led_walls = open_vp_cal_base.export(project_settings, project_settings.led_walls)
return {led_wall.name: led_wall.processing_results for led_wall in led_walls}
status = open_vp_cal_base.analyse(project_settings.led_walls)
if not status:
error_messages = "\n".join(open_vp_cal_base.error_messages())
warning_messages = "\n".join(open_vp_cal_base.warning_messages())
raise ValueError(f"Analysis Failed\nWarning Messages:\n{warning_messages}\nError Messages:\n{error_messages}\n")

status = open_vp_cal_base.post_analysis_validations(project_settings.led_walls)
if not status:
error_messages = "\n".join(open_vp_cal_base.error_messages())
warning_messages = "\n".join(open_vp_cal_base.warning_messages())
raise ValueError(f"Analysis Validation Failed\nWarning Messages:\n{warning_messages}\nError Messages:\n{error_messages}\n")

status = open_vp_cal_base.calibrate(project_settings.led_walls)
if not status:
error_messages = "\n".join(open_vp_cal_base.error_messages())
warning_messages = "\n".join(open_vp_cal_base.warning_messages())
raise ValueError(f"Calibrate Failed\nWarning Messages:\n{warning_messages}\nError Messages:\n{error_messages}\n")

status, led_walls = open_vp_cal_base.export(project_settings, project_settings.led_walls)
if not status:
error_messages = "\n".join(open_vp_cal_base.error_messages())
warning_messages = "\n".join(open_vp_cal_base.warning_messages())
raise ValueError(f"Export Failed\nWarning Messages:\n{warning_messages}\nError Messages:\n{error_messages}\n")

return {led_wall.name: led_wall for led_wall in led_walls}


def main() -> None:
Expand Down
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Loading

0 comments on commit 1780b91

Please sign in to comment.