def draw_score_diff_disti(testres):
    "\n\n        CommandLine:\n            python -m wbia --tf TestResult.draw_score_diff_disti --show -a varynannots_td -t best --db PZ_Master1\n            python -m wbia --tf TestResult.draw_score_diff_disti --show -a varynannots_td -t best --db GZ_Master1\n            python -m wbia --tf TestResult.draw_score_diff_disti --show -a varynannots_td1h -t best --db GIRM_Master1\n\n            python -m wbia --tf TestResult.draw_score_diff_disti --show -a varynannots_td:qmin_pername=3,dpername=2 -t best --db PZ_Master1\n\n            python -m wbia --tf get_annotcfg_list -a varynannots_td -t best --db PZ_Master1\n            13502\n            python -m wbia --tf draw_match_cases --db PZ_Master1 -a varynannots_td:dsample_size=.01 -t best  --show --qaid 13502\n            python -m wbia --tf draw_match_cases --db PZ_Master1 -a varynannots_td -t best  --show\n\n        Example:\n            >>> # DISABLE_DOCTEST\n            >>> from wbia.expt.test_result import *  # NOQA\n            >>> import wbia\n            >>> ibs, testres = wbia.testdata_expts('PZ_Master1', a=['varynannots_td'], t=['best'])\n            >>> result = testres.draw_score_diff_disti()\n            >>> print(result)\n            >>> ut.show_if_requested()\n        "
    import wbia.plottool as pt
    import vtool as vt
    ibs = testres.ibs
    qaids = testres.get_test_qaids()
    qaids = ibs.get_annot_tag_filterflags(qaids, {'has_none': 'timedeltaerror'})
    gt_rawscore = testres.get_infoprop_mat('qx2_gt_raw_score', qaids=qaids)
    gf_rawscore = testres.get_infoprop_mat('qx2_gf_raw_score', qaids=qaids)
    gt_valid_flags_list = np.isfinite(gt_rawscore).T
    gf_valid_flags_list = np.isfinite(gf_rawscore).T
    cfgx2_gt_scores = vt.zipcompress(gt_rawscore.T, gt_valid_flags_list)
    cfgx2_gf_scores = vt.zipcompress(gf_rawscore.T, gf_valid_flags_list)
    gt_rank = testres.get_infoprop_mat('qx2_gt_rank', qaids=qaids)
    gf_ranks = testres.get_infoprop_mat('qx2_gf_rank', qaids=qaids)
    cfgx2_gt_ranks = vt.zipcompress(gt_rank.T, gt_valid_flags_list)
    cfgx2_rank0_gt_scores = vt.zipcompress(cfgx2_gt_scores, [(ranks == 0) for ranks in cfgx2_gt_ranks])
    cfgx2_rankX_gt_scores = vt.zipcompress(cfgx2_gt_scores, [(ranks > 0) for ranks in cfgx2_gt_ranks])
    cfgx2_gf_ranks = vt.zipcompress(gf_ranks.T, gf_valid_flags_list)
    cfgx2_rank0_gf_scores = vt.zipcompress(cfgx2_gf_scores, [(ranks == 0) for ranks in cfgx2_gf_ranks])
    xdata = list(map(len, testres.cfgx2_daids))
    USE_MEDIAN = True
    USE_LOG = False
    if USE_MEDIAN:
        ave = np.median
        dev = vt.median_abs_dev
    else:
        ave = np.mean
        dev = np.std

    def make_interval_args(arr_list, ave=ave, dev=dev, **kwargs):
        import utool as ut
        if USE_LOG:
            arr_list = list(map((lambda x: np.log((x + 1))), arr_list))
        sizes_ = list(map(len, arr_list))
        ydata_ = list(map(ave, arr_list))
        spread_ = list(map(dev, arr_list))
        label = kwargs.get('label', '')
        label += (' ' + ut.get_funcname(ave))
        kwargs['label'] = label
        logger.info(((label + 'score stats : ') + ut.repr2(ut.get_jagged_stats(arr_list, use_median=True), nl=1, precision=1)))
        return (ydata_, spread_, kwargs, sizes_)
    args_list1 = [make_interval_args(cfgx2_gt_scores, label='GT', color=pt.TRUE_BLUE), make_interval_args(cfgx2_gf_scores, label='GF', color=pt.FALSE_RED)]
    args_list2 = [make_interval_args(cfgx2_rank0_gt_scores, label='GT-rank = 0', color=pt.LIGHT_GREEN), make_interval_args(cfgx2_rankX_gt_scores, label='GT-rank > 0', color=pt.YELLOW), make_interval_args(cfgx2_rank0_gf_scores, label='GF-rank = 0', color=pt.PINK)]
    plotargs_list = [args_list1, args_list2]
    ymax = (- np.inf)
    ymin = np.inf
    for args_list in plotargs_list:
        ydata_list = np.array(ut.get_list_column(args_list, 0))
        spread = np.array(ut.get_list_column(args_list, 1))
        ymax = max(ymax, np.array((ydata_list + spread)).max())
        ymin = min(ymax, np.array((ydata_list - spread)).min())
    ylabel = ('log name score' if USE_LOG else 'name score')
    statickw = dict(xlabel='database size (number of annotations)', ylabel=ylabel, linewidth=2, spread_alpha=0.5, lightbg=True, marker='o', ymax=ymax, ymin=ymin, xmax='data', xmin='data')
    fnum = pt.ensure_fnum(None)
    pnum_ = pt.make_pnum_nextgen(len(plotargs_list), 1)
    for args_list in plotargs_list:
        ydata_list = ut.get_list_column(args_list, 0)
        spread_list = ut.get_list_column(args_list, 1)
        kwargs_list = ut.get_list_column(args_list, 2)
        sizes_list = ut.get_list_column(args_list, 3)
        logger.info(('sizes_list = %s' % (ut.repr2(sizes_list, nl=1),)))
        plotkw = ut.dict_stack2(kwargs_list, '_list')
        plotkw2 = ut.merge_dicts(statickw, plotkw)
        pt.multi_plot(xdata, ydata_list, spread_list=spread_list, fnum=fnum, pnum=pnum_(), **plotkw2)
    figtitle = ('Score vs DBSize: %s' % testres.get_title_aug())
    pt.set_figtitle(figtitle)
CommandLine:
    python -m wbia --tf TestResult.draw_score_diff_disti --show -a varynannots_td -t best --db PZ_Master1
    python -m wbia --tf TestResult.draw_score_diff_disti --show -a varynannots_td -t best --db GZ_Master1
    python -m wbia --tf TestResult.draw_score_diff_disti --show -a varynannots_td1h -t best --db GIRM_Master1

    python -m wbia --tf TestResult.draw_score_diff_disti --show -a varynannots_td:qmin_pername=3,dpername=2 -t best --db PZ_Master1

    python -m wbia --tf get_annotcfg_list -a varynannots_td -t best --db PZ_Master1
    13502
    python -m wbia --tf draw_match_cases --db PZ_Master1 -a varynannots_td:dsample_size=.01 -t best  --show --qaid 13502
    python -m wbia --tf draw_match_cases --db PZ_Master1 -a varynannots_td -t best  --show

Example:
    >>> # DISABLE_DOCTEST
    >>> from wbia.expt.test_result import *  # NOQA
    >>> import wbia
    >>> ibs, testres = wbia.testdata_expts('PZ_Master1', a=['varynannots_td'], t=['best'])
    >>> result = testres.draw_score_diff_disti()
    >>> print(result)
    >>> ut.show_if_requested()
def draw_score_diff_disti(testres):
    "\n\n        CommandLine:\n            python -m wbia --tf TestResult.draw_score_diff_disti --show -a varynannots_td -t best --db PZ_Master1\n            python -m wbia --tf TestResult.draw_score_diff_disti --show -a varynannots_td -t best --db GZ_Master1\n            python -m wbia --tf TestResult.draw_score_diff_disti --show -a varynannots_td1h -t best --db GIRM_Master1\n\n            python -m wbia --tf TestResult.draw_score_diff_disti --show -a varynannots_td:qmin_pername=3,dpername=2 -t best --db PZ_Master1\n\n            python -m wbia --tf get_annotcfg_list -a varynannots_td -t best --db PZ_Master1\n            13502\n            python -m wbia --tf draw_match_cases --db PZ_Master1 -a varynannots_td:dsample_size=.01 -t best  --show --qaid 13502\n            python -m wbia --tf draw_match_cases --db PZ_Master1 -a varynannots_td -t best  --show\n\n        Example:\n            >>> # DISABLE_DOCTEST\n            >>> from wbia.expt.test_result import *  # NOQA\n            >>> import wbia\n            >>> ibs, testres = wbia.testdata_expts('PZ_Master1', a=['varynannots_td'], t=['best'])\n            >>> result = testres.draw_score_diff_disti()\n            >>> print(result)\n            >>> ut.show_if_requested()\n        "
    import wbia.plottool as pt
    import vtool as vt
    ibs = testres.ibs
    qaids = testres.get_test_qaids()
    qaids = ibs.get_annot_tag_filterflags(qaids, {'has_none': 'timedeltaerror'})
    gt_rawscore = testres.get_infoprop_mat('qx2_gt_raw_score', qaids=qaids)
    gf_rawscore = testres.get_infoprop_mat('qx2_gf_raw_score', qaids=qaids)
    gt_valid_flags_list = np.isfinite(gt_rawscore).T
    gf_valid_flags_list = np.isfinite(gf_rawscore).T
    cfgx2_gt_scores = vt.zipcompress(gt_rawscore.T, gt_valid_flags_list)
    cfgx2_gf_scores = vt.zipcompress(gf_rawscore.T, gf_valid_flags_list)
    gt_rank = testres.get_infoprop_mat('qx2_gt_rank', qaids=qaids)
    gf_ranks = testres.get_infoprop_mat('qx2_gf_rank', qaids=qaids)
    cfgx2_gt_ranks = vt.zipcompress(gt_rank.T, gt_valid_flags_list)
    cfgx2_rank0_gt_scores = vt.zipcompress(cfgx2_gt_scores, [(ranks == 0) for ranks in cfgx2_gt_ranks])
    cfgx2_rankX_gt_scores = vt.zipcompress(cfgx2_gt_scores, [(ranks > 0) for ranks in cfgx2_gt_ranks])
    cfgx2_gf_ranks = vt.zipcompress(gf_ranks.T, gf_valid_flags_list)
    cfgx2_rank0_gf_scores = vt.zipcompress(cfgx2_gf_scores, [(ranks == 0) for ranks in cfgx2_gf_ranks])
    xdata = list(map(len, testres.cfgx2_daids))
    USE_MEDIAN = True
    USE_LOG = False
    if USE_MEDIAN:
        ave = np.median
        dev = vt.median_abs_dev
    else:
        ave = np.mean
        dev = np.std

    def make_interval_args(arr_list, ave=ave, dev=dev, **kwargs):
        import utool as ut
        if USE_LOG:
            arr_list = list(map((lambda x: np.log((x + 1))), arr_list))
        sizes_ = list(map(len, arr_list))
        ydata_ = list(map(ave, arr_list))
        spread_ = list(map(dev, arr_list))
        label = kwargs.get('label', )
        label += (' ' + ut.get_funcname(ave))
        kwargs['label'] = label
        logger.info(((label + 'score stats : ') + ut.repr2(ut.get_jagged_stats(arr_list, use_median=True), nl=1, precision=1)))
        return (ydata_, spread_, kwargs, sizes_)
    args_list1 = [make_interval_args(cfgx2_gt_scores, label='GT', color=pt.TRUE_BLUE), make_interval_args(cfgx2_gf_scores, label='GF', color=pt.FALSE_RED)]
    args_list2 = [make_interval_args(cfgx2_rank0_gt_scores, label='GT-rank = 0', color=pt.LIGHT_GREEN), make_interval_args(cfgx2_rankX_gt_scores, label='GT-rank > 0', color=pt.YELLOW), make_interval_args(cfgx2_rank0_gf_scores, label='GF-rank = 0', color=pt.PINK)]
    plotargs_list = [args_list1, args_list2]
    ymax = (- np.inf)
    ymin = np.inf
    for args_list in plotargs_list:
        ydata_list = np.array(ut.get_list_column(args_list, 0))
        spread = np.array(ut.get_list_column(args_list, 1))
        ymax = max(ymax, np.array((ydata_list + spread)).max())
        ymin = min(ymax, np.array((ydata_list - spread)).min())
    ylabel = ('log name score' if USE_LOG else 'name score')
    statickw = dict(xlabel='database size (number of annotations)', ylabel=ylabel, linewidth=2, spread_alpha=0.5, lightbg=True, marker='o', ymax=ymax, ymin=ymin, xmax='data', xmin='data')
    fnum = pt.ensure_fnum(None)
    pnum_ = pt.make_pnum_nextgen(len(plotargs_list), 1)
    for args_list in plotargs_list:
        ydata_list = ut.get_list_column(args_list, 0)
        spread_list = ut.get_list_column(args_list, 1)
        kwargs_list = ut.get_list_column(args_list, 2)
        sizes_list = ut.get_list_column(args_list, 3)
        logger.info(('sizes_list = %s' % (ut.repr2(sizes_list, nl=1),)))
        plotkw = ut.dict_stack2(kwargs_list, '_list')
        plotkw2 = ut.merge_dicts(statickw, plotkw)
        pt.multi_plot(xdata, ydata_list, spread_list=spread_list, fnum=fnum, pnum=pnum_(), **plotkw2)
    figtitle = ('Score vs DBSize: %s' % testres.get_title_aug())
    pt.set_figtitle(figtitle)