Giter Site home page Giter Site logo

3-manifolds / snappy Goto Github PK

View Code? Open in Web Editor NEW
82.0 82.0 39.0 181.77 MB

SnapPy is a package for studying the topology and geometry of 3-manifolds, with a focus on hyperbolic structures. It is based on the SnapPea kernel written by Jeff Weeks.

Home Page: https://snappy.computop.org/

Python 25.80% C 59.14% Shell 0.08% TeX 0.53% Jupyter Notebook 0.39% GLSL 0.73% Dockerfile 0.10% Batchfile 0.01% CSS 0.06% Makefile 0.04% C++ 4.41% HTML 2.74% Tcl 0.01% Inno Setup 0.05% Sage 0.01% Cython 5.89% CMake 0.02%

snappy's People

Contributors

bobbycyiii avatar ckaterba avatar culler avatar farbere avatar fchapoton avatar henryseg avatar jcguu95 avatar jchilds0 avatar jmalionek avatar joseasanchez avatar malikobeidin avatar markcbell avatar nathandunfield avatar njt99 avatar slel avatar unhyperbolic avatar xrx1995 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

snappy's Issues

Filling a closed triangulation aborts

Originally reported by Robert Haraway at https://bitbucket.org/t3m/snappy/issues/25/filling-a-closed-triangulation-aborts.

This is for SnapPy version 2.7, running on Python version 3.7.3 compiled with GCC 8.3.0. The bug is present without IPython. My operating system is Linux 4.19.0-6-amd64, running on Debian 10.

Filling a closed Triangulation crashes Python with an unhandled SIGABRT. Here is a code snippet illustrating the issue.

import snappy
M = snappy.Manifold('m129')
M.dehn_fill([(1,0),(1,0)])
X = M.filled_triangulation()
X.filled_triangulation()
The output from the Python console is as follows.

free(): double free detected in tcache 2
------------------------------------------------------------------------
/home/rch3/.local/lib/python3.7/site-packages/cypari/_pari.cpython-37m-x86_64-linux-gnu.so(+0x7e804)[0x7f191e4a4804]
/home/rch3/.local/lib/python3.7/site-packages/cypari/_pari.cpython-37m-x86_64-linux-gnu.so(+0x7e845)[0x7f191e4a4845]
/home/rch3/.local/lib/python3.7/site-packages/cypari/_pari.cpython-37m-x86_64-linux-gnu.so(+0x181f01)[0x7f191e5a7f01]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x12730)[0x7f1920fb7730]
/lib/x86_64-linux-gnu/libc.so.6(gsignal+0x10b)[0x7f1920a317bb]
/lib/x86_64-linux-gnu/libc.so.6(abort+0x121)[0x7f1920a1c535]
/lib/x86_64-linux-gnu/libc.so.6(+0x79508)[0x7f1920a73508]
/lib/x86_64-linux-gnu/libc.so.6(+0x7fc1a)[0x7f1920a79c1a]
/lib/x86_64-linux-gnu/libc.so.6(+0x816fd)[0x7f1920a7b6fd]
/home/rch3/.local/lib/python3.7/site-packages/snappy/SnapPy.cpython-37m-x86_64-linux-gnu.so(my_free+0x9)[0x7f19200106e9]
/home/rch3/.local/lib/python3.7/site-packages/snappy/SnapPy.cpython-37m-x86_64-linux-gnu.so(+0x1ab23c)[0x7f192001d23c]
/home/rch3/.local/lib/python3.7/site-packages/snappy/SnapPy.cpython-37m-x86_64-linux-gnu.so(peripheral_curves+0x180)[0x7f192001e320]
/home/rch3/.local/lib/python3.7/site-packages/snappy/SnapPy.cpython-37m-x86_64-linux-gnu.so(tidy_peripheral_curves+0x25)[0x7f1920030875]
/home/rch3/.local/lib/python3.7/site-packages/snappy/SnapPy.cpython-37m-x86_64-linux-gnu.so(basic_simplification+0xb8)[0x7f192005ec08]
/home/rch3/.local/lib/python3.7/site-packages/snappy/SnapPy.cpython-37m-x86_64-linux-gnu.so(fill_cusps+0x13d)[0x7f192004ddcd]
/home/rch3/.local/lib/python3.7/site-packages/snappy/SnapPy.cpython-37m-x86_64-linux-gnu.so(+0x12a14e)[0x7f191ff9c14e]
python3(_PyMethodDescr_FastCallKeywords+0x3c4)[0x4d7d74]
python3(_PyEval_EvalFrameDefault+0x4599)[0x552089]
python3(_PyEval_EvalCodeWithName+0x252)[0x54b7c2]
python3(PyEval_EvalCode+0x23)[0x54dae3]
python3[0x630af2]
python3[0x480b0e]
python3(PyRun_InteractiveLoopFlags+0xd4)[0x480c90]
python3(PyRun_AnyFileExFlags+0x53)[0x631a03]
python3[0x653f7e]
python3(_Py_UnixMain+0x2e)[0x6542de]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xeb)[0x7f1920a1e09b]
python3(_start+0x2a)[0x5dfe9a]
------------------------------------------------------------------------
Unhandled SIGABRT: An abort() occurred.
This probably occurred because a *compiled* module has a bug
in it and is not properly wrapped with sig_on(), sig_off().
Python will now terminate.
------------------------------------------------------------------------
Aborted

The output from GDB is as follows.

(gdb) run more_bad.py 
Starting program: /usr/bin/python3 more_bad.py
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
double free or corruption (fasttop)

Program received signal SIGABRT, Aborted.
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
50  ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1  0x00007ffff79bb535 in __GI_abort () at abort.c:79
#2  0x00007ffff7a12508 in __libc_message (action=action@entry=do_abort, 
    fmt=fmt@entry=0x7ffff7b1d28d "%s\n") at ../sysdeps/posix/libc_fatal.c:181
#3  0x00007ffff7a18c1a in malloc_printerr (
    str=str@entry=0x7ffff7b1efb0 "double free or corruption (fasttop)")
    at malloc.c:5341
#4  0x00007ffff7a1a5d7 in _int_free (av=0x7ffff7b54c40 <main_arena>, 
    p=0x1b398d0, have_lock=<optimized out>) at malloc.c:4258
#5  0x00007ffff72646e9 in my_free (ptr=<optimized out>)
    at kernel/kernel_code/my_malloc.c:191
#6  0x00007ffff727123c in simplify_perimeter (perimeter_anchor=<optimized out>)
    at kernel/kernel_code/peripheral_curves.c:822
#7  do_one_cusp (manifold=manifold@entry=0x1b4aaf0, cusp=cusp@entry=0x1b719c0)
    at kernel/kernel_code/peripheral_curves.c:518
#8  0x00007ffff7272320 in peripheral_curves (manifold=manifold@entry=0x1b4aaf0)
    at kernel/kernel_code/peripheral_curves.c:356
#9  0x00007ffff7284875 in tidy_peripheral_curves (
    manifold=manifold@entry=0x1b4aaf0)
    at kernel/kernel_code/tidy_peripheral_curves.c:63
#10 0x00007ffff72b2c08 in basic_simplification (manifold=0x1b4aaf0)
    at kernel/kernel_code/simplify_triangulation.c:281
#11 0x00007ffff72a1dcd in fill_cusps (manifold=0x1b65240, 
    fill_cusp=fill_cusp@entry=0x1272c90 "\340\020\264\001", 
--Type <RET> for more, q to quit, c to continue without paging--c
    new_name=new_name@entry=0x7ffff72e39fb "", fill_all_cusps=<optimized out>) at kernel/kernel_code/filling.c:149
#12 0x00007ffff71f014e in __pyx_pf_6SnapPy_13Triangulation_86filled_triangulation (__pyx_v_cusps_to_fill=[], __pyx_v_self=0x7ffff1bfec48) at cython/SnapPy.c:33882
#13 __pyx_pw_6SnapPy_13Triangulation_87filled_triangulation (__pyx_v_self=<Triangulation at remote 0x7ffff1bfec48>, __pyx_args=<optimized out>, __pyx_kwds=<optimized out>) at cython/SnapPy.c:33308
#14 0x00000000004d7d74 in _PyMethodDef_RawFastCallKeywords (kwnames=<optimized out>, nargs=<optimized out>, args=<optimized out>, self=<Triangulation at remote 0x7ffff1bfec48>, method=0x7ffff7522f60 <__pyx_methods_6SnapPy_Triangulation+1248>) at ../Objects/call.c:690
#15 _PyMethodDescr_FastCallKeywords (descrobj=<method_descriptor at remote 0x7ffff7567d80>, args=0x7ffff764eb68, nargs=<optimized out>, kwnames=<optimized out>) at ../Objects/descrobject.c:288
#16 0x0000000000552089 in call_function (kwnames=0x0, oparg=1, pp_stack=0x7fffffffe240) at ../Python/ceval.c:4593
#17 _PyEval_EvalFrameDefault (f=<optimized out>, throwflag=<optimized out>) at ../Python/ceval.c:3110
#18 0x000000000054b7c2 in PyEval_EvalFrameEx (throwflag=0, f=Frame 0x7ffff764e9f8, for file more_bad.py, line 1, in <module> ()) at ../Python/ceval.c:547
#19 _PyEval_EvalCodeWithName (_co=<optimized out>, globals=<optimized out>, locals=<optimized out>, args=<optimized out>, argcount=<optimized out>, kwnames=0x0, kwargs=0x0, kwcount=<optimized out>, kwstep=2, defs=0x0, defcount=0, kwdefs=0x0, closure=0x0, name=0x0, qualname=0x0) at ../Python/ceval.c:3930
#20 0x000000000054dae3 in PyEval_EvalCodeEx (closure=0x0, kwdefs=0x0, defcount=0, defs=0x0, kwcount=0, kws=0x0, argcount=0, args=0x0, locals=<optimized out>, globals=<optimized out>, _co=<optimized out>) at ../Python/ceval.c:3959
#21 PyEval_EvalCode (co=<optimized out>, globals=<optimized out>, locals=<optimized out>) at ../Python/ceval.c:524
#22 0x0000000000630af2 in run_mod (mod=<optimized out>, filename=<optimized out>, globals={'__name__': '__main__', '__doc__': None, '__package__': None, '__loader__': <SourceFileLoader(name='__main__', path='more_bad.py') at remote 0x7ffff75e5198>, '__spec__': None, '__annotations__': {}, '__builtins__': <module at remote 0x7ffff76a5c28>, '__file__': 'more_bad.py', '__cached__': None, 'snappy': <module at remote 0x7ffff75b0c28>, 'M': <Manifold at remote 0x7ffff1bfea48>, 'X': <Triangulation at remote 0x7ffff1bfec48>}, locals={'__name__': '__main__', '__doc__': None, '__package__': None, '__loader__': <SourceFileLoader(name='__main__', path='more_bad.py') at remote 0x7ffff75e5198>, '__spec__': None, '__annotations__': {}, '__builtins__': <module at remote 0x7ffff76a5c28>, '__file__': 'more_bad.py', '__cached__': None, 'snappy': <module at remote 0x7ffff75b0c28>, 'M': <Manifold at remote 0x7ffff1bfea48>, 'X': <Triangulation at remote 0x7ffff1bfec48>}, flags=<optimized out>, arena=<optimized out>) at ../Python/pythonrun.c:1035
#23 0x0000000000630ba7 in PyRun_FileExFlags (fp=0x92dd90, filename_str=<optimized out>, start=<optimized out>, globals={'__name__': '__main__', '__doc__': None, '__package__': None, '__loader__': <SourceFileLoader(name='__main__', path='more_bad.py') at remote 0x7ffff75e5198>, '__spec__': None, '__annotations__': {}, '__builtins__': <module at remote 0x7ffff76a5c28>, '__file__': 'more_bad.py', '__cached__': None, 'snappy': <module at remote 0x7ffff75b0c28>, 'M': <Manifold at remote 0x7ffff1bfea48>, 'X': <Triangulation at remote 0x7ffff1bfec48>}, locals={'__name__': '__main__', '__doc__': None, '__package__': None, '__loader__': <SourceFileLoader(name='__main__', path='more_bad.py') at remote 0x7ffff75e5198>, '__spec__': None, '__annotations__': {}, '__builtins__': <module at remote 0x7ffff76a5c28>, '__file__': 'more_bad.py', '__cached__': None, 'snappy': <module at remote 0x7ffff75b0c28>, 'M': <Manifold at remote 0x7ffff1bfea48>, 'X': <Triangulation at remote 0x7ffff1bfec48>}, closeit=1, flags=0x7fffffffe4dc) at ../Python/pythonrun.c:988
#24 0x000000000063180f in PyRun_SimpleFileExFlags (fp=0x92dd90, filename=<optimized out>, closeit=1, flags=0x7fffffffe4dc) at ../Python/pythonrun.c:429
#25 0x0000000000653f7e in pymain_run_file (p_cf=0x7fffffffe4dc, filename=<optimized out>, fp=0x92dd90) at ../Modules/main.c:427
#26 pymain_run_filename (cf=0x7fffffffe4dc, pymain=0x7fffffffe5b0) at ../Modules/main.c:1627
#27 pymain_run_python (pymain=0x7fffffffe5b0) at ../Modules/main.c:2877
#28 pymain_main (pymain=<optimized out>, pymain=<optimized out>) at ../Modules/main.c:3038
#29 0x00000000006542de in _Py_UnixMain (argc=<optimized out>, argv=<optimized out>) at ../Modules/main.c:3073
#30 0x00007ffff79bd09b in __libc_start_main (main=0x4bc7b0 <main>, argc=2, argv=0x7fffffffe6f8, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffe6e8) at ../csu/libc-start.c:308
#31 0x00000000005dfe9a in _start () at ../Modules/main.c:725

Cannot compile in Sagemath 9.8beta7 in Fedora 37

I got error with make snappy in Sagemath 9.8beta7, with python3-3.1.11:

[snappy]       
error: Command "gcc -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fPIC -Ikernel/headers -Ikernel/unix_kit -Ikernel/addl_code -Ikernel/real_type -I/usr/local/sage-310/local/var/lib/sage/venv-python3.11/include -I/usr/include/python3.11 -c cython/SnapPy.c -o build/temp.linux-x86_64-cpython-311/cython/SnapPy.o" failed with exit status 1

Hang in the cusp neighbourhood code

Reported hang by Saul Schleimer:

sage: sig = 'nLLzLMAPAkcdchfghjkjklmmhsrsbwgarbgahr'
sage: M = snappy.Manifold(sig)
sage: C = M.cusp_neighborhood()
sage: C.set_tie(0, 2)

Support Python 3.12

The first release candidate for Python 3.12 is now available and the final version is scheduled to be released on October 1, 2023. We need to make SnapPy compatible, including the following binary components:

  • FXrays
  • low_index
  • knot_floer_homology
  • cypari
  • Spherogram
  • SnapPy itself

Depending on the module, this would also be a natural time to make sure everything works with Cython 3.0. Note that cibuildwheel has started including Python 3.12 in the CI runs as of early August.

error in GUI -> "Inside View" -> _tkinter.TclError: unknown option "-profile"

The following error occurs after creating a manifold, calling browse() and clicking the tab "Inside view" (the concerning error message then appears in the tab's content body):

Could not instantiate view. Error was:

Traceback (most recent call last):
   File "~/.local/lib/python3.9/site-packages/snappy/browser.py". line 450, in build_inside_view
      self.inside_view = InsideViewer(self, self.manifold,
   File "~/.local/lib/python3.9/site-packages/snappy/raytracing/inside_viewer.py", line 29, in __init__
      main_frame = self.create_frame_with_main_widget(
   File "~/.local/lib/python3.9/site-packages/snappy/raytracing/inside_viewer.py", line 459, in create_frame_with_main_widget
     self.widget = RaytracingView(
   File "~/.local/lib/python3.9/site-packages/snappy/raytracing/raytracing_view.py", line 160, in __init__
     SimpleImageShaderWidget.__init__(
   File "opengl/CyOpenGL.pyx", line 2275, in CyOpenGL.SimpleImageShaderWidget.__init__
   File "opengl/CyOpenGL.pyx", line 135, in CyOpenGL.RawOpenGLWidget.__init__
   File "usr/lib/python3.9/tkinter/__init__.py", line 2575, in __init__
     self.tk.call(
 _tkinter.TclError: unknown option "-profile"
 Couldn't configure togl widget

Everything else appears to work fine.
The environment is Ubuntu (16.04, 32bit, with python 3.9).
To get the GUI working for 32bit, I'm using libTogl2.0.so instead of libTogl2.1.so in ~/.local/lib/python3.9/site-packages/snappy/togl/linux2-tk8.6.
So possibly that is a 32/64bit compatibility issue as to the usage of Togl?
Can this be fixed?

fix pycodestyle issues

Here is the summary of pycodestyle on the code base (6 January 2023) ; this does not look very nice.

28 E101 indentation contains mixed spaces and tabs
9 E111 indentation is not a multiple of 4
14 E114 indentation is not a multiple of 4 (comment)
1 E115 expected an indented block (comment)
4 E116 unexpected indentation (comment)
5 E117 over-indented
11 E121 continuation line under-indented for hanging indent
40 E122 continuation line missing indentation or outdented
80 E123 closing bracket does not match indentation of opening bracket's line
36 E124 closing bracket does not match visual indentation
28 E125 continuation line with same indent as next logical line
121 E126 continuation line over-indented for hanging indent
96 E127 continuation line over-indented for visual indent
509 E128 continuation line under-indented for visual indent
27 E129 visually indented line with same indent as next logical line
25 E131 continuation line unaligned for hanging indent
1701 E201 whitespace after '['
1505 E202 whitespace before ']'
1134 E203 whitespace before ':'
15 E211 whitespace before '('
284 E221 multiple spaces before operator
67 E222 multiple spaces after operator
157 E225 missing whitespace around operator
1588 E226 missing whitespace around arithmetic operator
13 E227 missing whitespace around bitwise or shift operator
198 E228 missing whitespace around modulo operator
2945 E231 missing whitespace after ':'
167 E241 multiple spaces after ','
6304 E251 unexpected spaces around keyword / parameter equals
300 E261 at least two spaces before inline comment
18 E262 inline comment should start with '# '
223 E265 block comment should start with '# '
101 E266 too many leading '#' for block comment
30 E271 multiple spaces after keyword
29 E272 multiple spaces before keyword
62 E301 expected 1 blank line, found 0
1940 E302 expected 2 blank lines, found 1
176 E303 too many blank lines (3)
227 E305 expected 2 blank lines after class or function definition, found 1
7 E306 expected 1 blank line before a nested definition, found 0
54 E401 multiple imports on one line
83 E402 module level import not at top of file
4 E502 the backslash is redundant between brackets
33 E701 multiple statements on one line (colon)
2 E703 statement ends with a semicolon
2 E704 multiple statements on one line (def)
87 E714 test for object identity should be 'is not'
1 E721 do not compare types, use 'isinstance()'
72 E722 do not use bare 'except'
24 E731 do not assign a lambda expression, use a def
4 E743 ambiguous function definition 'I'
1349 W191 indentation contains tabs
255 W291 trailing whitespace
946 W293 blank line contains whitespace
47 W391 blank line at end of file
60 W605 invalid escape sequence '\e'

Triangulation isosig not parsed for big triangulations

Computing and reconstruction the attached triangulation of S3 with 720 tetrahedra using the isosig doesn't work:

Triangulation(Triangulation('bigS3.tri.txt', remove_finite_vertices=False).triangulation_isosig())

yields

OSError: The manifold file -cqlv...aaaaa_ was not found.

bigS3.tri.txt

macOS Catalina (10.15): app crashes when opening the preferences menu.

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/snappy/app.py", line 450, in <module>
    main()
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/snappy/app.py", line 446, in main
    terminal.window.mainloop()
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/tkinter/__init__.py", line 1283, in mainloop
    self.tk.mainloop(n)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/snappy/app.py", line 99, in edit_prefs
    dialog = PreferenceDialog(self.window, self.prefs)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/snappy/preferences.py", line 98, in __init__
    self.build_font_pane(notebook)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/snappy/preferences.py", line 163, in build_font_pane
    self.current_family = families.index(current_font['family'])
ValueError: '.SF NS Mono' is not in list

Can't use snappy with Python3 and macOS

Hi,

After trying a bit, I can't find a way to solve my issue.

I'm on macOS Catalina 10.15.3, and with Python 3.7.3

When I try to use snappy with Python2 it works ... but not with Python3. Apparently something is wrong with OpenGL but I can't say what exactly.

Here is my log in the terminal app.

Python 3.7.3 (default, Dec 13 2019, 19:58:14) 
[Clang 11.0.0 (clang-1100.0.33.17)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import snappy
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/rph/Library/Python/3.7/lib/python/site-packages/snappy/__init__.py", line 7, in <module>
    from .SnapPy import (AbelianGroup, HolonomyGroup, FundamentalGroup,
  File "cython/core/basic.pyx", line 45, in init SnapPy
  File "/Users/rph/Library/Python/3.7/lib/python/site-packages/snappy/horoviewer.py", line 3, in <module>
    from .CyOpenGL import (HoroballScene, OpenGLOrthoWidget,
  File "opengl/CyOpenGL.pyx", line 38, in init CyOpenGL
AttributeError: type object 'CyOpenGL.vector3' has no attribute '__reduce_cython__'

Thanks for your help :)

The snappy_manifold method of Mcomplex does not work in Python 3

In Python 3, running

>>> from snappy.snap.t3mlite import Mcomplex
>>> Mcomplex('4_1').snappy_manifold()

results in

ModuleNotFoundError: No module named 'StringIO'

due to an import StringIO in snap/t3mlite/mcomplex.py which does not work in Python 3 as this module was renamed to io. This was tested in Python 3.7.0 with SnapPy 2.7

SageMath 9.2 doctest issues

Should investigate these and fix if needed.

**********************************************************************
File "/ext/sage/sage-9.2/local/lib/python3.8/site-packages/spherogram/links/invariants.py", line 179, in spherogram.links.invariants.Link.alexander_matrix
Failed example:
    L.alexander_matrix()
Expected:
    ([   -1 1 - t     t]
    [    t    -1 1 - t]
    [1 - t     t    -1], [t, t, t])
Got:
    ([   -1     t 1 - t]
    [1 - t    -1     t]
    [    t 1 - t    -1], [t, t, t])
**********************************************************************
File "/ext/sage/sage-9.2/local/lib/python3.8/site-packages/spherogram/links/invariants.py", line 240, in spherogram.links.invariants.Link.alexander_polynomial
Failed example:
    K.alexander_polynomial(norm=False)
Expected:
    t2^-1 + t1^-1*t2^-4
Got:
    t1^-1*t2^-1 + t1^-2*t2^-4
**********************************************************************
File "/ext/sage/sage-9.2/local/lib/python3.8/site-packages/spherogram/links/invariants.py", line 599, in spherogram.links.invariants.Link.braid_word
Failed example:
    Link('K6a2').braid_word(as_sage_braid=True)
Expected:
    (s0^-1*s1)^2*s0^-2
Got:
    s0^-1*(s0^-1*s1)^2*s0^-1
**********************************************************************

M.verify_hyperbolicity(holonomy=True) doesn't work when there are more than 26 generators

Manifold("-cobLLzvvLvvLALvwvzwvwvzAALvLAwMLzzwLQMQPzQQQAQQQQQAQQPQcaeaeaiaoanamasaraxavaDaQaBaHaUaDaWaXa1a2a0a5a7aJaNaLa9aZa-aeb7afb5aabUaSaWa8a7a4aZaWaYa6aYa2aXa3akb0a2a+ahbcb8albhbib+a9aibkb-aibebjbfbjblbdbkbgbhbjblbnbnbnbiiafisfvbiolafbjgaaxdqaangrapmaataloopqquqxqetiaifgosrfjebrnnrffvgcrcxcfcfnarkf").verify_hyperbolicity(fundamental_group_args=[False], bits_prec=100)

raises the following exception:

~/anaconda3/envs/sage-93-py39/lib/python3.9/site-packages/snappy/snap/polished_reps.py in <genexpr>(.0)
    178         in a word yields the identity matrix or its negative.
    179         """
--> 180         rel_images = (self(R) for R in self.relators())
    181         return all(is_essentially_Id2(M) or is_essentially_Id2(-M)
    182                    for M in rel_images)

~/anaconda3/envs/sage-93-py39/lib/python3.9/site-packages/snappy/snap/polished_reps.py in __call__(self, word)
    164
    165     def __call__(self, word):
--> 166         return prod([self._hom_dict[g] for g in word], self._id)
    167
    168     def is_nonprojective_representation(self):

~/anaconda3/envs/sage-93-py39/lib/python3.9/site-packages/snappy/snap/polished_reps.py in <listcomp>(.0)
    164
    165     def __call__(self, word):
--> 166         return prod([self._hom_dict[g] for g in word], self._id)
    167
    168     def is_nonprojective_representation(self):

KeyError: 'x'

error: No module named 'snappy.CyOpenGL'

Having installed Snappy on Ubuntu (16.04 with python 3.9) as outlined in documentation,
I get the following error on starting it (~/.local/bin/SnapPy):

Traceback (most recent call last):
  File "~/.local/bin/SnapPy", line 5, in <module>
    from snappy.app import main
  File "~/.local/lib/python3.9/site-packages/snappy/app.py", line 17, in <module>
    from .browser import Browser
  File "~/.local/lib/python3.9/site-packages/snappy/browser.py", line 6, in <module>
    from .polyviewer import PolyhedronViewer
  File "~/.local/lib/python3.9/site-packages/snappy/polyviewer.py", line 6, in <module>
    from .CyOpenGL import *
ModuleNotFoundError: No module named 'snappy.CyOpenGL'

SnapPy 2.8 crashes on startup: error importing plink.ipython_tools

Hi,
I'm experiencing a crash in SnapPy 2.8, even though version 2.7 ran just fine on this system. The issue seems to be an import error related to plink, even though I have this module installed, so I'm led to believe it's a bug in SnapPy.

Here's the stderr output of SnapPy:
$ SnapPy
Traceback (most recent call last):
File "/usr/bin/SnapPy", line 5, in
from snappy.app import main
File "/usr/lib/python3.8/site-packages/snappy/app.py", line 11, in
from .gui import *
File "/usr/lib/python3.8/site-packages/snappy/gui.py", line 15, in
from plink.ipython_tools import IPythonTkRoot
ModuleNotFoundError: No module named 'plink.ipython_tools'

Some more information about my config:
$ python -m pip list | grep "plink"
plink 2.3
$ python --version
Python 3.8.3
$ python -m pip list | grep "snappy"
snappy 2.8
snappy-manifolds 1.1

Best wishes,
Rafael

Inaccurate volumes of Dirichlet domains

The volume of a DirichletDomain often does not match that of the associated Manifold. Here is a quite simple manifold where they only agree to three digits:

>>> M = snappy.Manifold('m004(1,2)')
>>> M.volume()
1.39850888415
>>> M.dirichlet_domain().volume()
1.393551248521783
>>> H = M.high_precision(); H.volume()
1.398508884150806640509594326663004920276433947325827118548221874
>>> H.dirichlet_domain().volume()
1.393551248521774626126463081235516657883615640326408683944746082

The problem is not with the location of the vertices of the domain. I did an alternate computation of the volume from the domain which gave the correct answer to 1e-62 when working at quad-double precision: I put a vertex at the barycenter of each face, coned out from that to divide each face into triangles, and then coned each of those triangles to the center, and used the general volume formula for a hyperbolic tetrahedron involving dilogarithms.

In contrast, the SnapPy kernel uses a decomposition of the Dirichlet domain into birectangular tets (possibly to simplify the volume formula) which can involve tetrahedra with both positive and negative volume, possibly creating some sort of accumulating numerical error.

Inside view improvements (GLSL raytracing)

  • Raytrace even when some tetrahedra are negatively oriented
  • Accelerate through the bananas ("Margulis tubes")
  • Recalculate shapes button (i.e., save original manifold and start surgery from a copy of original again)
  • Mouse over to get info about tetrahedron/edge num/face num/word

Browser: AKA field for a closed manifolds doesn't show Dehn filling coeffs

Neil Hoffman reports:

I noticed that in M.browse() the also known as feature is listing manifolds by 'name' instead of str(M). (see attached picture) This is fine for cusped manifolds but slightly confusing for closed manifolds. Of course, this behavior is only an issue for closed manifolds that are surgeries on more than one named/known manifold. For example, v3184(0,1) is also s882(1,2).

In[88]: v = Manifold('v3184')

In[89]: v.browse()

In[90]: v.dehn_fill((0,1),0)

In[91]: v.identify()

Out[91]: [s882(1,2)]

In[92]: vF = v.identify()[0]

In[93]: vF

Out[93]: s882(1,2)

In[94]: vF.name()

Out[94]: 's882'

In[95]: str(vF)

Out[95]: 's882(1,2)'

Screen Shot 2020-01-13 at 8 54 14 AM

Horoball viewer glitch

If the current peripheral framing is far from the one that minimizes the length of the basis curves, then the cusp neighborhood view can be missing various horoballs and cells of the triangulation and Ford domain. Here is an example, created by:

M = snappy.Manifold('m004')
M.set_peripheral_curves([[1, 0], [18, 1]])
N = M.cusp_neighborhood().view() 

2720439011-Cusp_neighborhood_of_m004_and_dev_—IPython__snappy_dev—_py3__pkgs_pythons_py36_bin_ipython

Another example is K14n18339; from the default position, just move to the right to see this image:

2281610583-Cusp_neighborhood_of_K14n18339

The root cause is likely in CyOpenGL.pyx, possibly in the build_shifts method of HoroballScene.

Reported by Saul Schleimer (https://bitbucket.org/t3m/snappy/issues/18/horoball-viewer-glitch).

Can't reproduce the solutions with PtolemyVariety

Hi (again),

Full disclosure, I'm currently working on PU(2,1) representations furnished by the PtolemyVariety (http://ptolemy.unhyperbolic.org/html/summary.html). Thank you for this work ... It helps me a lot for my research.

I have some issues with the reproducibility of the tables for PGL(3,C) representations.

Zero issue: on coordinates

This is not an issue, but it is a question that I didn't find its answer in the doc. What is the choice of the coordinates when talking about PU(2,1) representations?

First issue: retrieve_solutions()

First, I encountered a difficulty to retrieve the solutions. The code :

snappy.Manifold('m027').ptolemy_variety(3,'all').retrieve_solutions()

raise an AssertionError.

It depends on the choice of the manifold. I didn't have any issue with the manifolds requiring 2 or 3 tetrahedra. But when I tried with manifolds with 4 tetrahedra, lots of them give me something like the following:

Trying to retrieve solutions from http://ptolemy.unhyperbolic.org/data/pgl3/OrientableCuspedCensus/04_tetrahedra/m027__sl3_c0.magma_out ...
Parsing...
Trying to retrieve solutions from http://ptolemy.unhyperbolic.org/data/pgl3/OrientableCuspedCensus/04_tetrahedra/m027__sl3_c1.magma_out ...
Parsing...
  ***   Warning: increasing stack size to 8003584.
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/alexandre/Library/Python/2.7/lib/python/site-packages/snappy/ptolemy/manifoldMethods.py", line 165, in retrieve_solutions
    for p in self ])
  File "/Users/alexandre/Library/Python/2.7/lib/python/site-packages/snappy/ptolemy/ptolemyVariety.py", line 566, in retrieve_solutions
    return processFileDispatch.parse_solutions(text, numerical = numerical)
  File "/Users/alexandre/Library/Python/2.7/lib/python/site-packages/snappy/ptolemy/processFileDispatch.py", line 38, in parse_solutions
    return parse_decomposition(text).solutions(numerical)
  File "/Users/alexandre/Library/Python/2.7/lib/python/site-packages/snappy/ptolemy/utilities.py", line 216, in __call__
    return type(self)([elt(*args, **kwargs) for elt in self],
  File "/Users/alexandre/Library/Python/2.7/lib/python/site-packages/snappy/ptolemy/ptolemyVarietyPrimeIdealGroebnerBasis.py", line 136, in solutions
    return self._exact_solution()
  File "/Users/alexandre/Library/Python/2.7/lib/python/site-packages/snappy/ptolemy/ptolemyVarietyPrimeIdealGroebnerBasis.py", line 92, in _exact_solution
    number_field, ext_assignments = self._number_field_and_ext_assignments()
  File "/Users/alexandre/Library/Python/2.7/lib/python/site-packages/snappy/ptolemy/ptolemyVarietyPrimeIdealGroebnerBasis.py", line 76, in _number_field_and_ext_assignments
    process_extensions_to_pari(extensions))
  File "/Users/alexandre/Library/Python/2.7/lib/python/site-packages/snappy/ptolemy/solutionsToPrimeIdealGroebnerBasis.py", line 263, in process_extensions_to_pari
    number_field, ext_assignments = _process_extensions(extensions)
  File "/Users/alexandre/Library/Python/2.7/lib/python/site-packages/snappy/ptolemy/solutionsToPrimeIdealGroebnerBasis.py", line 220, in _process_extensions
    my_rnfequation(number_field, poly))
  File "/Users/alexandre/Library/Python/2.7/lib/python/site-packages/snappy/ptolemy/fieldExtensions.py", line 85, in my_rnfequation
    assert matrix.matrix_determinant(mat) == 0
AssertionError
  • For the particular choice of m027, Warning: increasing stack size to 8003584. is not an issue. But for others, I have to considerably increase the stack size ... and it bothers me a bit (is it truly necessary?).
  • I don't know how to prevent the assertion error at the bottom.

Second issue: is_pu_2_1_representation()

Thanks to the method _is_pu_2_1_representation(), I can test if a representation is in PU(2,1). Unfortunately, sometimes, I don't retrieve the same number of solutions as listed in http://ptolemy.unhyperbolic.org/html/pgl3/OrientableCuspedCensus/03_tetrahedra/summary.html.

I count the number of solutions in PU(2,1) with the following code (that also gives the coordinates of the representations in PU(2,1) in order to compare with the table given in the preceding link).

import numpy as np
import snappy

MANIFOLD = 'm007'

M = snappy.Manifold(MANIFOLD)
#M.ptolemy_variety(3,'all').retrieve_solutions(data_url="/Users/rph/Desktop/Knots-Simulations",prefer_rur=True)

G = M.fundamental_group(simplify_presentation = False)

solutions = M.ptolemy_variety(3,'all').retrieve_solutions()
numericalSolutions = solutions.numerical()

SOLUTIONS_DATA = []

def findSolutionsData():
    nObstructions = len(numericalSolutions)

    for i in range(nObstructions):
        obstructionSol = numericalSolutions[i]
        nParts = len(obstructionSol)

        for j in range(nParts):
            partSol = obstructionSol[j]

            if isinstance(partSol,list):
                nSolutions = len(partSol)
                #print(nSolutions)

                for k in range(nSolutions):
                    solution = partSol[k]
                    if solution.cross_ratios().is_pu_2_1_representation(0.001):
                        SOLUTIONS_DATA.append([i,j,k])
    return 0

findSolutionsData()
print('Has: '+str(len(SOLUTIONS_DATA)) + ' representations in PU(2,1).')
print(SOLUTIONS_DATA)
  • m006: ok we both have 17.
  • m007: I got 45 solutions instead of 15. This is quite strange!
  • m009: ok we both have 8.
  • m010: I got 12 instead of 4.
  • m011: I got 15 instead of 21.
  • m015: ok we both have 15.
  • m016: I got 16 instead of 24.
  • m017: I got 19 instead of 21.
  • m019: I got 12 instead of 24.

Probably my code is not right ... But since I'm not always wrong, I don't understand what is not right.


Thanks for your help :)

Conversion of SageMath link to SnapPy link results in mirror image

Using SageMath 9.4 and SnapPy 3.0.3, converting a SageMath link to a SnapPy link produces the mirror image of the original knot. This doesn't happen when converting the other way however. I tested this creating a variety of knots in both SageMath and in SnapPy in various ways. To demonstrate, running the code:

sage: L=snappy.Link('8_5') 
....: print("Snappy:",L.jones_polynomial(new_convention=False)) 
....: L2=L.sage_link() 
....: print("Sage:",L2.jones_polynomial()) 
....: L3=snappy.Link(L2) 
....: print("Snappy:",L3.jones_polynomial(new_convention=False)) 
....: L4=L3.sage_link() 
....: print("Sage:",L4.jones_polynomial()) 
....: L5=snappy.Link(L4) 
....: print("Snappy:",L5.jones_polynomial(new_convention=False)) 
....: print(L.signature(),L2.signature(),L3.signature(),L4.signature(),L5.signature())

Results in the output:

Snappy: 1 - q + 3*q^2 - 3*q^3 + 3*q^4 - 4*q^5 + 3*q^6 - 2*q^7 + q^8
Sage: t^8 - 2*t^7 + 3*t^6 - 4*t^5 + 3*t^4 - 3*t^3 + 3*t^2 - t + 1
Snappy: q^-8 - 2*q^-7 + 3*q^-6 - 4*q^-5 + 3*q^-4 - 3*q^-3 + 3*q^-2 - q^-1 + 1
Sage: -1/t + 3/t^2 - 3/t^3 + 3/t^4 - 4/t^5 + 3/t^6 - 2/t^7 + 1/t^8 + 1
Snappy: 1 - q + 3*q^2 - 3*q^3 + 3*q^4 - 4*q^5 + 3*q^6 - 2*q^7 + q^8
-4 -4 4 4 -4

time to drop python2 compatibility ?

in particular

  • usage of imports from __future__ and from six (done)
  • usage of xrange, iteritems and itervalues

Any opinion ?

Also:

  • remove object inheritance in classes

python-3.11 wheels ?

a new release with python-3.11 wheels would be awesome, unless there is pypi wheel size issue ?

Non-deterministic failure in DTcodec

The following code

from spherogram.codecs import DTcodec
DTcodec([(20, 22, 24, 26, 28, 10, 8, 6, 4, 2, 18, 16, 14, 12)])

or

DTcodec([(22, 20, 18, 16, 14, 12, 32, 30, 28, 26, 24, 2, 4, 6, 8, 10)])

sometimes succeeds and sometimes fails when trying to unpack marked_arc[:2] in DTFatGraph.bridge stack.

Background: The above DT codes were constructed as follows. Saul and I were trying to construct a family of two bridge knots with

from functools import reduce                                                                              
import operator                                                                                          
C, Id = snappy.RationalTangle(1), snappy.IdentityBraid(1)
x = sigma_1 = C | Id | Id                                                                                
y = sigma_2_inverse = Id | -C | Id                                                                        
def braid(n): return reduce(operator.mul, n*[x, y]).numerator_closure().exterior()
# these manifolds (two-bridge knot complements) are "designed" to have 
# Dirichlet domains with volume and diameter linear both in n - that is, they are "skinny".
# (I wanted to see the geometric convergence of the manifold to the cyclic
# cover of the figure eight knot complement.)
M=braid(7)
M.volume()
19.8015843460970
M.high_precision().dirichlet_domain().view()

which runs into the above problem when calling HP._set_DTcode(DTcodec(DT)) to transfer the DT code from the low to the high precision manifold.

TypeError: can't set attributes of built-in/extension type 'type'

On import snappy with SnapPy 2.8 from PyPi and Python 3.9.1 on Linux I got

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-1-4b977935db88> in <module>
----> 1 import snappy
      2 from snappy import Manifold

~/conda/envs/sage/lib/python3.9/site-packages/snappy/__init__.py in <module>
      5 #logging.debug('This message should go to the log file')
      6 import sys
----> 7 from .SnapPy import (AbelianGroup, HolonomyGroup, FundamentalGroup,
      8                      DirichletDomain, CuspNeighborhood, SymmetryGroup,
      9                      AlternatingKnotExteriors, NonalternatingKnotExteriors,

cython/core/fundamental_group.pyx in init SnapPy()

cython/core/fundamental_group.pyx in SnapPy.HolonomyGroup.use_field_conversion()

TypeError: can't set attributes of built-in/extension type 'type'

Upon downgrading to Python 3.8.6 I can import successfully.

I notice that you already added tests for Python 3.9, so I figure you're probably on top of this already. But I wanted to report it anyway in case someone else has this error. Thanks!

pop-up browser not working

I have just downloaded SnapPy on my windows computer and tried using the Manifold.browse command but no pop-up comes up. I just get the following message in brackets:

function Manifold.browse

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.