def load(cls, tica_fn): """ load a tICA solution to use in projecting data. Parameters: ----------- tica_fn : str filename pointing to tICA solutions """ # the only variables we need to save are the two matrices # and the eigenvectors / values as well as the lag time logger.warn("NOTE: You can only use the tICA solution, you will " "not be able to continue adding data") f = io.loadh(tica_fn) metric = cPickle.loads(f["metric_string"][0]) tica_obj = cls(f['lag'][0], prep_metric=metric) # lag entry is an array... with a single item tica_obj.timelag_corr_mat = f['timelag_corr_mat'] tica_obj.cov_mat = f['cov_mat'] tica_obj.vals = f['vals'] tica_obj.vecs = f['vecs'] tica_obj._sort() return tica_obj
def load(cls, tica_fn): """ load a tICA solution to use in projecting data. Parameters: ----------- tica_fn : str filename pointing to tICA solutions """ # the only variables we need to save are the two matrices # and the eigenvectors / values as well as the lag time logger.warn("NOTE: You can only use the tICA solution, you will " "not be able to continue adding data") f = io.loadh(tica_fn) metric = cPickle.loads(f["metric_string"][0]) tica_obj = cls(f['lag'][0], prep_metric=metric) # lag entry is an array... with a single item tica_obj.timelag_corr_mat = f['timelag_corr_mat'] tica_obj.cov_mat = f['cov_mat'] tica_obj.vals = f['vals'] tica_obj.vecs = f['vecs'] tica_obj._sort() return tica_obj
def test_pickle(): # test pickling of topology (bug #391) cPickle.loads(cPickle.dumps(md.load(get_fn('bpti.pdb')).topology))