def test_binaries_zero_cutoff(): trajectories = MinimalFsPeptide().get_cached().trajectories binarycontactfeaturizer = BinaryContactFeaturizer(cutoff=0) binaries = binarycontactfeaturizer.transform(trajectories) assert binaries[0].shape[1] == 171 assert np.sum(binaries[0]) == 0
def test_binaries_zero_cutoff(): trajectories = MinimalFsPeptide().get_cached().trajectories binarycontactfeaturizer = BinaryContactFeaturizer(cutoff=0) binaries = binarycontactfeaturizer.transform(trajectories) assert binaries[0].shape[1] == 171 assert np.sum(binaries[0]) == 0
def test_binary_to_logistics(): trajectories = MinimalFsPeptide().get_cached().trajectories steepness = np.absolute(10 * np.random.randn()) center = np.absolute(np.random.randn()) binarycontactfeaturizer = BinaryContactFeaturizer(cutoff=center) binaries = binarycontactfeaturizer.transform(trajectories) logisticcontactfeaturizer = LogisticContactFeaturizer(center=center, steepness=steepness) logistics = logisticcontactfeaturizer.transform(trajectories) # This checks that no distances that are larger than the center are logistically # transformed such that they are less than 1/2 np.testing.assert_array_almost_equal(binaries[0], logistics[0] > 0.5)
def test_binary_to_logistics(): trajectories = MinimalFsPeptide().get_cached().trajectories steepness = np.absolute(10 * np.random.randn()) center = np.absolute(np.random.randn()) binarycontactfeaturizer = BinaryContactFeaturizer(cutoff=center) binaries = binarycontactfeaturizer.transform(trajectories) logisticcontactfeaturizer = LogisticContactFeaturizer(center=center, steepness=steepness) logistics = logisticcontactfeaturizer.transform(trajectories) # This checks that no distances that are larger than the center are logistically # transformed such that they are less than 1/2 np.testing.assert_array_almost_equal(binaries[0], logistics[0] > 0.5)