This commit is contained in:
Jacob Holder 2023-04-19 15:59:44 +02:00
parent 5e6c84ebf5
commit 4bbc802ee4
Signed by: jacob
GPG Key ID: 2194FC747048A7FD
2 changed files with 25 additions and 11 deletions

View File

@ -43,9 +43,9 @@ class Evaluator(ABC):
@timeit @timeit
def generate_mask(self, img: FFT, merge=False): def generate_mask(self, img: FFT, merge=False):
hash = str(img.intens.shape) hash = str(img.intens.shape)
self.mask = self.gen_mask_helper(img, hash=hash) self.mask = self.gen_mask_helper(img)
if merge: if merge:
self.mask = self.merge_mask_helper(hash=hash) self.mask = self.merge_mask_helper()
self.eval_points = [[a] for a in np.arange(len(self.eval_points))] self.eval_points = [[a] for a in np.arange(len(self.eval_points))]
@abstractmethod @abstractmethod

View File

@ -1,4 +1,5 @@
from lattices import SCC_Lattice, VO2_Lattice from lattices import SCC_Lattice, VO2_Lattice
import sys
from spin_image import SpinImage from spin_image import SpinImage
import numpy as np import numpy as np
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
@ -121,7 +122,7 @@ def random(seed):
for i in tqdm.tqdm(ind): for i in tqdm.tqdm(ind):
maske[np.unravel_index(i, (LEN, LEN))] = True maske[np.unravel_index(i, (LEN, LEN))] = True
counter += 1 counter += 1
if np.mod(counter, 100) != 0: if np.mod(counter, 100) != 0 and not i == ind[-1]:
continue continue
si.apply_mask(lat.parse_mask(maske)) si.apply_mask(lat.parse_mask(maske))
@ -204,21 +205,34 @@ def ising(seed, temp=0.5):
out_2=out_rect[1], out_3=out_rect[2], out_4=out_rect[3]) out_2=out_rect[1], out_3=out_rect[2], out_4=out_rect[3])
def runner():
np.random.seed(1234)
seeds = np.random.randint(0, 10000, 200)
idx = int(sys.argv[1])
if idx < 0:
return
if idx >= seeds.size:
return
seed = seeds[idx]
random(seed)
if __name__ == "__main__": if __name__ == "__main__":
np.random.seed(1234) np.random.seed(1234)
runner()
# test_me() # test_me()
# test_square() # test_square()
# test_mixed() # test_mixed()
# plt.show() # plt.show()
# random(1234) # random(1234)
# ising(1234) # ising(1234)
test_pdf() # test_pdf()
plt.show() # plt.show()
exit() # exit()
for i in np.random.randint(0, 10000, 5): # for i in np.random.randint(0, 10000, 5):
random(i) # random(i)
ising(i, 0.5) # ising(i, 0.5)
ising(i, 1.0) # ising(i, 1.0)
ising(i, 1.5) # ising(i, 1.5)
# plt.show() # plt.show()