Example #1
0
def field_stamps(lon):
    """
    Return the stamp parameters to classify for each longitude

    Returns
    -------
    A list of lists
    """
    f = get_field(lon)
    stamps = list(f.all_stamps())
    stamps = [s for s in stamps if np.abs(s[1] - lon) <= 0.5]
    return sorted(stamps)
Example #2
0
def field_stamps(lon):
    """
    Return the stamp parameters to classify for each longitude

    Returns
    -------
    A list of lists
    """
    f = get_field(lon)
    stamps = list(f.all_stamps())
    stamps = [s for s in stamps if np.abs(s[1] - lon) <= 0.5]
    return sorted(stamps)
Example #3
0
def main():

    model = ModelGroup.load('../models/full_classifier.dat')

    f = get_field(305)
    stamps = sorted(list(f.all_stamps()))

    df = model.cloud_decision_function(stamps, workers=100)
    result = {'stamps': stamps, 'scores': df.tolist()}

    with open('../models/l305_scores.json', 'w') as outfile:
        json.dump(result, outfile)
Example #4
0
def main():

    model = ModelGroup.load('../models/full_classifier.dat')

    f = get_field(35)
    stamps = list(f.small_stamps())
    stamps = [s for s in stamps if s[1] > 34.5 and s[1] < 35.5]

    df = model.cloud_decision_function(stamps, workers=100)
    result = {'stamps': stamps, 'scores': df.tolist()}

    with open('../models/l035_small_scores.json', 'w') as outfile:
        json.dump(result, outfile)
Example #5
0
def main():
    np.random.seed(42)

    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 < 34.8) & (l > 34.6) & (b > -.4) & (b < -0.2)
    assert good.sum() > 0

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

    merged, ms = merge(stamps, scores)

    f = get_field(35)
    g = scale(f.i4, limits=[70, 99])
    r = scale(f.mips, limits=[70, 99])
    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(stamps, linewidth=1, edgecolor='white', label='Raw',
                alpha=1)
    plot_stamps(merged, edgecolor='red', alpha=1, linewidth=2,
                label='Merged')

    plt.xlim(34.795, 34.695)
    plt.ylim(-.365, -.265)


    plt.xlabel("$\ell$ ($^\circ$)")
    plt.ylabel("b ($^\circ$)")
    leg = plt.legend(loc='upper left', frameon=False)
    for text in leg.get_texts():
        text.set_color('white')

    plt.savefig('cluster.eps')
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():
    np.random.seed(42)

    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 < 34.8) & (l > 34.6) & (b > -.4) & (b < -0.2)
    assert good.sum() > 0

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

    merged, ms = merge(stamps, scores)

    f = get_field(35)
    g = scale(f.i4, limits=[70, 99])
    r = scale(f.mips, limits=[70, 99])
    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(stamps, linewidth=1, edgecolor='white', label='Raw', alpha=1)
    plot_stamps(merged, edgecolor='red', alpha=1, linewidth=2, label='Merged')

    plt.xlim(34.795, 34.695)
    plt.ylim(-.365, -.265)

    plt.xlabel("$\ell$ ($^\circ$)")
    plt.ylabel("b ($^\circ$)")
    leg = plt.legend(loc='upper left', frameon=False)
    for text in leg.get_texts():
        text.set_color('white')

    plt.savefig('cluster.eps')
Example #8
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 #9
0
File: l35.py Project: xuduo117/brut
 def extract(self, lon, l, b, r):
     shp = self.shp
     return get_field(lon).extract_stamp(l, b, r, limits=[30, 98], shp=shp)