<commit_before>import unittest
import skrf
import numpy as np
import os.path


class VectorFittingTestCase(unittest.TestCase):

    def test_vectorfitting_ring_slot(self):
        # load expected model parameters
        expected_parameters = np.load(os.path.join(os.path.dirname(os.path.abspath(skrf.__file__)), 'tests',
                                                   'vectorfit_ringslot_2poles.npz'))
        expected_poles = expected_parameters['arr_0']
        expected_zeros = expected_parameters['arr_1']
        expected_props = expected_parameters['arr_2']
        expected_const = expected_parameters['arr_3']

        # perform the fit
        vf = skrf.vectorFitting.VectorFitting(skrf.data.ring_slot)
        vf.vectorfit(n_poles_real=2, n_poles_cmplx=0, fit_constant=True, fit_proportional=True)

        # compare both sets of parameters
        self.assertTrue(np.isclose(vf.poles, expected_poles))
        self.assertTrue(np.isclose(vf.zeros, expected_zeros))
        self.assertTrue(np.isclose(vf.proportional_coeff, expected_props))
        self.assertTrue(np.isclose(vf.constant_coeff, expected_const))


suite = unittest.TestLoader().loadTestsFromTestCase(VectorFittingTestCase)
unittest.TextTestRunner(verbosity=2).run(suite)
<commit_msg>fixes ambiguous truth values in testcase<commit_after>import unittest
import skrf
import numpy as np
import os.path


class VectorFittingTestCase(unittest.TestCase):

    def test_vectorfitting_ring_slot(self):
        # load expected model parameters
        expected_parameters = np.load(os.path.join(os.path.dirname(os.path.abspath(skrf.__file__)), 'tests',
                                                   'vectorfit_ringslot_2poles.npz'))
        expected_poles = expected_parameters['arr_0']
        expected_zeros = expected_parameters['arr_1']
        expected_props = expected_parameters['arr_2']
        expected_const = expected_parameters['arr_3']

        # perform the fit
        vf = skrf.vectorFitting.VectorFitting(skrf.data.ring_slot)
        vf.vectorfit(n_poles_real=2, n_poles_cmplx=0, fit_constant=True, fit_proportional=True)

        # compare both sets of parameters
        self.assertTrue(np.all(np.isclose(vf.poles, expected_poles)))
        self.assertTrue(np.all(np.isclose(vf.zeros, expected_zeros)))
        self.assertTrue(np.all(np.isclose(vf.proportional_coeff, expected_props)))
        self.assertTrue(np.all(np.isclose(vf.constant_coeff, expected_const)))


suite = unittest.TestLoader().loadTestsFromTestCase(VectorFittingTestCase)
unittest.TextTestRunner(verbosity=2).run(suite)

{'fraction_non_alphanumeric': 0.09825918762088975, 'fraction_numerical': 0.006189555125725338, 'mean_word_length': 3.6847826086956523, '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': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4310995', 'n_tokens_mistral': 793, 'n_tokens_neox': 783, 'n_words': 115}