<commit_before>#!/usr/bin/env python3

from __future__ import print_function, division

import numpy as np


def standard_grid(L):
    thetas = []
    for i in range(1, L+1):
        if i % 2 == 0:
            theta = np.pi * (i - 1) / (2 * L - 1)
        else:
            theta = np.pi * (2 * L - i) / (2 * L - 1)
        thetas.append(theta)
    thetas = np.array(thetas)

    phis = []
    for i in range(L):
        for j in range(-i, i+1):
            phis.append(2 * np.pi * j / (2*i + 1))
    phis = np.array(phis)

    return thetas, phis


def get_cartesian_grid(thetas, phis):
    """
    Converts a list of thetas and phis into a cartesian grid.
    """
    thetas = l_to_lm(thetas)
    x = np.sin(thetas) * np.cos(phis)
    y = np.sin(thetas) * np.sin(phis)
    z = np.cos(thetas)
    return np.vstack((x, y, z)).T<commit_msg>Fix bug in grids revealed by testing.<commit_after>#!/usr/bin/env python3

from __future__ import print_function, division

import numpy as np

def standard_grid(L):
    thetas = []
    for i in range(1, L+1):
        if i % 2 == 0:
            theta = np.pi * (i - 1) / (2 * L - 1)
        else:
            theta = np.pi * (2 * L - i) / (2 * L - 1)
        thetas.append(theta)
    thetas = np.array(thetas)

    phis = []
    for i in range(L):
        for j in range(-i, i+1):
            phis.append(2 * np.pi * j / (2*i + 1))
    phis = np.array(phis)

    return thetas, phis


def get_cartesian_grid(thetas, phis):
    """
    Converts a list of thetas and phis into a cartesian grid.
    """
    from .utils import l_to_lm
    thetas = l_to_lm(thetas)
    x = np.sin(thetas) * np.cos(phis)
    y = np.sin(thetas) * np.sin(phis)
    z = np.cos(thetas)
    return np.vstack((x, y, z)).T
{'fraction_non_alphanumeric': 0.14549653579676675, 'fraction_numerical': 0.017321016166281754, 'mean_word_length': 1.9674657534246576, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, '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': '1399251', 'n_tokens_mistral': 726, 'n_tokens_neox': 687, 'n_words': 189}