Skip to content

Commit ade30fa

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent fd99f0f commit ade30fa

15 files changed

+35
-95
lines changed

colour_hdri/examples/examples_absolute_luminance_calibration_and_photometric_exposure_conversion.ipynb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,7 @@
143143
],
144144
"source": [
145145
"HDRI_IMAGE = colour.read_image(\n",
146-
" os.path.join(\n",
147-
" ROOT_RESOURCES, \"Unity_Treasure_Island_White_Balanced.exr\"\n",
148-
" )\n",
146+
" os.path.join(ROOT_RESOURCES, \"Unity_Treasure_Island_White_Balanced.exr\")\n",
149147
")\n",
150148
"\n",
151149
"colour.plotting.plot_image(\n",

colour_hdri/examples/examples_adobe_dng_sdk_colour_processing.ipynb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,7 @@
9797
"\n",
9898
"logging.basicConfig(level=logging.INFO)\n",
9999
"\n",
100-
"ROOT_RESOURCES = os.path.join(\n",
101-
" ROOT_RESOURCES_EXAMPLES, \"frobisher_001\"\n",
102-
")\n",
100+
"ROOT_RESOURCES = os.path.join(ROOT_RESOURCES_EXAMPLES, \"frobisher_001\")\n",
103101
"\n",
104102
"colour.plotting.colour_style()\n",
105103
"\n",

colour_hdri/examples/examples_advanced_processing_with_an_input_device_transform.ipynb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
"import os\n",
7171
"import rawpy\n",
7272
"import colour\n",
73+
"\n",
7374
"# NOTE: Currently requires the latest develop branch.\n",
7475
"import colour_datasets\n",
7576
"\n",
@@ -85,9 +86,7 @@
8586
"\n",
8687
"logging.basicConfig(level=logging.INFO)\n",
8788
"\n",
88-
"ROOT_RESOURCES = os.path.join(\n",
89-
" ROOT_RESOURCES_EXAMPLES, \"frobisher_001\"\n",
90-
")\n",
89+
"ROOT_RESOURCES = os.path.join(ROOT_RESOURCES_EXAMPLES, \"frobisher_001\")\n",
9190
"\n",
9291
"colour.plotting.colour_style()\n",
9392
"\n",
@@ -126,7 +125,7 @@
126125
" raw = rawpy.imread(path).postprocess(\n",
127126
" gamma=(1, 1), no_auto_bright=True, output_bps=16\n",
128127
" )\n",
129-
" \n",
128+
"\n",
130129
" return colour.utilities.as_float_array(raw) / 65535\n",
131130
"\n",
132131
"\n",
@@ -249,12 +248,13 @@
249248
"CCT = 6000\n",
250249
"\n",
251250
"SD_ILLUMINANT = colour.sd_CIE_illuminant_D_series(\n",
252-
" colour.temperature.CCT_to_xy_CIE_D(CCT * 1.4388 / 1.4380))\n",
251+
" colour.temperature.CCT_to_xy_CIE_D(CCT * 1.4388 / 1.4380)\n",
252+
")\n",
253253
"\n",
254254
"M_IDT, RGB_w = colour.matrix_idt(SENSITIVITIES, SD_ILLUMINANT)\n",
255255
"\n",
256256
"logging.info(f'\"IDT Matrix\": {M_IDT}')\n",
257-
"logging.info(f'\"White Balance Multipliers\": {RGB_w}')\n"
257+
"logging.info(f'\"White Balance Multipliers\": {RGB_w}')"
258258
]
259259
},
260260
{

colour_hdri/examples/examples_global_tonemapping_operators.ipynb

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,7 @@
122122
}
123123
],
124124
"source": [
125-
"HDRI_IMAGE = colour.read_image(\n",
126-
" os.path.join(ROOT_RESOURCES, \"HDRMark_small.hdr\")\n",
127-
")\n",
125+
"HDRI_IMAGE = colour.read_image(os.path.join(ROOT_RESOURCES, \"HDRMark_small.hdr\"))\n",
128126
"\n",
129127
"SAMPLES = np.linspace(0, 1, 512)\n",
130128
"D_SAMPLES = np.dstack((SAMPLES, SAMPLES, SAMPLES))\n",
@@ -276,9 +274,7 @@
276274
" with colour.utilities.suppress_warnings(python_warnings=True):\n",
277275
" plot_tonemapping_operator_image(\n",
278276
" tonemapping_operator_logarithmic(image, q, k),\n",
279-
" np.squeeze(\n",
280-
" tonemapping_operator_logarithmic(D_SAMPLES, q, k)[..., 0]\n",
281-
" ),\n",
277+
" np.squeeze(tonemapping_operator_logarithmic(D_SAMPLES, q, k)[..., 0]),\n",
282278
" title=\"Logarithmic Tonemapping Operator\",\n",
283279
" )\n",
284280
"\n",
@@ -324,9 +320,7 @@
324320
" with colour.utilities.suppress_warnings(python_warnings=True):\n",
325321
" plot_tonemapping_operator_image(\n",
326322
" tonemapping_operator_exponential(image, q, k),\n",
327-
" np.squeeze(\n",
328-
" tonemapping_operator_exponential(D_SAMPLES, q, k)[..., 0]\n",
329-
" ),\n",
323+
" np.squeeze(tonemapping_operator_exponential(D_SAMPLES, q, k)[..., 0]),\n",
330324
" title=\"Exponential Tonemapping Operator\",\n",
331325
" )\n",
332326
"\n",
@@ -373,9 +367,7 @@
373367
" plot_tonemapping_operator_image(\n",
374368
" tonemapping_operator_logarithmic_mapping(image, p, q),\n",
375369
" np.squeeze(\n",
376-
" tonemapping_operator_logarithmic_mapping(D_SAMPLES, p, q)[\n",
377-
" ..., 0\n",
378-
" ]\n",
370+
" tonemapping_operator_logarithmic_mapping(D_SAMPLES, p, q)[..., 0]\n",
379371
" ),\n",
380372
" title=\"Logarithmic Mapping Tonemapping Operator\",\n",
381373
" )\n",
@@ -422,9 +414,7 @@
422414
" with colour.utilities.suppress_warnings(python_warnings=True):\n",
423415
" plot_tonemapping_operator_image(\n",
424416
" tonemapping_operator_exponentiation_mapping(image, p, q),\n",
425-
" np.squeeze(\n",
426-
" tonemapping_operator_exponential(D_SAMPLES, p, q)[..., 0]\n",
427-
" ),\n",
417+
" np.squeeze(tonemapping_operator_exponential(D_SAMPLES, p, q)[..., 0]),\n",
428418
" title=\"Exponentiation Mapping Tonemapping Operator\",\n",
429419
" )\n",
430420
"\n",
@@ -511,16 +501,12 @@
511501
}
512502
],
513503
"source": [
514-
"def tonemapping_operator_Tumblin1999_interactive(\n",
515-
" image, L_da=20, C_max=100, L_max=100\n",
516-
"):\n",
504+
"def tonemapping_operator_Tumblin1999_interactive(image, L_da=20, C_max=100, L_max=100):\n",
517505
" with colour.utilities.suppress_warnings(python_warnings=True):\n",
518506
" plot_tonemapping_operator_image(\n",
519507
" tonemapping_operator_Tumblin1999(image, L_da, C_max, L_max),\n",
520508
" np.squeeze(\n",
521-
" tonemapping_operator_Tumblin1999(\n",
522-
" D_SAMPLES, L_da, C_max, L_max\n",
523-
" )[..., 0]\n",
509+
" tonemapping_operator_Tumblin1999(D_SAMPLES, L_da, C_max, L_max)[..., 0]\n",
524510
" ),\n",
525511
" title=\"Tumblin (1999) Tonemapping Operator\",\n",
526512
" )\n",
@@ -567,9 +553,7 @@
567553
"def tonemapping_operator_Reinhard2004_interactive(image, f=0, m=0.3, a=0, c=0):\n",
568554
" plot_tonemapping_operator_image(\n",
569555
" tonemapping_operator_Reinhard2004(image, f, m, a, c),\n",
570-
" np.squeeze(\n",
571-
" tonemapping_operator_Reinhard2004(D_SAMPLES, f, m, a, c)[..., 0]\n",
572-
" ),\n",
556+
" np.squeeze(tonemapping_operator_Reinhard2004(D_SAMPLES, f, m, a, c)[..., 0]),\n",
573557
" title=\"Reinhard (2004) Tonemapping Operator\",\n",
574558
" )\n",
575559
"\n",

colour_hdri/examples/examples_merge_from_ldr_files.ipynb

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,7 @@
7979
"\n",
8080
"logging.basicConfig(level=logging.INFO)\n",
8181
"\n",
82-
"ROOT_RESOURCES = os.path.join(\n",
83-
" ROOT_RESOURCES_EXAMPLES, \"frobisher_001\"\n",
84-
")\n",
82+
"ROOT_RESOURCES = os.path.join(ROOT_RESOURCES_EXAMPLES, \"frobisher_001\")\n",
8583
"\n",
8684
"colour.plotting.colour_style()\n",
8785
"\n",
@@ -117,9 +115,7 @@
117115
"\n",
118116
"for path in RAW_FILES:\n",
119117
" logging.info('Converting \"{0}\" to \"Tiff\" file...'.format(path))\n",
120-
" subprocess.call(\n",
121-
" [\"dcraw\"] + shlex.split('-w -W -H 0 -q 3 -T \"{0}\"'.format(path))\n",
122-
" )\n",
118+
" subprocess.call([\"dcraw\"] + shlex.split('-w -W -H 0 -q 3 -T \"{0}\"'.format(path)))\n",
123119
"\n",
124120
"TIFF_FILES = sorted(glob.glob(\"{0}/*.tiff\".format(ROOT_RESOURCES)))"
125121
]
@@ -261,7 +257,7 @@
261257
" return paths\n",
262258
"\n",
263259
"\n",
264-
"PATHS = merge_from_ldr_files(TIFF_FILES, ROOT_RESOURCES, CRFS)\n"
260+
"PATHS = merge_from_ldr_files(TIFF_FILES, ROOT_RESOURCES, CRFS)"
265261
]
266262
},
267263
{

colour_hdri/examples/examples_merge_from_raw_files.ipynb

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,7 @@
9292
"logging.basicConfig(level=logging.INFO)\n",
9393
"\n",
9494
"\n",
95-
"ROOT_RESOURCES = os.path.join(\n",
96-
" ROOT_RESOURCES_EXAMPLES, \"frobisher_001\"\n",
97-
")\n",
95+
"ROOT_RESOURCES = os.path.join(ROOT_RESOURCES_EXAMPLES, \"frobisher_001\")\n",
9896
"\n",
9997
"colour.plotting.colour_style()\n",
10098
"\n",
@@ -156,19 +154,13 @@
156154
"DNG_FILES = convert_raw_files_to_dng_files(RAW_FILES, ROOT_RESOURCES)\n",
157155
"\n",
158156
"XYZ_TO_CAMERA_SPACE_MATRIX = colour.utilities.as_float_array(\n",
159-
" [\n",
160-
" float(M_c)\n",
161-
" for M_c in read_exif_tag(DNG_FILES[-2], \"ColorMatrix2\").split()\n",
162-
" ]\n",
157+
" [float(M_c) for M_c in read_exif_tag(DNG_FILES[-2], \"ColorMatrix2\").split()]\n",
163158
").reshape((3, 3))\n",
164159
"\n",
165160
"# In order to avoid artefacts, white balancing should be peformed before\n",
166161
"# demosaicing thus we need to pass appropriate gains to *dcraw*.\n",
167162
"WHITE_BALANCE_MULTIPLIERS = colour.utilities.as_float_array(\n",
168-
" [\n",
169-
" float(M_c)\n",
170-
" for M_c in read_exif_tag(DNG_FILES[-2], \"AsShotNeutral\").split()\n",
171-
" ]\n",
163+
" [float(M_c) for M_c in read_exif_tag(DNG_FILES[-2], \"AsShotNeutral\").split()]\n",
172164
")\n",
173165
"\n",
174166
"WHITE_BALANCE_MULTIPLIERS = 1 / WHITE_BALANCE_MULTIPLIERS\n",

colour_hdri/examples/examples_merge_from_raw_files_using_rawpy.ipynb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,7 @@
7979
"\n",
8080
"logging.basicConfig(level=logging.INFO)\n",
8181
"\n",
82-
"ROOT_RESOURCES = os.path.join(\n",
83-
" ROOT_RESOURCES_EXAMPLES, \"frobisher_001\"\n",
84-
")\n",
82+
"ROOT_RESOURCES = os.path.join(ROOT_RESOURCES_EXAMPLES, \"frobisher_001\")\n",
8583
"\n",
8684
"colour.plotting.colour_style()\n",
8785
"\n",

colour_hdri/examples/examples_merge_from_raw_files_with_post_demosaicing.ipynb

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,7 @@
9595
"\n",
9696
"logging.basicConfig(level=logging.INFO)\n",
9797
"\n",
98-
"ROOT_RESOURCES = os.path.join(\n",
99-
" ROOT_RESOURCES_EXAMPLES, \"frobisher_001\"\n",
100-
")\n",
98+
"ROOT_RESOURCES = os.path.join(ROOT_RESOURCES_EXAMPLES, \"frobisher_001\")\n",
10199
"\n",
102100
"colour.plotting.colour_style()\n",
103101
"\n",
@@ -167,10 +165,7 @@
167165
"update_exif_tags(zip(DNG_FILES, INTERMEDIATE_FILES))\n",
168166
"\n",
169167
"XYZ_TO_CAMERA_SPACE_MATRIX = colour.utilities.as_float_array(\n",
170-
" [\n",
171-
" float(M_c)\n",
172-
" for M_c in read_exif_tag(DNG_FILES[-2], \"ColorMatrix2\").split()\n",
173-
" ]\n",
168+
" [float(M_c) for M_c in read_exif_tag(DNG_FILES[-2], \"ColorMatrix2\").split()]\n",
174169
").reshape((3, 3))"
175170
]
176171
},

colour_hdri/examples/examples_variance_minimization_light_probe_sampling.ipynb

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,7 @@
119119
"source": [
120120
"HDRI_IMAGE1 = colour.read_image(os.path.join(ROOT_RESOURCES, \"Dots.exr\"))\n",
121121
"\n",
122-
"HDRI_IMAGE2 = colour.read_image(\n",
123-
" os.path.join(ROOT_RESOURCES, \"Grace_Cathedral.hdr\")\n",
124-
")\n",
122+
"HDRI_IMAGE2 = colour.read_image(os.path.join(ROOT_RESOURCES, \"Grace_Cathedral.hdr\"))\n",
125123
"\n",
126124
"Y1 = colour.RGB_luminance(\n",
127125
" HDRI_IMAGE1,\n",
@@ -255,16 +253,12 @@
255253
],
256254
"source": [
257255
"print(\"Dots - 16 Lights\")\n",
258-
"pprint(\n",
259-
" light_probe_sampling_variance_minimization_Viriyothai2009(HDRI_IMAGE1, 16)\n",
260-
")\n",
256+
"pprint(light_probe_sampling_variance_minimization_Viriyothai2009(HDRI_IMAGE1, 16))\n",
261257
"\n",
262258
"print(\"\\n\")\n",
263259
"\n",
264260
"print(\"Grace Cathedral - 32 Lights\")\n",
265-
"pprint(\n",
266-
" light_probe_sampling_variance_minimization_Viriyothai2009(HDRI_IMAGE2, 32)\n",
267-
")"
261+
"pprint(light_probe_sampling_variance_minimization_Viriyothai2009(HDRI_IMAGE2, 32))"
268262
]
269263
}
270264
],

colour_hdri/examples/examples_vignette_characterisation_and_correction.ipynb

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -160,9 +160,7 @@
160160
}
161161
],
162162
"source": [
163-
"characterisation_data = colour_hdri.characterise_vignette(\n",
164-
" image, method=\"2D Function\"\n",
165-
")\n",
163+
"characterisation_data = colour_hdri.characterise_vignette(image, method=\"2D Function\")\n",
166164
"\n",
167165
"print(characterisation_data.parameters)\n",
168166
"print(characterisation_data.principal_point)"
@@ -272,9 +270,7 @@
272270
" image, method=\"Bivariate Spline\"\n",
273271
")\n",
274272
"\n",
275-
"colour.plotting.plot_image(\n",
276-
" colour.cctf_encoding(characterisation_data.parameters)\n",
277-
");"
273+
"colour.plotting.plot_image(colour.cctf_encoding(characterisation_data.parameters));"
278274
]
279275
},
280276
{
@@ -552,15 +548,11 @@
552548
},
553549
"outputs": [],
554550
"source": [
555-
"figure, axes = colour.plotting.plot_image(\n",
556-
" colour.cctf_encoding(image), standalone=False\n",
557-
")\n",
551+
"figure, axes = colour.plotting.plot_image(colour.cctf_encoding(image), standalone=False)\n",
558552
"\n",
559-
"sampling_coordinates = (\n",
560-
" colour_hdri.distortion.vignette.vignette_sampling_coordinates(\n",
561-
" characterisation_data.principal_point,\n",
562-
" image.shape[1] / image.shape[0],\n",
563-
" )\n",
553+
"sampling_coordinates = colour_hdri.distortion.vignette.vignette_sampling_coordinates(\n",
554+
" characterisation_data.principal_point,\n",
555+
" image.shape[1] / image.shape[0],\n",
564556
")\n",
565557
"\n",
566558
"axes.scatter(\n",
@@ -627,9 +619,7 @@
627619
}
628620
],
629621
"source": [
630-
"corrected = colour_hdri.correct_vignette(\n",
631-
" image, characterisation_data, method=\"RBF\"\n",
632-
")\n",
622+
"corrected = colour_hdri.correct_vignette(image, characterisation_data, method=\"RBF\")\n",
633623
"\n",
634624
"colour.plotting.plot_image(colour.cctf_encoding(corrected))\n",
635625
"\n",

0 commit comments

Comments
 (0)