From 5c727ddb652f5b2a0f6739663cdcd61b9f6801a4 Mon Sep 17 00:00:00 2001 From: Johannes Hentschel Date: Thu, 23 May 2024 15:15:48 +0200 Subject: [PATCH] fix: enables ignoring the COMPETING_MEASURE_INFO_WARNING --- src/ms3/bs4_measures.py | 10 +++-- tests/test_metarepo_files/debugging.py | 62 +++++++++++++++++++++----- 2 files changed, 57 insertions(+), 15 deletions(-) diff --git a/src/ms3/bs4_measures.py b/src/ms3/bs4_measures.py index 82f4886a..7162c83c 100644 --- a/src/ms3/bs4_measures.py +++ b/src/ms3/bs4_measures.py @@ -152,11 +152,15 @@ def squash_staves(df): if pd.isnull(val) and fillna: keep_row[col_name] = new_val msg = ( - f"{compress_col} {which}: The missing value in '{col_name}' was replaced by '{new_val}', " + f"{compress_col} {which}: The missing value in '{col_name}' was filled with '{new_val}', " f"present in '{differentiating_col}' " - f"{remaining.loc[remaining[col_name] == new_val, differentiating_col].to_list()}." + f"{remaining.loc[remaining[col_name] == new_val, differentiating_col].to_list()}. " + f"In rare cases, this may lead to incorrect values in the measures table because it ambiguous " + f"which staff contains the relevant information." + ) # ToDo: Currently there is nothing the user can do to influence this behavior! + log_this( + msg, extra={"message_id": (9, compress_col, which, col_name)} ) - log_this(msg) continue msg = ( f"{compress_col} {which}: The value '{new_val}' in '{col_name}' of '{differentiating_col}' " diff --git a/tests/test_metarepo_files/debugging.py b/tests/test_metarepo_files/debugging.py index 2e089fd8..75060063 100644 --- a/tests/test_metarepo_files/debugging.py +++ b/tests/test_metarepo_files/debugging.py @@ -7,12 +7,14 @@ the moment something is considered, it is considered obsolete. """ import os.path +from argparse import Namespace from ms3 import Parse, Score +from ms3.cli import review_cmd from ms3.logger import get_logger from ms3.operations import transform_to_resources -CORPUS_PATH = "~/unittest_metacorpus/wagner_overtures" +CORPUS_PATH = "~/git/389_chorale_settings/original_complete/" def ignoring_warning(): @@ -33,7 +35,7 @@ def parse_object() -> Parse: only_metadata_pieces=True, include_convertible=False, exclude_review=True, - file_re=None, + file_re="B378", folder_re=None, exclude_re=None, file_paths=None, @@ -65,18 +67,54 @@ def transform_cmd(): def single_score(): - path = "~/distant_listening_corpus/ABC/MS3/n13op130_06.mscx" + path = "/home/laser/git/389_chorale_settings/original_complete/MS3/B378.mscx" return Score(path) if __name__ == "__main__": - score = single_score() - score.mscx.store_excerpt( - start_mc=62, - start_mc_onset=0, - end_mc=102, - end_mc_onset=0, - exclude_end=True, - directory="/home/laser/Documents/phd/phrase_excerpts/231220_distant_listening_corpus", - suffix="_phrase776", + args = Namespace( + action="review", + ignore_scores=False, + ignore_labels=False, + fail=True, + ignore_metronome=False, + ask=False, + use="expanded", + flip=False, + safe=True, + force=False, + measures="../measures", + notes="../notes", + rests=None, + labels=None, + expanded="../harmonies", + form_labels="../form_labels", + events=None, + chords="../chords", + joined_chords=None, + metadata="", + positioning=False, + raw=True, + unfold=False, + interval_index=False, + corpuswise=False, + dir="/home/laser/git/389_chorale_settings", + out=None, + nonrecursive=False, + all=False, + include=None, + exclude=None, + folders=None, + musescore=None, + reviewed=False, + files=["/home/laser/git/389_chorale_settings/original_complete/MS3/B378.mscx"], + iterative=False, + level="i", + log=None, + test=False, + verbose=False, + compare="LATEST_VERSION", + threshold=0.6, + # func=review_cmd ) + review_cmd(args)