Skip to content

Commit

Permalink
black formatted way too much
Browse files Browse the repository at this point in the history
  • Loading branch information
ikrommyd committed Mar 28, 2024
1 parent 4642da0 commit 9a143e8
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 53 deletions.
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
zfit >= 0.12
zfit>=0.12
11 changes: 2 additions & 9 deletions tests/test_pdf_cmsshape.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""Tests for CMSShape PDF."""

import numpy as np
import pytest
import tensorflow as tf
Expand Down Expand Up @@ -27,17 +26,11 @@ def test_cmsshape_pdf():
# Test PDF here
cmsshape, _ = create_cmsshape(m=m_true, beta=beta_true, gamma=gamma_true, limits=(50, 130))
assert zfit.run(cmsshape.pdf(90.0)) == pytest.approx(
cmsshape_numba.pdf(90.0, beta=beta_true, gamma=gamma_true, loc=m_true).item(),
rel=1e-5,
cmsshape_numba.pdf(90.0, beta=beta_true, gamma=gamma_true, loc=m_true).item(), rel=1e-5
)
np.testing.assert_allclose(
cmsshape.pdf(tf.range(50.0, 130, 10_000)),
cmsshape_numba.pdf(
tf.range(50.0, 130, 10_000).numpy(),
beta=beta_true,
gamma=gamma_true,
loc=m_true,
),
cmsshape_numba.pdf(tf.range(50.0, 130, 10_000).numpy(), beta=beta_true, gamma=gamma_true, loc=m_true),
rtol=1e-5,
)
assert cmsshape.pdf(tf.range(50.0, 130, 10_000)) <= cmsshape.pdf(90.0)
Expand Down
14 changes: 2 additions & 12 deletions tests/test_pdf_cruijff.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,7 @@ def create_cruijff(mu, sigmal, alphal, sigmar, alphar, limits):
def test_cruijff_pdf():
# Test PDF here
cruijff, _ = create_cruijff(
mu=mu_true,
sigmal=sigmal_true,
alphal=alphal_true,
sigmar=sigmar_true,
alphar=alphar_true,
limits=(50, 130),
mu=mu_true, sigmal=sigmal_true, alphal=alphal_true, sigmar=sigmar_true, alphar=alphar_true, limits=(50, 130)
)
assert cruijff.pdf(90.0, norm=False).numpy() == pytest.approx(
cruijff_numba.density(
Expand Down Expand Up @@ -87,12 +82,7 @@ def test_cruijff_pdf():
def test_cruijff_integral():
# Test CDF and integral here
cruijff, obs = create_cruijff(
mu=mu_true,
sigmal=sigmal_true,
alphal=alphal_true,
sigmar=sigmar_true,
alphar=alphar_true,
limits=(50, 130),
mu=mu_true, sigmal=sigmal_true, alphal=alphal_true, sigmar=sigmar_true, alphar=alphar_true, limits=(50, 130)
)
full_interval_numeric = cruijff.numeric_integrate(obs, norm=False).numpy()
true_integral = 67.71494
Expand Down
25 changes: 3 additions & 22 deletions tests/test_pdf_erfexp.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,25 +46,12 @@ def test_erfexp_pdf():
)
np.testing.assert_allclose(
erfexp.pdf(tf.range(50.0, 130, 10_000), norm=False),
erfexp_numpy(
tf.range(50.0, 130, 10_000),
mu=mu_true,
beta=beta_true,
gamma=gamma_true,
n=n_true,
),
erfexp_numpy(tf.range(50.0, 130, 10_000), mu=mu_true, beta=beta_true, gamma=gamma_true, n=n_true),
rtol=1e-8,
)
np.testing.assert_allclose(
erfexp.pdf(tf.range(50.0, 130, 10_000)),
erfexp_numpy(
tf.range(50.0, 130, 10_000),
mu=mu_true,
beta=beta_true,
gamma=gamma_true,
n=n_true,
)
/ 71.18838,
erfexp_numpy(tf.range(50.0, 130, 10_000), mu=mu_true, beta=beta_true, gamma=gamma_true, n=n_true) / 71.18838,
rtol=1e-8,
atol=1e-8,
)
Expand All @@ -81,13 +68,7 @@ def test_erfexp_pdf_random_params():
erfexp, __ = create_erfexp(mu=mu_true, beta=beta_true, gamma=gamma_true, n=n_true, limits=(50, 130))
np.testing.assert_allclose(
erfexp.pdf(tf.range(50.0, 130, 10_000), norm=False),
erfexp_numpy(
tf.range(50.0, 130, 10_000),
mu=mu_true,
beta=beta_true,
gamma=gamma_true,
n=n_true,
),
erfexp_numpy(tf.range(50.0, 130, 10_000), mu=mu_true, beta=beta_true, gamma=gamma_true, n=n_true),
rtol=1e-5,
)

Expand Down
1 change: 0 additions & 1 deletion zfit_physics/models/pdf_argus.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""ARGUS PDF (https://en.wikipedia.org/wiki/ARGUS_distribution)"""

from typing import Optional

import numpy as np
Expand Down
8 changes: 1 addition & 7 deletions zfit_physics/models/pdf_cruijff.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,7 @@ def __init__(
the PDF for better identification.
Has no programmatical functional purpose as identification. |@docend:pdf.init.name|
"""
params = {
"mu": mu,
"sigmal": sigmal,
"alphal": alphal,
"sigmar": sigmar,
"alphar": alphar,
}
params = {"mu": mu, "sigmal": sigmal, "alphal": alphal, "sigmar": sigmar, "alphar": alphar}
super().__init__(obs=obs, params=params, extended=extended, norm=norm)

def _unnormalized_pdf(self, x):
Expand Down
1 change: 0 additions & 1 deletion zfit_physics/models/pdf_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
Create a module for each pdf that you add.
"""

import zfit


Expand Down

0 comments on commit 9a143e8

Please sign in to comment.