Esempio n. 1
0
def test_halton():
    corners = np.array([[0, 2], [10, 5]])
    sample = sequences.halton(dim=2, n_sample=5, bounds=corners)

    out = np.array([[5., 3.], [2.5, 4.], [7.5, 2.3], [1.25, 3.3], [6.25, 4.3]])
    npt.assert_almost_equal(sample, out, decimal=1)

    sample = sequences.halton(dim=2, n_sample=3, bounds=corners, start_index=2)
    out = np.array([[7.5, 2.3], [1.25, 3.3], [6.25, 4.3]])
    npt.assert_almost_equal(sample, out, decimal=1)
Esempio n. 2
0
def test_halton():
    corners = np.array([[0, 2], [10, 5]])
    sample = sequences.halton(dim=2, n_sample=5, bounds=corners)

    out = np.array([[5., 3.], [2.5, 4.], [7.5, 2.3], [1.25, 3.3], [6.25, 4.3]])
    npt.assert_almost_equal(sample, out, decimal=1)

    sample = sequences.halton(dim=2, n_sample=3, bounds=corners, start_index=2)
    out = np.array([[7.5, 2.3], [1.25, 3.3], [6.25, 4.3]])
    npt.assert_almost_equal(sample, out, decimal=1)
 def generate_halton_samples(self, bounds, dims, n_sample=10):
     samples = sequences.halton(dim=dims, n_sample=n_sample, bounds=bounds)
     return samples
Esempio n. 4
0
 def generate_halton_samples(self, bounds, dims, n_sample=10):
     """
     Generate halton samples in a n-dimensional space. Defaulted to 3 dimensions
     """
     samples = sequences.halton(dim=dims, n_sample=n_sample, bounds=bounds)
     return samples