[Feat] Provide derivatives for pow (#246)

* [Feat] Provide manual derivatives for __pow__

* [Feat] Also applied changes to rpow

* [Test] Another pow test added.
This commit is contained in:
Fabian Joswig 2024-11-26 17:52:27 +01:00 committed by GitHub
parent 0ce765a99d
commit 30bfb55981
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 15 additions and 6 deletions

View file

@ -461,6 +461,18 @@ def test_cobs_overloading():
obs / cobs
def test_pow():
data = [1, 2.341, pe.pseudo_Obs(4.8, 0.48, "test_obs"), pe.cov_Obs(1.1, 0.3 ** 2, "test_cov_obs")]
for d in data:
assert d * d == d ** 2
assert d * d * d == d ** 3
for d2 in data:
assert np.log(d ** d2) == d2 * np.log(d)
assert (d ** d2) ** (1 / d2) == d
def test_reweighting():
my_obs = pe.Obs([np.random.rand(1000)], ['t'])
assert not my_obs.reweighted