Ejemplo n.º 1
0
def get_swap_fraction_to_delta_range_fraction(s, netlist, percent=False):
    deltas = get_deltas_from_netlist(s, netlist, percent=percent)
    hist, bin_edges = np.histogram(deltas, bins=50)
    count = len(hist)
    plot_data = {'Cummulative swaps count': hist.cumsum() / sum(hist),
        '% of delta range': np.arange(count) / count}
    x_label, y_label = 'Cummulative swaps count', '% of delta range'
    f = LinearInterpolatedModel()
    f.fitData(np.concatenate(([0], plot_data[x_label])), 
            np.concatenate(([0], plot_data[y_label])))
    return f, bin_edges
Ejemplo n.º 2
0
def get_combined_swap_fraction_to_delta_range_fraction(s):
    #import pudb; pudb.set_trace()
    hist = get_combined_histogram(s)
    count = len(hist)
    plot_data = {'Cummulative swaps count': hist.cumsum() / sum(hist),
        '% of delta range': np.arange(count) / count}
    x_label, y_label = 'Cummulative swaps count', '% of delta range'
    f = LinearInterpolatedModel()
    f.fitData(np.concatenate(([0], plot_data[x_label])), 
            np.concatenate(([0], plot_data[y_label])))
    return f