true_tracks, true_falarms = FilterMHTTracks( *ReadTracks(os.path.join(dirPath, "noise_tracks"))) frameLims = (0, len(cornerVol)) print frameLims[1] t = TITAN(distThresh=5) for aVol in cornerVol: t.TrackStep(aVol) t.finalize() tracks = t.tracks falarms = [] CleanupTracks(tracks, falarms) # Compare with "truth data" segs = [ CreateSegments(trackData) for trackData in (true_tracks, true_falarms, tracks, falarms) ] truthtable = CompareSegments(*segs) # Display Result fig = plt.figure(figsize=plt.figaspect(0.5)) grid = AxesGrid(fig, 111, nrows_ncols=(1, 2), aspect=False, share_all=True,
def MakeTrackPlots(grid, trackData, titles, showMap, endFrame=None, tail=None, fade=False, multiTags=None, tag_filters=None): """ *grid* axes_grid object *trackData* a list of the lists of tracks *titles* titles for each subplot *showMap* boolean indicating whether to plot a map layer *endFrame* Display tracks as of *frame* number. Default: last *tail* How many frames to include prior to *frame* to display Default: all *fade* Whether or not to 'fade' old tracks """ if multiTags is None: multiTags = [None] * len(trackData) stackedTracks = [] for aTracker in trackData: stackedTracks += aTracker[0] + aTracker[1] # TODO: gotta make this get the time limits! (xLims, yLims, frameLims) = DomainFromTracks(stackedTracks) if endFrame is None: endFrame = frameLims[1] if tail is None: tail = endFrame - frameLims[0] startFrame = endFrame - tail if showMap: bmap = Basemap(projection='cyl', resolution='i', suppress_ticks=False, llcrnrlat=yLims[0], llcrnrlon=xLims[0], urcrnrlat=yLims[1], urcrnrlon=xLims[1]) for ax, (tracks, falarms), title, simTags in zip(grid, trackData, titles, multiTags): if showMap: PlotMapLayers(bmap, mapLayers, ax) ax.set_xlabel("Longitude") ax.set_ylabel("Latitude") else: ax.set_xlabel("X") ax.set_ylabel("Y") if simTags is not None: keeperIDs = process_tag_filters(simTags, tag_filters) if keeperIDs is not None: filtFunc = lambda trk: FilterTrack(trk, cornerIDs=keeperIDs) tracks = map(filtFunc, tracks) falarms = map(filtFunc, falarms) CleanupTracks(tracks, falarms) PlotPlainTracks(tracks, falarms, startFrame, endFrame, axis=ax, fade=fade) ax.set_title(title)