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

Is it possible to create Uncertainty array from an Uncertainty array? #4

Open
MichaelTiemannOSC opened this issue Aug 31, 2023 · 0 comments

Comments

@MichaelTiemannOSC
Copy link

MichaelTiemannOSC commented Aug 31, 2023

I can create an uncertainty array from a pair of arrays, one representing nominal values and one representing error values. However, I cannot seem to figure out how to pass a list or array of Uncertainty values to create a new np.array of Uncertainty values.

Indeed, this implementation of array seems to prevent such:

    def __array__(self, t=None) -> np.ndarray:
        warnings.warn(
            "The uncertainty is stripped when downcasting to ndarray.",
            NumpyDowncastWarning,
            stacklevel=2,
        )
        return np.asarray(self._nom)

ndarrays can hold object types (which is what makes PintArrays) work.

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

No branches or pull requests

1 participant