<commit_before><commit_msg>WIP: colorwave effect<commit_after>import math
import random
import numpy
from effectlayer import EffectLayer 
import colorsys

CENTER_FREQ = 1.2 #Hz

def jitter(size=0.15):
    return random.random() * size - (size/2)

class ColorWave(EffectLayer):
    def __init__(self, model):
        self.model = model
        self.phases = [ random.random() for i in range(self.model.numLEDs) ]
        self.frequencies = [CENTER_FREQ for i in range(self.model.numLEDs) ]
        self.color = numpy.array(colorsys.hsv_to_rgb(random.random(),1,1))
        self.colors = [self.color + [jitter(1.2), jitter(0.5), jitter(0.5)] for i in range(self.model.numLEDs)]

    def render(self, model, params, frame):
        for i in range(len(self.phases)):
            self.phases[i] += jitter()
            self.frequencies[i] += jitter(0.00000000001)


        for i in range(self.model.numLEDs):
            color = self.colors[i] + [ jitter(0.02), 0, 0]
            frame[i] = color * (math.sin(math.pi*(params.time*self.frequencies[i] + self.phases[i])))**2

{'fraction_non_alphanumeric': 0.1449953227315248, 'fraction_numerical': 0.029934518241347054, 'mean_word_length': 3.1153846153846154, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 1, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5093057', 'n_tokens_mistral': 392, 'n_tokens_neox': 372, 'n_words': 79}