Skip to content

Commit

Permalink
Merge pull request #101 from MTG/tn-pattern
Browse files Browse the repository at this point in the history
melodic pattern finding notebook
  • Loading branch information
thomasgnuttall authored Oct 30, 2024
2 parents 256fdee + 6e00cc8 commit 0dd75f8
Show file tree
Hide file tree
Showing 3 changed files with 1,668 additions and 2 deletions.
2 changes: 1 addition & 1 deletion compiam/melody/pattern/sancara_search/extraction/img.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,6 @@ def edges_to_contours(X, kernel_size=10):
def apply_bin_op(X, binop_dim):
binop_struct = np.zeros((binop_dim, binop_dim))
np.fill_diagonal(binop_struct, 1)
X_binop = binary_opening(X, structure=binop_struct).astype(np.int)
X_binop = binary_opening(X, structure=binop_struct).astype(int)

return X_binop
4 changes: 3 additions & 1 deletion compiam/melody/pattern/sancara_search/extraction/self_sim.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@
group_overlapping,
group_by_distance,
trim_silence,
segments_from_matrix,
remove_group_duplicates
)
from compiam.utils import get_logger

Expand Down Expand Up @@ -273,7 +275,7 @@ def normalise_self_sim(matrix):
matrix = convolve2d(matrix, ey, mode="same")

diag_mask = np.ones(matrix.shape)
diag_mask = (diag_mask - np.diag(np.ones(matrix.shape[0]))).astype(np.bool)
diag_mask = (diag_mask - np.diag(np.ones(matrix.shape[0]))).astype(bool)

mat_min = np.min(matrix[diag_mask])
mat_max = np.max(matrix[diag_mask])
Expand Down
1,664 changes: 1,664 additions & 0 deletions notebooks/melody/Melodic_Pattern_Finding_Carnatic.ipynb

Large diffs are not rendered by default.

0 comments on commit 0dd75f8

Please sign in to comment.