AguaClara / aguaclara

An open-source Python package for designing and performing research on AguaClara water treatment plants.
https://aguaclara.github.io/aguaclara/
MIT License
24 stars 13 forks source link

[BUG] pc.density_water function unit display issues #152

Closed jillianwhiting closed 5 years ago

jillianwhiting commented 5 years ago

Some students in the 4520 class and monroe and tried to run this code temp_crit = 10 * u.degC density = pc.density_water(temp_crit) density and an error was thrown that would not allow them to display the value of density, but then when you multiple density by 1 it does print.

oliver-leung commented 5 years ago

This is my output:

>>> temp_crit = 10 * u.degC
>>> density = pc.density_water(temp_crit)
>>> density
<Quantity(999.7, 'kilogram / meter ** 3')>

What was the error message that they got?

Could they run

pip show aguaclara

and see if they're on version 0.0.17?

oliver-leung commented 5 years ago

@monroews and I found that density_water uses a CubicSpline object from SciPy, and that it strangely returns a 1-by-1 NumPy array with the density magnitude. We managed to resolve it with the np.asscalar function.

Monroe, do you happen to have the physchem.py file that I edited on your computer? I just want to be sure that I'm making the correct change.

Task: return the water density quantity as a scalar (i.e. remove it from its array).

monroews commented 5 years ago

I don't know where the file is. I'm sorry!

oliver-leung commented 5 years ago

Resolved, will be released this week!