<commit_before>"""
This regression test allows to fix the outputs once and then compare subsequent
outputs to the previous ones. This allows to spot an error during refactoring
quickly. Many examples of models and transfomations are ran in this test.

# save expected outputs once to the expected/ dir
$ python regression_test.py --save-expected

# then run the test against the expected outputs
$ ./run_regression_test.sh

The actual outputs are stored in the actual/ dir to find out what was
different.

The test also makes a code coverage report.

$ open cover/index.html

The files are compared using the MD5 hash. Missing files are spotted, while
superfluous files are not checked.

The numpy random seed is fixed to allow replicability in stochastic models.
"""

from __future__ import print_function
import argparse
import glob
from hashlib import md5
import numpy as np
import os
import shutil
import sys

# matplotlib without a GUI
import matplotlib as mpl
mpl.use('Agg')

sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), '..'))

# TODO: try to make the module handing a bit less verbose

from smst.ui.models import \
    dftModel_function, \
    harmonicModel_function, \
    hprModel_function, \
    hpsModel_function, \
    sineModel_function, \
    sprModel_function, \
    spsModel_function, \
    stochasticModel_function

from smst.ui.transformations import \
    harmonicTransformations_function, \
    hpsMorph_function, \
    sineTransformations_function, \
    stftMorph_function, \
    stochasticTransformations_function

modules = {
    'dftModel_function': dftModel_function,
    'harmonicModel_function': harmonicModel_function,
    'hprModel_function': hprModel_function,
    'hpsModel_function': hpsModel_function,
    'sineModel_function': sineModel_function,
    'sprModel_function': sprModel_function,
    'spsModel_function': spsModel_function,
    'stochasticModel_function': stochasticModel_function,
    'harmonicTransformations_function': harmonicTransformations_function,
    'hpsMorph_function': hpsMorph_function,
    'sineTransformations_function': sineTransformations_function,
    'stftMorph_function': stftMorph_function,
    'stochasticTransformations_function': stochasticTransformations_function
}<commit_msg>Add the missing stftModel to the regression test.<commit_after>"""
This regression test allows to fix the outputs once and then compare subsequent
outputs to the previous ones. This allows to spot an error during refactoring
quickly. Many examples of models and transfomations are ran in this test.

# save expected outputs once to the expected/ dir
$ python regression_test.py --save-expected

# then run the test against the expected outputs
$ ./run_regression_test.sh

The actual outputs are stored in the actual/ dir to find out what was
different.

The test also makes a code coverage report.

$ open cover/index.html

The files are compared using the MD5 hash. Missing files are spotted, while
superfluous files are not checked.

The numpy random seed is fixed to allow replicability in stochastic models.
"""

from __future__ import print_function
import argparse
import glob
from hashlib import md5
import numpy as np
import os
import shutil
import sys

# matplotlib without a GUI
import matplotlib as mpl
mpl.use('Agg')

sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), '..'))

# TODO: try to make the module handing a bit less verbose

from smst.ui.models import \
    dftModel_function, \
    stftModel_function, \
    harmonicModel_function, \
    hprModel_function, \
    hpsModel_function, \
    sineModel_function, \
    sprModel_function, \
    spsModel_function, \
    stochasticModel_function

from smst.ui.transformations import \
    harmonicTransformations_function, \
    hpsMorph_function, \
    sineTransformations_function, \
    stftMorph_function, \
    stochasticTransformations_function

modules = {
    'dftModel_function': dftModel_function,
    'stftModel_function': stftModel_function,
    'harmonicModel_function': harmonicModel_function,
    'hprModel_function': hprModel_function,
    'hpsModel_function': hpsModel_function,
    'sineModel_function': sineModel_function,
    'sprModel_function': sprModel_function,
    'spsModel_function': spsModel_function,
    'stochasticModel_function': stochasticModel_function,
    'harmonicTransformations_function': harmonicTransformations_function,
    'hpsMorph_function': hpsMorph_function,
    'sineTransformations_function': sineTransformations_function,
    'stftMorph_function': stftMorph_function,
    'stochasticTransformations_function': stochasticTransformations_function
}
{'fraction_non_alphanumeric': 0.06367924528301887, 'fraction_numerical': 0.0008576329331046312, 'mean_word_length': 4.787841191066997, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3710319', 'n_tokens_mistral': 1371, 'n_tokens_neox': 1306, 'n_words': 416}