diff --git a/pliers/converters/api/ibm.py b/pliers/converters/api/ibm.py index 212301e0..f450263a 100644 --- a/pliers/converters/api/ibm.py +++ b/pliers/converters/api/ibm.py @@ -65,7 +65,7 @@ def check_valid_keys(self): self._send_request(request) return True except Exception as e: - if 'Unauthorized' in str(e): + if 'Not Authorized' in str(e): return False else: raise e diff --git a/pliers/extractors/base.py b/pliers/extractors/base.py index 0356c58e..dc70c904 100644 --- a/pliers/extractors/base.py +++ b/pliers/extractors/base.py @@ -159,7 +159,7 @@ def to_df(self, timing=True, metadata=False, format='wide', df.insert(0, 'onset', onsets) df.insert(0, 'duration', durations) df.insert(0, 'order', orders) - df = df.sort_values('onset') + df = df.sort_values('onset').reset_index(drop=True) index_cols.extend(['onset', 'order', 'duration']) if format == 'long': diff --git a/pliers/tests/extractors/api/test_google_extractors.py b/pliers/tests/extractors/api/test_google_extractors.py index c490c53c..6093dd15 100644 --- a/pliers/tests/extractors/api/test_google_extractors.py +++ b/pliers/tests/extractors/api/test_google_extractors.py @@ -232,6 +232,7 @@ def test_google_video_api_extractor2(caplog): {'startTimeOffset': '0.3s', 'endTimeOffset': '0.4s'}] ext = GoogleVideoIntelligenceAPIExtractor(timeout=500, segments=segments, features=['EXPLICIT_CONTENT_DETECTION']) + stim = VideoStim(join(VIDEO_DIR, 'park.mp4')) result = ext.transform(stim).to_df() log_message = caplog.records[-1].message incomplete = (log_message == ("The extraction reached the timeout limit of" @@ -327,7 +328,7 @@ def test_google_video_api_explicit_extractor(caplog): " %fs, which means the API may not have finished analyzing the" " video and the results may be empty or incomplete." % 90)) if not incomplete: - assert result.shape[2] == 5 + assert result.shape[1] == 5 assert result['onset'][0] >= 4.2 assert 'pornographyLikelihood' in result.columns assert 'UNLIKELY' in result['pornographyLikelihood'][0]