ee723d05e9cf56fa26a33735ee7bc2be882e0683,pliers/extractors/base.py,ExtractorResult,resample,#ExtractorResult#Any#Any#Any#,210

Before Change


        x = np.arange(n)

        // Calculate final number of samples after re-sampling
        num = int(np.round((sampling_rate / bin_sr) * n))

        resampled = {}
        for f_name in self.features:
            values = self.data[f_name]

            ts = np.zeros(n, dtype=values.dtype)
            start = 0
            for i, val in enumerate(values):
                _onset = int(start + onsets[i])
                _offset = int(_onset + durations[i])
                ts[_onset:_offset] = val

            // What does first sample correspond to? Only one
            f = interp1d(x, ts, kind=kind)
            x_new = np.linspace(0, n - 1, num=num)
            resampled[f_name] = f(x_new)

        new_dur = 1 / sampling_rate
        new_onsets = np.arange(0, math.ceil(max_duration), new_dur)

After Change


        num = math.ceil(max_duration / interval)

        // Maximum duration in bin_sr upscaling space
        max_dur_bin_sr = int(num * interval * bin_sr)
        x = np.arange(max_dur_bin_sr)

        resampled = {}
        for f_name in self.features:
            values = self.data[f_name]

            ts = np.zeros(int(max_dur_bin_sr), dtype=values.dtype)
            start = 0
            for i, val in enumerate(values):
                _onset = int(start + onsets[i])
                _offset = int(_onset + durations[i])
                ts[_onset:_offset] = val

            f = interp1d(x, ts, kind=kind)
            x_new = np.arange(0, max_dur_bin_sr, step=interval * bin_sr)
            resampled[f_name] = f(x_new)

        new_onsets = np.arange(0, max_dur_bin_sr / bin_sr, interval)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 8

Instances


Project Name: tyarkoni/pliers
Commit Name: ee723d05e9cf56fa26a33735ee7bc2be882e0683
Time: 2020-11-04
Author: aleph4@gmail.com
File Name: pliers/extractors/base.py
Class Name: ExtractorResult
Method Name: resample


Project Name: chartbeat-labs/textacy
Commit Name: 2d73fbbe9ec240ff700f9abeb30f12861044389e
Time: 2019-07-14
Author: burtdewilde@gmail.com
File Name: textacy/ke/sgrank.py
Class Name:
Method Name: sgrank


Project Name: pfnet/optuna
Commit Name: be773957fac50c042092d72ff12b65f7cfa2bdee
Time: 2020-06-22
Author: k_nzw@klis.tsukuba.ac.jp
File Name: optuna/integration/skopt.py
Class Name: _Optimizer
Method Name: ask