import os
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot
import pylab
from colour.plotting import *
matplotlib.pyplot.style.use('ggplot')
FIGURE_SIZE = (32, 32)
DEFAULT_FONT_SIZE = 16
DEFAULT_PARAMETERS = {
'figure.figsize': FIGURE_SIZE,
'font.size': DEFAULT_FONT_SIZE,
'axes.titlesize': DEFAULT_FONT_SIZE * 1.15,
'axes.labelsize': DEFAULT_FONT_SIZE,
'legend.fontsize': DEFAULT_FONT_SIZE * 0.9,
'xtick.labelsize': DEFAULT_FONT_SIZE,
'ytick.labelsize': DEFAULT_FONT_SIZE,
'axes.color_cycle': DEFAULT_COLOUR_CYCLE}
pylab.rcParams.update(DEFAULT_PARAMETERS)
ROOT_DIRECTORY = '/colour-science/colour-ramblings/digipro_diagrams/'
COLOURSPACES = ('ALEXA Wide Gamut RGB', 'Cinema Gamut', 'DCI-P3', 'DCI-P3+',
'ProPhoto RGB', 'Rec. 2020', 'Rec. 709', 'S-Gamut', 'S-Gamut3',
'S-Gamut3.Cine', 'V-Gamut', 'REDcolor', 'REDcolor2',
'REDcolor3', 'DRAGONcolor', 'DRAGONcolor2')
DIAGRAMS_SPECIFICATIONS = (
(RGB_colourspaces_CIE_1931_chromaticity_diagram_plot,
(-0.1, 0.9, -0.2, 1.2),
'upper right',
'CIE_1931_Chromaticity_Diagram'),
(RGB_colourspaces_CIE_1976_UCS_chromaticity_diagram_plot,
(-0.1, 0.7, -0.6, 0.7),
'lower right',
'CIE_1976_UCS_Chromaticity_Diagram'))
for artist, bounding_box, legend_location, diagram_name in DIAGRAMS_SPECIFICATIONS:
for colourspace in COLOURSPACES:
colourspace_name = colourspace.replace(' ', '_').replace('.', '_')
diagram_title = diagram_name.replace('_', ' ')
directory = os.path.join(ROOT_DIRECTORY,
diagram_name,
'Solo')
not os.path.exists(directory) and os.makedirs(directory)
base_name = os.path.join(directory, colourspace_name)
artist([colourspace],
bounding_box=bounding_box,
title='{0} - {1}\n'.format(colourspace, diagram_title),
legend_location=legend_location,
filename='{0}_{1}'.format(base_name, diagram_name))
directory = os.path.join(ROOT_DIRECTORY,
diagram_name,
'Compared_ACES_Encodings')
not os.path.exists(directory) and os.makedirs(directory)
base_name = os.path.join(directory, colourspace_name)
artist(['ACES2065-1', 'ACEScg', colourspace],
bounding_box=bounding_box,
colour_cycle_count=4,
legend_location=legend_location,
title='{0} - {1}\n'.format(
', '.join(['ACES2065-1', 'ACEScg', colourspace]),
diagram_title),
filename='{0}_Compared_ACES_Encodings_{1}'.format(
base_name, diagram_name))
directory = os.path.join(ROOT_DIRECTORY,
diagram_name,
'Compared_Pointer_Gamut')
not os.path.exists(directory) and os.makedirs(directory)
base_name = os.path.join(directory, colourspace_name)
artist([colourspace, 'Pointer Gamut'],
bounding_box=bounding_box,
legend_location=legend_location,
title='{0} - Pointer\'s Gamut - {1}\n'.format(
colourspace, diagram_title),
filename='{0}_Compared_Pointer_Gamut_{1}'.format(
base_name, diagram_name))
matplotlib.pyplot.close('all')
for artist, bounding_box, legend_location, diagram_name in DIAGRAMS_SPECIFICATIONS:
diagram_title = diagram_name.replace('_', ' ')
directory = os.path.join(ROOT_DIRECTORY,
diagram_name,
'Specific')
not os.path.exists(directory) and os.makedirs(directory)
base_name = os.path.join(directory, 'ACES2065-1_ACEScg_Pointer_Gamut')
artist(['ACES2065-1', 'ACEScg', 'Pointer Gamut'],
bounding_box=bounding_box,
colour_cycle_count=4,
legend_location=legend_location,
title='{0} - {1}\n'.format(
', '.join(['ACES2065-1', 'ACEScg', 'Pointer\'s Gamut']),
diagram_title),
filename='{0}_{1}'.format(base_name, diagram_name))
for artist, bounding_box, legend_location, diagram_name in DIAGRAMS_SPECIFICATIONS:
diagram_title = diagram_name.replace('_', ' ')
directory = os.path.join(ROOT_DIRECTORY,
diagram_name,
'Specific')
not os.path.exists(directory) and os.makedirs(directory)
base_name = os.path.join(directory, 'ACES2065-1_ACEScg')
artist(['ACES2065-1', 'ACEScg'],
bounding_box=bounding_box,
colour_cycle_count=4,
legend_location=legend_location,
title='{0} - {1}\n'.format(
', '.join(['ACES2065-1', 'ACEScg']),
diagram_title),
filename='{0}_{1}'.format(base_name, diagram_name))
for artist, bounding_box, legend_location, diagram_name in DIAGRAMS_SPECIFICATIONS:
diagram_title = diagram_name.replace('_', ' ')
directory = os.path.join(ROOT_DIRECTORY,
diagram_name,
'Specific')
not os.path.exists(directory) and os.makedirs(directory)
base_name = os.path.join(directory,
'ACES2065-1_ACEScg_DCI-P3_Rec__709_Rec__2020_Pointer_Gamut')
artist(['ACES2065-1', 'ACEScg', 'DCI-P3', 'Rec. 709', 'Rec. 2020', 'Pointer Gamut'],
bounding_box=bounding_box,
legend_location=legend_location,
title='{0} - {1}\n'.format(
', '.join(
['ACES2065-1', 'ACEScg', 'DCI-P3', 'Rec. 709', 'Rec. 2020',
'Pointer\'s Gamut']),
diagram_title),
filename='{0}_{1}'.format(base_name, diagram_name))
for artist, bounding_box, legend_location, diagram_name in DIAGRAMS_SPECIFICATIONS:
diagram_title = diagram_name.replace('_', ' ')
directory = os.path.join(ROOT_DIRECTORY,
diagram_name,
'Specific')
not os.path.exists(directory) and os.makedirs(directory)
base_name = os.path.join(directory,
'ACES2065-1_ACEScg_DCI-P3_Rec__709_Rec__2020')
artist(['ACES2065-1', 'ACEScg', 'DCI-P3', 'Rec. 709', 'Rec. 2020'],
bounding_box=bounding_box,
legend_location=legend_location,
colour_cycle_count=6,
title='{0} - {1}\n'.format(
', '.join(
['ACES2065-1', 'ACEScg', 'DCI-P3' 'Rec. 709', 'Rec. 2020']),
diagram_title),
filename='{0}_{1}'.format(base_name, diagram_name))
for artist, bounding_box, legend_location, diagram_name in DIAGRAMS_SPECIFICATIONS:
diagram_title = diagram_name.replace('_', ' ')
directory = os.path.join(ROOT_DIRECTORY,
diagram_name,
'Specific')
not os.path.exists(directory) and os.makedirs(directory)
base_name = os.path.join(directory, 'Camera_Display_Gamuts')
artist(sorted(COLOURSPACES),
bounding_box=bounding_box,
legend_location=legend_location,
title='Camera / Display Gamuts - {0}\n'.format(diagram_title),
filename='{0}_{1}'.format(base_name, diagram_name))
for artist, bounding_box, legend_location, diagram_name in DIAGRAMS_SPECIFICATIONS:
diagram_title = diagram_name.replace('_', ' ')
directory = os.path.join(ROOT_DIRECTORY,
diagram_name,
'Specific')
not os.path.exists(directory) and os.makedirs(directory)
base_name = os.path.join(directory, 'ACES2065-1_ACEScg_Camera_Display_Gamuts')
artist(sorted(['ACES2065-1', 'ACEScg'] + list(COLOURSPACES)),
bounding_box=bounding_box,
legend_location=legend_location,
title='ACES2065-1, ACEScg, Camera / Display Gamuts - {0}\n'.format(diagram_title),
filename='{0}_{1}'.format(base_name, diagram_name))
for artist, bounding_box, legend_location, diagram_name in DIAGRAMS_SPECIFICATIONS:
diagram_title = diagram_name.replace('_', ' ')
directory = os.path.join(ROOT_DIRECTORY,
diagram_name,
'Specific')
not os.path.exists(directory) and os.makedirs(directory)
base_name = os.path.join(directory, 'Imaginary_Primaries')
artist(sorted(('ACES2065-1', 'ACEScg', 'ALEXA Wide Gamut RGB', 'Cinema Gamut',
'DCI-P3+', 'ProPhoto RGB', 'S-Gamut', 'S-Gamut3',
'S-Gamut3.Cine', 'V-Gamut', 'REDcolor', 'REDcolor2',
'REDcolor3', 'DRAGONcolor', 'DRAGONcolor2')),
bounding_box=bounding_box,
legend_location=legend_location,
title='Imaginary Primaries - {0}\n'.format(diagram_title),
filename='{0}_{1}'.format(base_name, diagram_name))
for artist, bounding_box, legend_location, diagram_name in DIAGRAMS_SPECIFICATIONS:
diagram_title = diagram_name.replace('_', ' ')
directory = os.path.join(ROOT_DIRECTORY,
diagram_name,
'Specific')
not os.path.exists(directory) and os.makedirs(directory)
base_name = os.path.join(directory, 'Camera_Gamuts')
artist(sorted(('ALEXA Wide Gamut RGB', 'Cinema Gamut',
'S-Gamut', 'S-Gamut3', 'S-Gamut3.Cine', 'V-Gamut',
'REDcolor', 'REDcolor2', 'REDcolor3', 'DRAGONcolor',
'DRAGONcolor2')),
bounding_box=bounding_box,
legend_location=legend_location,
title='Camera Gamuts - {0}\n'.format(diagram_title),
filename='{0}_{1}'.format(base_name, diagram_name))
for artist, bounding_box, legend_location, diagram_name in DIAGRAMS_SPECIFICATIONS:
diagram_title = diagram_name.replace('_', ' ')
directory = os.path.join(ROOT_DIRECTORY,
diagram_name,
'Specific')
not os.path.exists(directory) and os.makedirs(directory)
base_name = os.path.join(directory,
'DCI-P3_Rec__709_Rec__2020')
artist(['DCI-P3', 'Rec. 709', 'Rec. 2020'],
bounding_box=bounding_box,
legend_location=legend_location,
colour_cycle_count=6,
title='{0} - {1}\n'.format(
', '.join(
['DCI-P3' 'Rec. 709', 'Rec. 2020']),
diagram_title),
filename='{0}_{1}'.format(base_name, diagram_name))
# Close-Up / Special Patch - RED
DIAGRAMS_SPECIFICATIONS = (
(RGB_colourspaces_CIE_1931_chromaticity_diagram_plot,
(0.69, 0.74, 0.27, 0.32),
'upper right',
'CIE_1931_Chromaticity_Diagram'),
(RGB_colourspaces_CIE_1976_UCS_chromaticity_diagram_plot,
(0.55, 0.57, 0.51, 0.53),
'upper right',
'CIE_1976_UCS_Chromaticity_Diagram'))
for artist, bounding_box, legend_location, diagram_name in DIAGRAMS_SPECIFICATIONS:
diagram_title = diagram_name.replace('_', ' ')
directory = os.path.join(ROOT_DIRECTORY,
diagram_name,
'Specific')
not os.path.exists(directory) and os.makedirs(directory)
base_name = os.path.join(directory, 'ACES2065-1_ACEScg_Rec__2020_Close-Up_Red')
artist(['ACES2065-1', 'ACEScg', 'Rec. 2020'],
bounding_box=bounding_box,
colour_cycle_count=4,
legend_location=legend_location,
title='{0} - {1}\n'.format(
', '.join(['ACES2065-1', 'ACEScg', 'Rec. 2020']),
diagram_title),
x_ticker_locator=matplotlib.ticker.LinearLocator(),
y_ticker_locator=matplotlib.ticker.LinearLocator(),
filename='{0}_{1}'.format(base_name, diagram_name))
# Close-Up / Special Patch - Green
DIAGRAMS_SPECIFICATIONS = (
(RGB_colourspaces_CIE_1931_chromaticity_diagram_plot,
(0.150, 0.200, 0.790, 0.840),
'upper right',
'CIE_1931_Chromaticity_Diagram'),
(RGB_colourspaces_CIE_1976_UCS_chromaticity_diagram_plot,
(0.045, 0.065, 0.58, 0.6),
'upper right',
'CIE_1976_UCS_Chromaticity_Diagram'))
for artist, bounding_box, legend_location, diagram_name in DIAGRAMS_SPECIFICATIONS:
diagram_title = diagram_name.replace('_', ' ')
directory = os.path.join(ROOT_DIRECTORY,
diagram_name,
'Specific')
not os.path.exists(directory) and os.makedirs(directory)
base_name = os.path.join(directory, 'ACES2065-1_ACEScg_Rec__2020_Close-Up_Green')
artist(['ACES2065-1', 'ACEScg', 'Rec. 2020'],
bounding_box=bounding_box,
colour_cycle_count=4,
legend_location=legend_location,
title='{0} - {1}\n'.format(
', '.join(['ACES2065-1', 'ACEScg', 'Rec. 2020']),
diagram_title),
x_ticker_locator=matplotlib.ticker.LinearLocator(),
y_ticker_locator=matplotlib.ticker.LinearLocator(),
filename='{0}_{1}'.format(base_name, diagram_name))
# Close-Up / Special Patch - RED
DIAGRAMS_SPECIFICATIONS = (
(RGB_colourspaces_CIE_1931_chromaticity_diagram_plot,
(0.60, 0.80, 0.20, 0.40),
'upper right',
'CIE_1931_Chromaticity_Diagram'),
(RGB_colourspaces_CIE_1976_UCS_chromaticity_diagram_plot,
(0.45, 0.65, 0.40, 0.60),
'upper right',
'CIE_1976_UCS_Chromaticity_Diagram'))
for artist, bounding_box, legend_location, diagram_name in DIAGRAMS_SPECIFICATIONS:
diagram_title = diagram_name.replace('_', ' ')
directory = os.path.join(ROOT_DIRECTORY,
diagram_name,
'Specific')
not os.path.exists(directory) and os.makedirs(directory)
base_name = os.path.join(directory, 'ACES2065-1_ACEScg_DCI-P3_Rec__2020_Close-Up_Red')
artist(['ACES2065-1', 'ACEScg', 'DCI-P3', 'Rec. 2020'],
bounding_box=bounding_box,
colour_cycle_count=4,
legend_location=legend_location,
title='{0} - {1}\n'.format(
', '.join(['ACES2065-1', 'ACEScg', 'DCI-P3', 'Rec. 2020']),
diagram_title),
x_ticker_locator=matplotlib.ticker.LinearLocator(),
y_ticker_locator=matplotlib.ticker.LinearLocator(),
filename='{0}_{1}'.format(base_name, diagram_name))
# Close-Up / Special Patch - Green
DIAGRAMS_SPECIFICATIONS = (
(RGB_colourspaces_CIE_1931_chromaticity_diagram_plot,
(0.1, 0.3, 0.65, 0.85),
'upper right',
'CIE_1931_Chromaticity_Diagram'),
(RGB_colourspaces_CIE_1976_UCS_chromaticity_diagram_plot,
(-0.05, 0.15, 0.45, 0.65),
'upper right',
'CIE_1976_UCS_Chromaticity_Diagram'))
for artist, bounding_box, legend_location, diagram_name in DIAGRAMS_SPECIFICATIONS:
diagram_title = diagram_name.replace('_', ' ')
directory = os.path.join(ROOT_DIRECTORY,
diagram_name,
'Specific')
not os.path.exists(directory) and os.makedirs(directory)
base_name = os.path.join(directory, 'ACES2065-1_ACEScg_DCI-P3_Rec__2020_Close-Up_Green')
artist(['ACES2065-1', 'ACEScg', 'DCI-P3', 'Rec. 2020'],
bounding_box=bounding_box,
colour_cycle_count=4,
legend_location=legend_location,
title='{0} - {1}\n'.format(
', '.join(['ACES2065-1', 'ACEScg', 'DCI-P3', 'Rec. 2020']),
diagram_title),
x_ticker_locator=matplotlib.ticker.LinearLocator(),
y_ticker_locator=matplotlib.ticker.LinearLocator(),
filename='{0}_{1}'.format(base_name, diagram_name))
DIAGRAMS_SPECIFICATIONS = (
(RGB_colourspaces_CIE_1931_chromaticity_diagram_plot,
(-0.1, 0.9, -0.2, 1.2),
'upper right',
'CIE_1931_Chromaticity_Diagram'),
(RGB_colourspaces_CIE_1976_UCS_chromaticity_diagram_plot,
(-0.1, 0.7, -0.6, 0.7),
'lower right',
'CIE_1976_UCS_Chromaticity_Diagram'))
for artist, bounding_box, legend_location, diagram_name in DIAGRAMS_SPECIFICATIONS:
diagram_title = diagram_name.replace('_', ' ')
directory = os.path.join(ROOT_DIRECTORY,
diagram_name,
'Test')
not os.path.exists(directory) and os.makedirs(directory)
base_name = os.path.join(directory, 'Rec_709')
artist(['Rec. 709'],
bounding_box=bounding_box,
colour_cycle_count=4,
legend_location=legend_location,
title='{0} - {1}\n'.format(
', '.join(['Rec. 709']),
diagram_title),
filename='{0}_{1}'.format(base_name, diagram_name))