def derive( self, rad=P('Altitude Radio'), hdot=P('Vertical Speed'), ): def seek_deck(rad, hdot, min_idx, rad_hz): def one_direction(rad, hdot, sence, rad_hz): # Stairway to Heaven is getting a bit old. Getting with the times? b_diffs = hdot / 60 r_diffs = np.ma.ediff1d(rad, to_begin=b_diffs[0]) diffs = np.ma.where( np.ma.abs(r_diffs - b_diffs) > 6.0, b_diffs, r_diffs) height = integrate(diffs, frequency=rad_hz, direction=sence, repair=False) return height height_from_rig = np_ma_masked_zeros_like(rad) if len(rad[:min_idx]) > 0: height_from_rig[:min_idx] = one_direction( rad[:min_idx], hdot[:min_idx], "backwards", rad_hz) if len(rad[min_idx:]) > 0: height_from_rig[min_idx:] = one_direction( rad[min_idx:], hdot[min_idx:], "forwards", rad_hz) ''' # And we are bound to want to know the rig height somewhere, so here's how to work that out. rig_height = rad[0]-height_from_rig[0] # I checked this and it seems pretty consistent. # See Library\Projects\Helicopter FDM\Algorithm Development\Rig height estimates from Bond initial test data.xlsx #lat=hdf['Latitude'].array[app_slice][-1] #lon=hdf['Longitude'].array[app_slice][-1] #print(lat, lon, rig_height) ''' return height_from_rig self.array = np_ma_masked_zeros_like(rad.array) rad_peak_idxs, rad_peak_vals = cycle_finder(rad.array, min_step=150.0) if len(rad_peak_idxs) < 4: return slice_idxs = zip(rad_peak_idxs[:-2], rad_peak_idxs[1:-1], rad_peak_idxs[2:], rad_peak_vals[1:]) for slice_idx in slice_idxs[1:-1]: this_deck_slice = slice(slice_idx[0] + 1, slice_idx[2] - 1) if slice_idx[3] > 5.0: # We didn't land in this period continue else: self.array[this_deck_slice] = seek_deck( rad.array[this_deck_slice], hdot.array[this_deck_slice], slice_idx[1] - slice_idx[0], rad.frequency) '''
def derive( self, rad=P('Altitude Radio'), hdot=P('Vertical Speed'), ): def seek_deck(rad, hdot, min_idx, rad_hz): def one_direction(rad, hdot, sence, rad_hz): # Stairway to Heaven is getting a bit old. Getting with the times? # Vertical Speed / 60 = Pressure alt V/S in feet per second b_diffs = hdot / 60 # Rate of change on radalt array = Rad alt V/S in feet per second r_diffs = np.ma.ediff1d(rad * rad_hz, to_begin=b_diffs[0]) # Difference between ROC greater than 6fps will mean flying over # the deck; use pressure alt roc when that happens and radio alt # roc in all other cases diffs = np.ma.where( np.ma.abs(r_diffs - b_diffs) > 6.0 * rad_hz, b_diffs, r_diffs) height = integrate(diffs, frequency=rad_hz, direction=sence, repair=False) return height height_from_rig = np_ma_masked_zeros_like(rad) if len(rad[:min_idx]) > 0: height_from_rig[:min_idx] = one_direction( rad[:min_idx], hdot[:min_idx], "backwards", rad_hz) if len(rad[min_idx:]) > 0: height_from_rig[min_idx:] = one_direction( rad[min_idx:], hdot[min_idx:], "forwards", rad_hz) ''' # And we are bound to want to know the rig height somewhere, so here's how to work that out. rig_height = rad[0]-height_from_rig[0] # I checked this and it seems pretty consistent. # See Library\Projects\Helicopter FDM\Algorithm Development\Rig height estimates from Bond initial test data.xlsx #lat=hdf['Latitude'].array[app_slice][-1] #lon=hdf['Longitude'].array[app_slice][-1] #print(lat, lon, rig_height) ''' return height_from_rig # Prepare a masked array filled with zeros for the parameter (same length as radalt array) self.array = np_ma_masked_zeros_like(rad.array) rad_peak_idxs, rad_peak_vals = cycle_finder(rad.array, min_step=150.0) if len(rad_peak_idxs) < 4: return slice_idxs = list( zip(rad_peak_idxs[:-2], rad_peak_idxs[1:-1], rad_peak_idxs[2:], rad_peak_vals[1:])) for slice_idx in slice_idxs[1:-1]: this_deck_slice = slice(slice_idx[0] + 1, slice_idx[2] - 1) if slice_idx[3] > 5.0: # We didn't land in this period continue else: self.array[this_deck_slice] = seek_deck( rad.array[this_deck_slice], hdot.array[this_deck_slice], slice_idx[1] - slice_idx[0], rad.frequency) '''
def derive(self, rad=P('Altitude Radio'), hdot=P('Vertical Speed'), ): def seek_deck(rad, hdot, min_idx, rad_hz): def one_direction(rad, hdot, sence, rad_hz): # Stairway to Heaven is getting a bit old. Getting with the times? # Vertical Speed / 60 = Pressure alt V/S in feet per second b_diffs = hdot/60 # Rate of change on radalt array = Rad alt V/S in feet per second r_diffs = np.ma.ediff1d(rad*rad_hz, to_begin=b_diffs[0]) # Difference between ROC greater than 6fps will mean flying over # the deck; use pressure alt roc when that happens and radio alt # roc in all other cases diffs = np.ma.where(np.ma.abs(r_diffs-b_diffs)>6.0*rad_hz, b_diffs, r_diffs) height = integrate(diffs, frequency=rad_hz, direction=sence, repair=False) return height height_from_rig = np_ma_masked_zeros_like(rad) if len(rad[:min_idx]) > 0: height_from_rig[:min_idx] = one_direction(rad[:min_idx], hdot[:min_idx], "backwards", rad_hz) if len(rad[min_idx:]) > 0: height_from_rig[min_idx:] = one_direction(rad[min_idx:], hdot[min_idx:], "forwards", rad_hz) ''' # And we are bound to want to know the rig height somewhere, so here's how to work that out. rig_height = rad[0]-height_from_rig[0] # I checked this and it seems pretty consistent. # See Library\Projects\Helicopter FDM\Algorithm Development\Rig height estimates from Bond initial test data.xlsx #lat=hdf['Latitude'].array[app_slice][-1] #lon=hdf['Longitude'].array[app_slice][-1] #print(lat, lon, rig_height) ''' return height_from_rig # Prepare a masked array filled with zeros for the parameter (same length as radalt array) self.array = np_ma_masked_zeros_like(rad.array) rad_peak_idxs, rad_peak_vals = cycle_finder(rad.array, min_step=150.0) if len(rad_peak_idxs)<4: return slice_idxs = list(zip(rad_peak_idxs[:-2], rad_peak_idxs[1:-1], rad_peak_idxs[2:], rad_peak_vals[1:])) for slice_idx in slice_idxs[1:-1]: this_deck_slice = slice(slice_idx[0]+1, slice_idx[2]-1) if slice_idx[3] > 5.0: # We didn't land in this period continue else: self.array[this_deck_slice] = seek_deck(rad.array[this_deck_slice], hdot.array[this_deck_slice], slice_idx[1]-slice_idx[0], rad.frequency) '''