def calibrate(self, obj, airfoil: Airfoil, calibrate_x: bool = False, calibrate_y: bool = True, calibrate_w: bool = False): """ calibrates the splines to match the airfoil as good as possible (lstsq) """ mapping, lower_bounds_upper_spline, upper_bounds_upper_spline = self._get_bounds_and_mapping( calibrate_x, calibrate_y, calibrate_w, upper=True) mapping, lower_bounds_lower_spline, upper_bounds_lower_spline = self._get_bounds_and_mapping( calibrate_x, calibrate_y, calibrate_w, upper=False) bounds_upper_spline = (lower_bounds_upper_spline, upper_bounds_upper_spline) bounds_lower_spline = (lower_bounds_lower_spline, upper_bounds_lower_spline) upper_array = obj.Proxy.get_upper_array(obj) lower_array = obj.Proxy.get_lower_array(obj) new_upper_mat = self._calibrate_one_side( upper_array, mapping, bounds_upper_spline, airfoil.get_upper_data()[::-1]) new_lower_mat = self._calibrate_one_side(lower_array, mapping, bounds_lower_spline, airfoil.get_lower_data()) obj.upper_array = new_upper_mat.tolist() obj.lower_array = new_lower_mat.tolist()