<commit_before>#!/usr/bin/env python
# -*- coding: utf-8 -*-

import time
import rospy
import math
from raspimouse_ros.msg import LightSensorValues
from sensor_msgs.msg import LaserScan


def range_to_led(range_value):
    try:
        distance = int(range_value[0]*1000) # distance[mm]
        if distance < 4:
            distance = 8 - distance

        led_value = int( 761000 / math.pow(distance,1.66) )

        if led_value > 4000:
            led_value = 4000
        if led_value < 15:
            led_value = 15
    except:
        led_value = 15 
    # rospy.loginfo(led_value)
    return led_value
    # return distance

def write_to_file(data):
    try:<commit_msg>Add comment to python script<commit_after>#!/usr/bin/env python
# -*- coding: utf-8 -*-

import time
import rospy
import math
from raspimouse_ros.msg import LightSensorValues
from sensor_msgs.msg import LaserScan


def range_to_led(range_value):
    try:
        distance = int(range_value[0]*1000) # distance[mm]
        if distance < 4:
            distance = 8 - distance

        # This formula is calculated from the measurement result of actual sensor.
        # http://products.rt-net.jp/micromouse/archives/3361
        led_value = int( 761000 / math.pow(distance,1.66) )

        if led_value > 4000:
            led_value = 4000
        if led_value < 15:
            led_value = 15
    except:
        led_value = 15 
    # rospy.loginfo(led_value)
    return led_value
    # return distance

def write_to_file(data):
    try:
{'fraction_non_alphanumeric': 0.08976897689768977, 'fraction_numerical': 0.04356435643564356, 'mean_word_length': 2.3839285714285716, 'pattern_counts': {'":': 0, '<': 7, '<?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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2974406', 'n_tokens_mistral': 541, 'n_tokens_neox': 478, 'n_words': 125}