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.

Better compatibility with uncertainties package

See original GitHub issue

Description

The uncertainties package is an extremely powerful tool for error propagation that is well integrated with NumPy.

Currently Astropy QTable objects work with uncertainties’ uarrays (essentially NumPy arrays). However, multiplying or dividing a uarray by an astropy unit returns the following error: TypeError: unsupported operand type(s) for *: 'numpy.ndarray' and 'IrreducibleUnit'

Likewise, uncertainties’ scalar type, ufloat, is not supported - multiplying a ufloat by a unit returns the following error: TypeError: unsupported operand type(s) for *: 'Variable' and 'IrreducibleUnit'

Fixing these incompatibilities and probably others I haven’t found could be a boon to Astropy.

Additional context

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
mhvkcommented, Oct 27, 2022

The branch is definitely meant for astropy! Part of what was holding it up is how to deal with reductions (like mean()) and in particular when to drop the covariances (subtracting the mean of a 1000x1000 image would otherwise create a covariance matrix of 10^12 points…). But also how to sensibly deal with, say, dividing all rows in a 1000x1000 image by a 1000-length column.

Any help with it would definitely be appreciated. Though partially it is really about defining expectations and writing tests.

(Sorry this is a bit vague, I haven’t looked at it recently.)

1reaction
mhvkcommented, Oct 26, 2022

As far as I’m aware, none of those handle covariances – this is the really nice part of the uncertainties package: with c = a+b-a, your variable will not just equal b, but also have its uncertainty; in nddata and so on, it would have the uncertainty of a included since the parts are assumed to be independent.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Welcome to the uncertainties package - PythonHosted.org
The uncertainties package is a free, cross-platform program that transparently handles calculations with numbers with uncertainties (like 3.14±0.01). It can ...
Read more >
uncertainties Python package Documentation - Read the Docs
The uncertainties package is a free, cross-platform program that transparently handles calculations with numbers.
Read more >
uncertainties - PyPI
The uncertainties package takes the pain and complexity out of uncertainty calculations. Detailed information about this package can be found on its main ......
Read more >
Uncertainty propagation the easy way in #Python - YouTube
Luckily there is a package in Python for that. To quote that package : "The uncertainties package takes the pain and complexity out...
Read more >
uncertainty - The Kitchin Research Group
Back in 2013 I wrote about using the uncertainties package to propagate uncertainties. The problem setup was for finding the uncertainty in ...
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