2bae518e899657e536572fa59df6e1587795e397,librosa/feature.py,,line_features,#,332

Before Change


    """

    N, K = np.shape(S)
    freq = np.transpose(np.linspace(0, sr/2, N))

    slope = np.zeros((1, K))
    intercept = np.zeros((1, K))

After Change


    // If we don"t have a spectrogram, build one
    if S is None:
        // By default, use a magnitude spectrogram
        S = np.abs(librosa.stft(y, n_fft=n_fft, hop_length=hop_length))
    else:
        // Infer n_fft from spectrogram shape
        n_fft = (S.shape[0] - 1) * 2

    // Compute the center frequencies of each bin
    if freq is None:
        freq = librosa.core.fft_frequencies(sr=sr, n_fft=n_fft)

    if freq.ndim == 1:
        coefficients = np.polyfit(freq, S, order)
    else:
        coefficients = np.concatenate([[np.polyfit(freq_t, S_t, order)]
                                       for (freq_t, S_t) in zip(freq.T, S.T)],
                                      axis=0).T

    return coefficients
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: librosa/librosa
Commit Name: 2bae518e899657e536572fa59df6e1587795e397
Time: 2014-12-30
Author: brian.mcfee@nyu.edu
File Name: librosa/feature.py
Class Name:
Method Name: line_features


Project Name: THUNLP-MT/THUMT
Commit Name: 62d2ea56ae4a090aa68baf133137982a836700bd
Time: 2018-01-25
Author: playinf@stu.xmu.edu.cn
File Name: thumt/layers/attention.py
Class Name:
Method Name: split_heads


Project Name: Esri/raster-functions
Commit Name: b39ae1072934ad146759cd1941931433908ed0d7
Time: 2015-02-07
Author: jwasilkowski@esri.com
File Name: functions/LinearSpectralUnmixing.py
Class Name: LinearSpectralUnmixing
Method Name: updatePixels