Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scientific/Engineering libraries using Pint #1216

Closed
salazardetroya opened this issue Dec 21, 2020 · 9 comments · Fixed by #1960
Closed

Scientific/Engineering libraries using Pint #1216

salazardetroya opened this issue Dec 21, 2020 · 9 comments · Fixed by #1960
Labels

Comments

@salazardetroya
Copy link

I am looking for a list of successful engineering/science projects using Pint. This will be helpful for anyone writing proposals to develop software that uses Pint as one of their components. Thanks.

@jthielen
Copy link
Contributor

jthielen commented Dec 21, 2020

I think MetPy (meteorology toolkit) would be a good example to get started.

Perhaps the Pint docs could curate a list of packages using Pint (like xarray does)?

@cpascual
Copy link
Contributor

cpascual commented Dec 23, 2020

we use it in taurus (a library for creating control system UIs)

@salazardetroya
Copy link
Author

For anyone wondering the same question: https://libraries.io/pypi/Pint/dependents

@CalebBell
Copy link

I use pint in:

fluids, a library for practical fluid dynamics calculations
ht, a library for practical heat transfer calculations
chemicals, a library for chemical property calculations and lookups
thermo, a library for thermodynamic equilibrium calculations

Pint is an incredible gift and a wonder of the Python scientific community. While it is not often practical to use in high-speed systems, it is critical for prototyping, and works wonderfully with "glue" code which wraps the hard scientific or numerical code.

The libraries.io link, however it works, has not detected my libraries and is likely missing most of pint's dependents. My projects have over 500 GitHub stars between them, and most users do not have GitHub accounts either.

@salazardetroya
Copy link
Author

@cpascual , @CalebBell , @jthielen how have you guys dealt with the issue of "Kind of Quantity" errors described in https://arxiv.org/ftp/arxiv/papers/1807/1807.07643.pdf ? Basically, there are some quantities that have the same units. For instance, energy and torque both have N*m. Pint by itself is not able to prevent the user from adding up together energy and torque quantities. Are there solutions to this problem?

@CalebBell
Copy link

@salazardetroya This is definitely a huge problem! In chemical engineering we have the quantities mole fraction, mass fraction, volume fractions; in the literature it is even common for the type of fraction to be assumed based on the context.

The fact that dimensional analysis can't help with any of these issues is not a fundamental problem with the technique; it is just a limitation. Code review, unit tests, documentation, and doing your best not to make mistakes are also very important. This limitation is much like how mypy or other static type analysis tools for Python can't prevent you from adding an integer of "1 elephant" to an integer of "1 whale"; because that's not what the tool is for.

Thank you for sharing that paper. It coherently describes a number of limitations. The truth of the mater is and always will be that errors can come in any number of places. Unit checking is an incredibly useful tool and I wouldn't stop using it for anything. However, if it upsets you that pint can't prevent this type of an error, it may be worth considering if larger opportunities for error exist.

@hgrecco
Copy link
Owner

hgrecco commented Jan 12, 2021

@CalebBell @salazardetroya We discussed in the past the idea of having an optional "Role" annotation to quantities. See #389 and #551

@cpascual
Copy link
Contributor

@salazardetroya: taurus being a control-system framework, it is sort of an "intermediary" between hardware and the actual scientific application. As such, it does not handle KoQ issues by itself (amongst other things because it lacks the application context knowledge to do it). It would be the responsibility of the scientific application built on top of taurus to handle KoQ issues if they are likely.

@jules-ch
Copy link
Collaborator

I think we can introduce a Ecosystem or Libraries using pint page in the docs.

I'll try to put this working on #972

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants