ReFRACtor
solar_doppler_shift_polynomial_test.py
Go to the documentation of this file.
1 from nose.tools import *
2 from full_physics import *
3 import os
4 import numpy as np
5 import numpy.testing as nptest
6 import datetime;
7 import time;
8 
9 #def test_solar_doppler_shift_polynomial():
10 # Working on solar stuff, so for now don't run this test.
11 if(False):
12  # Time as a datetime. Note you can also use a float as a unix time
13  # stamp if that is more convenient. We include fractions of a second
14 
15  tm = datetime.datetime(2006,9,14,12,27,22,100)
16 
17  # Somewhat oddly, python doesn't support timezones out of the box.
18  # Rather than depending on a third party library for a unit test,
19  # we just convert from local time to GMT time
20 
21  tm = tm - datetime.timedelta(seconds=time.timezone)
22  if(time.daylight):
23  tm += datetime.timedelta(hours=1)
24 
25  p = SolarDopplerShiftPolynomial(tm,
26  DoubleWithUnit(77.1828918457,Unit("deg")),
27  DoubleWithUnit(74.128288269,Unit("deg")),
28  DoubleWithUnit(167.495071411,Unit("deg")),
29  DoubleWithUnit(416,Unit("m")))
30 
31  assert_almost_equal(p.solar_distance.value, 1.0060305651331354)
32 
33  wn = SpectralDomain([12929.94, 12979.93, 13029.93, 13079.93,
34  13129.93, 13179.93])
35  expected = np.array([12929.919173650407,
36  12979.909093131146,
37  13029.909012595777,
38  13079.908932060409,
39  13129.908851525041,
40  13179.908770989672])
41  nptest.assert_array_almost_equal(p.doppler_stretch(wn).data, expected)
42 

Copyright © 2017, California Institute of Technology.
ALL RIGHTS RESERVED.
U.S. Government Sponsorship acknowledged.
Generated Fri Aug 24 2018 15:44:10