Skip to content

Commit

Permalink
Merge pull request #486 from PsychoinformaticsLab/Fix/remote_sampling
Browse files Browse the repository at this point in the history
CI/TESTING: Updated ffmpeg, expand to Python 3.10
  • Loading branch information
adelavega authored Nov 15, 2022
2 parents c249daf + a749cc8 commit ecdf208
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 17 deletions.
11 changes: 8 additions & 3 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,17 @@ on: [push, pull_request]
jobs:
build:
name: pytest (${{ matrix.python-version }}, ${{ matrix.os }})
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
defaults:
run:
shell: bash -l {0}
strategy:
fail-fast: false
matrix:
python-version: [3.6, 3.7, 3.8]
python-version: ["3.7", "3.8", "3.9", "3.10"]
env:
FFMPEG_BINARY: /usr/bin/ffmpeg
IMAGEIO_FFMPEG_EXE: /usr/bin/ffmpeg
steps:
- uses: actions/checkout@v2
- uses: conda-incubator/setup-miniconda@v2
Expand All @@ -24,8 +27,10 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: Set up system dependencies
run: |
sudo add-apt-repository ppa:savoury1/ffmpeg4
sudo apt-get update
sudo apt-get install libavformat-dev libavfilter-dev libavdevice-dev ffmpeg libmp3lame-dev tesseract-ocr graphviz cmake libboost-python-dev libgraphviz-dev
sudo apt-get upgrade -y ffmpeg
sudo apt-get install -y libavformat-dev libavfilter-dev libavdevice-dev libmp3lame-dev tesseract-ocr graphviz cmake libboost-python-dev libgraphviz-dev
- uses: actions/cache@v2
with:
path: ~/.cache/pip
Expand Down
1 change: 0 additions & 1 deletion optional-dependencies.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ gensim
google-api-python-client
google-compute-engine
librosa>=0.6.3
numba<=0.48
matplotlib
opencv-python
openpyxl
Expand Down
11 changes: 6 additions & 5 deletions pliers/tests/test_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,15 @@ def test_magic_loader():

def test_magic_loader2():
text_file = join(get_test_data_path(), 'text', 'sample_text.txt')
video_url = 'https://archive.org/download/DisneyCastletest/Disney_Castle_512kb.mp4'
audio_url = 'https://archive.org/download/999WavFiles/TANKEN.WAV'
image_url = 'https://archive.org/download/NIX-C-1987-11903/1987_11903L.jpg'
video_url = 'http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4'
audio_url = 'https://www2.cs.uic.edu/~i101/SoundFiles/Fanfare60.wav'
image_url = 'https://storage.googleapis.com/gtv-videos-bucket/sample/images/ElephantsDream.jpg'
text_url = 'https://github.com/psychoinformaticslab/pliers/blob/master/README.rst'

stims = load_stims([text_file, video_url, audio_url, image_url, text_url])
assert len(stims) == 5
assert stims[1].fps == 30.0
assert stims[3].data.shape == (288, 360, 3)
assert stims[1].fps == 24
assert stims[3].data.shape == (360, 480, 3)


def test_loader_nonexistent():
Expand Down
16 changes: 8 additions & 8 deletions pliers/tests/test_stims.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,31 +265,31 @@ def test_transcribed_audio_stim():

def test_remote_stims():

video_url = 'https://archive.org/download/DisneyCastletest/Disney_Castle_512kb.mp4'
video_url = 'http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4'
video = VideoStim(url=video_url)
assert video.fps == 30.0
assert video.fps == 24

url = 'https://archive.org/download/999WavFiles/TANKEN.WAV'
url = 'https://www2.cs.uic.edu/~i101/SoundFiles/Fanfare60.wav'
audio = AudioStim(url=url)
assert round(audio.duration) == 25
assert round(audio.duration) == 60

url = 'https://archive.org/download/NIX-C-1987-11903/1987_11903L.jpg'
url = 'https://storage.googleapis.com/gtv-videos-bucket/sample/images/ElephantsDream.jpg'
image = ImageStim(url=url)
assert image.data.shape == (288, 360, 3)
assert image.data.shape == (360, 480, 3)

url = 'https://github.com/psychoinformaticslab/pliers/blob/master/README.rst'
text = TextStim(url=url)
assert len(text.text) > 1


def test_get_filename():
url = 'https://archive.org/download/999WavFiles/TANKEN.WAV'
url = 'https://www2.cs.uic.edu/~i101/SoundFiles/Fanfare60.wav'
audio = AudioStim(url=url)
with audio.get_filename() as filename:
assert exists(filename)
assert not exists(filename)

url = 'https://archive.org/download/NIX-C-1987-11903/1987_11903L.jpg'
url = 'https://storage.googleapis.com/gtv-videos-bucket/sample/images/ElephantsDream.jpg'
image = ImageStim(url=url)
with image.get_filename() as filename:
assert exists(filename)
Expand Down

0 comments on commit ecdf208

Please sign in to comment.