Beispiel #1
0
def test_sky_dist():
    src1 = SimpleSource()
    src1.ra = 0
    src1.dec = 0
    src2 = SimpleSource()
    src2.ra = 0
    src2.dec = 1/3600.
    if not cluster.sky_dist(src1, src1) == 0.:
        raise AssertionError()
    if not cluster.sky_dist(src1, src2) == 1/3600.:
        raise AssertionError()
Beispiel #2
0
def test_norm_dist():
    src1 = SimpleSource()
    src1.ra = 0
    src1.dec = 0
    src1.a = 1.
    src1.b = 1.
    src2 = SimpleSource()
    src2.ra = 0
    src2.dec = 1/3600.
    src2.a = 1
    src2.b = 1
    if not cluster.norm_dist(src1, src1) == 0:
        raise AssertionError()
    if not cluster.norm_dist(src1, src2) == 1/math.sqrt(2):
        raise AssertionError()
Beispiel #3
0
def test_pairwise_elliptical_binary():
    src1 = SimpleSource()
    src1.ra = 0
    src1.dec = 0
    src1.a = 1.
    src1.b = 1.
    src2 = deepcopy(src1)
    src2.dec = 1/3600.
    src3 = deepcopy(src1)
    src3.dec = 50
    mat = cluster.pairwise_ellpitical_binary([src1, src2, src3], eps=0.5)
    if not np.all(mat == [[False, True, False], [True, False, False], [False, False, False]]):
        raise AssertionError()
def aegean_format(catalogue, out):
    """
    Save a catalogue in a format that Aegean will recognize
    :param catalogue: Catalogue
    :param out: Output filename
    :return:
    """
    sources = []
    for i, c in enumerate(catalogue):
        src = SimpleSource()
        src.ra, src.dec, src.peak_flux = c
        src.uuid = "injected_{0:04d}".format(i)
        src.pa = 0
        src.a = src.b = 0.0326580516349937 * 3600
        sources.append(src)
    save_catalog(out, sources)
    print("Wrote to file {0}".format(out))
    return