Skip to content
Merged
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
4 changes: 1 addition & 3 deletions surface_dynamics/flat_surfaces/abelian_strata.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,7 @@ def _cylinder_diagrams_with_symmetric(iterator):
yield cd.inverse()
elif sym == (True, False, False):
yield cd.vertical_symmetry()
elif sym == (False, True, False):
yield cd.horizontal_symmetry()
elif sym == (False, False, True):
elif sym == (False, True, False) or sym == (False, False, True):
yield cd.horizontal_symmetry()
else:
raise RuntimeError
Expand Down
4 changes: 1 addition & 3 deletions surface_dynamics/flat_surfaces/masur_veech_volumes.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,7 @@ def masur_veech_volume(C, rational=False, method=None):
elif isinstance(C, AbelianStratum):
vol = sum(abelian_volumes_table[CC] for CC in C.components())
S = C
elif isinstance(C, QuadraticStratumComponent):
raise NotImplementedError('quadratic differentials')
elif isinstance(C, QuadraticStratum):
elif isinstance(C, (QuadraticStratumComponent, QuadraticStratum)):
raise NotImplementedError('quadratic differentials')
else:
raise ValueError('invalid input')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1594,7 +1594,7 @@ def build(self, comp, N, force_computation=False, verbose=False):
if key in self._data_to_entry:
data[key] = self._entry_to_data[key](data[key])

value = [data.get(e,None) for e in columns]
value = [data.get(e) for e in columns]
self.add_row('origamis', value, columns)

if verbose:
Expand Down
2 changes: 1 addition & 1 deletion surface_dynamics/flat_surfaces/single_cylinder.py
Original file line number Diff line number Diff line change
Expand Up @@ -1755,7 +1755,7 @@ def cylinder_concatenation(perm_1, perm_2, alphabet=None):
if bot_row1[i] == 1:
bot_row1[i] += length_1
for j in range(length_2):
if not bot_row2[j] == 1:
if bot_row2[j] != 1:
bot_row2[j] += length_1
bot_row = bot_row1 + bot_row2 + [0]
perm = GeneralizedPermutation(top_row,bot_row)
Expand Down
16 changes: 3 additions & 13 deletions surface_dynamics/flat_surfaces/strata.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,9 +402,7 @@ def connected_components(self):
s = sum(zeros)
genus = s // 2 + 1

if genus == 1:
return (HypASC(self),)
elif genus == 2:
if genus == 1 or genus == 2:
return (HypASC(self),)
elif genus == 3:
if zeros == (2, 2) or zeros == (4,):
Expand Down Expand Up @@ -450,9 +448,7 @@ def connected_components(self):
if zeros == (4,) or zeros == (3, 1):
# empty!
return ()
elif zeros == (6, -1, -1):
return (HQSC(self), GTNQSC(self))
elif zeros == (3, 3, -1, -1):
elif zeros == (6, -1, -1) or zeros == (3, 3, -1, -1):
return (HQSC(self), GTNQSC(self))
elif zeros == (2, 2) or zeros == (2, 1, 1) or zeros == (1, 1, 1, 1):
return (GTHQSC(self),)
Expand All @@ -468,13 +464,7 @@ def connected_components(self):
elif zeros == (6, 6) or zeros == (6, 3, 3) or zeros == (3, 3, 3, 3):
return (HQSC(self), REQSC(self), IEQSC(self))
else:
if len(zeros) == 2 and zeros[0] % 4 == 2 and zeros[1] % 4 == 2:
return (HQSC(self), NQSC(self))
elif len(zeros) == 4 and zeros[0] == zeros[1] and zeros[2] == zeros[3] and zeros[0] % 2 and zeros[2] % 2:
return (HQSC(self), NQSC(self))
elif len(zeros) == 3 and zeros[0] == zeros[1] and zeros[0] % 2 and zeros[2] % 4 == 2:
return (HQSC(self), NQSC(self))
elif len(zeros) == 3 and zeros[1] == zeros[2] and zeros[1] % 2 and zeros[0] % 4 == 2:
if len(zeros) == 2 and zeros[0] % 4 == 2 and zeros[1] % 4 == 2 or len(zeros) == 4 and zeros[0] == zeros[1] and zeros[2] == zeros[3] and zeros[0] % 2 and zeros[2] % 2 or (len(zeros) == 3 and zeros[0] == zeros[1] and zeros[0] % 2 and zeros[2] % 4 == 2 or len(zeros) == 3 and zeros[1] == zeros[2] and zeros[1] % 2 and zeros[0] % 4 == 2):
return (HQSC(self), NQSC(self))
else:
return (CQSC(self),)
Expand Down
3 changes: 2 additions & 1 deletion surface_dynamics/flat_surfaces/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,8 @@ def test_random(self):
sage: Test().test_random() #random
Doing random test
"""
tests = [a for a in Test.__dict__.keys() if a[:5] == "test_" and a != "test_random"]
tests = [a for a in Test.__dict__
if a[:5] == "test_" and a != "test_random"]
name = prandom.choice(tests)
print("Doing random test %s" % name)
Test.__dict__[name](self)
Expand Down
2 changes: 1 addition & 1 deletion surface_dynamics/misc/constellation.py
Original file line number Diff line number Diff line change
Expand Up @@ -1325,7 +1325,7 @@ def random_element(self, mutable=False):

g = [SymmetricGroup(d).random_element() for _ in range(l-1)]
G = PermutationGroup(g)
while not G.degree() == d or (self._connected and not G.is_transitive()):
while G.degree() != d or (self._connected and not G.is_transitive()):
g = [SymmetricGroup(d).random_element() for _ in range(l-1)]
G = PermutationGroup(g)

Expand Down
2 changes: 1 addition & 1 deletion surface_dynamics/misc/factored_denominator.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def vector_to_linear_form_string(u, var_names):
s += ' + %d*%s' % (j, var)
first = False

return '0' if not s else s
return s if s else '0'


# NOTE: should this be an instance of Factorization?
Expand Down
10 changes: 4 additions & 6 deletions surface_dynamics/misc/permutation.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ def perm_check(l, n=None):
return ra_seen == im_seen


def perm_is_one(l, n=None):
def perm_is_one(l, n=None) -> bool:
r"""
Test whether ``l`` is the identity on its domain.

Expand All @@ -242,12 +242,10 @@ def perm_is_one(l, n=None):
"""
if n is None:
n = len(l)
for i in range(n):
if l[i] != -1 and l[i] != i:
return False
return True
return all(l[i] == -1 or l[i] == i for i in range(n))


def perm_is_regular(p, k=None, n=None):
def perm_is_regular(p, k=None, n=None) -> bool:
r"""
Return whether the cycle decomposition of ``p`` is only made of cycles
of identical lengths.
Expand Down