<commit_before>from pynitefields import *
from balthasar.curve import Curve

class Striations():
    """ A class to keep the set of linear striations in a given dimension
        for use in the Wigner function and doing various other things.
        It'll just be cleaner to have them in a separate class, and might
        be useful for other things later too.

        Striations are essentially stored as a set of Curves over the provided
        finite field.
    """
    def __init__(self, field):
        self.field = field
        self.striations = []

        # Handle the horizontal striation first
        horizontal_striation = []
        for intercept in field:
            curve = Curve([intercept, self.field[0]], self.field, True)
            horizontal_striation.append(curve)
        self.striations.append(horizontal_striation)

        # Take care of the rest of the striations 
        for slope in field:
            new_striation = []
            for intercept in field:
                    curve = Curve([intercept, slope], self.field)
                    new_striation.append(curve)
            self.striations.append(new_striation)
    
        # Store the rays as a set for safekeeping
        rays = [s[0] for s in self.striations]


    def print(self, as_points = False):
        print("============================")
        for s in self.striations:
            print("Ray: ")
            s[0].print()

            for curve in s:
                curve.print(as_points)
                print("")
            print("============================")
        


            <commit_msg>Added get item, iterable methods to the Striations class and fixed some of the documentation.<commit_after>from pynitefields import *
from balthasar.curve import Curve

class Striations():
    """ A class to keep the set of linear striations in a given dimension
        for use in the Wigner function and doing various other things.
        It'll just be cleaner to have them in a separate class, and might
        be useful for other things later too.

        Striations are essentially stored as a set of Curves over the provided
        finite field.
    """
    def __init__(self, field):
        self.field = field
        self.dim = field.dim
        self.striations = []

        # Striations of the form beta = lambda alpha + gamma
        # Do these first so that the slope lambda corresponds to the list element 
        for slope in field:
            new_striation = []
            for intercept in field:
                    curve = Curve([intercept, slope], self.field)
                    new_striation.append(curve)
            self.striations.append(new_striation)

        # Handle the vertical striation (infinite slope) last - easily accessible as striation -1
        horizontal_striation = []
        for intercept in field:
            curve = Curve([intercept, self.field[0]], self.field, True)
            horizontal_striation.append(curve)
        self.striations.append(horizontal_striation)

    
        # Store the rays as a set for safekeeping
        rays = [s[0] for s in self.striations]

        

    def __iter__(self):
        """ Allow the user to iterate through all the striations. """
        return iter(self.striations)


    def __getitem__(self, index):
        """ Grab a striation. Striation -1 corresponds to the horizontal striation,
            all other striations indicated by there slope as a power of the 
            primitive field element.
        """
        if (index >= -1) and (index <= self.dim + 1):
            return self.striations[index]
        else:
            print("Error, element out of bounds.")


    def get_rays(self):
        """ Get the set of rays only. """
        return [s[0] for s in self.striations]


    def print(self, as_points = False):
        """ Print out all the striations either as equations or as sets of points. """
        print("============================")
        for s in self.striations:
            print("Ray: ")
            s[0].print()

            for curve in s:
                curve.print(as_points)
                print("")
            print("============================")
        


            
{'fraction_non_alphanumeric': 0.1000473036896878, 'fraction_numerical': 0.002601702932828761, 'mean_word_length': 1.9823695345557122, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, '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': '319555', 'n_tokens_mistral': 1102, 'n_tokens_neox': 1038, 'n_words': 409}