Esempio n. 1
0
def gpshash(ftable, events):
    """
    Matches gps readings with frames.
    Returns a hash of GPS locations, one item for each frame
    """
    n = 0
    gps_hash = {}
    events_len = len(events)
    for frame in ftable:
        closest = events[n]
        while(n+1<events_len and not(common.closer(frame[0],closest,events[n+1]))):
            n+=1
            closest=events[n]
        gps_hash[frame[0].timestamp()] = closest
    return gps_hash
Esempio n. 2
0
def gpshash(ftable, events):
    """
    Matches gps readings with frames.
    Returns a hash of GPS locations, one item for each frame
    """
    n = 0
    gps_hash = {}
    events_len = len(events)
    for frame in ftable:
        closest = events[n]
        while (n + 1 < events_len
               and not (common.closer(frame[0], closest, events[n + 1]))):
            n += 1
            closest = events[n]
        gps_hash[frame[0].timestamp()] = closest
    return gps_hash
Esempio n. 3
0
def taggedhash(ftable, events):
    """
    Returns a hash of GPSEvents, one for each tagged event
    Hash keys are timestamps
    """
    n = 0
    gps_hash = {}
    frames_len = len(ftable)
    for event in events:
        closest = ftable[n][0]
        while (n+1<frames_len and
               not(common.closer(event, closest, ftable[n+1][0]))):
            n+=1
            closest = ftable[n][0]
        gps_hash[closest.timestamp()] = event
    return gps_hash
Esempio n. 4
0
def taggedhash(ftable, events):
    """
    Returns a hash of GPSEvents, one for each tagged event
    Hash keys are timestamps
    """
    n = 0
    gps_hash = {}
    frames_len = len(ftable)
    for event in events:
        closest = ftable[n][0]
        while (n + 1 < frames_len
               and not (common.closer(event, closest, ftable[n + 1][0]))):
            n += 1
            closest = ftable[n][0]
        gps_hash[closest.timestamp()] = event
    return gps_hash