def _get_eng_params(hdf, align_param=None): ''' Get eng parameters from hdf, and return the minimum. :param hdf: hdf_file object. :type hdf: hdfaccess.file.hdf_file :returns: Minimum of normalised split parameters along with its frequency. Will return None, None if no split parameters are available. :rtype: (None, None) or (np.ma.masked_array, float) ''' params = [] eng_params= ('Eng (1) N1', 'Eng (2) N1', 'Eng (3) N1', 'Eng (4) N1', 'Eng (1) N2', 'Eng (2) N2', 'Eng (3) N2', 'Eng (4) N2', 'Eng (1) Np', 'Eng (2) Np', 'Eng (3) Np', 'Eng (4) Np') for param_name in eng_params: try: param = hdf[param_name] except KeyError: continue if align_param: # Align all other parameters to provided param or first available. param.array = align(param, align_param) else: align_param = param params.append(param) if not len(params): return None, None # If there is at least one split parameter available. stacked_params = vstack_params(*params) split_params_avg = np.ma.average(stacked_params, axis=0) return split_params_avg, align_param.frequency
def _get_normalised_split_params(hdf): ''' Get split parameters (currently engine power and Groundspeed) from hdf, normalise them on a scale from 0-1.0 and return the minimum. :param hdf: hdf_file object. :type hdf: hdfaccess.file.hdf_file :returns: Minimum of normalised split parameters along with its frequency. Will return None, None if no split parameters are available. :rtype: (None, None) or (np.ma.masked_array, float) ''' params = [] first_split_param = None for param_name in ('Eng (1) N1', 'Eng (2) N1', 'Eng (3) N1', 'Eng (4) N1', 'Eng (1) N2', 'Eng (2) N2', 'Eng (3) N2', 'Eng (4) N2', 'Eng (1) Np', 'Eng (2) Np', 'Eng (3) Np', 'Eng (4) Np', 'Groundspeed', 'Groundspeed (1)', 'Groundspeed (2)'): try: param = hdf[param_name] except KeyError: continue if first_split_param: # Align all other parameters to first available. #Q: Why not force to 1Hz? param.array = align(param, first_split_param) else: first_split_param = param params.append(param) if not first_split_param: return None, None # If there is at least one split parameter available. # normalise the parameters we'll use for splitting the data stacked_params = vstack_params(*params) normalised_params = normalise(stacked_params, scale_max=100) split_params_min = np.ma.average(normalised_params, axis=0) return split_params_min, first_split_param.frequency
def _get_normalised_split_params(hdf): ''' Get split parameters (currently engine power and Groundspeed) from hdf, normalise them on a scale from 0-1.0 and return the minimum. :param hdf: hdf_file object. :type hdf: hdfaccess.file.hdf_file :returns: Minimum of normalised split parameters along with its frequency. Will return None, None if no split parameters are available. :rtype: (None, None) or (np.ma.masked_array, float) ''' params = [] first_split_param = None split_params = ( 'Eng (1) N1', 'Eng (2) N1', 'Eng (3) N1', 'Eng (4) N1', 'Eng (1) N2', 'Eng (2) N2', 'Eng (3) N2', 'Eng (4) N2', 'Eng (1) Np', 'Eng (2) Np', 'Eng (3) Np', 'Eng (4) Np', 'Eng (1) Fuel Flow', 'Eng (2) Fuel Flow', 'Eng (3) Fuel Flow', 'Eng (4) Fuel Flow', 'Groundspeed', 'Groundspeed (1)', 'Groundspeed (2)' ) for param_name in split_params: try: param = hdf[param_name] except KeyError: continue if first_split_param: # Align all other parameters to first available. #Q: Why not force # to 1Hz? param.array = align(param, first_split_param) else: first_split_param = param params.append(param) if not first_split_param: return None, None # If there is at least one split parameter available. # normalise the parameters we'll use for splitting the data stacked_params = vstack_params(*params) # We normalise each in turn to the range 0-1 so they have equal weight normalised_params = [normalise(i) for i in stacked_params] # Using a true minimum leads to bias to a zero value. We take the average # to allow each parameter equal weight, then (later) seek the minimum. split_params_min = np.ma.average(normalised_params, axis=0) return split_params_min, first_split_param.frequency
def _get_eng_params(hdf, align_param=None): ''' Get eng parameters from hdf, and return the minimum. :param hdf: hdf_file object. :type hdf: hdfaccess.file.hdf_file :returns: Minimum of normalised split parameters along with its frequency. Will return None, None if no split parameters are available. :rtype: (None, None) or (np.ma.masked_array, float) ''' params = [] eng_params = ( 'Eng (1) N1', 'Eng (2) N1', 'Eng (3) N1', 'Eng (4) N1', 'Eng (1) N2', 'Eng (2) N2', 'Eng (3) N2', 'Eng (4) N2', 'Eng (1) Np', 'Eng (2) Np', 'Eng (3) Np', 'Eng (4) Np', 'Eng (1) Fuel Flow', 'Eng (2) Fuel Flow', 'Eng (3) Fuel Flow', 'Eng (4) Fuel Flow' ) for param_name in eng_params: try: param = hdf[param_name] except KeyError: continue if align_param: # Align all other parameters to provided param or first available. param.array = align(param, align_param) else: align_param = param params.append(param) if not len(params): return None, None # If there is at least one split parameter available. stacked_params = vstack_params(*params) split_params_avg = np.ma.average(stacked_params, axis=0) return split_params_avg, align_param.frequency
def _get_normalised_split_params(hdf): ''' Get split parameters (currently engine power and Groundspeed) from hdf, normalise them on a scale from 0-1.0 and return the minimum. :param hdf: hdf_file object. :type hdf: hdfaccess.file.hdf_file :returns: Minimum of normalised split parameters along with its frequency. Will return None, None if no split parameters are available. :rtype: (None, None) or (np.ma.masked_array, float) ''' params = [] first_split_param = None for param_name in ('Eng (1) N1', 'Eng (2) N1', 'Eng (3) N1', 'Eng (4) N1', 'Eng (1) N2', 'Eng (2) N2', 'Eng (3) N2', 'Eng (4) N2', 'Eng (1) Np', 'Eng (2) Np', 'Eng (3) Np', 'Eng (4) Np', 'Groundspeed', 'Groundspeed (1)', 'Groundspeed (2)'): try: param = hdf[param_name] except KeyError: continue if first_split_param: # Align all other parameters to first available. #Q: Why not force # to 1Hz? param.array = align(param, first_split_param) else: first_split_param = param params.append(param) if not first_split_param: return None, None # If there is at least one split parameter available. # normalise the parameters we'll use for splitting the data stacked_params = vstack_params(*params) normalised_params = normalise(stacked_params, scale_max=100) split_params_min = np.ma.average(normalised_params, axis=0) return split_params_min, first_split_param.frequency