Example #1
0
def closest_bubble(p):

    bubbles = np.array(bubble_params())
    l0, b0 = bubbles[:, 1], bubbles[:, 2]

    d = np.hypot(l0 - p[1], b0 - p[2])
    ind = np.argmin(d)
    return bubbles[ind], d[ind]
Example #2
0
def closest_bubble(p):

    bubbles = np.array(bubble_params())
    l0, b0 = bubbles[:, 1], bubbles[:, 2]

    d = np.hypot(l0 - p[1], b0 - p[2])
    ind = np.argmin(d)
    return bubbles[ind], d[ind]
Example #3
0
def main():

    model = ModelGroup.load('../models/full_classifier.dat')
    bubbles = sorted(bubble_params())
    scores = model.decision_function(bubbles)

    result = {'params': bubbles, 'scores': scores.tolist()}

    with open('../models/bubble_scores.json', 'w') as outfile:
        json.dump(result, outfile)
Example #4
0
def collage(bubbles):
    ex = RGBExtractor()
    ex.shp = (200, 200)
    images = [ex.extract(*p) for p in bubble_params(bubbles)]

    if len(images) == 3:
        return np.vstack(images)

    r, g, b = tuple(
        montage2d(np.array([a[:, :, i] for a in images])) for i in range(3))
    return np.dstack((r, g, b)).astype(np.uint8)
Example #5
0
def collage(bubbles):
    ex = RGBExtractor()
    ex.shp = (200, 200)
    images = [ex.extract(*p) for p in bubble_params(bubbles)]

    if len(images) == 3:
        return np.vstack(images)

    r, g, b = tuple(montage2d(np.array([a[:, :, i] for a in images]))
                    for i in range(3))
    return np.dstack((r, g, b)).astype(np.uint8)
Example #6
0
def main():

    data = json.load(open('../models/l035_scores.json'))

    stamps = np.array(data['stamps'])
    scores = np.array(data['scores'])

    l = stamps[:, 1]
    b = stamps[:, 2]

    good = (scores > .1) & (l < 35.17) & (l > 34.9) & (b > -.9) & (b < -0.6)

    stamps = stamps[good]
    scores = scores[good]

    merged = merge(stamps, scores)
    mwp = np.array(bubble_params())
    mwp  = mwp[(mwp[:, 1] < 35.3) & (mwp[:, 1] > 35)]

    f = get_field(35)
    bad = f.mips == 0
    g = scale(f.i4, limits=[30, 99.8])
    r = scale(f.mips, limits=[30, 99.7])
    r[bad] = 255
    b = r * 0

    im = np.dstack((r, g, b))

    plt.figure(dpi=200, tight_layout=True)
    plt.imshow(im, extent=[36, 34, -1, 1], interpolation="bicubic")

    plot_stamps(merged, edgecolor='#7570b3', linewidth=2, label='Brut')
    plot_stamps(mwp, edgecolor='#e7298a', linewidth=2, label='MWP')

    plt.xlim(35.2, 35)
    plt.ylim(-.825, -.625)
    plt.legend(loc='upper right')

    plt.xlabel("$\ell$ ($^\circ$)")
    plt.ylabel("b ($^\circ$)")

    plt.savefig('cluster_confusion.eps')
Example #7
0
def main():

    data = json.load(open('../models/l035_scores.json'))

    stamps = np.array(data['stamps'])
    scores = np.array(data['scores'])

    l = stamps[:, 1]
    b = stamps[:, 2]

    good = (scores > .1) & (l < 35.17) & (l > 34.9) & (b > -.9) & (b < -0.6)

    stamps = stamps[good]
    scores = scores[good]

    merged = merge(stamps, scores)
    mwp = np.array(bubble_params())
    mwp = mwp[(mwp[:, 1] < 35.3) & (mwp[:, 1] > 35)]

    f = get_field(35)
    bad = f.mips == 0
    g = scale(f.i4, limits=[30, 99.8])
    r = scale(f.mips, limits=[30, 99.7])
    r[bad] = 255
    b = r * 0

    im = np.dstack((r, g, b))

    plt.figure(dpi=200, tight_layout=True)
    plt.imshow(im, extent=[36, 34, -1, 1], interpolation="bicubic")

    plot_stamps(merged, edgecolor='#7570b3', linewidth=2, label='Brut')
    plot_stamps(mwp, edgecolor='#e7298a', linewidth=2, label='MWP')

    plt.xlim(35.2, 35)
    plt.ylim(-.825, -.625)
    plt.legend(loc='upper right')

    plt.xlabel("$\ell$ ($^\circ$)")
    plt.ylabel("b ($^\circ$)")

    plt.savefig('cluster_confusion.eps')
Example #8
0
def bubble_names(bubbles):
    params = bubble_params(bubbles)
    return ['%6.6i%+5.5i' % (p[1] * 1000, p[2] * 10000) for p in params]
Example #9
0
def bubble_names(bubbles):
    params = bubble_params(bubbles)
    return ['%6.6i%+5.5i' % (p[1] * 1000, p[2] * 10000)
            for p in params]