Пример #1
0
def reb_after_ft_per_team(team='SAS', path='D:\Gal\Work\Results'):
    '''
    IN PROGRESS: need to be changed for OOP
    '''
    home_games = tf.specific_team(team, home=True, away=False)
    away_games = tf.specific_team(team, home=False, away=True)
    off_reb, allow_off_reb = 0, 0
    for g in home_games:
        times, home, away = tf.read_from_file(path+r'\\'+g)
        h_def_reb, h_off_reb, a_def_reb, a_off_reb = reb_after_ft(times,
                                                                  home, away)
        allow_off_reb += a_off_reb
        off_reb += h_off_reb
    for g in away_games:
        times, home, away = tf.read_from_file(path+r'\\'+g)
        h_def_reb, h_off_reb, a_def_reb, a_off_reb = reb_after_ft(times,
                                                                  home, away)
        allow_off_reb += h_off_reb
        off_reb += a_off_reb

    return off_reb, allow_off_reb, len(home_games)+len(away_games)
Пример #2
0
def time_out_histogram(team='NYK', path='D:\Gal\Work\Results'):
    ''' '''
    timeouts = []
    games = tf.specific_team(team, path)
    for g in games:
        h = g.find('-')
        im = tf.read_from_file(path+'\\'+g)
        if g[h+1:h+4] == team:
            timeouts += tf.find_timeouts(im[0], im[1])
        else:
            timeouts += tf.find_timeouts(im[0], im[2])
    plt.plot(actions_histogram(timeouts))
    plt.show()

    return timeouts
Пример #3
0
def action_raster24(player, team, s_date='10000101', f_date='21001231',
                    path='D:\Gal\Work\Results', action=c.Shot):
    games = tf.specific_team(team, path)
    actions, played_games = [], []
    i = 0
    for g in games:
        h = g.find('-')
        if g[:h] > s_date and g[:h] < f_date:
            i += 1
            game = tf.create_game_from_file(g, path)
            at = action_timing(game)
            for t in at:
                if type(t.get_action()) is action and t.get_action().player == player:
                    actions.append(t)
                    played_games.append(i)
    return actions, played_games