<commit_before>import time
import numpy as np
import matplotlib.pyplot as plt

def get_localtime(t):
    lt = time.localtime(np.floor(t))
    remainder = t - np.floor(t)
    return lt.tm_hour + lt.tm_min/60. + lt.tm_sec/3600. + remainder/3600.
        
def calc_localtime(data):
    for key, trajec in data.items():
        trajec.time_local = np.zeros_like(trajec.time)
        for i, t in enumerate(trajec.time):
            localtime = get_localtime(t)
            trajec.time_local[i] = localtime

def calc_continuous_localtime(data, rolloverthreshold=12):
    for key, trajec in data.items():
        trajec.time_continuous_local = np.zeros_like(trajec.time)
        for i, t in enumerate(trajec.time):
            localtime = trajec.time_local[i]
            if localtime < rolloverthreshold:
                t = localtime + 24
            else:
                t = localtime
            trajec.time_continuous_local[i] = t
            
    
def calc_speed(data):
    for key, trajec in data.items():
        trajec.speed = np.linalg.norm(trajec.velocity, axis=1)
        
def get_length_stats(data):
    length = []<commit_msg>reference time stamp calculations<commit_after>import time
import numpy as np
import matplotlib.pyplot as plt

def get_localtime(t):
    lt = time.localtime(np.floor(t))
    remainder = t - np.floor(t)
    return lt.tm_hour + lt.tm_min/60. + lt.tm_sec/3600. + remainder/3600.
        
def calc_localtime(data):
    for key, trajec in data.items():
        trajec.time_local = np.zeros_like(trajec.time)
        for i, t in enumerate(trajec.time):
            localtime = get_localtime(t)
            trajec.time_local[i] = localtime

def calc_continuous_localtime(data, rolloverthreshold=12):
    for key, trajec in data.items():
        trajec.time_continuous_local = np.zeros_like(trajec.time)
        for i, t in enumerate(trajec.time):
            localtime = trajec.time_local[i]
            if localtime < rolloverthreshold:
                t = localtime + 24
            else:
                t = localtime
            trajec.time_continuous_local[i] = t

def calc_relative_time(data, timestamp_relative):
    for key, trajec in data.items():
        trajec.time_relative = trajec.time - timestamp_relative
    
def calc_speed(data):
    for key, trajec in data.items():
        trajec.speed = np.linalg.norm(trajec.velocity, axis=1)
        
def get_length_stats(data):
    length = []
{'fraction_non_alphanumeric': 0.10012360939431397, 'fraction_numerical': 0.012360939431396786, 'mean_word_length': 2.453769559032717, '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': '6072395', 'n_tokens_mistral': 853, 'n_tokens_neox': 818, 'n_words': 176}