|
24 | 24 | from colour.models import (XYZ_to_colourspace_model, function_gamma,
|
25 | 25 | function_linear)
|
26 | 26 | from colour.plotting import filter_cmfs, filter_RGB_colourspaces
|
27 |
| -from colour.utilities import (CaseInsensitiveMapping, first_item, |
28 |
| - normalise_maximum, tsplit, tstack) |
| 27 | +from colour.utilities import (CaseInsensitiveMapping, as_float_array, |
| 28 | + first_item, normalise_maximum, tsplit, tstack) |
29 | 29 | from colour.volume import XYZ_outer_surface
|
30 | 30 |
|
31 | 31 | __author__ = 'Colour Developers'
|
@@ -254,7 +254,7 @@ def XYZ_to_colourspace_model_normalised(XYZ, illuminant, model, **kwargs):
|
254 | 254 |
|
255 | 255 | Other Parameters
|
256 | 256 | ----------------
|
257 |
| - \**kwargs : dict, optional |
| 257 | + \\**kwargs : dict, optional |
258 | 258 | Keywords arguments.
|
259 | 259 |
|
260 | 260 | Returns
|
@@ -296,13 +296,13 @@ def colourspace_model_axis_reorder(a, model=None):
|
296 | 296 |
|
297 | 297 | i, j, k = tsplit(a)
|
298 | 298 | if model in ('CIE XYZ', ):
|
299 |
| - a = tstack((k, j, i)) |
| 299 | + a = tstack([k, j, i]) |
300 | 300 | elif model in ('CIE UCS', 'CIE UVW', 'CIE xyY'):
|
301 |
| - a = tstack((j, k, i)) |
| 301 | + a = tstack([j, k, i]) |
302 | 302 | elif model in ('CIE Lab', 'CIE LCHab', 'CIE Luv', 'CIE LCHuv', 'DIN 99',
|
303 | 303 | 'Hunter Lab', 'Hunter Rdab', 'IPT', 'JzAzBz', 'OSA UCS',
|
304 | 304 | 'hdr-CIELAB', 'hdr-IPT'):
|
305 |
| - a = tstack((k, i, j)) |
| 305 | + a = tstack([k, i, j]) |
306 | 306 |
|
307 | 307 | return a
|
308 | 308 |
|
@@ -381,7 +381,7 @@ def buffer_geometry(**kwargs):
|
381 | 381 |
|
382 | 382 | Other Parameters
|
383 | 383 | ----------------
|
384 |
| - \**kwargs : dict, optional |
| 384 | + \\**kwargs : dict, optional |
385 | 385 | Valid attributes from `BufferGeometryLoader <https://threejs.org/docs/\
|
386 | 386 | #api/loaders/BufferGeometryLoader>`_.
|
387 | 387 |
|
@@ -412,7 +412,7 @@ def buffer_geometry(**kwargs):
|
412 | 412 | }
|
413 | 413 |
|
414 | 414 | for attribute, values in kwargs.items():
|
415 |
| - values = np.asarray(values) |
| 415 | + values = as_float_array(values) |
416 | 416 | shape = values.shape
|
417 | 417 | dtype = values.dtype.name
|
418 | 418 |
|
@@ -524,9 +524,12 @@ def create_plane(width=1,
|
524 | 524 | positions = np.roll(positions, shift, -1)
|
525 | 525 | normals = np.roll(normals, shift, -1) * sign
|
526 | 526 | colors = np.ravel(positions)
|
527 |
| - colors = np.hstack((np.reshape( |
528 |
| - np.interp(colors, (np.min(colors), np.max(colors)), (0, 1)), |
529 |
| - positions.shape), np.ones((positions.shape[0], 1)))) |
| 527 | + colors = np.hstack([ |
| 528 | + np.reshape( |
| 529 | + np.interp(colors, (np.min(colors), np.max(colors)), (0, 1)), |
| 530 | + positions.shape), |
| 531 | + np.ones((positions.shape[0], 1)) |
| 532 | + ]) |
530 | 533 | colors[..., neutral_axis] = 0
|
531 | 534 |
|
532 | 535 | vertices = np.zeros(positions.shape[0],
|
@@ -618,22 +621,25 @@ def create_box(width=1,
|
618 | 621 |
|
619 | 622 | offset = 0
|
620 | 623 | for vertices_p, faces_p, outline_p in planes_m:
|
621 |
| - positions = np.vstack((positions, vertices_p['position'])) |
622 |
| - uvs = np.vstack((uvs, vertices_p['uv'])) |
623 |
| - normals = np.vstack((normals, vertices_p['normal'])) |
| 624 | + positions = np.vstack([positions, vertices_p['position']]) |
| 625 | + uvs = np.vstack([uvs, vertices_p['uv']]) |
| 626 | + normals = np.vstack([normals, vertices_p['normal']]) |
624 | 627 |
|
625 |
| - faces = np.vstack((faces, faces_p + offset)) |
626 |
| - outline = np.vstack((outline, outline_p + offset)) |
| 628 | + faces = np.vstack([faces, faces_p + offset]) |
| 629 | + outline = np.vstack([outline, outline_p + offset]) |
627 | 630 | offset += vertices_p['position'].shape[0]
|
628 | 631 |
|
629 | 632 | vertices = np.zeros(positions.shape[0],
|
630 | 633 | [('position', np.float32, 3), ('uv', np.float32, 2),
|
631 | 634 | ('normal', np.float32, 3), ('colour', np.float32, 4)])
|
632 | 635 |
|
633 | 636 | colors = np.ravel(positions)
|
634 |
| - colors = np.hstack((np.reshape( |
635 |
| - np.interp(colors, (np.min(colors), np.max(colors)), (0, 1)), |
636 |
| - positions.shape), np.ones((positions.shape[0], 1)))) |
| 637 | + colors = np.hstack([ |
| 638 | + np.reshape( |
| 639 | + np.interp(colors, (np.min(colors), np.max(colors)), (0, 1)), |
| 640 | + positions.shape), |
| 641 | + np.ones((positions.shape[0], 1)) |
| 642 | + ]) |
637 | 643 |
|
638 | 644 | vertices['position'] = positions
|
639 | 645 | vertices['uv'] = uvs
|
@@ -690,11 +696,9 @@ def image_data(path,
|
690 | 696 | """
|
691 | 697 |
|
692 | 698 | primary_colourspace = first_item(
|
693 |
| - filter_RGB_colourspaces('^{0}$'.format( |
694 |
| - re.escape(primary_colourspace)))) |
| 699 | + filter_RGB_colourspaces(re.escape(primary_colourspace)).values()) |
695 | 700 | secondary_colourspace = first_item(
|
696 |
| - filter_RGB_colourspaces('^{0}$'.format( |
697 |
| - re.escape(secondary_colourspace)))) |
| 701 | + filter_RGB_colourspaces(re.escape(secondary_colourspace)).values()) |
698 | 702 |
|
699 | 703 | colourspace = (primary_colourspace if image_colourspace == 'Primary' else
|
700 | 704 | secondary_colourspace)
|
@@ -765,7 +769,7 @@ def RGB_colourspace_volume_visual(colourspace=PRIMARY_COLOURSPACE,
|
765 | 769 | """
|
766 | 770 |
|
767 | 771 | colourspace = first_item(
|
768 |
| - filter_RGB_colourspaces('^{0}$'.format(re.escape(colourspace)))) |
| 772 | + filter_RGB_colourspaces(re.escape(colourspace)).values()) |
769 | 773 |
|
770 | 774 | cube = create_box(
|
771 | 775 | width_segments=segments,
|
@@ -841,11 +845,9 @@ def RGB_image_scatter_visual(path,
|
841 | 845 | """
|
842 | 846 |
|
843 | 847 | primary_colourspace = first_item(
|
844 |
| - filter_RGB_colourspaces('^{0}$'.format( |
845 |
| - re.escape(primary_colourspace)))) |
| 848 | + filter_RGB_colourspaces(re.escape(primary_colourspace)).values()) |
846 | 849 | secondary_colourspace = first_item(
|
847 |
| - filter_RGB_colourspaces('^{0}$'.format( |
848 |
| - re.escape(secondary_colourspace)))) |
| 850 | + filter_RGB_colourspaces(re.escape(secondary_colourspace)).values()) |
849 | 851 |
|
850 | 852 | colourspace = (primary_colourspace if image_colourspace == 'Primary' else
|
851 | 853 | secondary_colourspace)
|
@@ -917,12 +919,12 @@ def spectral_locus_visual(colourspace=PRIMARY_COLOURSPACE,
|
917 | 919 | """
|
918 | 920 |
|
919 | 921 | colourspace = first_item(
|
920 |
| - filter_RGB_colourspaces('^{0}$'.format(re.escape(colourspace)))) |
| 922 | + filter_RGB_colourspaces(re.escape(colourspace)).values()) |
921 | 923 |
|
922 |
| - cmfs = first_item(filter_cmfs(cmfs)) |
| 924 | + cmfs = first_item(filter_cmfs(cmfs).values()) |
923 | 925 | XYZ = cmfs.values
|
924 | 926 |
|
925 |
| - XYZ = np.vstack((XYZ, XYZ[0, ...])) |
| 927 | + XYZ = np.vstack([XYZ, XYZ[0, ...]]) |
926 | 928 |
|
927 | 929 | vertices = colourspace_model_axis_reorder(
|
928 | 930 | XYZ_to_colourspace_model_normalised(
|
@@ -956,14 +958,14 @@ def pointer_gamut_visual(colourspace_model='CIE xyY'):
|
956 | 958 | for i in range(16):
|
957 | 959 | section = colourspace_model_axis_reorder(
|
958 | 960 | XYZ_to_colourspace_model_normalised(
|
959 |
| - np.vstack((pointer_gamut_data[i], |
960 |
| - pointer_gamut_data[i][0, ...])), |
| 961 | + np.vstack( |
| 962 | + [pointer_gamut_data[i], pointer_gamut_data[i][0, ...]]), |
961 | 963 | POINTER_GAMUT_ILLUMINANT, colourspace_model),
|
962 | 964 | colourspace_model)
|
963 | 965 |
|
964 | 966 | vertices.append(np.array(zip(section, section[1:])))
|
965 | 967 |
|
966 |
| - vertices = np.asarray(vertices) |
| 968 | + vertices = as_float_array(vertices) |
967 | 969 |
|
968 | 970 | return buffer_geometry(position=vertices)
|
969 | 971 |
|
|
0 commit comments