1
0
Fork 0
mirror of https://github.com/Findus23/halo_comparison.git synced 2024-09-19 16:03:50 +02:00

Merge branch 'main' of github.com:Findus23/halo_comparison

This commit is contained in:
Lukas Winkler 2022-12-13 11:43:30 +01:00
commit 0d6e293a2c
Signed by: lukas
GPG key ID: 54DE4D798D244853

View file

@ -8,7 +8,7 @@ from pathlib import Path
import matplotlib.cm as cm import matplotlib.cm as cm
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
import numpy as np import numpy as np
import siphash from numpy.random import SeedSequence, Generator, PCG64
# dictionary containing the first order hilbert curves # dictionary containing the first order hilbert curves
from utils import figsize_from_page_fraction from utils import figsize_from_page_fraction
@ -140,9 +140,6 @@ plt.ylabel("$y$")
plt.tight_layout() plt.tight_layout()
plt.savefig(Path(f"~/tmp/hilbert_indexcolor.eps").expanduser()) plt.savefig(Path(f"~/tmp/hilbert_indexcolor.eps").expanduser())
key = b"0123456789ABCDEF"
num = 123
print(siphash.SipHash_2_4(key, bytes(num)).hash())
order = 6 order = 6
curve = hilbert_curve(order, "u") curve = hilbert_curve(order, "u")
@ -157,22 +154,24 @@ sublevel = order - 4
cmap = cm.get_cmap("jet") cmap = cm.get_cmap("jet")
plt.figure()
key = b"0123456789ABCDEF" s = 10 # arbitrary lenght of each sequence drawn for every point
fig = plt.figure(figsize=figsize_from_page_fraction(height_to_width=1)) fig = plt.figure(figsize=figsize_from_page_fraction(height_to_width=1))
t = {} t = {}
sublevel = 7 sublevel = 7
for i in range(2 ** (2 * sublevel)): for i in range(2 ** (2 * sublevel)):
pcg = PCG64(1234)
pcg = pcg.advance(i * s)
rng = Generator(pcg)
il = i * N // (2 ** (2 * sublevel)) il = i * N // (2 ** (2 * sublevel))
ir = (i + 1) * N // 2 ** (2 * sublevel) ir = (i + 1) * N // 2 ** (2 * sublevel)
sipkey = siphash.SipHash_2_4(key, bytes(il)).hash() random_value = rng.random()
plt.plot( plt.plot(
cumulative_curve[il : ir + 1, 0], cumulative_curve[il : ir + 1, 0],
cumulative_curve[il : ir + 1, 1], cumulative_curve[il : ir + 1, 1],
lw=0.5, lw=0.5,
c=cmap(sipkey / 2 ** 64), c=cmap(random_value),
) )
plt.xlabel("$x$") plt.xlabel("$x$")