Skip to content

Commit

Permalink
Format all files using pre-commit hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
Radonirinaunimi committed Dec 1, 2024
1 parent fa46e44 commit 3386f4b
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 25 deletions.
4 changes: 2 additions & 2 deletions examples/cpp/fill-grid-v1.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////
// Exactly the same as `fill-grid.cpp` but using the generalization features
// introduced by v1. This in particular concerns the following functions:
//
//
// - pineappl_add_channel
// - pineappl_grid_new2
// - pineappl_grid_fill2
Expand Down Expand Up @@ -129,7 +129,7 @@ int main() {
auto* channels = pineappl_lumi_new();

// Specify the dimension of the channel, ie the number of convolutions required
std::size_t nb_convolutions = 2;
std::size_t nb_convolutions = 2;

// photon-photon initial state, where `22` is the photon (PDG MC ids)
int32_t pids1[] = { 22, 22 };
Expand Down
10 changes: 5 additions & 5 deletions examples/fortran/lhapdf_example_v1.f90
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ program lhapdf_example
call lhapdf_initpdfset_byname(1, "nCTEQ15FullNuc_208_82")

! write(*, *) "xfx_test1: ", xfx_test1(0, 0.5_dp, 100.0_dp, c_null_ptr)

! calling pineappl_grid_convolve without any flags
xfx = pineappl_xfx(xfx_test1)
alphas = pineappl_alphas(alphas_test1)
Expand All @@ -75,7 +75,7 @@ function xfx_test1(pdg_id, x, q2, state) bind(c)
use iso_c_binding

implicit none

integer(c_int32_t), value, intent(in) :: pdg_id
real(c_double), value, intent(in) :: x, q2
type(c_ptr), value, intent(in) :: state
Expand All @@ -88,7 +88,7 @@ function xfx_test2(pdg_id, x, q2, state) bind(c)
use iso_c_binding

implicit none

integer(c_int32_t), value, intent(in) :: pdg_id
real(c_double), value, intent(in) :: x, q2
type(c_ptr), value, intent(in) :: state
Expand All @@ -105,7 +105,7 @@ function alphas_test1(q2, state) bind(c)
use iso_c_binding

implicit none

real(c_double), value, intent(in) :: q2
type(c_ptr), value, intent(in) :: state
real(c_double) :: alphas_test1
Expand All @@ -117,7 +117,7 @@ function alphas_test2(q2, state) bind(c)
use iso_c_binding

implicit none

real(c_double), value, intent(in) :: q2
type(c_ptr), value, intent(in) :: state
real(c_double) :: alphas_test2
Expand Down
10 changes: 5 additions & 5 deletions examples/fortran/test_v1.f90
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
program test_pineappl
use pineappl
use iso_c_binding

implicit none

integer, parameter :: dp = kind(0.0d0)
Expand All @@ -24,7 +24,7 @@ program test_pineappl

channels = pineappl_channels_new()
call pineappl_channels_add(channels, 3, 2, [0, 0, 1, -1, 2, -2], [1.0_dp, 1.0_dp, 1.0_dp])

if (pineappl_lumi_count(channels) /= 1) then
write(*, *) "pineappl_lumi_count(): ", pineappl_lumi_count(channels)
error stop "error: pineappl_lumi_count"
Expand Down Expand Up @@ -190,7 +190,7 @@ function xfx1_test(pdg_id, x, q2, state) bind(c)
use iso_c_binding

implicit none

integer(c_int32_t), value, intent(in) :: pdg_id
real(c_double), value, intent(in) :: x, q2
type(c_ptr), value, intent(in) :: state
Expand All @@ -203,7 +203,7 @@ function xfx2_test(pdg_id, x, q2, state) bind(c)
use iso_c_binding

implicit none

integer(c_int32_t), value, intent(in) :: pdg_id
real(c_double), value, intent(in) :: x, q2
type(c_ptr), value, intent(in) :: state
Expand All @@ -216,7 +216,7 @@ function alphas_test(q2, state) bind(c)
use iso_c_binding

implicit none

real(c_double), value, intent(in) :: q2
type(c_ptr), value, intent(in) :: state
real(c_double) :: alphas_test
Expand Down
4 changes: 1 addition & 3 deletions pineappl_py/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,7 @@ def grid_with_generic_convolution(

# Construct the `Scales` object
fragmentation_scale = (
ScaleFuncForm.Scale(0)
if nb_convolutions >= 3
else ScaleFuncForm.NoScale(0)
ScaleFuncForm.Scale(0) if nb_convolutions >= 3 else ScaleFuncForm.NoScale(0)
)
scale_funcs = Scales(
ren=ScaleFuncForm.Scale(0),
Expand Down
4 changes: 1 addition & 3 deletions pineappl_py/tests/test_bin.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,7 @@ def test_binremapper(self, fake_grids):
bin_dims = g.bin_dimensions()
bin_limits = [
(left, right)
for left, right in zip(
g.bin_left(bin_dims - 1), g.bin_right(bin_dims - 1)
)
for left, right in zip(g.bin_left(bin_dims - 1), g.bin_right(bin_dims - 1))
]
normalizations = [10.0 for _ in g.bin_normalizations()]

Expand Down
8 changes: 2 additions & 6 deletions pineappl_py/tests/test_grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,9 +253,7 @@ def test_incosistent_convolutions(
xfxs=[pdf.polarized_pdf], # Requires ONE single PDF
alphas=pdf.alphasQ,
)
assert "called `Option::unwrap()` on a `None` value" == str(
err_func.value
)
assert "called `Option::unwrap()` on a `None` value" == str(err_func.value)

@pytest.mark.parametrize("params,expected", TESTING_SPECS)
def test_toy_convolution(self, fake_grids, params, expected):
Expand Down Expand Up @@ -440,9 +438,7 @@ def test_many_convolutions(self, fake_grids, pdf, nb_convolutions: int = 3):
_q2grid = np.geomspace(1e3, 1e5, 5)
_xgrid = np.geomspace(1e-5, 1, 4)
comb_nodes = [_q2grid] + [_xgrid for _ in range(nb_convolutions)]
ntuples = [
np.array(list(kins)) for kins in itertools.product(*comb_nodes)
]
ntuples = [np.array(list(kins)) for kins in itertools.product(*comb_nodes)]
obs = [rndgen.uniform(binning[0], binning[-1]) for _ in ntuples]
for pto in range(len(ORDERS)):
for channel_id in range(len(channels)):
Expand Down
4 changes: 3 additions & 1 deletion pineappl_py/tests/test_subgrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ def fake_grid(self, fake_grids) -> Grid:
convolutions=[CONVOBJECT],
)

def fake_importonlysubgrid(self, nb_xdim: int = 1) -> Tuple[ImportSubgridV1, OperatorInfo]:
def fake_importonlysubgrid(
self, nb_xdim: int = 1
) -> Tuple[ImportSubgridV1, OperatorInfo]:
x_grids = [np.linspace(0.1, 1, 2) for _ in range(nb_xdim)]
xgrid_size = [x.size for x in x_grids]
Q2s = np.linspace(10, 20, 2)
Expand Down

0 comments on commit 3386f4b

Please sign in to comment.