pyhf icon indicating copy to clipboard operation
pyhf copied to clipboard

chore: [pre-commit.ci] pre-commit autoupdate

Open pre-commit-ci[bot] opened this issue 1 year ago • 2 comments

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 98.21%. Comparing base (3d26434) to head (189be40).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2535   +/-   ##
=======================================
  Coverage   98.21%   98.21%           
=======================================
  Files          69       69           
  Lines        4543     4543           
  Branches      804      804           
=======================================
  Hits         4462     4462           
  Misses         48       48           
  Partials       33       33           
Flag Coverage Δ
contrib 97.79% <ø> (ø)
doctest 98.08% <ø> (ø)
unittests-3.10 96.23% <ø> (ø)
unittests-3.11 96.23% <ø> (ø)
unittests-3.12 96.23% <ø> (ø)
unittests-3.8 96.25% <ø> (ø)
unittests-3.9 96.27% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Aug 05 '24 23:08 codecov[bot]

Looks like there's a slightly different type coercion needed here (taking one as an example0

src/pyhf/tensor/numpy_backend.py:38: error: Argument 2 to "poisson_logpdf" of "numpy_backend" has incompatible type

got:
"Union[ndarray[Any, dtype[number[T@__init__]]], ndarray[Any, dtype[bool]]]"

expected:
"Union[ndarray[Any, dtype[number[T@log_prob]]], ndarray[Any, dtype[bool]]]"

so need to dig into why. The @ notation is throwing me off a little (must be related to the generics). /cc @henryiii or @alexander-held if they've seen this before.

with this code

class _BasicPoisson:
    def __init__(self, rate: Tensor[T]):
        self.rate = rate

    def sample(self, sample_shape: Shape) -> ArrayLike:
        return poisson(self.rate).rvs(size=sample_shape + self.rate.shape)  # type: ignore[no-any-return]

    def log_prob(self, value: NDArray[np.number[T]]) -> ArrayLike:
        tensorlib: numpy_backend[T] = numpy_backend()
        return tensorlib.poisson_logpdf(value, self.rate)

here, it seems to complain about self.rate which is typed as Tensor[T].

kratsg avatar Aug 06 '24 16:08 kratsg

I'm going to merge this even though the CI is broken, as the other components are fine. We can follow up in https://github.com/scikit-hep/pyhf/issues/2553.

matthewfeickert avatar Nov 01 '24 08:11 matthewfeickert