prefig 0.3.9.dev20250726054209__py3-none-any.whl → 0.3.9.dev20250728054658__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.
@@ -15,6 +15,9 @@ def set_diagram(d):
15
15
  # introduce some useful mathematical operations
16
16
  # that are meant to be available to authors
17
17
 
18
+ def ln(x):
19
+ return math.log(x)
20
+
18
21
  def dot(u, v):
19
22
  return np.dot(np.array(u), np.array(v))
20
23
 
@@ -196,6 +196,7 @@ def vector_field(element, diagram, parent, outline_status):
196
196
  # we will go through and generate the vectors first
197
197
  # since we'll need to scale them
198
198
  max_scale = 0
199
+ exponent = un.valid_eval(element.get('exponent', '1'))
199
200
  x = rx[0]
200
201
  while x <= rx[2]:
201
202
  y = ry[0]
@@ -211,6 +212,13 @@ def vector_field(element, diagram, parent, outline_status):
211
212
  return;
212
213
  except:
213
214
  pass
215
+ norm = math_util.length(f_value)
216
+ if norm < 1e-10:
217
+ f_value = np.array((0,0))
218
+ else:
219
+ # we will scale the length by length**exponent
220
+ # to promote the length of shorter vectors
221
+ f_value = norm**exponent * (1/norm * f_value)
214
222
  max_scale = max(max_scale,
215
223
  abs((f_value[0])/rx[1]),
216
224
  abs((f_value[1])/ry[1]))
prefig/core/tags.py CHANGED
@@ -41,6 +41,7 @@ tag_dict = {
41
41
  'caption': label.caption,
42
42
  'circle': circle.circle,
43
43
  'clip': clip.clip,
44
+ 'contour': implicit.implicit_curve,
44
45
  'coordinates': coordinates.coordinates,
45
46
  'definition': definition.definition,
46
47
  'derivative': definition.derivative,
@@ -66,6 +66,8 @@ def validate_node(node, args=None):
66
66
  return True
67
67
  if isinstance(node, ast.Expression):
68
68
  return validate_node(node.body, args)
69
+ if isinstance(node, ast.Starred):
70
+ return validate_node(node.value)
69
71
  if isinstance(node, ast.Name):
70
72
  if node.id in variables:
71
73
  return True
@@ -313,8 +313,8 @@ GraphicalElements =
313
313
  Area-Under-Curve* &
314
314
  Axes* &
315
315
  Circle* &
316
+ Contour* &
316
317
  Ellipse* &
317
- Gradient* &
318
318
  Graph* &
319
319
  Grid* &
320
320
  Grid-Axes* &
@@ -422,34 +422,6 @@ Axes = element axes {
422
422
  YLabel?
423
423
  }
424
424
 
425
- Gradient = element gradient {
426
- attribute at {text}?,
427
- attribute function {text}?,
428
- attribute spacings {text}?,
429
- attribute scale {text}?,
430
- attribute curve {text}?,
431
- attribute domain {text}?,
432
- attribute N {text}?,
433
- attribute arrow-width {text}?,
434
- attribute arrow-angles {text?}?,
435
- StrokeAttributes,
436
- CommonAttributes
437
- }
438
-
439
- Vector-Field = element vector-field {
440
- attribute at {text}?,
441
- attribute function {text}?,
442
- attribute spacings {text}?,
443
- attribute scale {text}?,
444
- attribute curve {text}?,
445
- attribute domain {text}?,
446
- attribute N {text}?,
447
- attribute arrow-width {text}?,
448
- attribute arrow-angles {text?}?,
449
- StrokeAttributes,
450
- CommonAttributes
451
- }
452
-
453
425
  Grid = element grid {
454
426
  attribute at {text}?,
455
427
  attribute spacings {text}?,
@@ -506,6 +478,16 @@ Tick-Mark = element tick-mark {
506
478
  LabelText?
507
479
  }
508
480
 
481
+ Contour = element contour {
482
+ attribute at {text}?,
483
+ attribute function {text},
484
+ attribute k {text}?,
485
+ attribute depth {text}?,
486
+ attribute initial-depth {text}?,
487
+ StrokeAttributes,
488
+ CommonAttributes
489
+ }
490
+
509
491
  Circle = element circle {
510
492
  attribute at {text}?,
511
493
  attribute center {text},
@@ -815,4 +797,18 @@ Vector = element vector {
815
797
  CommonAttributes
816
798
  }
817
799
 
800
+ Vector-Field = element vector-field {
801
+ attribute at {text}?,
802
+ attribute function {text}?,
803
+ attribute spacings {text}?,
804
+ attribute scale {text}?,
805
+ attribute curve {text}?,
806
+ attribute domain {text}?,
807
+ attribute N {text}?,
808
+ attribute arrow-width {text}?,
809
+ attribute arrow-angles {text?}?,
810
+ StrokeAttributes,
811
+ CommonAttributes
812
+ }
813
+
818
814
  }
@@ -763,10 +763,10 @@
763
763
  <ref name="Circle"/>
764
764
  </zeroOrMore>
765
765
  <zeroOrMore>
766
- <ref name="Ellipse"/>
766
+ <ref name="Contour"/>
767
767
  </zeroOrMore>
768
768
  <zeroOrMore>
769
- <ref name="Gradient"/>
769
+ <ref name="Ellipse"/>
770
770
  </zeroOrMore>
771
771
  <zeroOrMore>
772
772
  <ref name="Graph"/>
@@ -1122,80 +1122,6 @@
1122
1122
  </optional>
1123
1123
  </element>
1124
1124
  </define>
1125
- <define name="Gradient">
1126
- <element name="gradient">
1127
- <optional>
1128
- <attribute name="at"/>
1129
- </optional>
1130
- <optional>
1131
- <attribute name="function"/>
1132
- </optional>
1133
- <optional>
1134
- <attribute name="spacings"/>
1135
- </optional>
1136
- <optional>
1137
- <attribute name="scale"/>
1138
- </optional>
1139
- <optional>
1140
- <attribute name="curve"/>
1141
- </optional>
1142
- <optional>
1143
- <attribute name="domain"/>
1144
- </optional>
1145
- <optional>
1146
- <attribute name="N"/>
1147
- </optional>
1148
- <optional>
1149
- <attribute name="arrow-width"/>
1150
- </optional>
1151
- <optional>
1152
- <attribute name="arrow-angles">
1153
- <optional>
1154
- <text/>
1155
- </optional>
1156
- </attribute>
1157
- </optional>
1158
- <ref name="StrokeAttributes"/>
1159
- <ref name="CommonAttributes"/>
1160
- </element>
1161
- </define>
1162
- <define name="Vector-Field">
1163
- <element name="vector-field">
1164
- <optional>
1165
- <attribute name="at"/>
1166
- </optional>
1167
- <optional>
1168
- <attribute name="function"/>
1169
- </optional>
1170
- <optional>
1171
- <attribute name="spacings"/>
1172
- </optional>
1173
- <optional>
1174
- <attribute name="scale"/>
1175
- </optional>
1176
- <optional>
1177
- <attribute name="curve"/>
1178
- </optional>
1179
- <optional>
1180
- <attribute name="domain"/>
1181
- </optional>
1182
- <optional>
1183
- <attribute name="N"/>
1184
- </optional>
1185
- <optional>
1186
- <attribute name="arrow-width"/>
1187
- </optional>
1188
- <optional>
1189
- <attribute name="arrow-angles">
1190
- <optional>
1191
- <text/>
1192
- </optional>
1193
- </attribute>
1194
- </optional>
1195
- <ref name="StrokeAttributes"/>
1196
- <ref name="CommonAttributes"/>
1197
- </element>
1198
- </define>
1199
1125
  <define name="Grid">
1200
1126
  <element name="grid">
1201
1127
  <optional>
@@ -1407,6 +1333,25 @@
1407
1333
  </optional>
1408
1334
  </element>
1409
1335
  </define>
1336
+ <define name="Contour">
1337
+ <element name="contour">
1338
+ <optional>
1339
+ <attribute name="at"/>
1340
+ </optional>
1341
+ <attribute name="function"/>
1342
+ <optional>
1343
+ <attribute name="k"/>
1344
+ </optional>
1345
+ <optional>
1346
+ <attribute name="depth"/>
1347
+ </optional>
1348
+ <optional>
1349
+ <attribute name="initial-depth"/>
1350
+ </optional>
1351
+ <ref name="StrokeAttributes"/>
1352
+ <ref name="CommonAttributes"/>
1353
+ </element>
1354
+ </define>
1410
1355
  <define name="Circle">
1411
1356
  <element name="circle">
1412
1357
  <optional>
@@ -2198,4 +2143,41 @@
2198
2143
  <ref name="CommonAttributes"/>
2199
2144
  </element>
2200
2145
  </define>
2146
+ <define name="Vector-Field">
2147
+ <element name="vector-field">
2148
+ <optional>
2149
+ <attribute name="at"/>
2150
+ </optional>
2151
+ <optional>
2152
+ <attribute name="function"/>
2153
+ </optional>
2154
+ <optional>
2155
+ <attribute name="spacings"/>
2156
+ </optional>
2157
+ <optional>
2158
+ <attribute name="scale"/>
2159
+ </optional>
2160
+ <optional>
2161
+ <attribute name="curve"/>
2162
+ </optional>
2163
+ <optional>
2164
+ <attribute name="domain"/>
2165
+ </optional>
2166
+ <optional>
2167
+ <attribute name="N"/>
2168
+ </optional>
2169
+ <optional>
2170
+ <attribute name="arrow-width"/>
2171
+ </optional>
2172
+ <optional>
2173
+ <attribute name="arrow-angles">
2174
+ <optional>
2175
+ <text/>
2176
+ </optional>
2177
+ </attribute>
2178
+ </optional>
2179
+ <ref name="StrokeAttributes"/>
2180
+ <ref name="CommonAttributes"/>
2181
+ </element>
2182
+ </define>
2201
2183
  </grammar>
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: prefig
3
- Version: 0.3.9.dev20250726054209
3
+ Version: 0.3.9.dev20250728054658
4
4
  Summary: An authoring system for mathematical diagrams
5
5
  Home-page: https://prefigure.org
6
6
  License: GPL-3.0-or-later
@@ -22,7 +22,7 @@ prefig/core/label.py,sha256=e_gOd2kcdOtcJay1VyRstP66SiDNxK2UK2-obkxQnOc,24746
22
22
  prefig/core/label_tools.py,sha256=jOawiyrKC5iQs0vq7133xNXqrkJbMqDZVHflT-hOruo,9167
23
23
  prefig/core/legend.py,sha256=0mVfyU3LvqgDCYUOlCeBD04maV-rj2h0fs1aOEBBt6c,13340
24
24
  prefig/core/line.py,sha256=HBB9cvJawKAtdubISn5maRrzFFzV0NQuBgwoQoxeXcw,6055
25
- prefig/core/math_utilities.py,sha256=nQV8RiZRvGgqAeatWwHKOHb107ZcLRgwa77CaXvUmCg,5892
25
+ prefig/core/math_utilities.py,sha256=sMm3U9rcYKY8oZZWeJjcBokCDO4CxUkvmaX55auR4Eo,5927
26
26
  prefig/core/network.py,sha256=1izAX2AKvnj2knElrdLeojE_0Q0zO0aQM-EsEwor0Os,27217
27
27
  prefig/core/parametric_curve.py,sha256=ftxdg3gs0M0ME5iPJo3iEX7jT8PHQEMYpx8psr8Cm-w,3046
28
28
  prefig/core/parse.py,sha256=plLmR0KKrUjYx0PmHHo5HZonaaT3tW4qjiDOtzuhSkQ,4542
@@ -34,11 +34,11 @@ prefig/core/rectangle.py,sha256=T0EMtRdLtmG1uY7Bu8kXmxQ81IGG_102g5fLCg9RuzE,3387
34
34
  prefig/core/repeat.py,sha256=DAO5w4BxUMGU-8ymsv8EwsifI0zPa_cgIRUcWWS8BWU,2755
35
35
  prefig/core/riemann_sum.py,sha256=T2dQgJIY17QuuPDOB8XWIP8HYmg5jOQ-LroFH7tiGAU,3012
36
36
  prefig/core/shape.py,sha256=Qb_-upbSHwEoYrrAnbCoFFFuVIb3JgJLdyP9ckD5evc,8675
37
- prefig/core/slope_field.py,sha256=MQgqwfsBNL4bZYqcpEif64gj7Xz6a1SSfcJPAYBZAE8,8231
37
+ prefig/core/slope_field.py,sha256=e396uznWNaCUmOIIf70lsxvy9g_SGRFZlpxsIpy4ajE,8640
38
38
  prefig/core/statistics.py,sha256=5qN_-ABN0EFVG12ZP95uSPk82INbWRqI3w2fUdR3wsw,3458
39
- prefig/core/tags.py,sha256=Y3LdH8KSEqIbjTrQLBOV56WMqGbjII-kEhtlEEIKSTQ,4048
39
+ prefig/core/tags.py,sha256=fj86TjSkSpo0cAYmp0OQ83ULX9B8Nz4PRsNyZsR2JMk,4088
40
40
  prefig/core/tangent_line.py,sha256=I9wf9VAqhnmmsh8Lzynwi7_Z1DonHXqHf8ym7eO40tk,3400
41
- prefig/core/user_namespace.py,sha256=73rV4iXICoh84xHCqBMTcIXNXGPQcPvTUEE8qFiSivM,6980
41
+ prefig/core/user_namespace.py,sha256=6xlkYd2g9dSiDPH0vmYj93oPzm1BFZdgyMGQ9ipKOgU,7059
42
42
  prefig/core/utilities.py,sha256=R1fBrzj-abXHG4Bh-sS0pZNC8vc9fIt6yJBcuztCVho,2905
43
43
  prefig/core/vector.py,sha256=lTw-y9mt6jqmbFxdPwQB4PYBQ9y4pGrQRcpRp9lBIbY,2917
44
44
  prefig/engine.py,sha256=Zz7j2sFxeMwPN1f3GFTpaBihqguzMNJD5iBONOVL7eQ,11972
@@ -55,13 +55,13 @@ prefig/resources/examples/tangent.xml,sha256=FLZaNz0iFoTLX6gB4pfLZFtu_TWeCug4Dda
55
55
  prefig/resources/fonts/Braille29.ttf,sha256=T4hosDvaUGMVK0Wh0BmBgWeT7sQQmLXyA3gRUR-a0oE,55880
56
56
  prefig/resources/js/mj-sre-page.js,sha256=LHVeI4dCH13bTv56nz3SKNo3JGRXa6joPM3D3wpKV40,9251
57
57
  prefig/resources/js/package.json,sha256=hwKDg76_GzkhX72T7DRiF3FoMLokCv9PSLQvnW5Ovok,116
58
- prefig/resources/schema/pf_schema.rnc,sha256=33E_zj90OVa9xU6QXfBgJZwlPzaoNgtTYrAcp2uBEdk,19954
59
- prefig/resources/schema/pf_schema.rng,sha256=YC9BYvLNa1OgHs3Y5fV_99NwbQaXTfKnAAhjE3L8tAE,53903
58
+ prefig/resources/schema/pf_schema.rnc,sha256=KAmcFfhLpVRVG9nFzdHcPOMdEj62aUOMs6BXqiXy7jc,19824
59
+ prefig/resources/schema/pf_schema.rng,sha256=OfOY7Pgd_G6V07v6kqRVJlvyAbyclWBSX9Q8Br97CKo,53495
60
60
  prefig/resources/template/pf_publication.xml,sha256=eEv8HACv610Apw5DSVNy0reLfELYqHlNy9Oq0GH7C_c,200
61
61
  prefig/scripts/__init__.py,sha256=qJcPi1WRh9UAwu4zIFJbmxWalAMilMYqgi6LxRkF7bI,25
62
62
  prefig/scripts/install_mj.py,sha256=5A6-oc1xbIXka5mkFE70vlp9-Rh_QoxOxGMrQi9Hkio,1219
63
- prefig-0.3.9.dev20250726054209.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
64
- prefig-0.3.9.dev20250726054209.dist-info/METADATA,sha256=dagV-ujiU-KtJOZKABw4eolGUmoOyUDvKI5O6uwmTvE,8728
65
- prefig-0.3.9.dev20250726054209.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
66
- prefig-0.3.9.dev20250726054209.dist-info/entry_points.txt,sha256=OP4ZQT71q2b0Zfbie-oM2Z1HlxpkuX7qaxJnzwsBOVQ,42
67
- prefig-0.3.9.dev20250726054209.dist-info/RECORD,,
63
+ prefig-0.3.9.dev20250728054658.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
64
+ prefig-0.3.9.dev20250728054658.dist-info/METADATA,sha256=kqDcIYXexeaIQR_LzQ9tVV7kntpcoTyqFzjSh28PbdQ,8728
65
+ prefig-0.3.9.dev20250728054658.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
66
+ prefig-0.3.9.dev20250728054658.dist-info/entry_points.txt,sha256=OP4ZQT71q2b0Zfbie-oM2Z1HlxpkuX7qaxJnzwsBOVQ,42
67
+ prefig-0.3.9.dev20250728054658.dist-info/RECORD,,