def preparation(x_list, y_list,feature_symbols,Func = None, ref = None, **kwargs): """ feature symbols are a list of interested feature names (Not with the prefix g_ or H_ ) """ global perparation_called_times features.DT = 0.1 print(perparation_called_times) xy_vector = np.array(list(x_list) + list(y_list)) assert(len(x_list)==len(y_list)) # ref = ref_bottom if x_list[0]<1000 else ref_top ref = ref_select(x_list,y_list) if ref is None else ref if(Func is None): feature = Features(vec=xy_vector, referenceCurv=ref,**kwargs) else: feature = featureFuncWrapper(vec=xy_vector, Func = Func, referenceCurv=ref,**kwargs) ftrvalues = [np.array([feature.featureValue(f) for f in feature_symbols])] return_list = [] for k in feature_symbols: print("symbol:",k) g,H,N = feature.featureGradJacobNormalizer(k) return_list.append(g) return_list.append(H) return_list.append(N) perparation_called_times +=1 return return_list, ftrvalues
def calculateFeature(x_list, y_list,feature_symbols, Func = None, **kwargs): """ feature symbols are a list of interested feature names (Not with the prefix g_ or H_ ) """ global calculation_called_times features.DT = 0.1 print(calculation_called_times) xy_vector = np.array(list(x_list) + list(y_list)) assert(len(x_list)==len(y_list)) ref = ref_select(x_list,y_list) if(Func is not None): feature = featureFuncWrapper(vec=xy_vector, referenceCurv=ref, Func = Func, **kwargs) else: feature = Features(vec=xy_vector, referenceCurv=ref,**kwargs) return_list = [] for k in feature_symbols: print("symbol:",k) return_list.append(feature.featureValue(k)) calculation_called_times +=1 return return_list