<commit_before># Import statements
import sys
sys.path.append("/home/pi/Documents/Robots/slcypi/MA") ### ADD PATH
sys.path.append("/home/pi/Documents/Robots/slcypi/HAT_Python3") ### ADD PATH
import cv2
import numpy as np
import matplotlib.pyplot as plt
from Tank import Tank
import picamera
import picamera.array
import time
import pygame
from scipy import ndimage
from time import sleep

# Settings
WIDTH = 320
HEIGHT = 240

# Initialize Tank
robot = Tank()
robot.correctDirections(False,False,True)

# Initialize Pygame
pygame.init()
pygame.display.set_caption('My Robot')
screen = pygame.display.set_mode((WIDTH,HEIGHT),0)

# Image analysis
lower = np.array([25,0,0])
upper = np.array([40,255,255])

def blockAnalyze(mask):
        # Assume 320,240 image
        mask = np.transpose(mask)
        sum = 0
        count = 0
        for x in range(5):
                blockCount = np.sum(mask[x*64:x*64+63,0:100]) / 255     
                sum = sum + blockCount * x
                count = count + blockCount

        if count > 0:
                overallMean = float(sum) / count        
                direction = (overallMean - 2) / 2
                return direction, count
        else:
                return -999, count

                                  <commit_msg>Calibration<commit_after># Import statements
import sys
sys.path.append("/home/pi/Documents/Robots/slcypi/MA") ### ADD PATH
sys.path.append("/home/pi/Documents/Robots/slcypi/HAT_Python3") ### ADD PATH
import cv2
import numpy as np
import matplotlib.pyplot as plt
from Tank import Tank
import picamera
import picamera.array
import time
import pygame
from scipy import ndimage
from time import sleep

# Settings
WIDTH = 320
HEIGHT = 240

# Initialize Tank
robot = Tank()
robot.correctDirections(True,True,True)

# Initialize Pygame
pygame.init()
pygame.display.set_caption('My Robot')
screen = pygame.display.set_mode((WIDTH,HEIGHT),0)

# Image analysis
lower = np.array([25,0,0])
upper = np.array([40,255,255])

def blockAnalyze(mask):
        # Assume 320,240 image
        mask = np.transpose(mask)
        sum = 0
        count = 0
        for x in range(5):
                blockCount = np.sum(mask[x*64:x*64+63,0:100]) / 255     
                sum = sum + blockCount * x
                count = count + blockCount

        if count > 0:
                overallMean = float(sum) / count        
                direction = (overallMean - 2) / 2
                return direction, count
        else:
                return -999, count

                                  
{'fraction_non_alphanumeric': 0.10266457680250783, 'fraction_numerical': 0.0384012539184953, 'mean_word_length': 2.268886043533931, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5786799', 'n_tokens_mistral': 880, 'n_tokens_neox': 777, 'n_words': 212}