From 0c47306ebded4120fc3b8430bc639ab5f4d9767d Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 30 Sep 2024 23:58:19 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- ..._and_photometric_exposure_conversion.ipynb | 4 +-- ...ples_adobe_dng_sdk_colour_processing.ipynb | 4 +-- ...ssing_with_an_input_device_transform.ipynb | 12 +++---- ...xamples_global_tonemapping_operators.ipynb | 32 +++++-------------- .../examples_merge_from_ldr_files.ipynb | 10 ++---- .../examples_merge_from_raw_files.ipynb | 14 ++------ ...les_merge_from_raw_files_using_rawpy.ipynb | 4 +-- ...from_raw_files_with_post_demosaicing.ipynb | 9 ++---- ...ce_minimization_light_probe_sampling.ipynb | 12 ++----- ...ette_characterisation_and_correction.ipynb | 24 ++++---------- colour_hdri/exposure/tests/test_common.py | 1 - colour_hdri/exposure/tests/test_dsc.py | 1 - .../tests/test_weighting_functions.py | 1 - colour_hdri/models/tests/test_rgb.py | 1 - .../global_operators/tests/test_operators.py | 1 - 15 files changed, 35 insertions(+), 95 deletions(-) diff --git a/colour_hdri/examples/examples_absolute_luminance_calibration_and_photometric_exposure_conversion.ipynb b/colour_hdri/examples/examples_absolute_luminance_calibration_and_photometric_exposure_conversion.ipynb index b800289..5c04b06 100644 --- a/colour_hdri/examples/examples_absolute_luminance_calibration_and_photometric_exposure_conversion.ipynb +++ b/colour_hdri/examples/examples_absolute_luminance_calibration_and_photometric_exposure_conversion.ipynb @@ -143,9 +143,7 @@ ], "source": [ "HDRI_IMAGE = colour.read_image(\n", - " os.path.join(\n", - " ROOT_RESOURCES, \"Unity_Treasure_Island_White_Balanced.exr\"\n", - " )\n", + " os.path.join(ROOT_RESOURCES, \"Unity_Treasure_Island_White_Balanced.exr\")\n", ")\n", "\n", "colour.plotting.plot_image(\n", diff --git a/colour_hdri/examples/examples_adobe_dng_sdk_colour_processing.ipynb b/colour_hdri/examples/examples_adobe_dng_sdk_colour_processing.ipynb index 93fabab..41a5a19 100644 --- a/colour_hdri/examples/examples_adobe_dng_sdk_colour_processing.ipynb +++ b/colour_hdri/examples/examples_adobe_dng_sdk_colour_processing.ipynb @@ -97,9 +97,7 @@ "\n", "logging.basicConfig(level=logging.INFO)\n", "\n", - "ROOT_RESOURCES = os.path.join(\n", - " ROOT_RESOURCES_EXAMPLES, \"frobisher_001\"\n", - ")\n", + "ROOT_RESOURCES = os.path.join(ROOT_RESOURCES_EXAMPLES, \"frobisher_001\")\n", "\n", "colour.plotting.colour_style()\n", "\n", diff --git a/colour_hdri/examples/examples_advanced_processing_with_an_input_device_transform.ipynb b/colour_hdri/examples/examples_advanced_processing_with_an_input_device_transform.ipynb index d08d899..044ccd9 100644 --- a/colour_hdri/examples/examples_advanced_processing_with_an_input_device_transform.ipynb +++ b/colour_hdri/examples/examples_advanced_processing_with_an_input_device_transform.ipynb @@ -70,6 +70,7 @@ "import os\n", "import rawpy\n", "import colour\n", + "\n", "# NOTE: Currently requires the latest develop branch.\n", "import colour_datasets\n", "\n", @@ -85,9 +86,7 @@ "\n", "logging.basicConfig(level=logging.INFO)\n", "\n", - "ROOT_RESOURCES = os.path.join(\n", - " ROOT_RESOURCES_EXAMPLES, \"frobisher_001\"\n", - ")\n", + "ROOT_RESOURCES = os.path.join(ROOT_RESOURCES_EXAMPLES, \"frobisher_001\")\n", "\n", "colour.plotting.colour_style()\n", "\n", @@ -126,7 +125,7 @@ " raw = rawpy.imread(path).postprocess(\n", " gamma=(1, 1), no_auto_bright=True, output_bps=16\n", " )\n", - " \n", + "\n", " return colour.utilities.as_float_array(raw) / 65535\n", "\n", "\n", @@ -249,12 +248,13 @@ "CCT = 6000\n", "\n", "SD_ILLUMINANT = colour.sd_CIE_illuminant_D_series(\n", - " colour.temperature.CCT_to_xy_CIE_D(CCT * 1.4388 / 1.4380))\n", + " colour.temperature.CCT_to_xy_CIE_D(CCT * 1.4388 / 1.4380)\n", + ")\n", "\n", "M_IDT, RGB_w = colour.matrix_idt(SENSITIVITIES, SD_ILLUMINANT)\n", "\n", "logging.info(f'\"IDT Matrix\": {M_IDT}')\n", - "logging.info(f'\"White Balance Multipliers\": {RGB_w}')\n" + "logging.info(f'\"White Balance Multipliers\": {RGB_w}')" ] }, { diff --git a/colour_hdri/examples/examples_global_tonemapping_operators.ipynb b/colour_hdri/examples/examples_global_tonemapping_operators.ipynb index b7b2514..306e27d 100644 --- a/colour_hdri/examples/examples_global_tonemapping_operators.ipynb +++ b/colour_hdri/examples/examples_global_tonemapping_operators.ipynb @@ -122,9 +122,7 @@ } ], "source": [ - "HDRI_IMAGE = colour.read_image(\n", - " os.path.join(ROOT_RESOURCES, \"HDRMark_small.hdr\")\n", - ")\n", + "HDRI_IMAGE = colour.read_image(os.path.join(ROOT_RESOURCES, \"HDRMark_small.hdr\"))\n", "\n", "SAMPLES = np.linspace(0, 1, 512)\n", "D_SAMPLES = np.dstack((SAMPLES, SAMPLES, SAMPLES))\n", @@ -276,9 +274,7 @@ " with colour.utilities.suppress_warnings(python_warnings=True):\n", " plot_tonemapping_operator_image(\n", " tonemapping_operator_logarithmic(image, q, k),\n", - " np.squeeze(\n", - " tonemapping_operator_logarithmic(D_SAMPLES, q, k)[..., 0]\n", - " ),\n", + " np.squeeze(tonemapping_operator_logarithmic(D_SAMPLES, q, k)[..., 0]),\n", " title=\"Logarithmic Tonemapping Operator\",\n", " )\n", "\n", @@ -324,9 +320,7 @@ " with colour.utilities.suppress_warnings(python_warnings=True):\n", " plot_tonemapping_operator_image(\n", " tonemapping_operator_exponential(image, q, k),\n", - " np.squeeze(\n", - " tonemapping_operator_exponential(D_SAMPLES, q, k)[..., 0]\n", - " ),\n", + " np.squeeze(tonemapping_operator_exponential(D_SAMPLES, q, k)[..., 0]),\n", " title=\"Exponential Tonemapping Operator\",\n", " )\n", "\n", @@ -373,9 +367,7 @@ " plot_tonemapping_operator_image(\n", " tonemapping_operator_logarithmic_mapping(image, p, q),\n", " np.squeeze(\n", - " tonemapping_operator_logarithmic_mapping(D_SAMPLES, p, q)[\n", - " ..., 0\n", - " ]\n", + " tonemapping_operator_logarithmic_mapping(D_SAMPLES, p, q)[..., 0]\n", " ),\n", " title=\"Logarithmic Mapping Tonemapping Operator\",\n", " )\n", @@ -422,9 +414,7 @@ " with colour.utilities.suppress_warnings(python_warnings=True):\n", " plot_tonemapping_operator_image(\n", " tonemapping_operator_exponentiation_mapping(image, p, q),\n", - " np.squeeze(\n", - " tonemapping_operator_exponential(D_SAMPLES, p, q)[..., 0]\n", - " ),\n", + " np.squeeze(tonemapping_operator_exponential(D_SAMPLES, p, q)[..., 0]),\n", " title=\"Exponentiation Mapping Tonemapping Operator\",\n", " )\n", "\n", @@ -511,16 +501,12 @@ } ], "source": [ - "def tonemapping_operator_Tumblin1999_interactive(\n", - " image, L_da=20, C_max=100, L_max=100\n", - "):\n", + "def tonemapping_operator_Tumblin1999_interactive(image, L_da=20, C_max=100, L_max=100):\n", " with colour.utilities.suppress_warnings(python_warnings=True):\n", " plot_tonemapping_operator_image(\n", " tonemapping_operator_Tumblin1999(image, L_da, C_max, L_max),\n", " np.squeeze(\n", - " tonemapping_operator_Tumblin1999(\n", - " D_SAMPLES, L_da, C_max, L_max\n", - " )[..., 0]\n", + " tonemapping_operator_Tumblin1999(D_SAMPLES, L_da, C_max, L_max)[..., 0]\n", " ),\n", " title=\"Tumblin (1999) Tonemapping Operator\",\n", " )\n", @@ -567,9 +553,7 @@ "def tonemapping_operator_Reinhard2004_interactive(image, f=0, m=0.3, a=0, c=0):\n", " plot_tonemapping_operator_image(\n", " tonemapping_operator_Reinhard2004(image, f, m, a, c),\n", - " np.squeeze(\n", - " tonemapping_operator_Reinhard2004(D_SAMPLES, f, m, a, c)[..., 0]\n", - " ),\n", + " np.squeeze(tonemapping_operator_Reinhard2004(D_SAMPLES, f, m, a, c)[..., 0]),\n", " title=\"Reinhard (2004) Tonemapping Operator\",\n", " )\n", "\n", diff --git a/colour_hdri/examples/examples_merge_from_ldr_files.ipynb b/colour_hdri/examples/examples_merge_from_ldr_files.ipynb index bcee91a..3f17974 100644 --- a/colour_hdri/examples/examples_merge_from_ldr_files.ipynb +++ b/colour_hdri/examples/examples_merge_from_ldr_files.ipynb @@ -79,9 +79,7 @@ "\n", "logging.basicConfig(level=logging.INFO)\n", "\n", - "ROOT_RESOURCES = os.path.join(\n", - " ROOT_RESOURCES_EXAMPLES, \"frobisher_001\"\n", - ")\n", + "ROOT_RESOURCES = os.path.join(ROOT_RESOURCES_EXAMPLES, \"frobisher_001\")\n", "\n", "colour.plotting.colour_style()\n", "\n", @@ -117,9 +115,7 @@ "\n", "for path in RAW_FILES:\n", " logging.info('Converting \"{0}\" to \"Tiff\" file...'.format(path))\n", - " subprocess.call(\n", - " [\"dcraw\"] + shlex.split('-w -W -H 0 -q 3 -T \"{0}\"'.format(path))\n", - " )\n", + " subprocess.call([\"dcraw\"] + shlex.split('-w -W -H 0 -q 3 -T \"{0}\"'.format(path)))\n", "\n", "TIFF_FILES = sorted(glob.glob(\"{0}/*.tiff\".format(ROOT_RESOURCES)))" ] @@ -261,7 +257,7 @@ " return paths\n", "\n", "\n", - "PATHS = merge_from_ldr_files(TIFF_FILES, ROOT_RESOURCES, CRFS)\n" + "PATHS = merge_from_ldr_files(TIFF_FILES, ROOT_RESOURCES, CRFS)" ] }, { diff --git a/colour_hdri/examples/examples_merge_from_raw_files.ipynb b/colour_hdri/examples/examples_merge_from_raw_files.ipynb index 32e8d43..b3fd6bb 100644 --- a/colour_hdri/examples/examples_merge_from_raw_files.ipynb +++ b/colour_hdri/examples/examples_merge_from_raw_files.ipynb @@ -92,9 +92,7 @@ "logging.basicConfig(level=logging.INFO)\n", "\n", "\n", - "ROOT_RESOURCES = os.path.join(\n", - " ROOT_RESOURCES_EXAMPLES, \"frobisher_001\"\n", - ")\n", + "ROOT_RESOURCES = os.path.join(ROOT_RESOURCES_EXAMPLES, \"frobisher_001\")\n", "\n", "colour.plotting.colour_style()\n", "\n", @@ -156,19 +154,13 @@ "DNG_FILES = convert_raw_files_to_dng_files(RAW_FILES, ROOT_RESOURCES)\n", "\n", "XYZ_TO_CAMERA_SPACE_MATRIX = colour.utilities.as_float_array(\n", - " [\n", - " float(M_c)\n", - " for M_c in read_exif_tag(DNG_FILES[-2], \"ColorMatrix2\").split()\n", - " ]\n", + " [float(M_c) for M_c in read_exif_tag(DNG_FILES[-2], \"ColorMatrix2\").split()]\n", ").reshape((3, 3))\n", "\n", "# In order to avoid artefacts, white balancing should be peformed before\n", "# demosaicing thus we need to pass appropriate gains to *dcraw*.\n", "WHITE_BALANCE_MULTIPLIERS = colour.utilities.as_float_array(\n", - " [\n", - " float(M_c)\n", - " for M_c in read_exif_tag(DNG_FILES[-2], \"AsShotNeutral\").split()\n", - " ]\n", + " [float(M_c) for M_c in read_exif_tag(DNG_FILES[-2], \"AsShotNeutral\").split()]\n", ")\n", "\n", "WHITE_BALANCE_MULTIPLIERS = 1 / WHITE_BALANCE_MULTIPLIERS\n", diff --git a/colour_hdri/examples/examples_merge_from_raw_files_using_rawpy.ipynb b/colour_hdri/examples/examples_merge_from_raw_files_using_rawpy.ipynb index 5e387a9..c0ec810 100644 --- a/colour_hdri/examples/examples_merge_from_raw_files_using_rawpy.ipynb +++ b/colour_hdri/examples/examples_merge_from_raw_files_using_rawpy.ipynb @@ -79,9 +79,7 @@ "\n", "logging.basicConfig(level=logging.INFO)\n", "\n", - "ROOT_RESOURCES = os.path.join(\n", - " ROOT_RESOURCES_EXAMPLES, \"frobisher_001\"\n", - ")\n", + "ROOT_RESOURCES = os.path.join(ROOT_RESOURCES_EXAMPLES, \"frobisher_001\")\n", "\n", "colour.plotting.colour_style()\n", "\n", diff --git a/colour_hdri/examples/examples_merge_from_raw_files_with_post_demosaicing.ipynb b/colour_hdri/examples/examples_merge_from_raw_files_with_post_demosaicing.ipynb index 8f011a8..9a941a9 100644 --- a/colour_hdri/examples/examples_merge_from_raw_files_with_post_demosaicing.ipynb +++ b/colour_hdri/examples/examples_merge_from_raw_files_with_post_demosaicing.ipynb @@ -95,9 +95,7 @@ "\n", "logging.basicConfig(level=logging.INFO)\n", "\n", - "ROOT_RESOURCES = os.path.join(\n", - " ROOT_RESOURCES_EXAMPLES, \"frobisher_001\"\n", - ")\n", + "ROOT_RESOURCES = os.path.join(ROOT_RESOURCES_EXAMPLES, \"frobisher_001\")\n", "\n", "colour.plotting.colour_style()\n", "\n", @@ -167,10 +165,7 @@ "update_exif_tags(zip(DNG_FILES, INTERMEDIATE_FILES))\n", "\n", "XYZ_TO_CAMERA_SPACE_MATRIX = colour.utilities.as_float_array(\n", - " [\n", - " float(M_c)\n", - " for M_c in read_exif_tag(DNG_FILES[-2], \"ColorMatrix2\").split()\n", - " ]\n", + " [float(M_c) for M_c in read_exif_tag(DNG_FILES[-2], \"ColorMatrix2\").split()]\n", ").reshape((3, 3))" ] }, diff --git a/colour_hdri/examples/examples_variance_minimization_light_probe_sampling.ipynb b/colour_hdri/examples/examples_variance_minimization_light_probe_sampling.ipynb index 2313c08..3bf1422 100644 --- a/colour_hdri/examples/examples_variance_minimization_light_probe_sampling.ipynb +++ b/colour_hdri/examples/examples_variance_minimization_light_probe_sampling.ipynb @@ -119,9 +119,7 @@ "source": [ "HDRI_IMAGE1 = colour.read_image(os.path.join(ROOT_RESOURCES, \"Dots.exr\"))\n", "\n", - "HDRI_IMAGE2 = colour.read_image(\n", - " os.path.join(ROOT_RESOURCES, \"Grace_Cathedral.hdr\")\n", - ")\n", + "HDRI_IMAGE2 = colour.read_image(os.path.join(ROOT_RESOURCES, \"Grace_Cathedral.hdr\"))\n", "\n", "Y1 = colour.RGB_luminance(\n", " HDRI_IMAGE1,\n", @@ -255,16 +253,12 @@ ], "source": [ "print(\"Dots - 16 Lights\")\n", - "pprint(\n", - " light_probe_sampling_variance_minimization_Viriyothai2009(HDRI_IMAGE1, 16)\n", - ")\n", + "pprint(light_probe_sampling_variance_minimization_Viriyothai2009(HDRI_IMAGE1, 16))\n", "\n", "print(\"\\n\")\n", "\n", "print(\"Grace Cathedral - 32 Lights\")\n", - "pprint(\n", - " light_probe_sampling_variance_minimization_Viriyothai2009(HDRI_IMAGE2, 32)\n", - ")" + "pprint(light_probe_sampling_variance_minimization_Viriyothai2009(HDRI_IMAGE2, 32))" ] } ], diff --git a/colour_hdri/examples/examples_vignette_characterisation_and_correction.ipynb b/colour_hdri/examples/examples_vignette_characterisation_and_correction.ipynb index 3b21b85..098c0b9 100644 --- a/colour_hdri/examples/examples_vignette_characterisation_and_correction.ipynb +++ b/colour_hdri/examples/examples_vignette_characterisation_and_correction.ipynb @@ -160,9 +160,7 @@ } ], "source": [ - "characterisation_data = colour_hdri.characterise_vignette(\n", - " image, method=\"2D Function\"\n", - ")\n", + "characterisation_data = colour_hdri.characterise_vignette(image, method=\"2D Function\")\n", "\n", "print(characterisation_data.parameters)\n", "print(characterisation_data.principal_point)" @@ -272,9 +270,7 @@ " image, method=\"Bivariate Spline\"\n", ")\n", "\n", - "colour.plotting.plot_image(\n", - " colour.cctf_encoding(characterisation_data.parameters)\n", - ");" + "colour.plotting.plot_image(colour.cctf_encoding(characterisation_data.parameters));" ] }, { @@ -552,15 +548,11 @@ }, "outputs": [], "source": [ - "figure, axes = colour.plotting.plot_image(\n", - " colour.cctf_encoding(image), standalone=False\n", - ")\n", + "figure, axes = colour.plotting.plot_image(colour.cctf_encoding(image), standalone=False)\n", "\n", - "sampling_coordinates = (\n", - " colour_hdri.distortion.vignette.vignette_sampling_coordinates(\n", - " characterisation_data.principal_point,\n", - " image.shape[1] / image.shape[0],\n", - " )\n", + "sampling_coordinates = colour_hdri.distortion.vignette.vignette_sampling_coordinates(\n", + " characterisation_data.principal_point,\n", + " image.shape[1] / image.shape[0],\n", ")\n", "\n", "axes.scatter(\n", @@ -627,9 +619,7 @@ } ], "source": [ - "corrected = colour_hdri.correct_vignette(\n", - " image, characterisation_data, method=\"RBF\"\n", - ")\n", + "corrected = colour_hdri.correct_vignette(image, characterisation_data, method=\"RBF\")\n", "\n", "colour.plotting.plot_image(colour.cctf_encoding(corrected))\n", "\n", diff --git a/colour_hdri/exposure/tests/test_common.py b/colour_hdri/exposure/tests/test_common.py index 0abd802..db5003f 100644 --- a/colour_hdri/exposure/tests/test_common.py +++ b/colour_hdri/exposure/tests/test_common.py @@ -1,6 +1,5 @@ """Define the unit tests for the :mod:`colour_hdri.exposure.common` module.""" - import numpy as np from colour.constants import TOLERANCE_ABSOLUTE_TESTS diff --git a/colour_hdri/exposure/tests/test_dsc.py b/colour_hdri/exposure/tests/test_dsc.py index 3917d66..2676d4f 100644 --- a/colour_hdri/exposure/tests/test_dsc.py +++ b/colour_hdri/exposure/tests/test_dsc.py @@ -1,6 +1,5 @@ """Define the unit tests for the :mod:`colour_hdri.exposure.dsc` module.""" - import numpy as np from colour.constants import TOLERANCE_ABSOLUTE_TESTS diff --git a/colour_hdri/generation/tests/test_weighting_functions.py b/colour_hdri/generation/tests/test_weighting_functions.py index d095622..7f86603 100644 --- a/colour_hdri/generation/tests/test_weighting_functions.py +++ b/colour_hdri/generation/tests/test_weighting_functions.py @@ -3,7 +3,6 @@ :mod:`colour_hdri.generation.weighting_functions` module. """ - import numpy as np from colour.constants import TOLERANCE_ABSOLUTE_TESTS diff --git a/colour_hdri/models/tests/test_rgb.py b/colour_hdri/models/tests/test_rgb.py index 605524a..c029a70 100644 --- a/colour_hdri/models/tests/test_rgb.py +++ b/colour_hdri/models/tests/test_rgb.py @@ -1,6 +1,5 @@ """Define the unit tests for the :mod:`colour_hdri.models.rgb` module.""" - import numpy as np from colour.constants import TOLERANCE_ABSOLUTE_TESTS diff --git a/colour_hdri/tonemapping/global_operators/tests/test_operators.py b/colour_hdri/tonemapping/global_operators/tests/test_operators.py index 461aca4..af91dd2 100644 --- a/colour_hdri/tonemapping/global_operators/tests/test_operators.py +++ b/colour_hdri/tonemapping/global_operators/tests/test_operators.py @@ -3,7 +3,6 @@ :mod:`colour_hdri.tonemapping.global_operators.operators` module. """ - import numpy as np from colour.constants import TOLERANCE_ABSOLUTE_TESTS