Esempio n. 1
0
def test_new_census(census, max_errors=20):
    file = open('../manifold_src/' + census + '.csv')
    data = csv.DictReader(file)
    errors = 0
    for row in data:
        M_old = snappy.Triangulation(row['name'])
        M_new = snappy.Triangulation(row['triangulation'])
        M_new.set_name(row['name'])
        if not same_labeled_triangulation_and_peripheral_curves(M_old, M_new):
            print(row['name'], row['triangulation'])
            errors += 1
            if errors >= max_errors:
                break
Esempio n. 2
0
    def splitting(self,
                  gluing,
                  handles,
                  name=None,
                  optimize=True,
                  warnings=True,
                  debugging_level=0,
                  return_type='manifold'):
        ''' Generate a manifold with Heegaard splitting this surface from mapping class group data using the Twister
        program of Bell, Hall and Schleimer.
        
        Arguments:
        Required:
         gluing - the gluing used to join the upper and lower compression bodies
         handles - where to attach 2-handles
        Optional:
         name - name of the resulting manifold
         optimize - try to reduce the number of tetrahedra (default True)
         warnings - print Twister warnings (default True)
         debugging_level - specifies the amount of debugging information to be shown (default 0)
         return_type - specifies how to return the manifold, either as a 'manifold' (default), 'triangulation' or 'string'
        
        Gluing is a word of annulus and rectangle names (or
        their inverses).  These are read from left to right and determine a
        sequence of (half) Dehn twists.  When prefixed with an "!" the name
        specifies a drilling.  For example, "a*B*a*B*A*A*!a*!b" will perform 6
        twists and then drill twice.
        
        Handles is again a word of annulus names (or inverses).  For example,
        'a*c*A' means attach three 2-handles, two above and one below.
        
        Examples:
        
        The genus two splitting of the solid torus:
        >>> M = twister.Surface('S_2').splitting(gluing='', handles='a*B*c') '''

        if name is None: name = gluing + ' ' + handles
        tri, messages = build_splitting(name, self.surface_contents, gluing,
                                        handles, optimize, True, warnings,
                                        debugging_level)

        # You might want to change what is done with any warning / error messages.
        # Perhaps they should be returned in the next block?
        if messages != '': print(messages)

        if tri is None:
            return None

        return_type = return_type.lower()
        if return_type == 'manifold':
            return snappy.Manifold(tri)
        if return_type == 'triangulation':
            return snappy.Triangulation(tri)
        if return_type == 'string':
            return tri

        raise TypeError(
            'Return type must be \'manifold\', \'triangulation\' or \'string\'.'
        )
Esempio n. 3
0
    def bundle(self,
               monodromy,
               name=None,
               optimize=True,
               warnings=True,
               debugging_level=0,
               return_type='manifold'):
        ''' Generate a surface bundle over a circle with fibre this surface from mapping class group data using the Twister
        program of Bell, Hall and Schleimer.
        
        Arguments:
        Required:
         monodromy - build a surface bundle with specified monodromy
        Optional:
         name - name of the resulting manifold
         optimize - try to reduce the number of tetrahedra (default True)
         warnings - print Twister warnings (default True)
         debugging_level - specifies the amount of debugging information to be shown (default 0)
         return_type - specifies how to return the manifold, either as a 'manifold' (default), 'triangulation' or 'string'
        
        Monodromy is a word of annulus and rectangle names (or
        their inverses).  These are read from left to right and determine a
        sequence of (half) Dehn twists.  When prefixed with an "!" the name
        specifies a drilling.  For example, "a*B*a*B*A*A*!a*!b" will perform 6
        twists and then drill twice.
        
        Examples:
        
        The figure eight knot complement:
        >>> M = twister.Surface((1,1)).bundle(monodromy='a_0*B1')
        
        The minimally twisted six chain link:
        >>> M = twister.Surface('S_1_1').bundles(monodromy='!a*!b*!a*!b*!a*!b')
        >>> M.set_peripheral_curves('shortest_meridians', 0)
        >>> M.dehn_fill((1,0),0) '''

        if name is None: name = monodromy
        tri, messages = build_bundle(name, self.surface_contents, monodromy,
                                     optimize, True, warnings, debugging_level)

        # You might want to change what is done with any warning / error messages.
        # Perhaps they should be returned in the next block?
        if messages != '': print(messages)

        if tri is None:
            return None

        return_type = return_type.lower()
        if return_type == 'manifold':
            return snappy.Manifold(tri)
        if return_type == 'triangulation':
            return snappy.Triangulation(tri)
        if return_type == 'string':
            return tri

        raise TypeError(
            'Return type must be \'manifold\', \'triangulation\' or \'string\'.'
        )
Esempio n. 4
0
 def __init__(self, tetrahedron_list=None):
   if tetrahedron_list is None:
        tetrahedron_list = []
   if isinstance(tetrahedron_list, str) and snappy == None:
        tetrahedron_list = tets_from_data(files.read_SnapPea_file(file_name=tetrahedron_list))
   if snappy:
        if isinstance(tetrahedron_list, str):
             tetrahedron_list = snappy.Triangulation(tetrahedron_list)
        if isinstance(tetrahedron_list, (snappy.Triangulation, snappy.Manifold)):
             tetrahedron_list = tets_from_data(files.read_SnapPea_file(data=tetrahedron_list._to_string()))
      
   self.Tetrahedra = tetrahedron_list
   self.Edges                = []
   self.Faces                = []
   self.Vertices             = []
   self.NormalSurfaces       = []
   self.AlmostNormalSurfaces = []
   Mcomplex.Count += 1
   self.build()
Esempio n. 5
0
def main_test():
    import snappy
    censuses = [snappy.OrientableClosedCensus[:100], 
                snappy.OrientableCuspedCensus(filter='tets<7'),
                snappy.NonorientableClosedCensus,
                snappy.NonorientableCuspedCensus,
                snappy.CensusKnots(), 
                snappy.HTLinkExteriors(filter='cusps>3 and volume<14'),
                [snappy.Manifold(name) for name in asymmetric]]
    tests = 0
    for census in censuses:
        for M in census:
            isosig = decorated_isosig(M, snappy.Triangulation)
            N = snappy.Triangulation(isosig)
            assert same_peripheral_curves(M, N), M
            assert isosig == decorated_isosig(N, snappy.Triangulation), M
            assert M.homology() == N.homology()
            tests += 1
    print('Tested decorated isosig encode/decode on %d triangulations' % tests)
Esempio n. 6
0
    def __init__(self, tetrahedron_list=None):
        if tetrahedron_list is None:
            tetrahedron_list = []
        if isinstance(tetrahedron_list, str) and snappy == None:
            tetrahedron_list = tets_from_data(
                files.read_SnapPea_file(file_name=tetrahedron_list))
        if snappy:
            if isinstance(tetrahedron_list, str):
                tetrahedron_list = snappy.Triangulation(
                    tetrahedron_list, remove_finite_vertices=False)
            if hasattr(tetrahedron_list, '_get_tetrahedra_gluing_data'):
                tetrahedron_list = tets_from_data(
                    tetrahedron_list._get_tetrahedra_gluing_data())

        self.Tetrahedra = tetrahedron_list
        self.Edges = []
        self.Faces = []
        self.Vertices = []
        self.NormalSurfaces = []
        self.AlmostNormalSurfaces = []
        self.build()
Esempio n. 7
0
def get_triangulation_tester():
    """
    >>> get_triangulation_tester()
    L13n9331(0,0)(0,0)(0,0) 16.64369585 Z + Z + Z
    m003(0,0) 2.02988321 Z/5 + Z
    m004(0,0) 2.02988321 Z
    v1205(2,3) 4.70744340 Z/40
    x012(0,0)(0,0) 3.54972978 Z/2 + Z
    y123(0,0) 5.02755480 Z
    L13n9331(3,4)(2,3)(2,1) 14.60215339 Z/53
    K7_1(0,0) 3.57388254 Z
    6_1(0,0) 3.16396323 Z
    5^2_1(3,4)(1,-2) 2.73300075 Z/3
    8^3_3(0,0)(0,0)(0,0) 8.96736085 Z + Z + Z
    4_1(0,0) 2.02988321 Z
    12n123(0,0) 18.15036328 Z
    16n1235(0,0) 21.29383093 Z
    b++RL(0,0) 2.02988321 Z
    b-+RRL(0,0) 2.40690959 Z/3 + Z
    b+-RL(0,0) 2.02988321 Z/5 + Z
    b--RRL(0,0) 2.40690959 Z/3 + Z
    Braid:[1, 2, -1, -2](0,0)(0,0) 4.05976643 Z + Z
    DT:[(8, 10, -14), (2, 6, 20), (-4, 22, 24, 12, 26, 18, 16)](0,0)(0,0)(0,0) 16.64369585 Z + Z + Z
    DT[4,6,2](0,0) 0.00000000 Z
    DT[mcccgdeGacjBklfmih](0,0)(0,0)(0,0) 16.64369585 Z + Z + Z
    DT:mcccgdeGacjBklfmih(0,0)(0,0)(0,0) 16.64369585 Z + Z + Z
    a_0*B_1(0,0) 2.02988321 Z
    b_1*A_0 a_0*B_1(1,0) 0.00001202 Z/2
    L13n9331(0,0)(0,0)(0,0) Z + Z + Z
    m003(0,0) Z/5 + Z
    m004(0,0) Z
    v1205(2,3) Z/40
    x012(0,0)(0,0) Z/2 + Z
    y123(0,0) Z
    L13n9331(3,4)(2,3)(2,1) Z/53
    K7_1(0,0) Z
    6_1(0,0) Z
    5^2_1(3,4)(1,-2) Z/3
    8^3_3(0,0)(0,0)(0,0) Z + Z + Z
    4_1(0,0) Z
    12n123(0,0) Z
    16n1235(0,0) Z
    b++RL(0,0) Z
    b-+RRL(0,0) Z/3 + Z
    b+-RL(0,0) Z/5 + Z
    b--RRL(0,0) Z/3 + Z
    Braid:[1, 2, -1, -2](0,0)(0,0) Z + Z
    DT:[(8, 10, -14), (2, 6, 20), (-4, 22, 24, 12, 26, 18, 16)](0,0)(0,0)(0,0) Z + Z + Z
    DT[4,6,2](0,0) Z
    DT[mcccgdeGacjBklfmih](0,0)(0,0)(0,0) Z + Z + Z
    DT:mcccgdeGacjBklfmih(0,0)(0,0)(0,0) Z + Z + Z
    a_0*B_1(0,0) Z
    b_1*A_0 a_0*B_1(1,0) Z/2
    """

    M = snappy.HTLinkExteriors['L13n9331']
    specs = [
        M._to_string(),
        'm003',
        'm004',
        'v1205(2,3)',
        'x012',
        'y123',
        'L13n9331(3,4)(2,3)(2,1)',
        'K7_1',
        '6_1',
        '5^2_1(3,4)(1,-2)',
        '8_3^3',
        'L104001',
        '12n123',
        '16n1235',
        'b++RL',
        'b-+RRL',
        'b+-RL',
        'b--RRL',
        'Braid[1,2,-1,-2]',
        'DT:' + repr(M.DT_code()),
        'DT[4,6,2]',
        'DT[' + M.DT_code(alpha=True) + ']',
        'DT:' + M.DT_code(alpha=True),
        'Bundle(S_{1,1}, [a_0, B_1])',
        'Splitting(S_{1,0}, [b_1, A_0], [a_0,B_1])',
    ]

    for spec in specs:
        M = snappy.Manifold(spec)
        print(M, M.volume(), M.homology())

    for spec in specs:
        M = snappy.Triangulation(spec)
        print(M, M.homology())
Esempio n. 8
0
 def isosig(self):
     return snappy.Triangulation(
         self._snappea_file_contents(),
         remove_finite_vertices=False).triangulation_isosig(decorated=False)
Esempio n. 9
0
 def snappy_triangulation(self):
     """
    >>> Mcomplex('4_1').snappy_manifold().homology()
    Z
    """
     return snappy.Triangulation(self._snappea_file_contents())
Esempio n. 10
0
 def snappy_triangulation(self):
     return snappy.Triangulation(self._snappea_file_contents())