Showing 4 of 19 files from the diff.

@@ -5,7 +5,7 @@
Loading
5 5
__all__ = ["torus", "dsphere", "sphere", "swiss_roll", "infty_sign"]
6 6
7 7
8 -
## TODO: Make a base class that controls `ambient` and `noise`.
8 +
# TODO: Make a base class that controls `ambient` and `noise`.
9 9
class Shape:
10 10
    def __init__(self):
11 11
        pass
@@ -24,13 +24,13 @@
Loading
24 24
    ambient : int, default=None
25 25
        Embed the sphere into a space with ambient dimension equal to `ambient`. The sphere is randomly rotated in this high dimensional space.
26 26
    seed : int, default=None
27 -
        Seed for random state. 
27 +
        Seed for random state.
28 28
    """
29 29
    np.random.seed(seed)
30 -
    data = np.random.randn(n, d+1)
30 +
    data = np.random.randn(n, d + 1)
31 31
32 32
    # Normalize points to the sphere
33 -
    data = r * data / np.sqrt(np.sum(data**2, 1)[:, None])
33 +
    data = r * data / np.sqrt(np.sum(data ** 2, 1)[:, None])
34 34
35 35
    if noise:
36 36
        data += noise * np.random.randn(*data.shape)
@@ -39,8 +39,6 @@
Loading
39 39
        assert ambient > d, "Must embed in higher dimensions"
40 40
        data = embed(data, ambient)
41 41
42 -
43 -
44 42
    return data
45 43
46 44
@@ -57,7 +55,7 @@
Loading
57 55
    ambient : int, default=None
58 56
        Embed the sphere into a space with ambient dimension equal to `ambient`. The sphere is randomly rotated in this high dimensional space.
59 57
    seed : int, default=None
60 -
        Seed for random state. 
58 +
        Seed for random state.
61 59
    """
62 60
63 61
    np.random.seed(seed)
@@ -71,7 +69,6 @@
Loading
71 69
    data[:, 1] = rad * np.cos(theta) * np.sin(phi)
72 70
    data[:, 2] = rad * np.sin(theta)
73 71
74 -
75 72
    if noise:
76 73
        data += noise * np.random.randn(*data.shape)
77 74
@@ -96,7 +93,7 @@
Loading
96 93
    ambient : int, default=None
97 94
        Embed the torus into a space with ambient dimension equal to `ambient`. The torus is randomly rotated in this high dimensional space.
98 95
    seed : int, default=None
99 -
        Seed for random state. 
96 +
        Seed for random state.
100 97
    """
101 98
102 99
    assert a <= c, "That's not a torus"
@@ -131,7 +128,7 @@
Loading
131 128
    ambient : int, default=None
132 129
        Embed the swiss roll into a space with ambient dimension equal to `ambient`. The swiss roll is randomly rotated in this high dimensional space.
133 130
    seed : int, default=None
134 -
        Seed for random state. 
131 +
        Seed for random state.
135 132
136 133
    References
137 134
    ----------
@@ -155,6 +152,7 @@
Loading
155 152
156 153
    return data
157 154
155 +
158 156
def infty_sign(n=100, noise=None, angle=None, seed=None):
159 157
    """Construct a figure 8 or infinity sign with :code:`n` points and noise level with :code:`noise` standard deviation.
160 158
@@ -168,20 +166,23 @@
Loading
168 166
    angle: float
169 167
        angle in radians to rotate the infinity sign.
170 168
    seed : int, default=None
171 -
        Seed for random state. 
169 +
        Seed for random state.
172 170
    """
173 171
174 -
175 172
    np.random.seed(seed)
176 -
    t = np.linspace(0, 2*np.pi, n+1)[0:n]
173 +
    t = np.linspace(0, 2 * np.pi, n + 1)[0:n]
177 174
    X = np.zeros((n, 2))
178 175
    X[:, 0] = np.cos(t)
179 -
    X[:, 1] = np.sin(2*t)
176 +
    X[:, 1] = np.sin(2 * t)
180 177
181 178
    if noise:
182 179
        X += noise * np.random.randn(n, 2)
183 180
    if angle is not None:
184 -
        assert angle >= -np.pi and angle <= 2*np.pi, "Angle {angle} not in range. Angle should be in the range {min_angle} <= angle <= {max_angle}".format(angle=angle, min_angle="-pi", max_angle="2*pi")
181 +
        assert (
182 +
            angle >= -np.pi and angle <= 2 * np.pi
183 +
        ), "Angle {angle} not in range. Angle should be in the range {min_angle} <= angle <= {max_angle}".format(
184 +
            angle=angle, min_angle="-pi", max_angle="2*pi"
185 +
        )
185 186
186 187
        X = rotate_2D(X, angle=angle)
187 188
    return X

@@ -9,4 +9,5 @@
Loading
9 9
    ax.scatter(data[:, 0], data[:, 1], data[:, 2], **params)
10 10
    return ax
11 11
12 -
__all__ = ["plot3d"]

@@ -1,5 +1,6 @@
Loading
1 1
import numpy as np
2 2
3 +
3 4
def get_phi(row):
4 5
    """Helper function for rotating data.
5 6
@@ -7,6 +8,7 @@
Loading
7 8
    """
8 9
    return np.arctan2(row[0], row[1])
9 10
11 +
10 12
def rotate_2D(d, angle):
11 13
    """Rotate a 2-dimensional figure.
12 14
@@ -20,9 +22,11 @@
Loading
20 22
    try:
21 23
        assert d.shape[1] == 2
22 24
    except AssertionError:
23 -
        raise ValueError("Error: data has {} dimensions, but should only be 2. ".format(d.shape[1]))
25 +
        raise ValueError(
26 +
            "Error: data has {} dimensions, but should only be 2. ".format(d.shape[1])
27 +
        )
24 28
25 -
    rot = angle - np.pi/2
29 +
    rot = angle - np.pi / 2
26 30
    phis = np.apply_along_axis(get_phi, 1, d)
27 31
    phi_new = phis + rot
28 32
    r = np.sqrt(d[:, 0] ** 2 + d[:, 1] ** 2)

@@ -10,7 +10,7 @@
Loading
10 10
    """
11 11
    Randomly sample points by area on a triangle mesh.  This function is
12 12
    extremely fast by using broadcasting/numpy operations in lieu of loops
13 -
    
13 +
14 14
    Inputs
15 15
    -------
16 16
    vertices : ndarray (N, 3)
@@ -124,4 +124,4 @@
Loading
124 124
    return Ps
125 125
126 126
127 -
__all__ = ["from_mesh"]
Files Coverage
tadasets 90.70%
Project Totals (7 files) 90.70%
43.2
3.4=.4
TRAVIS_OS_NAME=linux
43.1
TRAVIS_OS_NAME=linux
2.7=.7
43.3
3.5=.5
TRAVIS_OS_NAME=linux
43.4
3.6=.6
TRAVIS_OS_NAME=linux

No yaml found.

Create your codecov.yml to customize your Codecov experience

Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading