Support for Numpy Arrays (chemicals.vectorized)

Basic module which wraps all chemicals functions with numpy’s np.vectorize function.

All other object - dicts, classes, etc - are not wrapped. Supports star imports; so the same objects exported when importing from the main library will be imported from here.

>>> from chemicals.vectorized import *
>>> Antoine(np.linspace(100, 200, 5), A=8.95894, B=510.595, C=-15.95)
array([7.65674361e+02, 1.89116754e+04, 1.41237759e+05, 5.60609191e+05,
       1.53010431e+06])

Inputs do not need to be numpy arrays; they can be any iterable:

>>> import chemicals.vectorized
>>> chemicals.vectorized.Tc(['108-88-3', '7732-18-5'])
array([591.75 , 647.096])

Warning

This module does not replace the functions in the chemicals module; it copies all the functions into the chemicals.vectorized module and makes them vectorized there.

For example by importing chemicals.vectorized, chemicals.Antoine won’t become vectorized, but chemicals.vectorized.Antoine will become available and is vectorized.

Warning

np.vectorize does not use NumPy to accelerate any computations; it is a convenience wrapper. If you are working on a problem large enough for speed to be an issue and Numba is compatible with your version of Python, an interface to that library is available at chemicals.numba which does accelerate NumPy array computations and is normally faster than using numpy directly.