<jupyter_start><jupyter_text>We now select a region in energy ($E$) and angular momentum ($L_z$) that corresponds to a satellite that is not fully phase mixed<jupyter_code>limits_Lz_E_clump = (1181.77098138, 1291.92208245), (-70850.9198711, -68491.169297)
ds.select_rectangle("Lz", "E", limits_Lz_E_clump, name="stream")
ds.plot("Lz", "E", selection=[None, "stream"], f="log")
print(ds.count(selection="stream"))
# calculate the mean vy on a course grid
mean_vy = ds.mean("vy", binby=["y", "z"], limits=limits, shape=shape_vector, selection='stream')
mean_vz = ds.mean("vz", binby=["y", "z"], limits=limits, shape=shape_vector, selection='stream')

# create a 2d array with holds the center of the bins
centers = np.linspace(*limits, shape_vector, endpoint=False) + (limits[1] - limits[0])/2./shape_vector
z, y = np.meshgrid(centers, centers)

# we don't want to show bins with low number of counts
counts = ds.count(binby=["y", "z"], limits=limits, shape=shape_vector, selection='stream')
mask = counts.flatten( ) > 10

# background density
ds.plot("y", "z", limits=limits, f="log1p", figsize=(8,8), selection=[None, "stream"], shape=128)

# overplot the mean vectors
plt.quiver(y.flatten()[mask], z.flatten()[mask], mean_vy.flatten()[mask], mean_vz.flatten()[mask],
         color="white", alpha=0.75)<jupyter_output>/Users/users/breddels/src/vaex/vaex/dataset.py:990: RuntimeWarning: invalid value encountered in true_divide
  mean = stats[...,1] / counts
{'fraction_non_alphanumeric': 0.1728395061728395, 'fraction_numerical': 0.04526748971193416, 'mean_word_length': 6.295, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '563937', 'license': 'MIT', 'n_tokens_mistral': 553, 'n_tokens_neox': 510, 'n_words': 129, 'path': 'examples/plot_vectors.ipynb', 'repo_name': 'cyrusradfar/vaex', 'size': '1458'}