#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2017 Malcolm Ramsay <malramsay64@gmail.com>
#
# Distributed under terms of the MIT license.

"""Create functions to colourize figures."""

import logging

import numpy as np
from hsluv import hpluv_to_hex
from quaternion import as_quat_array, as_rotation_vector

logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)

HEX_VALUES_DARK = np.array([hpluv_to_hex((value, 85, 65)) for value in range(360)])
HEX_VALUES_LIGHT = np.array([hpluv_to_hex((value, 85, 85)) for value in range(360)])


# def clean_orientation(snapshot):
    # """Convert an orientation to a sensible format."""
    # nmol = max(snapshot.particles.body)+1
    # o_dict = {body: orient for body, orient in zip(
        # snapshot.particles.body[:nmol],
        # orientation[:nmol]
    # )}
    # orientation = np.array([o_dict[body] for body in snapshot.particles.body])
    # return orientation


def colour_orientation(orientations, light_colours=False):
    """Get a colour from an orientation."""
    orientations = orientations % 2 * np.pi
    if light_colours:
        return HEX_VALUES_LIGHT[np.floor(orientations / np.pi * 180).astype(int)]
    return HEX_VALUES_DARK[np.floor(orientations / np.pi * 180).astype(int)]

@@ -281,65 +281,8 @@
 _hex
-%0Afrom quaternion import as_quat_array, as_rotation_vector
 %0A%0Alo
@@ -523,386 +523,8 @@
 )%0A%0A%0A
-# def clean_orientation(snapshot):%0A    # %22%22%22Convert an orientation to a sensible format.%22%22%22%0A    # nmol = max(snapshot.particles.body)+1%0A    # o_dict = %7Bbody: orient for body, orient in zip(%0A        # snapshot.particles.body%5B:nmol%5D,%0A        # orientation%5B:nmol%5D%0A    # )%7D%0A    # orientation = np.array(%5Bo_dict%5Bbody%5D for body in snapshot.particles.body%5D)%0A    # return orientation%0A%0A%0A
 def 

Remove unnecessary code from colour