scope 0.5.4__tar.gz → 0.5.5__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: scope
3
- Version: 0.5.4
3
+ Version: 0.5.5
4
4
  Summary: Metrics logging and analysis
5
5
  Home-page: http://github.com/danijar/scope
6
6
  Classifier: Intended Audience :: Science/Research
@@ -1,4 +1,4 @@
1
- __version__ = '0.5.4'
1
+ __version__ = '0.5.5'
2
2
 
3
3
  from .reader import Reader
4
4
  from .writer import Writer
@@ -194,6 +194,8 @@ class MediapyVideo:
194
194
  x.shape[-1] in (1, 3))
195
195
 
196
196
  def convert(self, x):
197
+ if x.shape[-1] == 1:
198
+ x = x.repeat(3, -1)
197
199
  return x
198
200
 
199
201
  def create(self, path):
@@ -1,16 +1,22 @@
1
1
  import pathlib
2
2
 
3
- import scope
4
3
  import numpy as np
4
+ import pytest
5
+ import scope
5
6
 
6
7
 
7
8
  class TestVideo:
8
9
 
9
- def test_roundtrip(self, tmpdir):
10
+ @pytest.mark.parametrize('channels', (3, 1))
11
+ @pytest.mark.parametrize('fmt', (
12
+ scope.formats.Video(fps=10),
13
+ scope.formats.MediapyVideo(fps=10),
14
+ ))
15
+ def test_roundtrip(self, tmpdir, fmt, channels):
10
16
  logdir = pathlib.Path(tmpdir)
11
- writer = scope.Writer(logdir, workers=0)
12
- vid1 = np.ones((5, 64, 128, 3), np.uint8) + 12
13
- vid2 = np.ones((5, 64, 128, 3), np.uint8) + 255
17
+ writer = scope.Writer(logdir, workers=0, formats=[fmt])
18
+ vid1 = np.ones((5, 64, 128, channels), np.uint8) + 12
19
+ vid2 = np.ones((5, 64, 128, channels), np.uint8) + 255
14
20
  writer.add(0, {'foo': vid1})
15
21
  writer.add(5, {'foo': vid2})
16
22
  writer.flush()
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes