def test_derive_not_dip(self): alt_agl = P(name='Altitude AGL', array=np.ma.concatenate((np.ones(10) * 310, np.ones(10) * 290, np.ones(10) * 310))) gspd = P('Groundspeed', array=np.ma.zeros(30)) airs = buildsections('Airborne', [0, 30]) t_hf = buildsections('Transition Hover To Flight', [2, 4]) t_fh = buildsections('Transition Flight To Hover', [28, 30]) node = Hover() node.derive(alt_agl, airs, gspd, t_hf, t_fh) self.assertEqual(len(node), 0)
def test_derive_not_without_transition(self): alt_agl = P(name='Altitude AGL', array=np.ma.concatenate((np.zeros(5), np.ones(45) * 10, np.ones(50) * 400, np.ones(50) * 250, np.ones(30) * 400, np.zeros(20)))) gspd = P('Groundspeed', array=np.ma.zeros(200)) airs = buildsections('Airborne', [6, 200]) t_hf = buildsections('Transition Hover To Flight', [22, 24]) t_fh = buildsections('Transition Flight To Hover', [180, 190]) node = Hover() node.derive(alt_agl, airs, gspd, t_hf, t_fh) self.assertEqual(len(node), 2)
def test_derive_basic(self): alt_agl = P(name='Altitude AGL', array=np.ma.concatenate((np.zeros(5), np.ones(30) * 10, np.zeros(5)))) gspd = P('Groundspeed', array=np.ma.zeros(40)) airs = buildsections('Airborne', [6, 26]) t_hf = buildsections('Transition Hover To Flight', [22, 24]) t_fh = buildsections('Transition Flight To Hover', [8, 10]) node = Hover() node.derive(alt_agl, airs, gspd, t_hf, t_fh) self.assertEqual(len(node), 1) self.assertEqual(node[0].slice.start, 11) self.assertEqual(node[0].slice.stop, 22)
def test_derive_too_fast(self): alt_agl = P(name='Altitude AGL', array=np.ma.ones(30) * 10, frequency=0.2) gspd = P('Groundspeed', array=np.ma.concatenate( (np.zeros(10), np.ones(10) * 20, np.zeros(10)))) airs = buildsections('Airborne', [0, 30]) t_hf = buildsections('Transition Hover To Flight', [2, 4]) t_fh = buildsections('Transition Flight To Hover', [28, 30]) node = Hover() node.derive(alt_agl, airs, gspd) self.assertEqual(len(node), 2)
def test_derive_basic(self): alt_agl = P(name='Altitude AGL', array=np.ma.concatenate((np.zeros(5), np.ones(30) * 10.0, np.zeros(5)))) alt_agl.array[14] = 20.0 alt_agl.array[17] = 60.0 hovers = buildsections('Hover', [6, 8], [24,26]) airs = buildsections('Airborne', [6, 26]) t_hf = buildsections('Transition Hover To Flight', [12, 15]) t_fh = buildsections('Transition Flight To Hover', [18, 20]) node = HoverTaxi() node.derive(alt_agl, airs, hovers, t_hf, t_fh) self.assertEqual(len(node), 2) self.assertEqual(node[0].slice.start, 9) self.assertEqual(node[0].slice.stop, 12) self.assertEqual(node[1].slice.start, 21) self.assertEqual(node[1].slice.stop, 24)
def test_derive_too_short(self): alt_agl = P(name='Altitude AGL', array=np.ma.zeros(30)) gspd = P('Groundspeed', array=np.ma.zeros(30)) airs = buildsections('Airborne', [6, 8], [15, 27]) node = Hover() node.derive(alt_agl, airs, gspd) self.assertEqual(len(node), 1)
def test_derive_no_auto(self): descs = buildsections('Descending', [4, 13], [15, 27]) eng_np = P(name='Eng (*) Np Max', array=np.ma.ones(30) * 100) nr = P(name='Nr', array=np.ma.ones(30) * 100) node = Autorotation() node.derive(eng_np, nr, descs) self.assertEqual(len(node), 0)
def test_derive_too_fast(self): alt_agl = P(name='Altitude AGL', array=np.ma.ones(30) * 10, frequency=0.2) gspd = P('Groundspeed', array=np.ma.concatenate((np.zeros(10), np.ones(10) * 20, np.zeros(10)))) airs = buildsections('Airborne', [0, 30]) node = Hover() node.derive(alt_agl, airs, gspd) self.assertEqual(len(node), 2)
def test_derive_too_short(self): alt_agl = P(name='Altitude AGL', array=np.ma.zeros(30)) gspd = P('Groundspeed', array=np.ma.zeros(30)) airs = buildsections('Airborne', [6,8], [15,27]) node = Hover() node.derive(alt_agl, airs, gspd) self.assertEqual(len(node), 1)
def test_derive_null_transitions(self): alt_agl = P(name='Altitude AGL', array=np.ma.concatenate((np.zeros(5), np.ones(10) * 10.0, np.zeros(5)))) gspd = P('Groundspeed', array=np.ma.zeros(20)) airs = buildsections('Airborne', [6, 16]) node = Hover() node.derive(alt_agl, airs, gspd, None, None) self.assertEqual(len(node), 1)
def test_derive_no_auto(self): descs = buildsections('Descending', [4,13], [15,27]) eng_np = P(name='Eng (*) Np Max', array=np.ma.ones(30) * 100) nr = P(name= 'Nr', array=np.ma.ones(30) * 100) node = Autorotation() node.derive(eng_np , nr, descs) self.assertEqual(len(node), 0)
def test_nose_down_multiple_climbs(self): node = NoseDownAttitudeAdoption() pitch = np.concatenate([np.ones(15) * 2, np.linspace(2, -11, num=15), np.linspace(-11, 2, num=10), np.ones(20) * 2, np.linspace(2, -11, num=15), np.ones(10) * -11]) climbs = buildsections('Initial Climb', [10, 40], [60, 85]) node.derive(P('Pitch', pitch), climbs) self.assertEqual(len(node), 2) self.assertEqual(node[0], Section('Nose Down Attitude Adoption', slice(15, 28, None), 15, 28)) self.assertEqual(node[1], Section('Nose Down Attitude Adoption', slice(60, 73, None), 60, 73))
def setUp(self): self.null = np.array([0.0] * 100) self.wave = np.sin(np.array(range(100)) / 3.0) self.gnds = buildsections('Grounded', [10, 89])
def setUp(self): self.null = np.array([0.0]*100) self.wave = np.sin(np.array(range(100))/3.0) self.gnds = buildsections('Grounded', [10, 89])