Commit 8aa8f574 authored by Anton Akhmerov's avatar Anton Akhmerov Committed by Joseph Weston

use correct coordinate reshaping when determining a plot reference length

Also correctly select random sites without repetitions.
Closes issue #265.
parent 1e2d2c2b
Pipeline #15302 passed with stages
in 41 minutes and 31 seconds
......@@ -43,7 +43,7 @@ _p = _common.lazy_import('_plotter')
def _sample_array(array, n_samples, rng=None):
rng = _common.ensure_rng(rng)
la = len(array)
return array[rng.choice(range(la), min(n_samples, la))]
return array[rng.choice(range(la), min(n_samples, la), replace=False)]
# matplotlib helper functions.
......@@ -891,7 +891,7 @@ def plot(sys, num_lead_cells=2, unit='nn',
# from ten randomly selected points to the remaining points in the
# system.
points = _sample_array(sites_pos, 10).T
distances = (sites_pos.T.reshape(1, -1, dim) -
distances = (sites_pos.reshape(1, -1, dim) -
points.reshape(-1, 1, dim)).reshape(-1, dim)
distances = np.sort(np.sum(distances**2, axis=1))
# Then check if distances are present that are way shorter than the
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment