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

def force_to_microsec(force):
    us = PulseWidthMax
    for i in range(0, len(ForceLookup)):
        if force < ForceLookup[i]:
            us_prev = PulseWidthMin + PulseWidthIncrement*(i-1)
            us_next = PulseWidthMin + PulseWidthIncrement*i
            us_diff = us_next - us_prev
            force_diff = ForceLookup[i] - ForceLookup[i-1]
            force_offset = force - ForceLookup[i-1]
            us = us_prev + us_diff*(force_offset/force_diff)
            return us

def microsec_to_pwm(us):
    pulse = float(us)
    pulse_length = 1000000.0    # 1,000,000 us per second
    pulse_length /= 273.0      # 273 Hz (målt frekvens)
    #print('{0}us per period'.format(pulse_length))
    pulse_length /= 4096     # 12 bits of resolution
    #print('{0}us per bit'.format(pulse_length))
    pulse /= pulse_length
    return pulse

def force_to_pwm(force):
    return microsec_to_pwm(force_to_microsec(force));

PulseWidthMin = 1300
PulseWidthMax = 1700
PulseWidthIncrement = 10

ForceLookup = [
    -5.7056872745,
    -5.2153547745,
    -4.6358709118,
    -4.1901140882,
    -3.92266,
    -3.6106302255,
    -3.2094490882,
    -2.6745409118,
    -2.2733597745,
    -1.96133,<commit_msg>Remove unneeded semicolon<commit_after>#!/usr/bin/env python
# -*- coding: utf-8 -*-

def force_to_microsec(force):
    us = PulseWidthMax
    for i in range(0, len(ForceLookup)):
        if force < ForceLookup[i]:
            us_prev = PulseWidthMin + PulseWidthIncrement*(i-1)
            us_next = PulseWidthMin + PulseWidthIncrement*i
            us_diff = us_next - us_prev
            force_diff = ForceLookup[i] - ForceLookup[i-1]
            force_offset = force - ForceLookup[i-1]
            us = us_prev + us_diff*(force_offset/force_diff)
            return us

def microsec_to_pwm(us):
    pulse = float(us)
    pulse_length = 1000000.0    # 1,000,000 us per second
    pulse_length /= 273.0      # 273 Hz (målt frekvens)
    #print('{0}us per period'.format(pulse_length))
    pulse_length /= 4096     # 12 bits of resolution
    #print('{0}us per bit'.format(pulse_length))
    pulse /= pulse_length
    return pulse

def force_to_pwm(force):
    return microsec_to_pwm(force_to_microsec(force))

PulseWidthMin = 1300
PulseWidthMax = 1700
PulseWidthIncrement = 10

ForceLookup = [
    -5.7056872745,
    -5.2153547745,
    -4.6358709118,
    -4.1901140882,
    -3.92266,
    -3.6106302255,
    -3.2094490882,
    -2.6745409118,
    -2.2733597745,
    -1.96133,
{'fraction_non_alphanumeric': 0.11382434029145333, 'fraction_numerical': 0.11421819614021268, 'mean_word_length': 2.5825105782792668, 'pattern_counts': {'":': 0, '<': 5, '<?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': '3384407', 'n_tokens_mistral': 1115, 'n_tokens_neox': 933, 'n_words': 179}