Skip to content

Commit

Permalink
Bugfix
Browse files Browse the repository at this point in the history
- fix a problem in the ratio to subgroup monzo conversion
  • Loading branch information
FloraCanou committed Mar 26, 2024
1 parent a79edb4 commit f432878
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions te_common.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# © 2020-2024 Flora Canou | Version 1.3.0
# © 2020-2024 Flora Canou | Version 1.3.1
# This work is licensed under the GNU General Public License version 3.

import re, functools, itertools, warnings
Expand Down Expand Up @@ -330,9 +330,10 @@ def ratio2monzo (ratio, subgroup = None):
return __ratio2monzo (ratio)
else:
result = (linalg.pinv (subgroup.basis_matrix)
@ vec_pad (__ratio2monzo (ratio), length = len (subgroup)))
if all (entry.is_integer for entry in result):
return result.astype (int)
@ vec_pad (__ratio2monzo (ratio), length = subgroup.basis_matrix.shape[0]))
result_int = result.astype (int)
if np.all (result == result_int):
return result_int
else:
warnings.warn ("improper subgroup. ")
return result
Expand Down

0 comments on commit f432878

Please sign in to comment.