def storeVirtualEventOfMatch(matchid): for half in [1,2]: rows = c.execute("""select locationx, locationy,eventname,duel,teamid,idactor1,position, eventid,eventtime from eventstream where matchid = ? and halfid = ?""",(matchid,half)).fetchall() events = [Event(tup) for tup in rows] eventstream = list(ip.interpolate_eventstream(events,C.EVENT_INTERVAL/C.TIME_UNIT)) for e in eventstream: temp = (matchid,half,e.time, e.eventname,e.duel,e.x,e.y, e.actor,e.team,e.position) c.execute("insert into virtualeventstream values (" + ",".join("?" for _i in range(0,10)) + ")" , temp)
def getWindows(matchids): windows = [] windowsize = int((C.FEATURE_WINDOW_SIZE+C.CLASS_WINDOW_SIZE)/C.EVENT_INTERVAL) for matchid in matchids: #print(matchid) for half in [1,2]: rows = c.execute("""select locationx, locationy,eventname,duel,teamid,idactor1,position, eventid,eventtime from eventstream where matchid = ? and halfid = ?""",(matchid,half)).fetchall() events = [Event(tup) for tup in rows] eventstream = list(ip.interpolate_eventstream(events,C.EVENT_INTERVAL/C.TIME_UNIT)) hometeamid,awayteamid = c.execute("""select hometeamid,awayteamid from match where id = ?""", (matchid,)).fetchone() matchhalf = MatchHalf(matchid,half,eventstream,hometeamid,awayteamid) i=0 while (i < len(eventstream)-windowsize): windows.append(Window(eventstream[i:i+windowsize],matchhalf)) i += int(C.WINDOW_INTERVAL/C.EVENT_INTERVAL) return windows