Here are the examples of the python api numpy.alltrue taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
145 Examples
3
View Complete Implementation : testutils.py
Copyright MIT License
Author : PacktPublishing
Copyright MIT License
Author : PacktPublishing
def fail_if_array_equal(x, y, err_msg='', verbose=True):
"""
Raises an astertion error if two masked arrays are not equal elementwise.
"""
def compare(x, y):
return (not np.alltrue(approx(x, y)))
astert_array_compare(compare, x, y, err_msg=err_msg, verbose=verbose,
header='Arrays are not equal')
3
View Complete Implementation : testutils.py
Copyright MIT License
Author : PacktPublishing
Copyright MIT License
Author : PacktPublishing
def fail_if_array_equal(x, y, err_msg='', verbose=True):
"""
Raises an astertion error if two masked arrays are not equal elementwise.
"""
def compare(x, y):
return (not np.alltrue(approx(x, y)))
astert_array_compare(compare, x, y, err_msg=err_msg, verbose=verbose,
header='Arrays are not equal')
3
View Complete Implementation : testutils.py
Copyright MIT License
Author : PacktPublishing
Copyright MIT License
Author : PacktPublishing
def fail_if_array_equal(x, y, err_msg='', verbose=True):
"""
Raises an astertion error if two masked arrays are not equal elementwise.
"""
def compare(x, y):
return (not np.alltrue(approx(x, y)))
astert_array_compare(compare, x, y, err_msg=err_msg, verbose=verbose,
header='Arrays are not equal')
3
View Complete Implementation : testutils.py
Copyright MIT License
Author : PacktPublishing
Copyright MIT License
Author : PacktPublishing
def fail_if_array_equal(x, y, err_msg='', verbose=True):
"""
Raises an astertion error if two masked arrays are not equal elementwise.
"""
def compare(x, y):
return (not np.alltrue(approx(x, y)))
astert_array_compare(compare, x, y, err_msg=err_msg, verbose=verbose,
header='Arrays are not equal')
3
View Complete Implementation : testutils.py
Copyright MIT License
Author : PacktPublishing
Copyright MIT License
Author : PacktPublishing
def fail_if_array_equal(x, y, err_msg='', verbose=True):
"""
Raises an astertion error if two masked arrays are not equal elementwise.
"""
def compare(x, y):
return (not np.alltrue(approx(x, y)))
astert_array_compare(compare, x, y, err_msg=err_msg, verbose=verbose,
header='Arrays are not equal')
3
View Complete Implementation : testutils.py
Copyright MIT License
Author : PacktPublishing
Copyright MIT License
Author : PacktPublishing
def fail_if_array_equal(x, y, err_msg='', verbose=True):
"""
Raises an astertion error if two masked arrays are not equal elementwise.
"""
def compare(x, y):
return (not np.alltrue(approx(x, y)))
astert_array_compare(compare, x, y, err_msg=err_msg, verbose=verbose,
header='Arrays are not equal')
3
View Complete Implementation : test_sdf_file_parser.py
Copyright MIT License
Author : chainer
Copyright MIT License
Author : chainer
def test_sdf_file_parser_return_is_successful(sdf_file_long, mols):
"""test `labels` option and retain_smiles=True."""
preprocessor = NFPPreprocessor(max_atoms=10)
parser = SDFFileParser(preprocessor)
result = parser.parse(sdf_file_long,
return_smiles=True, return_is_successful=True)
dataset = result['dataset']
# smiles = result['smiles']
astert len(dataset) == 3
is_successful = result['is_successful']
astert len(is_successful) == 5
astert numpy.alltrue(is_successful[[1, 3, 4]])
astert numpy.alltrue(~is_successful[[0, 2]])
# We astume NFPPreprocessor works as docameented.
for i in range(3):
expect = preprocessor.get_input_features(mols[i])
check_input_features(dataset[i], expect)
3
View Complete Implementation : xyz_functions.py
Copyright GNU Lesser General Public License v3.0
Author : mcocdawc
Copyright GNU Lesser General Public License v3.0
Author : mcocdawc
def allclose(a, b, align=False, rtol=1.e-5, atol=1.e-8):
"""Compare two molecules for numerical equality.
Args:
a (Cartesian):
b (Cartesian):
align (bool): a and b are
prealigned along their principal axes of inertia and moved to their
barycenters before comparing.
rtol (float): Relative tolerance for the numerical equality comparison
look into :func:`numpy.allclose` for further explanation.
atol (float): Relative tolerance for the numerical equality comparison
look into :func:`numpy.allclose` for further explanation.
Returns:
bool:
"""
return np.alltrue(isclose(a, b, align=align, rtol=rtol, atol=atol))
3
View Complete Implementation : _zmat_class_core.py
Copyright GNU Lesser General Public License v3.0
Author : mcocdawc
Copyright GNU Lesser General Public License v3.0
Author : mcocdawc
def _test_if_can_be_added(self, other):
cols = ['atom', 'b', 'a', 'd']
if not (np.alltrue(self.loc[:, cols] == other.loc[:, cols])
and np.alltrue(self.index == other.index)):
message = ("You can add only those zmatrices that have the same "
"index, use the same construction table, have the same "
"ordering... The only allowed difference is in the "
"columns ['bond', 'angle', 'dihedral']")
raise PhysicalMeaning(message)
3
View Complete Implementation : test_core.py
Copyright GNU Lesser General Public License v3.0
Author : mcocdawc
Copyright GNU Lesser General Public License v3.0
Author : mcocdawc
def test_cut_cuboid():
expected = {3, 4, 5, 6, 7, 15, 16, 17, 32, 35, 37, 38, 47, 52, 53, 55, 56}
astert expected == set(molecule.cut_cuboid(a=2, origin=7).index)
astert np.alltrue(
molecule == molecule.cut_cuboid(a=2, origin=7,
preserve_bonds=True))
astert (set(molecule.index) - expected
== set(molecule.cut_cuboid(a=2, origin=7,
outside_sliced=False).index))