finally hopefully
This commit is contained in:
parent
a015542b03
commit
3c3ff46d21
@ -36,7 +36,6 @@ def merge(files):
|
||||
plt.plot(out[2, :], "g")
|
||||
|
||||
all = sum(merge)
|
||||
|
||||
summe = np.max(np.sum(all, axis=0))
|
||||
all = all / summe
|
||||
|
||||
@ -45,7 +44,6 @@ def merge(files):
|
||||
plt.plot(all[2, :], "k")
|
||||
percentage = 1-percentage
|
||||
return percentage, all
|
||||
>>>>>>> e1a921c2eb7fb8f51d860e28b81ff3a41af21abc
|
||||
|
||||
|
||||
def debug(percentage, out):
|
||||
@ -87,15 +85,10 @@ def time_scale(p, o):
|
||||
mono_perc = mono_perc - np.min(mono_perc)
|
||||
mono_perc /= np.max(mono_perc)
|
||||
|
||||
<<<<<<< HEAD
|
||||
cs_rut = ip.CubicSpline(p[::-1], rut_perc[::-1])
|
||||
cs_mono = ip.CubicSpline(p[::-1], mono_perc[::-1])
|
||||
=======
|
||||
# cs_rut = ip.CubicSpline(p[::-1], rut_perc[::-1])
|
||||
# cs_mono = ip.CubicSpline(p[::-1], mono_perc[::-1])
|
||||
cs_rut = ip.interp1d(p[::-1], rut_perc[::-1])
|
||||
cs_mono = ip.interp1d(p[::-1], mono_perc[::-1])
|
||||
>>>>>>> e1a921c2eb7fb8f51d860e28b81ff3a41af21abc
|
||||
|
||||
plt.figure()
|
||||
ph = np.linspace(0.01, 0.99, 100)
|
||||
@ -118,6 +111,7 @@ def time_scale(p, o):
|
||||
plt.savefig("timescale.png")
|
||||
plt.savefig("timescale.pdf")
|
||||
|
||||
|
||||
def read_file(file):
|
||||
files = np.load("./merged.npz")
|
||||
p = files["p"]
|
||||
@ -127,13 +121,8 @@ def read_file(file):
|
||||
|
||||
if __name__ == "__main__":
|
||||
p, o = merge(sys.argv[1:])
|
||||
<<<<<<< HEAD
|
||||
np.savez("merged.npz", p=p, o=o)
|
||||
# eval_data_print(f)
|
||||
stacked_plot(p, o)
|
||||
=======
|
||||
>>>>>>> e1a921c2eb7fb8f51d860e28b81ff3a41af21abc
|
||||
# debug(p, o)
|
||||
stacked_plot(p, o)
|
||||
time_scale(p, o)
|
||||
plt.show()
|
||||
|
@ -79,8 +79,8 @@ class Rect_Evaluator(Evaluator):
|
||||
new_eval_points = np.arange(len(self.eval_points))
|
||||
mask = self.mask.copy()
|
||||
for nc, ev_points in zip(new_eval_points, self.eval_points):
|
||||
maske_low = np.min(ev_points) >= self.mask
|
||||
maske_high = np.max(ev_points) <= self.mask
|
||||
maske_low = np.min(ev_points) <= self.mask
|
||||
maske_high = np.max(ev_points) >= self.mask
|
||||
mask[np.logical_and(maske_high, maske_low)] = nc
|
||||
|
||||
plt.figure()
|
||||
@ -103,65 +103,3 @@ class Rect_Evaluator(Evaluator):
|
||||
count += 1
|
||||
return mask
|
||||
|
||||
#
|
||||
# def main():
|
||||
# np.random.seed(10)
|
||||
# points = (np.random.rand(100, 2)-0.5) * 2
|
||||
# voro = Voronoi_Evaluator(points, [[1],[2]])
|
||||
# rect = Rect_Evaluator(points, [[1], [2]])
|
||||
# Z = np.ones((1000, 1000))
|
||||
# img = Image_Wrapper(Z, -5, .01, -5, .01)
|
||||
# voro.extract(img)
|
||||
# rect.extract(img)
|
||||
#
|
||||
# plt.scatter(points[[1], 0], points[[1], 1])
|
||||
# plt.scatter(points[[2], 0], points[[2], 1])
|
||||
# plt.imshow(img.img, extent=img.ext(), origin="lower")
|
||||
# #plt.imshow(img.img, origin="lower")
|
||||
# plt.show()
|
||||
#
|
||||
#
|
||||
# if __name__ == "__main__":
|
||||
# main()
|
||||
# class Voronoi_Evaluator(Evaluator):
|
||||
# def __init__(self, list_points):
|
||||
# points = np.concatenate(list_points, axis=0)
|
||||
# self.eval_points = []
|
||||
# start = 0
|
||||
# for l in list_points:
|
||||
# stop = l.shape[0]
|
||||
# self.eval_points.append(np.arange(start, start + stop))
|
||||
# start += stop
|
||||
# self.vor = Voronoi(points)
|
||||
#
|
||||
# @persist_to_file("cache_merge_voro")
|
||||
# def merge_mask_helper(self):
|
||||
# new_eval_points = np.arange(len(self.eval_points))
|
||||
# mask = self.mask
|
||||
# for nc, ev_points in zip(new_eval_points, self.eval_points):
|
||||
# for num in ev_points:
|
||||
# mask[self.mask == num] = nc
|
||||
# return mask
|
||||
#
|
||||
# @persist_to_file("cache_voro")
|
||||
# def gen_mask_helper(self, img: Image_Wrapper):
|
||||
# mask = np.full_like(img.img, -1)
|
||||
#
|
||||
# counter = -1
|
||||
# region_mask = self.vor.point_region
|
||||
# for i in np.array(self.vor.regions, dtype=list)[region_mask]:
|
||||
# counter += 1
|
||||
# if -1 in i:
|
||||
# continue
|
||||
# if len(i) == 0:
|
||||
# continue
|
||||
# pts = self.vor.vertices[i]
|
||||
# pts = np.stack(img.val2pos(
|
||||
# pts[:, 0], pts[:, 1])).astype(np.int32).T
|
||||
# if np.any(pts < 0):
|
||||
# continue
|
||||
# mask_2 = np.zeros_like(img.img)
|
||||
# cv2.fillConvexPoly(mask_2, pts, 1)
|
||||
# mask_2 = mask_2 > 0 # To convert to Boolean
|
||||
# mask[mask_2] = counter
|
||||
# return mask
|
||||
|
Loading…
Reference in New Issue
Block a user