Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support angles greater 2π in EquiangularPolygons #170

Draft
wants to merge 9 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 29 additions & 7 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,39 @@ jobs:
- name: Install dependencies
shell: bash -l {0}
run: |
mamba install codespell=2.2.2 pycodestyle=2.9.1
mamba install codespell=2.2.2
- name: Run codespell
shell: bash -l {0}
run: codespell flatsurf
pycodestyle:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
with: { submodules: recursive }
- uses: conda-incubator/setup-miniconda@v2
with: { miniforge-variant: "Mambaforge", miniforge-version: "latest" }
- name: Install dependencies
shell: bash -l {0}
run: |
mamba install pycodestyle=2.9.1
- name: Run pycodestyle
shell: bash -l {0}
# We currently only check for some warnings. We should enable & fix more of them.
run: pycodestyle --select=E111,E306,E401,E701,E702,E703,E704,W391,W605,E711,E713,E714,E721,E722 flatsurf/
- uses: flatsurf/actions/show-logs@main
if: ${{ always() }}

env:
MAKEFLAGS: -j2
SAGE_NUM_THREADS: 2
black:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
with: { submodules: recursive }
- uses: conda-incubator/setup-miniconda@v2
with: { miniforge-variant: "Mambaforge", miniforge-version: "latest" }
- name: Install dependencies
shell: bash -l {0}
run: |
mamba install black=22.12
- name: Run black
shell: bash -l {0}
run: black **/*.py
- name: Detect changes
shell: bash -l {0}
run: git diff --exit-code
68 changes: 43 additions & 25 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,29 @@

# -- General configuration ------------------------------------------------
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.todo',
'sphinx.ext.mathjax',
'sphinx.ext.viewcode',
'sphinx.ext.intersphinx',
'myst_nb',
"sphinx.ext.autodoc",
"sphinx.ext.todo",
"sphinx.ext.mathjax",
"sphinx.ext.viewcode",
"sphinx.ext.intersphinx",
"myst_nb",
]

# Extensions when rendering .ipynb/.md notebooks
myst_enable_extensions = [
'dollarmath',
'amsmath',
"dollarmath",
"amsmath",
]

# The suffix of source filenames.
source_suffix = '.rst'
source_suffix = ".rst"

# The master toctree document.
master_doc = 'index'
master_doc = "index"

# General information about the project.
project = u'sage-flatsurf'
copyright = u'2016-2023, the sage-flatsurf authors'
project = "sage-flatsurf"
copyright = "2016-2023, the sage-flatsurf authors"

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
Expand All @@ -34,10 +34,10 @@

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns = ['_build', 'news']
exclude_patterns = ["_build", "news"]

# Allow linking to external projects, e.g., SageMath
intersphinx_mapping = {'sage': ('https://doc.sagemath.org/html/en/reference', None)}
intersphinx_mapping = {"sage": ("https://doc.sagemath.org/html/en/reference", None)}

# -- Options for HTML output ----------------------------------------------

Expand All @@ -49,15 +49,17 @@
html_css_files = sage_docbuild.conf.html_css_files

if html_css_files != ["custom-furo.css"]:
raise NotImplementedError("CSS customization has changed in SageMath. The configuration of sage-flatsurf documentation build needs to be updated.")
raise NotImplementedError(
"CSS customization has changed in SageMath. The configuration of sage-flatsurf documentation build needs to be updated."
)

html_css_files = ['https://doc.sagemath.org/html/en/reference/_static/custom-furo.css']
html_css_files = ["https://doc.sagemath.org/html/en/reference/_static/custom-furo.css"]

html_theme_options['light_logo'] = html_theme_options['dark_logo'] = 'logo.svg'
html_theme_options["light_logo"] = html_theme_options["dark_logo"] = "logo.svg"
html_static_path = ["static"]

# Output file base name for HTML help builder.
htmlhelp_basename = 'sage-flatsurfdoc'
htmlhelp_basename = "sage-flatsurfdoc"

# -- Options for LaTeX output ---------------------------------------------

Expand All @@ -67,17 +69,27 @@
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
('index', 'sage-flatsurf.tex', u'sage-flatsurf Documentation',
u'the sage-flatsurf authors', 'manual'),
(
"index",
"sage-flatsurf.tex",
"sage-flatsurf Documentation",
"the sage-flatsurf authors",
"manual",
),
]

# -- Options for manual page output ---------------------------------------

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
('index', 'sage-flatsurf', u'sage-flatsurf Documentation',
[u'the sage-flatsurf authors'], 1)
(
"index",
"sage-flatsurf",
"sage-flatsurf Documentation",
["the sage-flatsurf authors"],
1,
)
]

# -- Options for Texinfo output -------------------------------------------
Expand All @@ -86,7 +98,13 @@
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
('index', 'sage-flatsurf', u'sage-flatsurf Documentation',
u'the sage-flatsurf authors', 'sage-flatsurf', 'One line description of project.',
'Miscellaneous'),
(
"index",
"sage-flatsurf",
"sage-flatsurf Documentation",
"the sage-flatsurf authors",
"sage-flatsurf",
"One line description of project.",
"Miscellaneous",
),
]
3 changes: 3 additions & 0 deletions doc/news/black.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
**Fixed:**

* Fixed non-standard source code formatting in sage-flatsurf.
1 change: 1 addition & 0 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ channels:
- conda-forge
- defaults
dependencies:
- black >=22,<23
- codespell >=2.2.2,<3
- gap-defaults
- ipywidgets
Expand Down
8 changes: 6 additions & 2 deletions flatsurf/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,12 @@

from .geometry.polygon import polygons, EquiangularPolygons, Polygons, ConvexPolygons

from .geometry.similarity_surface_generators import (similarity_surfaces,
dilation_surfaces, half_translation_surfaces, translation_surfaces)
from .geometry.similarity_surface_generators import (
similarity_surfaces,
dilation_surfaces,
half_translation_surfaces,
translation_surfaces,
)

from .geometry.surface import Surface_list, Surface_dict

Expand Down
8 changes: 6 additions & 2 deletions flatsurf/features.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,9 @@

from sage.features import PythonModule

cppyy_feature = PythonModule("cppyy", url="https://cppyy.readthedocs.io/en/latest/installation.html")
pyflatsurf_feature = PythonModule("pyflatsurf", url="https://github.com/flatsurf/flatsurf/#install-with-conda")
cppyy_feature = PythonModule(
"cppyy", url="https://cppyy.readthedocs.io/en/latest/installation.html"
)
pyflatsurf_feature = PythonModule(
"pyflatsurf", url="https://github.com/flatsurf/flatsurf/#install-with-conda"
)
62 changes: 35 additions & 27 deletions flatsurf/geometry/chamanara.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,43 +31,49 @@

def ChamanaraPolygon(alpha):
from sage.categories.fields import Fields

field = alpha.parent()
if field not in Fields():
ValueError("The value of alpha must lie in a field.")
if alpha<=0 or alpha>=1:
if alpha <= 0 or alpha >= 1:
ValueError("The value of alpha must be between zero and one.")
# The value of x is $\sum_{n=0}^\infty \alpha^n$.
x=1/(1-alpha)
x = 1 / (1 - alpha)
from .polygon import polygons
return polygons((1,0), (-x,x), (0,-1), (x-1,1-x))

return polygons((1, 0), (-x, x), (0, -1), (x - 1, 1 - x))


# pc=PolygonCreator(field=field)
# pc.add_vertex((0,0))
# pc.add_vertex((1,0))
# pc.add_vertex((1-x,x))
# pc.add_vertex((1-x,x-1))
# return pc.get_polygon()


class ChamanaraSurface(Surface):
r"""
The ChamanaraSurface $X_{\alpha}$.

EXAMPLES::

sage: from flatsurf.geometry.chamanara import ChamanaraSurface
sage: ChamanaraSurface(1/2)
Chamanara surface with parameter 1/2
"""

def __init__(self, alpha):
self._p = ChamanaraPolygon(alpha)

field = alpha.parent()
if not field.is_field():
field = field.fraction_field()

self.rename('Chamanara surface with parameter {}'.format(alpha))
self.rename("Chamanara surface with parameter {}".format(alpha))

super().__init__(field, ZZ(0), finite=False, mutable=False)

def polygon(self, lab):
r"""
EXAMPLES::
Expand All @@ -84,48 +90,50 @@ def polygon(self, lab):
return self._p

def opposite_edge(self, p, e):
if e==0 or e==2:
return 1-p,e
elif e==1:
if p<0:
return p+1,3
elif p>1:
return p-1,3
if e == 0 or e == 2:
return 1 - p, e
elif e == 1:
if p < 0:
return p + 1, 3
elif p > 1:
return p - 1, 3
else:
# p==0 or p==1
return 1-p,1
return 1 - p, 1
else:
# e==3
if p<=0:
return p-1,1
if p <= 0:
return p - 1, 1
else:
# p>=1
return p+1,1
return p + 1, 1


def chamanara_half_dilation_surface(alpha, n=8):
r"""
Return Chamanara's surface thought of as a Half Dilation surface.

EXAMPLES::

sage: from flatsurf.geometry.chamanara import chamanara_half_dilation_surface
sage: s = chamanara_half_dilation_surface(1/2)
sage: TestSuite(s).run(skip='_test_pickling')
"""
s=HalfDilationSurface(ChamanaraSurface(alpha))
adjacencies = [(0,1)]
s = HalfDilationSurface(ChamanaraSurface(alpha))
adjacencies = [(0, 1)]
for i in range(n):
adjacencies.append((-i,3))
adjacencies.append((i+1,3))
adjacencies.append((-i, 3))
adjacencies.append((i + 1, 3))
s.graphical_surface(adjacencies=adjacencies)
return s

def chamanara_surface(alpha,n=8):


def chamanara_surface(alpha, n=8):
r"""
Return Chamanara's surface thought of as a translation surface.

EXAMPLES::

sage: from flatsurf.geometry.chamanara import chamanara_surface
sage: s = chamanara_surface(1/2)
sage: TestSuite(s).run(skip='_test_pickling')
Expand Down
Loading