Пример #1
0
    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,
                    axes_pad=0.35)

    ax = grid[0]
    PlotPlainTracks(tracks, falarms, *frameLims, axis=ax)
    ax.set_title("TITAN Tracks")

    ax = grid[1]
    PlotSegments(truthtable, frameLims, axis=ax)
    ax.set_title("Track Check")

    plt.show()
Пример #2
0
def MakeComparePlots(grid,
                     trackData,
                     truthData,
                     titles,
                     showMap,
                     endFrame=None,
                     tail=None,
                     fade=False,
                     multiTags=None,
                     tag_filters=None):
    true_AssocSegs = None
    true_FAlarmSegs = None
    frameLims = None

    if multiTags is None:
        multiTags = [None] * len(trackData)

    for ax, aTracker, truth, title, simTags in zip(grid, trackData, truthData,
                                                   titles, multiTags):
        this_endFrame = endFrame
        this_tail = tail

        # Will return None if either simTags or filters are None
        keeperIDs = process_tag_filters(simTags, tag_filters)

        # Either only do this for the first pass through,
        #  or do it for all passes
        # In other words, if no frameLims is given, then use the frameLimits
        # for each truthkData dataset.
        # Or, if there are multiple truthData datasets, then regardless of
        # whether frameLims was specified, calculate the frame limits each time
        if frameLims is None or len(truthData) > 1:
            true_AssocSegs = CreateSegments(truth[0])
            true_FAlarmSegs = CreateSegments(truth[1])

            if keeperIDs is not None:
                true_AssocSegs = FilterSegments(keeperIDs, true_AssocSegs)
                true_FAlarmSegs = FilterSegments(keeperIDs, true_FAlarmSegs)

            # TODO: gotta make this get the time limits!
            xLims, yLims, frameLims = DomainFromTracks(true_AssocSegs,
                                                       true_FAlarmSegs)

            if showMap:
                bmap = Basemap(projection='cyl',
                               resolution='i',
                               suppress_ticks=False,
                               llcrnrlat=yLims[0],
                               llcrnrlon=xLims[0],
                               urcrnrlat=yLims[1],
                               urcrnrlon=xLims[1])
                PlotMapLayers(bmap, mapLayers, ax)

        if this_endFrame is None:
            this_endFrame = frameLims[1]

        if this_tail is None:
            this_tail = this_endFrame - frameLims[0]

        this_startFrame = this_endFrame - this_tail

        trackAssocSegs = CreateSegments(aTracker[0])
        trackFAlarmSegs = CreateSegments(aTracker[1])

        if keeperIDs is not None:
            trackAssocSegs = FilterSegments(keeperIDs, trackAssocSegs)
            trackFAlarmSegs = FilterSegments(keeperIDs, trackFAlarmSegs)

        truthtable = CompareSegments(true_AssocSegs, true_FAlarmSegs,
                                     trackAssocSegs, trackFAlarmSegs)
        PlotSegments(truthtable, (this_startFrame, this_endFrame),
                     axis=ax,
                     fade=fade)

        ax.set_title(title)
        if not showMap:
            ax.set_xlabel("X")
            ax.set_ylabel("Y")
        else:
            ax.set_xlabel("Longitude")
            ax.set_ylabel("Latitude")