diff --git a/pyproject.toml b/pyproject.toml index bfd750a..36e56ea 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -21,6 +21,7 @@ classifiers = [ dependencies = [ "jellyfish >=0.8.2, ==0.*", "opencv-python >=4.5, ==4.*", + "numpy >=1.17.0, ==1.*", "pandas >=1.2.0, ==1.*", "scipy >=1.5.4, ==1.*", ] @@ -29,7 +30,6 @@ dependencies = [ test = [ "coverage[toml] >=5.2.1, ==5.*", "cram >=0.7, ==0.*", - "deepdiff[cli] >=5.2.0, ==5.*", "flake8 >=3.9.0, ==3.*", "pylint >=2.14.5, ==2.*", ] diff --git a/scripts/diff_tsv.py b/scripts/diff_tsv.py new file mode 100644 index 0000000..769ef75 --- /dev/null +++ b/scripts/diff_tsv.py @@ -0,0 +1,41 @@ +"""Compare TSV files line by line with deepdiff +""" +import argparse +import deepdiff +import pandas as pd + + +if __name__ == "__main__": + parser = argparse.ArgumentParser( + description="Compare TSV files line by line with deepdiff", + formatter_class=argparse.ArgumentDefaultsHelpFormatter + ) + parser.add_argument("first_tsv", help="first TSV to compare") + parser.add_argument("second_tsv", help="second TSV to compare") + parser.add_argument("--significant-digits", type=int, default=6, help="number of significant digits to use when comparing numeric values") + + args = parser.parse_args() + + first_tsv = pd.read_csv( + args.first_tsv, + sep="\t", + header=None, + engine="python", + na_filter=False, + ).to_dict() + + second_tsv = pd.read_csv( + args.second_tsv, + sep="\t", + header=None, + engine="python", + na_filter=False, + ).to_dict() + + print( + deepdiff.DeepDiff( + first_tsv, + second_tsv, + significant_digits=args.significant_digits, + ) + ) diff --git a/tests/functional/forecast.t b/tests/functional/forecast.t index a14a918..10a7c6b 100644 --- a/tests/functional/forecast.t +++ b/tests/functional/forecast.t @@ -9,9 +9,6 @@ Forecast frequencies with a model trained on simulated data. > --model data/simulated_sample_1/normalized_fitness.json \ > --delta-months 12 \ > --output-table "$TMP/forecasts.tsv" > /dev/null - $ deep diff --significant-digits 6 "data/simulated_sample_1/forecasts.tsv" "$TMP/forecasts.tsv" - {} - $ rm -f "$TMP/forecasts.tsv" Forecast tips with existing frequencies.