Talking with SnapPy

Since Regina 4.95, a default installation of Regina can talk directly with a default installation of SnapPy on many platforms. This includes MacOS X 10.7 or greater (if you installed the SnapPy app bundle in the usual Applications folder), and GNU/Linux (if your SnapPy uses the default system Python installation).

Simply type import snappy from within any of Regina's Python environments. You can use Regina's functions NTriangulation.snapPea() and NTriangulation() to get information out of and into Regina as strings, and you can hook these up to SnapPy's functions Manifold() and Manifold._to_string() at the other end. See the example below.

Warning

At present, SnapPy (version 2.0.3) is not compatible with multiple Python interpreters. If you import SnapPy into more than one Python console in the graphical user interface, SnapPy may stop working. See this troubleshooting entry for details.

bab@ember:~$ regina-python 
Regina 4.95
Software for 3-manifold topology and normal surface theory
Copyright (c) 1999-2013, The Regina development team
>>> import snappy
>>> m = snappy.Manifold('m001')
>>> t = NTriangulation(m._to_string())
>>> print t.detail()
Size of the skeleton:
  Tetrahedra: 2
  Triangles: 4
  Edges: 2
  Vertices: 1

Tetrahedron gluing:
  Tet  |  glued to:      (012)      (013)      (023)      (123)
  -----+-------------------------------------------------------
    0  |               1 (103)    1 (320)    1 (210)    1 (132)
    1  |               0 (320)    0 (102)    0 (310)    0 (132)

Vertices:
  Tet  |  vertex:    0   1   2   3
  -----+--------------------------
    0  |             0   0   0   0
    1  |             0   0   0   0

Edges:
  Tet  |  edge:   01  02  03  12  13  23
  -----+--------------------------------
    0  |           0   1   1   1   1   0
    1  |           0   1   1   1   1   0

Triangles:
  Tet  |  face:  012 013 023 123
  -----+------------------------
    0  |           0   1   2   3
    1  |           2   0   1   3


>>> t2 = NExampleTriangulation.figureEightKnotComplement()
>>> m2 = snappy.Manifold(t2.snapPea())
>>> print m2.volume()
2.02988321282
>>>