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_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_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)