Introduction

PySheaf is a Python module that implements cellular sheaves with a view towards computing useful invariants such as cohomology, consistency radius, and induced maps. It is based on the idea that cell complexes are topological spaces, and that sheaves on cell complexes have at least that structure with some additional information as well. The design follows the principles set out in the following book, which might be helpful to consult:

Michael Robinson, Topological Signal Processing, Springer, 2014.

Although PySheaf can compute (co)homology of sheaves and cell complexes, the primary workflow for sheaves is

  1. Construct the Sheaf instance, which involves defining lists of SheafCell and SheafCoface instances. Presently, the Sheaf instance will remain fixed once constructed. Therefore, make sure to have all stalks and restrictions defined at this point!
  2. If you want to compute cohomology of the Sheaf, you can do so using the Sheaf.cohomology() or Sheaf.betti()
  3. Construct various Section instances for the data you have. Key point: a Section refers to a local section. Its SectionCell members refer to the Sheaf you’ve just finished building, so you must built the Sheaf first!
  4. Process the data using the Sheaf and Section instances:
    1. You can measure the consistency using Sheaf.consistencyRadius()
    2. You can fit a nearest global section using Sheaf.fuseAssignment()
    3. You may also use Section.extend()
  5. If you want to relate your Sheaf to others, you may construct a SheafMorphism instance, which incidentally may also be used as a restriction morphism if you want to build a Sheaf of sheaves!

For cell complexes, you can do steps (1) and (2). Instead of a Sheaf, you define a CellComplex built from lists of Cell and Coface instances.

PySheaf is very much under active development and exploration, since there aren’t well-established ways of computing using sheaves to process data. Expect some rough edges, but feel free to suggest improvements!