Skip to content

Commit 3725aa4

Browse files
RoyStegemanachiefa
authored andcommitted
format a bit
1 parent 54bda12 commit 3725aa4

File tree

6 files changed

+315
-333
lines changed

6 files changed

+315
-333
lines changed

validphys2/src/validphys/commondata.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,12 @@
66
:py:mod:`validphys.coredata`
77
88
"""
9+
10+
import functools
11+
912
from reportengine import collect
1013
from validphys.commondataparser import load_commondata
11-
import functools
14+
1215

1316
@functools.lru_cache
1417
def loaded_commondata_with_cuts(commondata, cuts):
@@ -37,5 +40,5 @@ def loaded_commondata_with_cuts(commondata, cuts):
3740
)
3841

3942
groups_dataset_inputs_loaded_cd_with_cuts_byprocess = collect(
40-
"loaded_commondata_with_cuts", ("group_dataset_inputs_by_process", "data")
41-
)
43+
"loaded_commondata_with_cuts", ("group_dataset_inputs_by_process", "data")
44+
)

validphys2/src/validphys/config.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1156,8 +1156,7 @@ def produce_loaded_user_covmat_path(self, user_covmat_path: str = ""):
11561156
l = self.loader
11571157
fileloc = l.check_vp_output_file(user_covmat_path)
11581158
return fileloc
1159-
1160-
1159+
11611160
@configparser.explicit_node
11621161
def produce_covmat_custom(self, use_ht_uncertainties: bool = False):
11631162
if use_ht_uncertainties:
@@ -1225,15 +1224,13 @@ def res(*args, **kwargs):
12251224
# Set this to get the same filename regardless of the action.
12261225
res.__name__ = "theory_covmat"
12271226
return res
1228-
1229-
1227+
12301228
@configparser.explicit_node
12311229
def produce_combine_by_type_custom(self, use_ht_uncertainties: bool = False):
12321230
if use_ht_uncertainties:
12331231
return validphys.theorycovariance.construction.combine_by_type_ht
12341232
return validphys.theorycovariance.construction.combine_by_type
12351233

1236-
12371234
def produce_fitthcovmat(
12381235
self, use_thcovmat_if_present: bool = False, fit: (str, type(None)) = None
12391236
):
@@ -1779,9 +1776,9 @@ def produce_filter_data(self, fakedata: bool = False, theorycovmatconfig=None):
17791776
if not fakedata:
17801777
return validphys.filters.filter_real_data
17811778
else:
1782-
#if theorycovmatconfig is not None and theorycovmatconfig.get(
1779+
# if theorycovmatconfig is not None and theorycovmatconfig.get(
17831780
# "use_thcovmat_in_sampling"
1784-
#):
1781+
# ):
17851782
# # NOTE: By the time we run theory covmat closure tests,
17861783
# # hopefully the generation of pseudodata will be done in python.
17871784
# raise ConfigError(

validphys2/src/validphys/dataplots.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
Plots of relations between data PDFs and fits.
33
"""
44

5-
from __future__ import generator_stop
6-
75
from collections import defaultdict
86
from collections.abc import Sequence
97
import itertools
@@ -28,7 +26,7 @@
2826
from validphys.coredata import KIN_NAMES
2927
from validphys.plotoptions.core import get_info, kitable, transform_result
3028
from validphys.results import chi2_stat_labels, chi2_stats
31-
from validphys.sumrules import POL_LIMS, partial_polarized_sum_rules
29+
from validphys.sumrules import POL_LIMS
3230
from validphys.utils import sane_groupby_iter, scale_from_grid, split_ranges
3331

3432
log = logging.getLogger(__name__)
@@ -301,9 +299,7 @@ def _plot_fancy_impl(
301299
min_vals = []
302300
max_vals = []
303301
fig, ax = plotutils.subplots()
304-
ax.set_title(
305-
"{} {}".format(info.dataset_label, info.group_label(samefig_vals, info.figure_by))
306-
)
302+
ax.set_title(f"{info.dataset_label} {info.group_label(samefig_vals, info.figure_by)}")
307303

308304
lineby = sane_groupby_iter(fig_data, info.line_by)
309305

@@ -1494,7 +1490,7 @@ def next_options():
14941490
# if group is None then make sure that shows on legend.
14951491
key = str(group)
14961492
elif marker_by == "kinematics":
1497-
key = None
1493+
key = None
14981494
else:
14991495
raise ValueError('Unknown marker_by value')
15001496

@@ -1526,8 +1522,10 @@ def next_options():
15261522
# This is to get the label key
15271523
coords = [], []
15281524
if marker_by == "kinematics":
1529-
ht_magnitude = np.concatenate( cvdict[key]) / (coords[1] * (1 - coords[0]) )
1530-
out = ax.scatter(*coords, marker='.', c=ht_magnitude, cmap="viridis", norm=mcolors.LogNorm())
1525+
ht_magnitude = np.concatenate(cvdict[key]) / (coords[1] * (1 - coords[0]))
1526+
out = ax.scatter(
1527+
*coords, marker='.', c=ht_magnitude, cmap="viridis", norm=mcolors.LogNorm()
1528+
)
15311529
clb = fig.colorbar(out)
15321530
clb.ax.set_title(r'$F_\mathrm{exp}\frac{1}{Q^2(1-x)}$')
15331531
ax.plot(*coords, label=key, markeredgewidth=1, markeredgecolor=None, **key_options[key])

validphys2/src/validphys/results.py

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -276,22 +276,29 @@ def group_kin_table_no_table(groups_data, groups_index):
276276
"""Generate a table containing the kinematics and the process_type."""
277277
result_records = []
278278
for group_data in groups_data:
279-
group_cd = group_data.load_commondata()
280-
cd = np.concatenate(
281-
[group_cd[i].commondata_table[['kin1','kin2','kin3','process']] for i in range(len(group_cd))],
282-
axis=0
283-
)
284-
for index, dataset in enumerate(cd):
285-
try:
286-
process_name = dataset[3].name
287-
except AttributeError:
288-
process_name = dataset[3]
289-
result_records.append(
290-
dict([("kin_1", dataset[0]),
291-
("kin_2", dataset[1]),
292-
("kin_3", dataset[2]),
293-
("process_type", process_name)])
279+
group_cd = group_data.load_commondata()
280+
cd = np.concatenate(
281+
[
282+
group_cd[i].commondata_table[['kin1', 'kin2', 'kin3', 'process']]
283+
for i in range(len(group_cd))
284+
],
285+
axis=0,
294286
)
287+
for index, dataset in enumerate(cd):
288+
try:
289+
process_name = dataset[3].name
290+
except AttributeError:
291+
process_name = dataset[3]
292+
result_records.append(
293+
dict(
294+
[
295+
("kin_1", dataset[0]),
296+
("kin_2", dataset[1]),
297+
("kin_3", dataset[2]),
298+
("process_type", process_name),
299+
]
300+
)
301+
)
295302

296303
if not result_records:
297304
log.warning("Empty records for group results")

0 commit comments

Comments
 (0)