CYTools

website·Indexed 31 days ago

https://cy.tools

An open-source software package for analyzing Calabi-Yau manifolds and lattice polytopes. It provides Python classes for managing triangulations, toric varieties, polyhedral cones, and reflexive polytopes, featuring fast algorithms for triangulating point configurations using CGAL and Qhull backends.

Tokens
25.5K
Snippets
158
Records
203
Agent score
65%

What's inside CYTools

  1. Overview of CYTools for reflexive polytopes and Calabi-Yau hypersurfaces

    CYTools is an open-source toolset providing fast algorithms to handle and triangulate reflexive polytopes. It is designed to extract data for associated Calabi-Yau hypersurfaces and is capable of exploring the entire Kreuzer-Skarke database, including cases with the largest Hodge numbers.
  2. Overview of CYTools core Python classes

    CYTools is a Python library for computations related to lattice polytopes and Calabi-Yau manifolds. It organizes its functionality into six primary classes:

    • Polytope: Handles lattice polytope computations, including lattice points, faces, and topological properties of Calabi-Yau hypersurfaces for reflexive polytopes.
    • PolytopeFace: Manages computations specifically relating to the faces of lattice polytopes.
    • Triangulation: Handles triangulations of lattice polytopes, computes triangulation properties, and can construct ToricVariety or CalabiYau objects.
    • ToricVariety: Used for computations relating to toric varieties, such as intersection numbers and the Kähler cone.
    • CalabiYau: Handles computations for Calabi-Yau manifolds, including intersection numbers and toric Mori and Kähler cones.
    • Cone: Manages rational polyhedral cones, including cone duality and extremal ray computations, primarily for studying Kähler and Mori cones.
  3. Overview of CYTools for Calabi-Yau manifold analysis

    CYTools is an open-source software package designed for studying Calabi-Yau manifolds arising from the Kreuzer-Skarke database. It is primarily written in Python and provides high computational performance for exploring the string landscape. The package is distributed under the GNU General Public License version 3 (GPLv3).
  4. Overview of CYTools installation and usage

    CYTools is an open-source software package designed for Unix-like systems, primarily distributed as a conda environment. It provides tools for computations involving polytopes and triangulations. Installation is available for Linux, MacOS, and Windows.
  5. System requirements for CYTools on Linux and macOS

    To run CYTools, the following system requirements must be met:

    • Operating System: Almost any Linux distribution or macOS version 10.13 or newer.
    • Linux Hardware: A modern x86-64 processor with hardware virtualization enabled. Other architectures may require emulation and may encounter issues.
    • macOS Hardware: Any modern Apple computer (including those with Apple silicon processors).
    • Software: A conda installation is highly recommended (Miniforge is the preferred distribution).
  6. Create and analyze a lattice Polytope

    The Polytope class in CYTools is used to define lattice polytopes by specifying a list of points that define the convex hull. Note that any floating point numbers provided are truncated to integers as only lattice polytopes are supported. You can retrieve the full list of lattice points using .points() and find faces of a specific dimension using .faces(d=dimension).
    from cytools import Polytope
    
    # Create a polytope from a list of points
    p = Polytope([[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1],[-1,-1,-1,-1]])
    
    # Print polytope info
    print(p)
    
    # Get all lattice points
    all_points = p.points()
    
    # Get 2-dimensional faces
    faces_2d = p.faces(d=2)
  7. Create PolytopeFace objects using the Polytope class

    The cytools.polytopeface.PolytopeFace class handles computations for faces of lattice polytopes. Users should not construct PolytopeFace objects directly; instead, they should be created using the faces() method of the Polytope class.
    from cytools import Polytope
    # Create a polytope
    p = Polytope([[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1],[-1,-1,-1,-1]])
    # Find the 3-dimensional faces
    faces_3 = p.faces(3)
    # Access the first 3-face
    first_face = faces_3[0]
  8. Remove CYTools from Windows WSL

    To remove the CYTools environment, run the following command in the WSL terminal. Replace cytools with cytools-dev if the development version was installed. To remove all associated installed packages, append the --all flag.
    conda env remove --name cytools
    # Or to remove all packages:
    conda env remove --name cytools --all
  9. Prerequisites for installing CYTools on Windows

    CYTools installation on Windows is performed exclusively via the Windows Subsystem for Linux (WSL). The following requirements must be met:

    • A recent version of Windows 10 or 11.
    • A modern x86-64 processor with hardware virtualization enabled.
    • A functional WSL installation.
  10. Manage memory and caching in CYTools

    CYTools classes cache expensive computations as hidden attributes. To prevent memory exhaustion when processing a large number of polytopes or triangulations, you can either manually clear the cache or use generators instead of lists.
    from cytools import Polytope
    
    p = Polytope([[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1],[-1,-1,-1,-1]]).dual()
    
    # Option 1: Use a generator (Preferable) 
    # Remove as_list=True to avoid loading all triangulations into memory
    triangs = p.random_triangulations_fast(N=100)
    for t in triangs:
        cy = t.get_cy()
        # ... computations ...
    
    # Option 2: Manually clear cache
    triangs_list = p.random_triangulations_fast(N=100, as_list=True)
    for t in triangs_list:
        cy = t.get_cy()
        # ... computations ...
        t.clear_cache()
  11. Optimize GNN sampling for large polytopes

    For large polytopes, it is more efficient to build the GNN-sampled 2-face FRT pools once using face_triangs and then reuse them across multiple NTFE draws via ntfe_frts.
    verts = [[-1,-1,-1,-1],[-1,-1,-1,3],[-1,-1,3,-1],[-1,3,-1,-1],
             [ 1,-1,-1,-1],[ 1,-1,-1,3],[ 1,-1,3,-1],[ 1,3,-1,-1]]
    p = Polytope(verts) # h11=86
    
    # Step 1: Build pools (expensive step)
    pools = p.face_triangs(
        dim=2, triang_method="dualgnn", max_npts=0, N_face_triangs=50, seed=0
    )
    
    # Step 2: Draw NTFEs (cheap step)
    frsts = p.ntfe_frts(N=300, face_triangs=pools, make_star=True, seed=0)