4a1b3db27268b3a928a9f423651ecc9e5ff51196,featurex/extractors/audio.py,MeanAmplitudeExtractor,_extract,#MeanAmplitudeExtractor#Any#,106

Before Change


                raise Exception("Block ends after data.")
            
            mean_amplitude = np.mean(amps[r_onset:r_offset])
            amplitude_data = {"mean_amplitude": mean_amplitude}
            ev = Event(onset=onset, duration=duration)
            ev.add_value(Value(stim, self, amplitude_data))
            events.append(ev)
        return events

After Change


        amps = stim.data
        sampling_rate = stim.sampling_rate
        elements = stim.transcription.elements
        values = []
        onsets = []
        durations = []
        for i, el in enumerate(elements):
            onset = sampling_rate * el.onset
            onsets.append(onset)
            duration = sampling_rate * el.duration
            durations.append(duration)
            
            r_onset = np.round(onset).astype(int)
            r_offset = np.round(onset+duration).astype(int)
            if not r_offset <= amps.shape[0]:
                raise Exception("Block ends after data.")
            
            mean_amplitude = np.mean(amps[r_onset:r_offset])
            values.append(mean_amplitude)

        return ExtractorResult(values, stim, self, features=["mean_amplitude"],
                                onsets=onsets, durations=durations)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 10

Instances


Project Name: tyarkoni/pliers
Commit Name: 4a1b3db27268b3a928a9f423651ecc9e5ff51196
Time: 2016-10-23
Author: quinten.mcnamara@gmail.com
File Name: featurex/extractors/audio.py
Class Name: MeanAmplitudeExtractor
Method Name: _extract


Project Name: tyarkoni/pliers
Commit Name: c19000b012bba5fa7ae54fadc953f5b679dead4f
Time: 2016-10-20
Author: quinten.mcnamara@gmail.com
File Name: featurex/extractors/video.py
Class Name: DenseOpticalFlowExtractor
Method Name: _extract


Project Name: tyarkoni/pliers
Commit Name: e98d99e745b61af768bd30fd9bad7c892eefbe17
Time: 2016-10-20
Author: quinten.mcnamara@gmail.com
File Name: featurex/extractors/api.py
Class Name: IndicoAPIExtractor
Method Name: _extract