Skip to content

Commit f3a86f6

Browse files
committed
update modeling.py in TorchMeent for vector modeling.
1 parent c3642bd commit f3a86f6

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

meent/on_torch/modeler/modeling.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ def __init__(self, period=None, *args, **kwargs):
3939
self.ucell_info_list = None
4040
self.period = period
4141

42+
self.film_layer = None
43+
44+
def film(self):
45+
return []
46+
4247
@staticmethod
4348
def rectangle_no_approximation(cx, cy, lx, ly, base):
4449

@@ -546,8 +551,6 @@ def ellipse(self, cx, cy, lx, ly, n_index, angle=0, n_split_w=2, n_split_h=2, an
546551
right_array.append(points_contour_rot[:, y_highest_index])
547552
elif left_y < right_y:
548553
left_array.append(points_contour_rot[:, y_highest_index])
549-
else:
550-
raise ValueError # TODO
551554

552555
for i in range(points_contour_rot.shape[1]//2):
553556
left_array.append(points_contour_rot[:, (y_highest_index+i+1) % points_contour_rot.shape[1]])
@@ -690,9 +693,9 @@ def vector(self, layer_info, x64=True):
690693
col_list.insert(index, bottom_right[1])
691694

692695
if not row_list or row_list[-1] != self.period[1]:
693-
row_list.append(self.period[1].reshape(1))
696+
row_list.append(self.period[1].reshape(1).type(datatype))
694697
if not col_list or col_list[-1] != self.period[0]:
695-
col_list.append(self.period[0].reshape(1))
698+
col_list.append(self.period[0].reshape(1).type(datatype))
696699

697700
if row_list and row_list[0] == 0:
698701
row_list = row_list[1:]
@@ -727,10 +730,13 @@ def vector(self, layer_info, x64=True):
727730

728731
def draw(self, layer_info_list):
729732
ucell_info_list = []
733+
self.film_layer = torch.zeros(len(layer_info_list))
730734

731-
for layer_info in layer_info_list:
735+
for i, layer_info in enumerate(layer_info_list):
732736
ucell_layer, x_list, y_list = self.vector(layer_info)
733737
ucell_info_list.append([ucell_layer, x_list, y_list])
738+
if len(x_list) == len(y_list) == 1:
739+
self.film_layer[i] = 1
734740
self.ucell_info_list = ucell_info_list
735741
return ucell_info_list
736742

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
}
1313
setup(
1414
name='meent',
15-
version='0.9.9',
15+
version='0.9.10',
1616
url='https://github.com/kc-ml2/meent',
1717
author='KC ML2',
1818
author_email='yongha@kc-ml2.com',

0 commit comments

Comments
 (0)