Skip to content

Commit df43380

Browse files
MNT: Fix rebasing problems
1 parent 386e01b commit df43380

File tree

1 file changed

+2
-24
lines changed

1 file changed

+2
-24
lines changed

rocketpy/mathutils/function.py

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -804,29 +804,7 @@ def set_discrete(
804804
func, lower, upper, samples, interpolation, extrapolation, one_by_one
805805
)
806806
elif func.__dom_dim__ == 2:
807-
# Determine boundaries
808-
domain = [[0, 10], [0, 10]]
809-
if self.__cropped_domain__ is not None:
810-
for i in range(0, 2):
811-
if self.__cropped_domain__[i] is not None:
812-
if self.__cropped_domain__[i][0] > domain[i][0]:
813-
domain[i][0] = self.__cropped_domain__[i][0]
814-
if self.__cropped_domain__[i][1] < domain[i][1]:
815-
domain[i][1] = self.__cropped_domain__[i][1]
816-
lower = lower or [domain[0][0], domain[1][0]]
817-
lower = 2 * [lower] if isinstance(lower, NUMERICAL_TYPES) else lower
818-
upper = [domain[0][1], domain[1][1]] if upper is None else upper
819-
upper = 2 * [upper] if isinstance(upper, NUMERICAL_TYPES) else upper
820-
sam = 2 * [samples] if isinstance(samples, NUMERICAL_TYPES) else samples
821-
# Create nodes to evaluate function
822-
xs = np.linspace(lower[0], upper[0], sam[0])
823-
ys = np.linspace(lower[1], upper[1], sam[1])
824-
xs, ys = np.array(np.meshgrid(xs, ys)).reshape(2, xs.size * ys.size)
825-
# Evaluate function at all mesh nodes and convert it to matrix
826-
zs = np.array(func.get_value(xs, ys))
827-
func.set_source(np.concatenate(([xs], [ys], [zs])).transpose())
828-
func.__interpolation__ = "shepard"
829-
func.__extrapolation__ = "natural"
807+
self.__discretize_2d_function(func, lower, upper, samples)
830808
else:
831809
raise ValueError(
832810
"Discretization is only supported for 1-D and 2-D Functions."
@@ -2006,7 +1984,7 @@ def plot_2d( # pylint: disable=too-many-statements
20061984
domain[i][0] = self.__cropped_domain__[i][0]
20071985
if self.__cropped_domain__[i][1] < domain[i][1]:
20081986
domain[i][1] = self.__cropped_domain__[i][1]
2009-
lower = lower or [domain[0][0], domain[1][0]]
1987+
lower = [domain[0][0], domain[1][0]] if lower is None else lower
20101988
lower = 2 * [lower] if isinstance(lower, NUMERICAL_TYPES) else lower
20111989
upper = [domain[0][1], domain[1][1]] if upper is None else upper
20121990
upper = 2 * [upper] if isinstance(upper, NUMERICAL_TYPES) else upper

0 commit comments

Comments
 (0)