question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

The vectorized submodule is not fully supported throughout the package

See original GitHub issue

Describe the bug The vectorized functionality does not seem to be universally applied.

Minimal Reproducible Example

import chemicals as chem
import numpy as np
from chemicals import vectorized
props = chem.heat_capacity.TRC_gas_data.loc['7732-18-5']  # for water
coeffs = {}
for val in props.index:
    if val.startswith('a'):
        coeffs[val] = props[val]
Cp = chem.heat_capacity.TRCCp(T=np.array([333, 444]), **coeffs)

Additional context The error message is:

ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

This is occurring because of the line:

if T <= a7:

For this to work in a vectorized way, this needs to be if np.all(T < a7).

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
jgostickcommented, Mar 30, 2021

Ummm, I just happened to discover that they only work with positional arguments. I think that’ll get me going now…but positional arguments scare me, guess I’ll just have to live with it.

Thanks again!

0reactions
jgostickcommented, Mar 30, 2021

Interesting. Our problems are usually limited by the matrix routines, so a few microseconds don’t matter much.

Anyway, new issue: I am getting an ‘invalid number of arguments’ error from all the numba_vectorized functions. Any thoughts?

numba_vectorized.viscosity_gas_Gharagheizi(T=[444, 555], Tc=555, Pc=444, MW=18)

Sorry to be a pain, but we’re integrating chemicals into openpnm for phase property estimation, so we need to apply the functions to millions of values, hence my interest in the speed-ups.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why does git fail to fetch specific valid submodule for a given ...
Running this command after cloning (and receiving the error) solved my problem: git submodule update --force --recursive --init --remote.
Read more >
Git - Submodules - Git SCM
Although DbConnector is a subdirectory in your working directory, Git sees it as a submodule and doesn't track its contents when you're not...
Read more >
Sparse matrices (scipy.sparse) — SciPy v1.9.3 Manual
This package is switching to an array interface, compatible with NumPy arrays, from the older matrix interface. We recommend that you use the...
Read more >
Using Git submodules with GitLab CI/CD
Use Git submodules to keep a Git repository as a subdirectory of another Git repository. You can clone another repository into your project...
Read more >
gnuradio/volk: The Vector Optimized Library of Kernels - GitHub
Since each SIMD architecture can be very different and no compiler has yet come along to handle vectorization properly or highly efficiently, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found