Skip to content

Commit

Permalink
[coordinates/transformer] Now returns default chunk size if no data_p…
Browse files Browse the repository at this point in the history
…roducer is given, added test for that case. Should fix issue markovmodel#830. (markovmodel#833)
  • Loading branch information
clonker authored and marscher committed Jun 19, 2016
1 parent ebb19e7 commit 7dc5f7f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pyemma/coordinates/tests/test_tica.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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])
Expand Down
2 changes: 2 additions & 0 deletions pyemma/coordinates/transform/transformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7dc5f7f

Please sign in to comment.