From f43287874158f6261341d2f02642e5ad9d846a48 Mon Sep 17 00:00:00 2001 From: Flora Canou Date: Tue, 26 Mar 2024 22:36:04 +0800 Subject: [PATCH] Bugfix - fix a problem in the ratio to subgroup monzo conversion --- te_common.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/te_common.py b/te_common.py index 8170325..20e08ea 100644 --- a/te_common.py +++ b/te_common.py @@ -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 @@ -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