def visible_spectrum_visual(colourspace_model='CIE xyY'):
    """
    Returns the visible spectrum visual geometry formatted as *JSON*.

    Parameters
    ----------
    colourspace_model : unicode, optional
        Colourspace model used to generate the visual geometry.

    Returns
    -------
    unicode
        Visible spectrum visual geometry formatted as *JSON*.
    """

    XYZ = XYZ_outer_surface()
    vertices = colourspace_model_axis_reorder(
        XYZ_to_colourspace_model(
            XYZ,
            CCS_ILLUMINANTS['CIE 1931 2 Degree Standard Observer']['E'],
            colourspace_model,
        ), colourspace_model)

    vertices = as_float_array(list(zip(vertices, vertices[1:])))

    return buffer_geometry(position=vertices)
Пример #2
0
    def test_XYZ_outer_surface(self):
        """
        Test :func:`colour.volume.spectrum.XYZ_outer_surface`
        definition.
        """

        shape = SpectralShape(
            SPECTRAL_SHAPE_DEFAULT.start, SPECTRAL_SHAPE_DEFAULT.end, 84
        )
        cmfs = MSDS_CMFS["CIE 1931 2 Degree Standard Observer"]

        # pylint: disable=E1102
        np.testing.assert_array_almost_equal(
            XYZ_outer_surface(reshape_msds(cmfs, shape)),
            np.array(
                [
                    [0.00000000e00, 0.00000000e00, 0.00000000e00],
                    [9.63613812e-05, 2.90567768e-06, 4.49612264e-04],
                    [2.59105294e-01, 2.10312980e-02, 1.32074689e00],
                    [1.05610219e-01, 6.20382435e-01, 3.54235713e-02],
                    [7.26479803e-01, 3.54608696e-01, 2.10051491e-04],
                    [1.09718745e-02, 3.96354538e-03, 0.00000000e00],
                    [3.07925724e-05, 1.11197622e-05, 0.00000000e00],
                    [2.59201656e-01, 2.10342037e-02, 1.32119651e00],
                    [3.64715514e-01, 6.41413733e-01, 1.35617047e00],
                    [8.32090022e-01, 9.74991131e-01, 3.56336228e-02],
                    [7.37451677e-01, 3.58572241e-01, 2.10051491e-04],
                    [1.10026671e-02, 3.97466514e-03, 0.00000000e00],
                    [1.27153954e-04, 1.40254398e-05, 4.49612264e-04],
                    [3.64811875e-01, 6.41416639e-01, 1.35662008e00],
                    [1.09119532e00, 9.96022429e-01, 1.35638052e00],
                    [8.43061896e-01, 9.78954677e-01, 3.56336228e-02],
                    [7.37482470e-01, 3.58583361e-01, 2.10051491e-04],
                    [1.10990285e-02, 3.97757082e-03, 4.49612264e-04],
                    [2.59232448e-01, 2.10453234e-02, 1.32119651e00],
                    [1.09129168e00, 9.96025335e-01, 1.35683013e00],
                    [1.10216719e00, 9.99985975e-01, 1.35638052e00],
                    [8.43092689e-01, 9.78965796e-01, 3.56336228e-02],
                    [7.37578831e-01, 3.58586267e-01, 6.59663755e-04],
                    [2.70204323e-01, 2.50088688e-02, 1.32119651e00],
                    [3.64842668e-01, 6.41427759e-01, 1.35662008e00],
                    [1.10226355e00, 9.99988880e-01, 1.35683013e00],
                    [1.10219798e00, 9.99997094e-01, 1.35638052e00],
                    [8.43189050e-01, 9.78968702e-01, 3.60832350e-02],
                    [9.96684125e-01, 3.79617565e-01, 1.32140656e00],
                    [3.75814542e-01, 6.45391304e-01, 1.35662008e00],
                    [1.09132247e00, 9.96036455e-01, 1.35683013e00],
                    [1.10229434e00, 1.00000000e00, 1.35683013e00],
                ]
            ),
            decimal=7,
        )
Пример #3
0
    def test_XYZ_outer_surface(self):
        """
        Tests :func:`colour.volume.spectrum.XYZ_outer_surface`
        definition.
        """

        np.testing.assert_array_almost_equal(
            XYZ_outer_surface(84),
            np.array([
                [0.00000000e+00, 0.00000000e+00, 0.00000000e+00],
                [1.47669249e-03, 4.15303476e-05, 6.98843624e-03],
                [1.62812757e-01, 3.71143871e-02, 9.01514713e-01],
                [1.86508941e-01, 5.66174645e-01, 9.13551791e-02],
                [6.15553478e-01, 3.84277759e-01, 4.74220708e-04],
                [3.36220454e-02, 1.23545569e-02, 0.00000000e+00],
                [1.02795008e-04, 3.71211582e-05, 0.00000000e+00],
                [1.64289450e-01, 3.71559174e-02, 9.08503149e-01],
                [3.49321699e-01, 6.03289032e-01, 9.92869892e-01],
                [8.02062419e-01, 9.50452405e-01, 9.18293998e-02],
                [6.49175523e-01, 3.96632316e-01, 4.74220708e-04],
                [3.37248404e-02, 1.23916780e-02, 0.00000000e+00],
                [1.57948749e-03, 7.86515058e-05, 6.98843624e-03],
                [3.50798391e-01, 6.03330563e-01, 9.99858328e-01],
                [9.64875177e-01, 9.87566792e-01, 9.93344113e-01],
                [8.35684465e-01, 9.62806961e-01, 9.18293998e-02],
                [6.49278318e-01, 3.96669437e-01, 4.74220708e-04],
                [3.52015329e-02, 1.24332084e-02, 6.98843624e-03],
                [1.64392245e-01, 3.71930386e-02, 9.08503149e-01],
                [9.66351869e-01, 9.87608322e-01, 1.00033255e+00],
                [9.98497222e-01, 9.99921348e-01, 9.93344113e-01],
                [8.35787260e-01, 9.62844083e-01, 9.18293998e-02],
                [6.50755011e-01, 3.96710968e-01, 7.46265695e-03],
                [1.98014290e-01, 4.95475954e-02, 9.08503149e-01],
                [3.50901186e-01, 6.03367684e-01, 9.99858328e-01],
                [9.99973915e-01, 9.99962879e-01, 1.00033255e+00],
                [9.98600017e-01, 9.99958470e-01, 9.93344113e-01],
                [8.37263952e-01, 9.62885613e-01, 9.88178360e-02],
                [8.13567768e-01, 4.33825355e-01, 9.08977370e-01],
                [3.84523232e-01, 6.15722241e-01, 9.99858328e-01],
                [9.66454664e-01, 9.87645443e-01, 1.00033255e+00],
                [1.00007671e+00, 1.00000000e+00, 1.00033255e+00],
            ]),
            decimal=7)