Database of cylinder diagrams and quadratic permutations#

Databases for translation surfaces.

This file contain different databases (with different implementations) for algorithms related to translation surfaces:

  • structure of Strebel differentials for quadratic differentials in order to differentiate

  • database of separatrix and cylinder diagrams up to isomorphism

  • database of volume of connected components of Abelian strata

class surface_dynamics.databases.flat_surfaces.CylinderDiagrams(path=None, read_only=True)[source]#

Bases: GenericRepertoryDatabase

Database of cylinder diagrams.

The database consists of several files with the following name convention: “stratum-component-ncyls”. As an example, the list of 3-cylinder diagrams in the odd component of H(2,2) is named “2_2-odd-3”.

EXAMPLES:

sage: from surface_dynamics import *
sage: from surface_dynamics.databases.flat_surfaces import CylinderDiagrams
sage: import os

sage: C = CylinderDiagrams()
sage: a = AbelianStratum(3,1,1,1).unique_component()
sage: C.filename(a, 2)
'cyl_diags-3_1_1_1-c-2'
sage: os.path.isfile(os.path.join(C.path, C.filename(a, 2)))
True
sage: l = list(C.get_iterator(a, 2))
sage: l[0]
(0,9)-(0,5,7,8,6) (1,6,2,5,3,8,4,7)-(1,2,3,9,4)
sage: l[0].ncyls()
2
sage: l[0].stratum()
H_4(3, 1^3)
count(comp, ncyls=None)[source]#

Returns the number of cylinder diagrams for a stratum or a component of stratum with given number of cylinders.

default_path = '/usr/share/miniconda3/envs/test/lib/python3.10/site-packages/surface_dynamics/databases/cylinder_diagrams'#
filename(comp, ncyls)[source]#

Returns the name of the file for the given component comp and the given of number of cylinders ncyls.

EXAMPLES:

sage: from surface_dynamics import *
sage: from surface_dynamics.databases.flat_surfaces import CylinderDiagrams
sage: C = CylinderDiagrams()
sage: C.filename(AbelianStratum(4).odd_component(), 3)
'cyl_diags-4-odd-3'
sage: C.filename(AbelianStratum(3,3).hyperelliptic_component(), 2)
'cyl_diags-3_3-hyp-2'
get_iterator(comp, ncyls=None)[source]#

Returns an iterator over the list of cylinder diagrams for the component comp read from the database.

INPUT:

  • comp - a component of stratum

  • ncyls - number of cylinders

EXAMPLES:

sage: from surface_dynamics import *

sage: from surface_dynamics.databases.flat_surfaces import CylinderDiagrams
sage: import os

sage: C = CylinderDiagrams(tmp_dir(), read_only=False)

sage: A = AbelianStratum(2)
sage: a = A.unique_component()
sage: C.update(A)
sage: list(C.get_iterator(a)) == A.cylinder_diagrams()
True

sage: C.clean()
sage: C.get_iterator(a)
Traceback (most recent call last):
...
ValueError: not in the database
has_component(comp)[source]#

Test whether the database has the component comp.

EXAMPLES:

sage: from surface_dynamics import *
sage: from surface_dynamics.databases.flat_surfaces import CylinderDiagrams
sage: import tempfile

sage: tmp_dir = tempfile.TemporaryDirectory()
sage: C = CylinderDiagrams(tmp_dir.name, read_only=False)
sage: C.clean()

sage: a1 = AbelianStratum(4).odd_component()
sage: a2 = AbelianStratum(1,1,1,1).unique_component()

sage: C.has_component(a1)
False
sage: C.has_component(a2)
False
sage: C.update(AbelianStratum(4))
sage: C.has_component(a1)
True

sage: C.has_component(a2)
False

sage: C.has_component(-19)
Traceback (most recent call last):
...
AssertionError: the argument must be a component of stratum of Abelian differentials
has_stratum(stratum)[source]#

Test whether the database contains the data for a given stratum.

EXAMPLES:

sage: from surface_dynamics import *

sage: from surface_dynamics.databases.flat_surfaces import CylinderDiagrams
sage: import os

sage: C = CylinderDiagrams(tmp_dir(), read_only=False)
sage: C.clean()

sage: a1 = AbelianStratum(4)
sage: a2 = AbelianStratum(1,1,1,1)

sage: C.has_stratum(a1)
False
sage: C.has_stratum(a2)
False
sage: C.update(AbelianStratum(4))
sage: C.has_stratum(a1)
True

sage: C.has_stratum(a2)
False

sage: C.has_stratum(1)
Traceback (most recent call last):
...
AssertionError: the argument must be a stratum of Abelian differential
list_strata()[source]#

List available strata in that database.

EXAMPLES:

sage: from surface_dynamics import *

sage: from surface_dynamics.databases.flat_surfaces import CylinderDiagrams
sage: import os

sage: C = CylinderDiagrams(tmp_dir(), read_only=False)
sage: C.clean()

sage: C.list_strata()
[]
sage: C.update(AbelianStratum(1,1))
sage: C.list_strata()
[H_2(1^2)]
sage: C.update(AbelianStratum(2))
sage: C.list_strata()
[H_2(2), H_2(1^2)]
update(stratum, verbose=False)[source]#

Compute once for all the given cylinder diagrams of the given stratum.

Warning:

Depending on the dimension of the stratum, it may be very long!

EXAMPLES:

sage: from surface_dynamics import *

sage: from surface_dynamics.databases.flat_surfaces import CylinderDiagrams

sage: C = CylinderDiagrams(tmp_dir(), read_only=False)
sage: C.update(AbelianStratum(4), verbose=True) # random
computation for H_3(4)
 ncyls = 1
 1 cyl. diags for H_3(4)^hyp
 2 cyl. diags for H_3(4)^odd
 ncyls = 2
 2 cyl. diags for H_3(4)^hyp
 4 cyl. diags for H_3(4)^odd
 ncyls = 3
 2 cyl. diags for H_3(4)^hyp
 4 cyl. diags for H_3(4)^odd
sage: sorted(os.listdir(C.path))
['cyl_diags-4-hyp-1',
 'cyl_diags-4-hyp-2',
 'cyl_diags-4-hyp-3',
 'cyl_diags-4-odd-1',
 'cyl_diags-4-odd-2',
 'cyl_diags-4-odd-3']
class surface_dynamics.databases.flat_surfaces.GenericRepertoryDatabase(path=None, read_only=True)[source]#

Bases: object

Database that consists of a list of files in a repertory.

clean()[source]#

Clean the database.

EXAMPLES:

sage: from surface_dynamics import *
sage: from surface_dynamics.databases.flat_surfaces import CylinderDiagrams
sage: import tempfile

sage: tmp_dir = tempfile.TemporaryDirectory()
sage: C = CylinderDiagrams(tmp_dir.name, read_only=False)
sage: C.update(AbelianStratum(4))
sage: import os
sage: sorted(os.listdir(C.path))
['cyl_diags-4-hyp-1',
 'cyl_diags-4-hyp-2',
 'cyl_diags-4-hyp-3',
 'cyl_diags-4-odd-1',
 'cyl_diags-4-odd-2',
 'cyl_diags-4-odd-3']
sage: C.clean()
sage: os.listdir(C.path)
[]
default_name = 'generic_db'#
class surface_dynamics.databases.flat_surfaces.IrregularComponentTwins(path=None, read_only=True)[source]#

Bases: GenericRepertoryDatabase

Twin data of generalized permutation of irregular components of strata of Abelian differentials.

count(stratum)[source]#

Returns the number of twins for that stratum.

EXAMPLES:

sage: from surface_dynamics import *

sage: from surface_dynamics.databases.flat_surfaces import IrregularComponentTwins
sage: D = IrregularComponentTwins()
sage: Q = QuadraticStratum(12)
sage: len(D.get(Q))
82
sage: D.count(Q)
82
default_path = '/usr/share/miniconda3/envs/test/lib/python3.10/site-packages/surface_dynamics/databases/generalized_permutation_twins'#
filename(stratum)[source]#

Returns the name of the file for the given component.

EXAMPLES:

sage: from surface_dynamics import *

sage: from surface_dynamics.databases.flat_surfaces import IrregularComponentTwins
sage: D = IrregularComponentTwins()
sage: D.filename(QuadraticStratum(12))
'twins-12-irr'
sage: D.filename(QuadraticStratum(2,2))
Traceback (most recent call last):
...
AssertionError: the stratum has no irregular component
get(stratum)[source]#

Get the list of twins for the stratum of quadratic differentials stratum.

EXAMPLES:

sage: from surface_dynamics import *

sage: from surface_dynamics.databases.flat_surfaces import IrregularComponentTwins
sage: D = IrregularComponentTwins()
sage: l = D.get(QuadraticStratum(6,3,-1))
sage: l[0]
((1, 2, 0, 4, 6, 7, 8, 9, 10, 11, 12, 13, 5, 3),)
sage: len(l)
32
has_stratum(stratum)[source]#

Test whether the component is in the database.

EXAMPLES:

sage: from surface_dynamics import *

sage: from surface_dynamics.databases.flat_surfaces import IrregularComponentTwins
sage: D = IrregularComponentTwins()
sage: D.has_stratum(QuadraticStratum(12))
True
list_strata()[source]#

Returns the list of components for which the list of twins is stored.

EXAMPLES:

sage: from surface_dynamics.databases.flat_surfaces import IrregularComponentTwins
sage: G = IrregularComponentTwins()
sage: G.list_strata()
[Q_3(9, -1), Q_3(6, 3, -1), Q_4(12), Q_3(3^3, -1), Q_4(6^2), Q_4(9, 3), Q_4(6, 3^2), Q_4(3^4)]
update(stratum)[source]#

Update the database with the irregular component of the given stratum.

The database should not be in read only mode.

surface_dynamics.databases.flat_surfaces.line_count(filename)[source]#

Returns the number of lines in the file whose name is filename.