knit-graphs 0.0.6__py3-none-any.whl → 0.0.8__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. knit_graphs-0.0.6.dist-info/licenses/LICENSE → LICENSE +21 -21
  2. README.md +75 -0
  3. docs/Makefile +20 -0
  4. docs/make.bat +35 -0
  5. docs/source/api/knit_graphs.Course.rst +7 -0
  6. docs/source/api/knit_graphs.Knit_Graph.rst +7 -0
  7. docs/source/api/knit_graphs.Knit_Graph_Visualizer.rst +7 -0
  8. docs/source/api/knit_graphs.Loop.rst +7 -0
  9. docs/source/api/knit_graphs.Pull_Direction.rst +7 -0
  10. docs/source/api/knit_graphs.Yarn.rst +7 -0
  11. docs/source/api/knit_graphs.artin_wale_braids.Crossing_Direction.rst +7 -0
  12. docs/source/api/knit_graphs.artin_wale_braids.Loop_Braid_Graph.rst +7 -0
  13. docs/source/api/knit_graphs.artin_wale_braids.Wale.rst +7 -0
  14. docs/source/api/knit_graphs.artin_wale_braids.Wale_Braid.rst +7 -0
  15. docs/source/api/knit_graphs.artin_wale_braids.Wale_Braid_Word.rst +7 -0
  16. docs/source/api/knit_graphs.artin_wale_braids.Wale_Group.rst +7 -0
  17. docs/source/api/knit_graphs.artin_wale_braids.rst +23 -0
  18. docs/source/api/knit_graphs.basic_knit_graph_generators.rst +7 -0
  19. docs/source/api/knit_graphs.rst +32 -0
  20. docs/source/conf.py +335 -0
  21. docs/source/index.rst +71 -0
  22. docs/source/installation.rst +67 -0
  23. knit_graphs/Course.py +156 -104
  24. knit_graphs/Knit_Graph.py +249 -186
  25. knit_graphs/Knit_Graph_Visualizer.py +675 -0
  26. knit_graphs/Loop.py +141 -155
  27. knit_graphs/Pull_Direction.py +68 -23
  28. knit_graphs/Yarn.py +424 -267
  29. knit_graphs/__init__.py +3 -3
  30. knit_graphs/_base_classes.py +173 -0
  31. knit_graphs/artin_wale_braids/Crossing_Direction.py +74 -15
  32. knit_graphs/artin_wale_braids/Loop_Braid_Graph.py +95 -62
  33. knit_graphs/artin_wale_braids/Wale.py +169 -93
  34. knit_graphs/artin_wale_braids/Wale_Braid.py +50 -30
  35. knit_graphs/artin_wale_braids/Wale_Braid_Word.py +99 -54
  36. knit_graphs/artin_wale_braids/Wale_Group.py +136 -88
  37. knit_graphs/basic_knit_graph_generators.py +251 -0
  38. knit_graphs-0.0.8.dist-info/LICENSE +21 -0
  39. {knit_graphs-0.0.6.dist-info → knit_graphs-0.0.8.dist-info}/METADATA +33 -24
  40. knit_graphs-0.0.8.dist-info/RECORD +42 -0
  41. {knit_graphs-0.0.6.dist-info → knit_graphs-0.0.8.dist-info}/WHEEL +1 -1
  42. knit_graphs/__about__.py +0 -4
  43. knit_graphs/knit_graph_generators/__init__.py +0 -0
  44. knit_graphs/knit_graph_generators/basic_knit_graph_generators.py +0 -248
  45. knit_graphs/knit_graph_visualizer/Stitch_Visualizer.py +0 -427
  46. knit_graphs/knit_graph_visualizer/__init__.py +0 -0
  47. knit_graphs-0.0.6.dist-info/RECORD +0 -22
@@ -0,0 +1,42 @@
1
+ LICENSE,sha256=Oazk3oiRu5ZN7b-EdYNYh0vu-I3Av2uIPQ-9L_cZ6Oo,1070
2
+ README.md,sha256=Hrs3kN8A7hxyel-WhEkzZYY89456vAh3KWbupcOAHsI,3963
3
+ docs/Makefile,sha256=4zv3TVkTACm6JBaKgTES3ZI9cETXgM6ULbZkXZP1as8,638
4
+ docs/make.bat,sha256=0qjrzODegavKd7LLwmr9ADhaYftiTnBgqOVAL9kApyo,769
5
+ docs/source/api/knit_graphs.Course.rst,sha256=k3RxvR2pSYgf_nyLjLgT3J56hjzk4fUU6kIdmp85pEc,144
6
+ docs/source/api/knit_graphs.Knit_Graph.rst,sha256=_VZEniw4cvMz6uUrXrTK1hBuYEZSaDUk1138AbIEZ2s,158
7
+ docs/source/api/knit_graphs.Knit_Graph_Visualizer.rst,sha256=vo7RSxjhWhIAFlKJMlwq48x1j3DszzZmpF-8-09uDaE,193
8
+ docs/source/api/knit_graphs.Loop.rst,sha256=Rgrs-yFP_0Qt6Mxjjt9s_PE4Vzk6gRpmZ_Qo8zHWNVQ,138
9
+ docs/source/api/knit_graphs.Pull_Direction.rst,sha256=Y6z1SBcsBb1Gdr_UnSgjvIawzfjDndBbciQhoNYTKhE,170
10
+ docs/source/api/knit_graphs.Yarn.rst,sha256=S2Vcm0xxVGx_2EvXLex0QusiTRpJEIras5XPOjL3ONQ,138
11
+ docs/source/api/knit_graphs.artin_wale_braids.Crossing_Direction.rst,sha256=C_apeGs2QvSG06jfcimuXGJDMAAZW4L_9fZT3vSnhts,240
12
+ docs/source/api/knit_graphs.artin_wale_braids.Loop_Braid_Graph.rst,sha256=5R0PtnLiAYFtsejQq-KJQYSMLeoGOs4jAAkVTbKtvy0,236
13
+ docs/source/api/knit_graphs.artin_wale_braids.Wale.rst,sha256=L3-9V-_5txjPa-XrBbOCAO4Le5ewSnGrJX9ZyUgWUDQ,196
14
+ docs/source/api/knit_graphs.artin_wale_braids.Wale_Braid.rst,sha256=tHXetyWrArkVBM89fIjCauGfOuVhb0jkZRDIZs5ZAWA,216
15
+ docs/source/api/knit_graphs.artin_wale_braids.Wale_Braid_Word.rst,sha256=NkXO_cCev1XdUwcUVsdb2CivEHm-xqJyFg3ZgHOfmZ0,233
16
+ docs/source/api/knit_graphs.artin_wale_braids.Wale_Group.rst,sha256=bAGHs3s8dW6lbkctyh8VvVNzlYkjwZXhrbXx-VvSKYQ,216
17
+ docs/source/api/knit_graphs.artin_wale_braids.rst,sha256=ESKgE9gg830yJ6w5mKuv3MHgH3tMZ-Ee2y3b-bSnU4Y,547
18
+ docs/source/api/knit_graphs.basic_knit_graph_generators.rst,sha256=OgV2jkEMY0LfRq8v0cNhJUk3fbUOS9VcP8zRv4VBvC4,213
19
+ docs/source/api/knit_graphs.rst,sha256=w9HIhWI8P0_gG0H_efRUMHYBtWbgCprcS9moclgM_3I,499
20
+ docs/source/conf.py,sha256=TZK8Rz0JNgQs2J_cUhVX5_4tmMBvRdGtILJsnAnAFWo,13350
21
+ docs/source/index.rst,sha256=D4KmCX1_d2-WrPgxSeggHHsc9-TeQwSUGYOkehRQWrw,1462
22
+ docs/source/installation.rst,sha256=GyNRk_oXKVgOZ4KFLAgkXLwjHYzDYsx8gcokLRrS0ZI,1247
23
+ knit_graphs/Course.py,sha256=oT-YghPdAg7A51GI_StdfF8oxYGWGkoad72woEkRKeY,5818
24
+ knit_graphs/Knit_Graph.py,sha256=KgcWQPzZJ-Iif7g3zWq6hBy4fdJXkJXnFxGOSMYOn-g,10795
25
+ knit_graphs/Knit_Graph_Visualizer.py,sha256=s2zp6Z7-ZF_52x3zTx8oQr__tQScpkGthIoWck57ykE,40227
26
+ knit_graphs/Loop.py,sha256=zp1ZiVRFSCPL2CnXNxgwNPv7WrcuqFRe3S_ZATxEBAo,5781
27
+ knit_graphs/Pull_Direction.py,sha256=8xRLN-j7V1mExgmt3YjcJcTDa5rLedA2bF4wI8gd-DE,2334
28
+ knit_graphs/Yarn.py,sha256=wNOmj15dnSA56Qw2D5ksgbmQqug-u5kPPxKGuitQ_qI,15901
29
+ knit_graphs/__init__.py,sha256=qzZAOxTqjgLkhoGnKNZwOkuYbKEyzfWKkKpKkV6lVfk,111
30
+ knit_graphs/_base_classes.py,sha256=ZEv_jkUglHzkfg-0TD6oonBq7QQmA4G7jrC_A6OubpY,6401
31
+ knit_graphs/artin_wale_braids/Crossing_Direction.py,sha256=71ckmEFfL0s25NJb8lfYwH2zku0uM1C5X9gGM7PYC5A,2820
32
+ knit_graphs/artin_wale_braids/Loop_Braid_Graph.py,sha256=2tsE16IzcvgsIKij1JNHWah6hLOgrpXCcjb6eocbfFs,4575
33
+ knit_graphs/artin_wale_braids/Wale.py,sha256=PK8IQDnTFXk5924QZYiGCqfckS62laG9_XhK7xH2zAo,7171
34
+ knit_graphs/artin_wale_braids/Wale_Braid.py,sha256=Ws0QmU7s63nrBKe69acDza-r-LozDyyaKVDNxQMy10Y,2662
35
+ knit_graphs/artin_wale_braids/Wale_Braid_Word.py,sha256=4YBlVMUZkqp85r46ETQSbFVS_WrT4PsWthHmFv5Ny9M,4587
36
+ knit_graphs/artin_wale_braids/Wale_Group.py,sha256=HTl01PHzFhInhFJuB30OScWx7pIejmo3-HwHN4RB4V4,6868
37
+ knit_graphs/artin_wale_braids/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
38
+ knit_graphs/basic_knit_graph_generators.py,sha256=doDH2MiXbMzGU9b3enEr3KdY8Fw90cssHi_lkts6VpY,11720
39
+ knit_graphs-0.0.8.dist-info/LICENSE,sha256=Oazk3oiRu5ZN7b-EdYNYh0vu-I3Av2uIPQ-9L_cZ6Oo,1070
40
+ knit_graphs-0.0.8.dist-info/METADATA,sha256=H8xfTEPGsLFE-_j4ZfleigF2RlmbKJU9SycIFhkDuX4,5195
41
+ knit_graphs-0.0.8.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
42
+ knit_graphs-0.0.8.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: hatchling 1.24.2
2
+ Generator: poetry-core 1.8.1
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
knit_graphs/__about__.py DELETED
@@ -1,4 +0,0 @@
1
- # SPDX-FileCopyrightText: 2024-present m.hofmann <m.hofmann@northeastern.edu>
2
- #
3
- # SPDX-License-Identifier: MIT
4
- __version__ = "0.0.6"
File without changes
@@ -1,248 +0,0 @@
1
- """Module of functions that generate basic knit graph swatches."""
2
-
3
- from knit_graphs.Knit_Graph import Knit_Graph
4
- from knit_graphs.Pull_Direction import Pull_Direction
5
- from knit_graphs.Yarn import Yarn
6
- from knit_graphs.artin_wale_braids.Crossing_Direction import Crossing_Direction
7
-
8
-
9
- def co_loops(width: int) -> tuple[Knit_Graph, Yarn]:
10
- """
11
- :param width:
12
- :return: Knit Graph with one course of length width
13
- """
14
- knit_graph = Knit_Graph()
15
- yarn = Yarn()
16
- for _ in range(0, width):
17
- _loop = yarn.make_loop_on_end(knit_graph)
18
- return knit_graph, yarn
19
-
20
-
21
- def jersey_swatch(width: int, height: int) -> Knit_Graph:
22
- """
23
- :param width: number of stitches per course
24
- :param height: number of loops per course
25
- :return: Generate a Knitgraph of width and height with all knit stitches in a sheet structure
26
- """
27
- knit_graph, yarn = co_loops(width)
28
- last_course = knit_graph.get_courses()[0]
29
- for _ in range(0, height):
30
- next_course = []
31
- for parent_loop in reversed(last_course):
32
- child_loop = yarn.make_loop_on_end(knit_graph)
33
- knit_graph.connect_loops(parent_loop, child_loop, pull_direction=Pull_Direction.BtF)
34
- next_course.append(child_loop)
35
- last_course = next_course
36
- return knit_graph
37
-
38
-
39
- def jersey_tube(tube_width: int, height: int) -> Knit_Graph:
40
- """
41
- :param tube_width: number of stitches per course on front side of tube
42
- :param height: number of loops per course
43
- :return: Generate a Knitgraph of width and height with all knit stitches in a tube structure
44
- """
45
- knit_graph, yarn = co_loops(tube_width * 2)
46
- last_course = [*knit_graph.get_courses()[0]]
47
-
48
- def _set_tube_floats():
49
- front_loops = last_course[0:tube_width]
50
- back_loops = last_course[tube_width:]
51
- for first_front, second_front, back in zip(front_loops[0:-1], front_loops[1:], reversed(back_loops)):
52
- yarn.add_loop_behind_float(back, first_front, second_front)
53
- for (first_back, second_back, front) in zip(back_loops[0:-1], back_loops[1:], reversed(front_loops)):
54
- yarn.add_loop_in_front_of_float(front, first_back, second_back)
55
-
56
- _set_tube_floats()
57
- for _ in range(0, height):
58
- next_course = [yarn.make_loop_on_end(knit_graph) for _p in last_course]
59
- for parent_loop, child_loop in zip(last_course, next_course):
60
- knit_graph.connect_loops(parent_loop, child_loop, pull_direction=Pull_Direction.BtF)
61
- last_course = next_course
62
- _set_tube_floats()
63
- return knit_graph
64
-
65
-
66
- def kp_rib_swatch(width: int, height: int) -> Knit_Graph:
67
- """
68
- :param width: number of stitches per course
69
- :param height: number of loops per course
70
- :return: Generate a Knitgraph of width and height with alternating wales of knit purl stitches in a sheet structure
71
- """
72
- knit_graph, yarn = co_loops(width)
73
- last_course = knit_graph.get_courses()[0]
74
- next_course = []
75
- next_pull = Pull_Direction.BtF
76
- for parent_loop in reversed(last_course):
77
- child_loop = yarn.make_loop_on_end(knit_graph)
78
- knit_graph.connect_loops(parent_loop, child_loop, pull_direction=next_pull)
79
- next_pull = next_pull.opposite()
80
- next_course.append(child_loop)
81
- last_course = next_course
82
- for _ in range(1, height):
83
- next_course = []
84
- for parent_loop in reversed(last_course):
85
- grand_parent = parent_loop.parent_loops[0]
86
- parent_pull = knit_graph.get_stitch_edge(grand_parent, parent_loop, "pull_direction")
87
- child_loop = yarn.make_loop_on_end(knit_graph)
88
- knit_graph.connect_loops(parent_loop, child_loop, pull_direction=parent_pull)
89
- next_course.append(child_loop)
90
- last_course = next_course
91
- return knit_graph
92
-
93
-
94
- def seed_swatch(width: int, height: int) -> Knit_Graph:
95
- """
96
- :param width: number of stitches per course
97
- :param height: number of loops per course
98
- :return: Generate a Knitgraph of width and height with checkered knit purl stitches in a sheet structure
99
- """
100
- knit_graph, yarn = co_loops(width)
101
- last_course = knit_graph.get_courses()[0]
102
- next_course = []
103
- next_pull = Pull_Direction.BtF
104
- for parent_loop in reversed(last_course):
105
- child_loop = yarn.make_loop_on_end(knit_graph)
106
- knit_graph.connect_loops(parent_loop, child_loop, pull_direction=next_pull)
107
- next_pull = next_pull.opposite()
108
- next_course.append(child_loop)
109
- last_course = next_course
110
- for _ in range(1, height):
111
- next_course = []
112
- for parent_loop in reversed(last_course):
113
- grand_parent = parent_loop.parent_loops[0]
114
- parent_pull = knit_graph.get_stitch_edge(grand_parent, parent_loop, "pull_direction")
115
- child_loop = yarn.make_loop_on_end(knit_graph)
116
- knit_graph.connect_loops(parent_loop, child_loop, pull_direction=parent_pull.opposite())
117
- next_course.append(child_loop)
118
- last_course = next_course
119
- return knit_graph
120
-
121
-
122
- def kp_mesh_decrease_left_swatch(width, height) -> Knit_Graph:
123
- """
124
- :param width: number of stitches per course
125
- :param height: number of loops per course
126
- :return: Knit Graph with mesh of kp rib with even courses decreasing purls leftward and replacing them with yarn overs
127
- """
128
- # k<o k<o k <-: 1->2
129
- # |\ |\
130
- # k p k p k ->: 0->1
131
- # 0 1 2 3 4
132
- knit_graph, yarn = co_loops(width)
133
- last_course = knit_graph.get_courses()[0]
134
- next_course = []
135
- next_pull = Pull_Direction.BtF
136
- for parent_loop in reversed(last_course):
137
- child_loop = yarn.make_loop_on_end(knit_graph)
138
- knit_graph.connect_loops(parent_loop, child_loop, pull_direction=next_pull)
139
- next_pull = next_pull.opposite()
140
- next_course.append(child_loop)
141
- last_course = next_course
142
- for _ in range(1, height):
143
- next_course = []
144
- for parent_loop in reversed(last_course):
145
- child_loop = yarn.make_loop_on_end(knit_graph)
146
- grand_parent = parent_loop.parent_loops[0]
147
- parent_pull = knit_graph.get_stitch_edge(grand_parent, parent_loop, "pull_direction")
148
- if parent_pull is Pull_Direction.BtF: # knits stay in decrease at bottom of stack
149
- knit_graph.connect_loops(parent_loop, child_loop, pull_direction=Pull_Direction.BtF, stack_position=0)
150
- prior_parent = yarn.prior_loop(parent_loop)
151
- if prior_parent is not None:
152
- knit_graph.connect_loops(prior_parent, child_loop, pull_direction=Pull_Direction.FtB, stack_position=1)
153
- next_course.append(child_loop)
154
- last_course = next_course
155
- next_course = []
156
- for parent_loop in reversed(last_course):
157
- child_loop = yarn.make_loop_on_end(knit_graph)
158
- if len(parent_loop.parent_loops) == 0:
159
- knit_graph.connect_loops(parent_loop, child_loop, pull_direction=Pull_Direction.FtB)
160
- else:
161
- knit_graph.connect_loops(parent_loop, child_loop, pull_direction=Pull_Direction.BtF)
162
- next_course.append(child_loop)
163
- last_course = next_course
164
- return knit_graph
165
-
166
-
167
- def kp_mesh_decrease_right_swatch(width, height) -> Knit_Graph:
168
- """
169
- :param width: number of stitches per course
170
- :param height: number of loops per course
171
- :return: Knit Graph with mesh of kp rib with even courses decreasing purls rightward and replacing them with yarn overs
172
- """
173
- # k o>k o>k <-: 1->2
174
- # /| /|
175
- # k p k p k ->: 0->1
176
- # 0 1 2 3 4
177
- knit_graph, yarn = co_loops(width)
178
- last_course = knit_graph.get_courses()[0]
179
- next_course = []
180
- next_pull = Pull_Direction.BtF
181
- for parent_loop in reversed(last_course):
182
- child_loop = yarn.make_loop_on_end(knit_graph)
183
- knit_graph.connect_loops(parent_loop, child_loop, pull_direction=next_pull)
184
- next_pull = next_pull.opposite()
185
- next_course.append(child_loop)
186
- last_course = next_course
187
- for _ in range(1, height):
188
- next_course = []
189
- for parent_loop in reversed(last_course):
190
- child_loop = yarn.make_loop_on_end(knit_graph)
191
- grand_parent = parent_loop.parent_loops[0]
192
- parent_pull = knit_graph.get_stitch_edge(grand_parent, parent_loop, "pull_direction")
193
- if parent_pull is Pull_Direction.BtF: # knits stay in decrease at bottom of stack
194
- knit_graph.connect_loops(parent_loop, child_loop, pull_direction=Pull_Direction.BtF, stack_position=0)
195
- next_parent = yarn.next_loop(parent_loop)
196
- if next_parent is not None:
197
- knit_graph.connect_loops(next_parent, child_loop, pull_direction=Pull_Direction.FtB, stack_position=1)
198
- next_course.append(child_loop)
199
- last_course = next_course
200
- next_course = []
201
- for parent_loop in reversed(last_course):
202
- child_loop = yarn.make_loop_on_end(knit_graph)
203
- if len(parent_loop.parent_loops) == 0:
204
- knit_graph.connect_loops(parent_loop, child_loop, pull_direction=Pull_Direction.FtB)
205
- else:
206
- knit_graph.connect_loops(parent_loop, child_loop, pull_direction=Pull_Direction.BtF)
207
- next_course.append(child_loop)
208
- last_course = next_course
209
- return knit_graph
210
-
211
-
212
- def twist_cable(width, height) -> Knit_Graph:
213
- """
214
- :param width: number of stitches per course
215
- :param height: number of loops per course
216
- :return: Knit Graph of alternating 1 by 1 twists in different directions with purl wales between them
217
- """
218
- # p k\k p ->: 3-4
219
- # p k k p <-: 2-3
220
- # p k/k p ->: 1-2
221
- # p k k p <-: 0-1
222
- # 0 1 2 3
223
- knit_graph, yarn = co_loops(width)
224
- last_course = knit_graph.get_courses()[0]
225
- next_course = []
226
- pull_directions = [Pull_Direction.FtB, Pull_Direction.BtF, Pull_Direction.BtF, Pull_Direction.FtB]
227
- for i, parent_loop in enumerate(reversed(last_course)):
228
- child_loop = yarn.make_loop_on_end(knit_graph)
229
- knit_graph.connect_loops(parent_loop, child_loop, pull_direction=pull_directions[i % 4])
230
- next_course.append(child_loop)
231
- last_course = next_course
232
- crossing = Crossing_Direction.Over_Right
233
- for r in range(1, height):
234
- next_course = [yarn.make_loop_on_end(knit_graph) for _ in last_course]
235
- for i, parent_loop in enumerate(reversed(last_course)):
236
- if r % 2 == 0 or i % 4 == 0 or i % 4 == 3: # not cable row (even) or in purl wale
237
- child_loop = next_course[i]
238
- elif i % 4 == 1:
239
- child_loop = next_course[i + 1]
240
- else:
241
- child_loop = next_course[i - 1]
242
- knit_graph.connect_loops(parent_loop, child_loop, pull_direction=pull_directions[i % 4])
243
- if r % 2 == 1: # cable row
244
- for left_loop, right_loop in zip(next_course[1::4], next_course[2::4]):
245
- knit_graph.add_crossing(left_loop, right_loop, crossing)
246
- crossing = ~crossing
247
- last_course = next_course
248
- return knit_graph