Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion SYMBOLS_MANIFEST.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1132,7 +1132,7 @@ System`Sow
System`Span
System`SparseArray
System`Sphere
System`Sphere3DBox
System`SphereBox
System`SphericalBesselJ
System`SphericalBesselY
System`SphericalHankelH1
Expand Down
4 changes: 2 additions & 2 deletions mathics/builtin/box/graphics3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ def _apply_boxscaling(self, boxscale):
coords.scale(boxscale)


class Sphere3DBox(GraphicsElementBox):
class SphereBox(GraphicsElementBox):
# summary_text = "box representation for a sphere"

# We have no documentation for this (yet).
Expand Down Expand Up @@ -359,7 +359,7 @@ def _apply_boxscaling(self, boxscale):
Symbol("Line3DBox"): Line3DBox,
Symbol("Point3DBox"): Point3DBox,
Symbol("Polygon3DBox"): Polygon3DBox,
Symbol("Sphere3DBox"): Sphere3DBox,
Symbol("SphereBox"): SphereBox,
Symbol("Tube3DBox"): Tube3DBox,
}
)
4 changes: 2 additions & 2 deletions mathics/builtin/drawing/graphics3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class Graphics3D(Graphics):
. size(6.6667cm, 6.6667cm);
. currentprojection=perspective(2.6,-4.8,4.0);
. currentlight=light(rgb(0.5,0.5,0.5), specular=red, (2,0,2), (2,2,2), (0,2,2));
. // Sphere3DBox
. // SphereBox
. draw(surface(sphere((0, 0, 0), 1)), rgb(1,1,1)+opacity(1));
. draw(((-1,-1,-1)--(1,-1,-1)), rgb(0.4, 0.4, 0.4)+linewidth(1));
. draw(((-1,1,-1)--(1,1,-1)), rgb(0.4, 0.4, 0.4)+linewidth(1));
Expand Down Expand Up @@ -130,7 +130,7 @@ class Graphics3D(Graphics):
"ViewProjection": "Automatic",
"ViewRange": "All",
"ViewVector": "Automatic",
"ViewVertical": "{0,0,1}",
"ViewVertical": "{0.,0.,1.}",
}
)

Expand Down
2 changes: 2 additions & 0 deletions mathics/core/systemsymbols.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,8 @@
SymbolSortBy: Final[Symbol] = Symbol("System`SortBy")
SymbolSpan: Final[Symbol] = Symbol("System`Span")
SymbolSparseArray: Final[Symbol] = Symbol("System`SparseArray")
SymbolSphere: Final[Symbol] = Symbol("System`Sphere")
SymbolSphereBox: Final[Symbol] = Symbol("System`SphereBox")
SymbolSphericalRegion: Final[Symbol] = Symbol("System`SphericalRegion")
SymbolSplit: Final[Symbol] = Symbol("System`Split")
SymbolSqrt: Final[Symbol] = Symbol("System`Sqrt")
Expand Down
2 changes: 1 addition & 1 deletion mathics/doc/latex/testing-sample.tex
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ \section*{TestSection}
size(6.6667cm, 6.6667cm);
currentprojection=perspective(2.6,-4.8,4.0);
currentlight=light(rgb(0.5,0.5,0.5), specular=red, (2,0,2), (2,2,2), (0,2,2));
// Sphere3DBox
// SphereBox
draw(surface(sphere((0, 0, 0), 1)), rgb(0.0,0.6666666666666667,0.0));
draw(((-1,-1,-1)--(1,-1,-1)), rgb(0.4, 0.4, 0.4)+linewidth(1));
draw(((-1,1,-1)--(1,1,-1)), rgb(0.4, 0.4, 0.4)+linewidth(1));
Expand Down
2 changes: 1 addition & 1 deletion mathics/eval/options/values.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from mathics.core.parser import parse_builtin_rule
from mathics.core.symbols import SymbolList, strip_context
from mathics.core.symbols import strip_context


def filter_non_default_values(builtin):
Expand Down
5 changes: 5 additions & 0 deletions mathics/format/box/graphics.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
SymbolGraphics,
SymbolInset,
SymbolOffset,
SymbolSphere,
SymbolSphereBox,
SymbolStyle,
SymbolText,
)
Expand Down Expand Up @@ -956,6 +958,9 @@ def primitives_to_boxes(
],
)

# Sphere-> SphereBox, no Sphere3DBox...
if head is SymbolSphere:
return Expression(SymbolSphereBox, *content.elements)
if head in ELEMENT_HEADS:
if head is SymbolText:
head = SymbolInset
Expand Down
8 changes: 4 additions & 4 deletions mathics/format/render/asy.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
Line3DBox,
Point3DBox,
Polygon3DBox,
Sphere3DBox,
SphereBox,
Tube3DBox,
)
from mathics.builtin.box.uniform_polyhedra import UniformPolyhedron3DBox
Expand Down Expand Up @@ -700,22 +700,22 @@ def roundbox(box: RoundBox):
add_render_function(RoundBox)


def sphere3dbox(box: Sphere3DBox, **options) -> str:
def spherebox(box: SphereBox, **options) -> str:
# l = box.style.get_line_width(face_element=True)

face_color = box.face_color.to_js() if box.face_color else (1, 1, 1)
opacity = box.face_opacity
color_str = build_3d_pen_color(face_color, opacity)

return "// Sphere3DBox\n" + "\n".join(
return "// SphereBox\n" + "\n".join(
"draw(surface(sphere({0}, {1})), {2});".format(
tuple(coord.pos()[0]), box.radius, color_str
)
for coord in box.points
)


add_render_function(Sphere3DBox)
add_render_function(SphereBox)


def tube_3d_box(box: Tube3DBox, **options) -> str:
Expand Down
8 changes: 4 additions & 4 deletions mathics/format/render/json.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
Line3DBox,
Point3DBox,
Polygon3DBox,
Sphere3DBox,
SphereBox,
Tube3DBox,
)
from mathics.builtin.box.uniform_polyhedra import UniformPolyhedron3DBox
Expand Down Expand Up @@ -271,7 +271,7 @@ def polygon_3d_box(box: Polygon3DBox) -> list:
add_render_function(Polygon3DBox, polygon_3d_box)


def sphere_3d_box(box: Sphere3DBox) -> list:
def sphere_3d_box(box: SphereBox) -> list:
face_color = box.face_color.to_js()
if len(face_color) < 4 and box.face_opacity:
face_color = face_color + [box.face_opacity.opacity]
Expand All @@ -281,11 +281,11 @@ def sphere_3d_box(box: Sphere3DBox) -> list:
face_color,
{"radius": box.radius},
)
# print("### json Sphere3DBox", data)
# print("### json SphereBox", data)
return data


add_render_function(Sphere3DBox, sphere_3d_box)
add_render_function(SphereBox, sphere_3d_box)


def uniform_polyhedron_3d_box(box: UniformPolyhedron3DBox) -> list:
Expand Down
2 changes: 1 addition & 1 deletion test/builtin/assumptions/test_assumptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ def test_assumptions_integrate(str_expr, str_expected, message):
LIST_TEST_ASSUMPTIONS_INTEGRATE_FAILING,
)
@pytest.mark.xfail(reason="the Assumptions with Integrate is not fully working")
def test_assumptions_integrate(str_expr, str_expected, message):
def test_assumptions_integrate2(str_expr, str_expected, message):
check_evaluation(str_expr, str_expected)


Expand Down
2 changes: 1 addition & 1 deletion test/builtin/drawing/test_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ def test__listplot():
"size(6.6667cm, 6.6667cm);\n"
"currentprojection=perspective(2.6,-4.8,4.0);\n"
"currentlight=light(rgb(0.5,0.5,0.5), background=rgb(1, 0.1, 0.1), specular=red, (2,0,2), (2,2,2), (0,2,2));\n"
"// Sphere3DBox\n"
"// SphereBox\n"
"draw(surface(sphere((0, 0, 0), 1)), rgb(1,1,1)+opacity(1));\n"
"draw(((-1,-1,-1)--(1,-1,-1)), rgb(0.4, 0.4, 0.4)+linewidth(1));\n"
"draw(((-1,1,-1)--(1,1,-1)), rgb(0.4, 0.4, 0.4)+linewidth(1));\n"
Expand Down
11 changes: 1 addition & 10 deletions test/core/convert/test_sympy.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,7 @@
Symbol_F = Symbol("Global`F")
Symbol_G = Symbol("Global`G")

from mathics.core.expression import Expression
from mathics.core.expression_predefined import MATHICS3_COMPLEX_INFINITY
from mathics.core.symbols import (
Symbol,
SymbolNull,
SymbolPlus,
SymbolPower,
SymbolTimes,
)
from mathics.core.systemsymbols import SymbolE, SymbolExp, SymbolI, SymbolPi, SymbolSin
from mathics.core.symbols import Symbol

Symbol_a = Symbol("Global`a")
Symbol_b = Symbol("Global`b")
Expand Down
2 changes: 0 additions & 2 deletions test/format/test_makeboxes.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ def test_makeboxes_precedence(str_expr, str_expected, msg):
("str_expr", "str_expected", "msg"),
list(makeboxes_basic_forms_iterator("Graphics")),
)
@skip_or_fail
def test_makeboxes_graphics(str_expr, str_expected, msg):
"""
# TODO: Constructing boxes from Real which are currently failing
Expand Down Expand Up @@ -231,7 +230,6 @@ def test_makeboxes_others_fail(str_expr, str_expected, msg):
),
],
)
@skip_or_fail
def test_makeboxes_custom(str_expr, str_expected, msg):
"""
These tests checks the behaviour of MakeBoxes.
Expand Down
3 changes: 0 additions & 3 deletions test/timings/test_regressions.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,6 @@
param_ids = [name for name, _, _, _ in BENCHMARK_TASKS]


import pytest


@pytest.mark.skipif(
not os.environ.get("BENCHMARKS", 0), reason="benchmarks not required"
)
Expand Down
Loading