From 7dc5f7fb79a69486da9961c170c1830000bd10bd Mon Sep 17 00:00:00 2001 From: Moritz Hoffmann Date: Sun, 19 Jun 2016 18:27:51 +0200 Subject: [PATCH] [coordinates/transformer] Now returns default chunk size if no data_producer is given, added test for that case. Should fix issue #830. (#833) --- pyemma/coordinates/tests/test_tica.py | 7 +++++++ pyemma/coordinates/transform/transformer.py | 2 ++ 2 files changed, 9 insertions(+) diff --git a/pyemma/coordinates/tests/test_tica.py b/pyemma/coordinates/tests/test_tica.py index d594f333f..fbd2c9fb9 100644 --- a/pyemma/coordinates/tests/test_tica.py +++ b/pyemma/coordinates/tests/test_tica.py @@ -33,6 +33,7 @@ from pyemma.coordinates.data.data_in_memory import DataInMemory from pyemma.coordinates import source, tica +from pyemma.coordinates.transform import TICA as _internal_tica from pyemma.util.contexts import numpy_random_seed from logging import getLogger import pyemma.util.types as types @@ -92,6 +93,12 @@ def test_duplicated_data(self): assert tica_obj.eigenvectors.dtype == np.float64 assert tica_obj.eigenvalues.dtype == np.float64 + def test_fit_transform(self): + X = np.random.randn(100, 2) + tica = _internal_tica(1, 1) + out = tica.fit_transform(X) + np.testing.assert_array_almost_equal(out, api.tica(data=X, lag=1, dim=1).get_output()[0]) + def test_duplicated_data_in_fit_transform(self): X = np.random.randn(100, 2) d = DataInMemory([X, X]) diff --git a/pyemma/coordinates/transform/transformer.py b/pyemma/coordinates/transform/transformer.py index c90f2446c..61728c8f9 100644 --- a/pyemma/coordinates/transform/transformer.py +++ b/pyemma/coordinates/transform/transformer.py @@ -214,6 +214,8 @@ def parametrize(self, stride=1): @property def chunksize(self): """chunksize defines how much data is being processed at once.""" + if not self.data_producer: + return self._default_chunksize return self.data_producer.chunksize @chunksize.setter