Skip to content

Commit 6505e8c

Browse files
committed
2D: small style changes in docs
1 parent 52a9281 commit 6505e8c

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

adaptive/learner/learner2D.py

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# -*- coding: utf-8 -*-
22

33
import itertools
4+
import warnings
45
from collections import OrderedDict
56
from copy import copy
67
from math import sqrt
7-
import warnings
88

99
import numpy as np
1010
from scipy import interpolate
@@ -95,9 +95,11 @@ def uniform_loss(ip):
9595
... x, y = xy
9696
... return x**2 + y**2
9797
>>>
98-
>>> learner = adaptive.Learner2D(f,
99-
... bounds=[(-1, -1), (1, 1)],
100-
... loss_per_triangle=uniform_loss)
98+
>>> learner = adaptive.Learner2D(
99+
... f,
100+
... bounds=[(-1, -1), (1, 1)],
101+
... loss_per_triangle=uniform_loss,
102+
... )
101103
>>>
102104
"""
103105
return np.sqrt(areas(ip))
@@ -123,10 +125,7 @@ def resolution_loss_function(min_distance=0, max_distance=1):
123125
... return x**2 + y**2
124126
>>>
125127
>>> loss = resolution_loss_function(min_distance=0.01, max_distance=1)
126-
>>> learner = adaptive.Learner2D(f,
127-
... bounds=[(-1, -1), (1, 1)],
128-
... loss_per_triangle=loss)
129-
>>>
128+
>>> learner = adaptive.Learner2D(f, bounds=[(-1, -1), (1, 1)], loss_per_triangle=loss)
130129
"""
131130

132131
def resolution_loss(ip):
@@ -192,7 +191,7 @@ def _get_vectors(points):
192191

193192

194193
def default_loss(ip):
195-
"""Loss function that combines
194+
"""Loss function that combines `deviations` and `areas` of the triangles.
196195
197196
Works with `~adaptive.Learner2D` only.
198197
@@ -222,15 +221,15 @@ def choose_point_in_triangle(triangle, max_badness):
222221
223222
Parameters
224223
----------
225-
triangle : numpy array
226-
The coordinates of a triangle with shape (3, 2)
224+
triangle : numpy.ndarray
225+
The coordinates of a triangle with shape (3, 2).
227226
max_badness : int
228227
The badness at which the point is either chosen on a edge or
229228
in the middle.
230229
231230
Returns
232231
-------
233-
point : numpy array
232+
point : numpy.ndarray
234233
The x and y coordinate of the suggested new point.
235234
"""
236235
a, b, c = triangle

0 commit comments

Comments
 (0)