コード例 #1
0
    def test_get_geo_from_obs(self):
        """ChannelConverter_test.test_get_geo_from_obs()

        The observatory component ``h`` and ``e`` combined with the declination
        basline angle ``d0`` converts to the geographic north component
        ``X`` and east vector ``Y``
        """

        # 1) Call get_geo_from_obs using equal h,e values with a d0 of 0
        #   the geographic values X,Y will be the same. This proves the simple
        #   case where the observatory is aligned with geographic north.
        h = 1
        e = 1
        (X, Y) = channel.get_geo_from_obs(h, e)
        assert_almost_equal(X, 1, 8, "Expect X to almost equal 1.", True)
        assert_almost_equal(Y, 1, 8, "Expect Y to almost equal 1.", True)

        # 2) Call get_geo_from_obs using h,e values of cos(15), sin(15)
        #       (to create a d of 15 degrees) and a d0 of 15 degrees.
        #       X and Y will be cos(30), sin(30)
        h = cos(15 * D2R)
        e = sin(15 * D2R)
        d0 = 15 * D2R
        (X, Y) = channel.get_geo_from_obs(h, e, d0)
        assert_almost_equal(X, cos(30 * D2R), 8, "Expect X to equal cos(30)",
                            True)
        assert_almost_equal(Y, sin(30 * D2R), 8, "Expect Y to equal sin(30)",
                            True)

        # 3) Call get_geo_from_obs using h,e values of 1,0 with a d0 of 315
        #   degrees. The geographic X,Y will be cos(45), sin(-45)
        h = 1
        e = 0
        d0 = 315 * D2R
        (X, Y) = channel.get_geo_from_obs(h, e, d0)
        assert_almost_equal(X, cos(45 * D2R), 8, "Expect X to equal cos(45).",
                            True)
        assert_almost_equal(Y, sin(-45 * D2R), 8, "Expect Y to equal sin(45).",
                            True)

        # 4) Call get_geo_from_obs using h,e values of cos_30,sin_30 and d0 of
        #   30 degrees. The geographic X,Y will be cos(-30), sin(-30), due to
        #   combined angle of the observatory declination of 30 degrees, and
        #   the d0 of -60 degrees.
        h = cos(30 * D2R)
        e = sin(30 * D2R)
        d0 = -60 * D2R
        (X, Y) = channel.get_geo_from_obs(h, e, d0)
        assert_almost_equal(X, cos(-30 * D2R), 8, "Expect X to equal cos(60).",
                            True)
        assert_almost_equal(Y, sin(-30 * D2R), 8, "Expect Y to equal sin(60).",
                            True)
コード例 #2
0
    def test_geo_to_obs_to_geo(self):
        """ChannelConverter_test.test_geo_to_obs_to_geo()

        Call get_geo_from_obs using values from Boulder, then call
            get_obs_from_geo using the X,Y values returned from
            get_geo_from_obs. Expect the end values to be the same
            as the start values.
        """
        h_in = 20840.15
        e_in = -74.16
        d0 = dec_bas_rad
        (X, Y) = channel.get_geo_from_obs(h_in, e_in, d0)
        (h, e) = channel.get_obs_from_geo(X, Y, d0)

        assert_almost_equal(h, 20840.15, 8, "Expect h to = 20840.15.", True)
        assert_almost_equal(e, -74.16, 8, "Expect e to = -74.16", True)