Ejemplo n.º 1
0
def test_fit_core():
    '''
    creating some great circles pointing in different directions (two
    north-south,
    two east-west) and that have a slight position errors (+- 0.1 m in one of
    the four
    cardinal directions '''
    circle1 = GreatCircle([[1, 0, 0], [0, 0, 1]])
    circle1.pos = [0, 0.1] * u.m
    circle1.trace = [1, 0, 0]

    circle2 = GreatCircle([[0, 1, 0], [0, 0, 1]])
    circle2.pos = [0.1, 0] * u.m
    circle2.trace = [0, 1, 0]

    circle3 = GreatCircle([[1, 0, 0], [0, 0, 1]])
    circle3.pos = [0, -.1] * u.m
    circle3.trace = [1, 0, 0]

    circle4 = GreatCircle([[0, 1, 0], [0, 0, 1]])
    circle4.pos = [-.1, 0] * u.m
    circle4.trace = [0, 1, 0]

    # creating the fit class and setting the the great circle member
    fit = HillasReconstructor()
    fit.circles = {1: circle1, 2: circle2, 3: circle3, 4: circle4}

    # performing the position fit with the minimisation algorithm
    # and a seed that is quite far away
    pos_fit_minimise = fit.fit_core_minimise([100, 1000] * u.m)
    print("position fit test minimise:", pos_fit_minimise)
    print()

    # performing the position fit with the geometric algorithm
    pos_fit_crosses, err_est_pos_fit_crosses = fit.fit_core_crosses()
    print("position fit test crosses:", pos_fit_crosses)
    print("error estimate:", err_est_pos_fit_crosses)
    print()

    # the results should be close to the origin of the coordinate system
    np.testing.assert_allclose(pos_fit_minimise / u.m, [0, 0], atol=1e-3)
    np.testing.assert_allclose(pos_fit_crosses / u.m, [0, 0], atol=1e-3)
Ejemplo n.º 2
0
def test_fit_core():
    '''
    creating some great circles pointing in different directions (two
    north-south,
    two east-west) and that have a slight position errors (+- 0.1 m in one of
    the four
    cardinal directions '''
    circle1 = GreatCircle([[1, 0, 0], [0, 0, 1]])
    circle1.pos = [0, 0.1] * u.m
    circle1.trace = [1, 0, 0]

    circle2 = GreatCircle([[0, 1, 0], [0, 0, 1]])
    circle2.pos = [0.1, 0] * u.m
    circle2.trace = [0, 1, 0]

    circle3 = GreatCircle([[1, 0, 0], [0, 0, 1]])
    circle3.pos = [0, -.1] * u.m
    circle3.trace = [1, 0, 0]

    circle4 = GreatCircle([[0, 1, 0], [0, 0, 1]])
    circle4.pos = [-.1, 0] * u.m
    circle4.trace = [0, 1, 0]

    # creating the fit class and setting the the great circle member
    fit = HillasReconstructor()
    fit.circles = {1: circle1, 2: circle2, 3: circle3, 4: circle4}

    # performing the position fit with the minimisation algorithm
    # and a seed that is quite far away
    pos_fit_minimise = fit.fit_core_minimise([100, 1000] * u.m)
    print("position fit test minimise:", pos_fit_minimise)
    print()

    # performing the position fit with the geometric algorithm
    pos_fit_crosses, err_est_pos_fit_crosses = fit.fit_core_crosses()
    print("position fit test crosses:", pos_fit_crosses)
    print("error estimate:", err_est_pos_fit_crosses)
    print()

    # the results should be close to the origin of the coordinate system
    np.testing.assert_allclose(pos_fit_minimise / u.m, [0, 0], atol=1e-3)
    np.testing.assert_allclose(pos_fit_crosses / u.m, [0, 0], atol=1e-3)
Ejemplo n.º 3
0
def test_fit_origin():
    '''
    creating some great circles pointing in different directions (two
    north-south,
    two east-west) and that have a slight position errors (+- 0.1 m in one of
    the four
    cardinal directions '''
    circle1 = GreatCircle([[1, 0, 0], [0, 0, 1]])
    circle1.pos = [0, 0.1] * u.m
    circle1.trace = [1, 0, 0]

    circle2 = GreatCircle([[0, 1, 0], [0, 0, 1]])
    circle2.pos = [0.1, 0] * u.m
    circle2.trace = [0, 1, 0]

    circle3 = GreatCircle([[1, 0, 0], [0, 0, 1]])
    circle3.pos = [0, -.1] * u.m
    circle3.trace = [1, 0, 0]

    circle4 = GreatCircle([[0, 1, 0], [0, 0, 1]])
    circle4.pos = [-.1, 0] * u.m
    circle4.trace = [0, 1, 0]

    # creating the fit class and setting the the great circle member
    fit = HillasReconstructor()
    fit.circles = {1: circle1, 2: circle2, 3: circle3, 4: circle4}

    # performing the direction fit with the minimisation algorithm
    # and a seed that is perpendicular to the up direction
    dir_fit_minimise = fit.fit_origin_minimise((0.1, 0.1, 1))
    print("direction fit test minimise:", dir_fit_minimise)
    print()

    # performing the direction fit with the geometric algorithm
    dir_fit_crosses = fit.fit_origin_crosses()[0]
    print("direction fit test crosses:", dir_fit_crosses)
    print()

    # the results should be close to the direction straight up
    # np.testing.assert_allclose(dir_fit_minimise, [0, 0, 1], atol=1e-1)
    np.testing.assert_allclose(dir_fit_crosses, [0, 0, 1], atol=1e-3)
Ejemplo n.º 4
0
def test_fit_origin():
    '''
    creating some great circles pointing in different directions (two
    north-south,
    two east-west) and that have a slight position errors (+- 0.1 m in one of
    the four
    cardinal directions '''
    circle1 = GreatCircle([[1, 0, 0], [0, 0, 1]])
    circle1.pos = [0, 0.1] * u.m
    circle1.trace = [1, 0, 0]

    circle2 = GreatCircle([[0, 1, 0], [0, 0, 1]])
    circle2.pos = [0.1, 0] * u.m
    circle2.trace = [0, 1, 0]

    circle3 = GreatCircle([[1, 0, 0], [0, 0, 1]])
    circle3.pos = [0, -.1] * u.m
    circle3.trace = [1, 0, 0]

    circle4 = GreatCircle([[0, 1, 0], [0, 0, 1]])
    circle4.pos = [-.1, 0] * u.m
    circle4.trace = [0, 1, 0]

    # creating the fit class and setting the the great circle member
    fit = HillasReconstructor()
    fit.circles = {1: circle1, 2: circle2, 3: circle3, 4: circle4}

    # performing the direction fit with the minimisation algorithm
    # and a seed that is perpendicular to the up direction
    dir_fit_minimise = fit.fit_origin_minimise((0.1, 0.1, 1))
    print("direction fit test minimise:", dir_fit_minimise)
    print()

    # performing the direction fit with the geometric algorithm
    dir_fit_crosses = fit.fit_origin_crosses()[0]
    print("direction fit test crosses:", dir_fit_crosses)
    print()

    # the results should be close to the direction straight up
    # np.testing.assert_allclose(dir_fit_minimise, [0, 0, 1], atol=1e-1)
    np.testing.assert_allclose(dir_fit_crosses, [0, 0, 1], atol=1e-3)