def test_get_obs_from_geo(self): """ChannelConverter_test.test_get_obs_from_geo() The geographic north and east components ``X`` and ``Y`` of the magnetic field vector H, combined with the declination baseline angle ``d0`` can be used to produce the observatory components ``h`` and ```e`` """ # 1) Call get_obs_from_geo using equal X,Y values with a d0 of 0 # the observatory values h,e will be the same. X = 1 Y = 1 (h, e) = channel.get_obs_from_geo(X, Y) assert_almost_equal(h, 1.0, 8, "Expect h to be 1.", True) assert_almost_equal(e, 1.0, 8, "Expect e to be 1.", True) # 2) Call get_obs_from_geo using equal X,Y values to create a 45 # degree angle (D), with a d0 of 45/2. The observatory declination # (d) will be 45/2, the difference between the total field angle, # and d0. X = 1 Y = 1 d0 = 22.5 * D2R (h, e) = channel.get_obs_from_geo(X, Y, d0) d = channel.get_obs_d_from_obs(h, e) assert_almost_equal(d, 22.5 * D2R, 8, "Expect d to be 22.5 degrees.", True) # 3) Call get_obs_from_geo using equal X,Y values to create a 45 # degree angle (D), with a d0 of 315 degrees. The observatory # declination (d) will be 90 degrees. X = 1 Y = 1 d0 = 315 * D2R (h, e) = channel.get_obs_from_geo(X, Y, d0) d = channel.get_obs_d_from_obs(h, e) assert_almost_equal(d, 90 * D2R, 8, "Expect d to be 90 degrees.", True) # 4) Call get_obs_from_geo using X,Y values of cos(60), sin(60), and # d0 of 30 degrees. The observatory values h,e will be cos(30) # and sin(30), and the observatory declination will be 30 degrees. # The observatory angle of 30 degrees + the d0 of 30 degrees produces # the total declination (D) of 60 degrees. X = cos(60 * D2R) Y = sin(60 * D2R) d0 = 30 * D2R (h, e) = channel.get_obs_from_geo(X, Y, d0) assert_almost_equal(h, cos(30 * D2R), 8, "Expect h to be cos(30).", True) assert_almost_equal(e, sin(30 * D2R), 8, "Expect e to be sin(30).", True) d = channel.get_obs_d_from_obs(h, e) assert_almost_equal(d, 30 * D2R, 8, "Expect d to be 30 degrees.", True)
def test_get_obs_d_from_obs(self): """ChannelConverter_test.test_get_obs_d_from_obs() ``d`` is the angle formed by the observatory components ``h`` and ``e`` the primary and secondary axis of the horizontal magnetic field vector in the observatories frame of reference. """ # 1) Call get_obs_d_from_obs usine h,e equal to cos(30), sin(30). # Expect d to be 30. h = cos(30 * D2R) e = sin(30 * D2R) d = channel.get_obs_d_from_obs(h, e) assert_almost_equal(d, 30 * D2R, 8, "Expect d to be 30 degrees.", True) # 2) Call get_obs_d_from_obs using h,e cos(30), -sin(30). Expect # d to be 30. h = cos(30 * D2R) e = sin(-30 * D2R) d = channel.get_obs_d_from_obs(h, e) assert_almost_equal(d, -30 * D2R, 8, "Expect d to be 30 degrees.", True)