Skip to content

Commit 19af0b6

Browse files
authored
Merge pull request #2334 from NNPDF/remove_deprecated_and_dead_functions
Remove a bunch of deprecated functions and options
2 parents d0ac76d + eefc403 commit 19af0b6

File tree

12 files changed

+30
-360
lines changed

12 files changed

+30
-360
lines changed

deprecated_functions.py

Lines changed: 0 additions & 138 deletions
This file was deleted.

doc/sphinx/source/vp/custom_pipelines.rst

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ specification" (something typically containing metadata information
141141
such as paths, which are necessary to load the final commondata or fktable)
142142

143143
In the case of the positivity set, this is entirely given in terms of
144-
existing check functions:
144+
existing check functions
145145

146146
.. code:: python
147147
@@ -151,9 +151,6 @@ existing check functions:
151151
th = self.check_theoryID(theiryID)
152152
return PositivitySetSpec(cd, fk, postlambda, th)
153153
154-
def get_posset(self, theoryID, setname, postlambda):
155-
return self.check_posset(theiryID, setname, postlambda).load()
156-
157154
158155
A more complicated example should raise the appropriate loader
159156
errors (see the other examples in the class).

n3fit/src/n3fit/scripts/evolven3fit.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,6 @@ def construct_evolven3fit_parser(subparsers):
106106
return parser
107107

108108

109-
def evolven3fit_new():
110-
_logger.warning("`evolven3fit_new` is deprecated. Please use `evolven3fit` instead.")
111-
main()
112-
113-
114109
def main():
115110
parser = ArgumentParser(description="evolven3fit - a script with tools to evolve PDF fits")
116111
parser.add_argument(

pyproject.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@ n3fit = "n3fit.scripts.n3fit_exec:main"
4040
validphys = "validphys.scripts.main:main"
4141
# Fitting scripts
4242
evolven3fit = "n3fit.scripts.evolven3fit:main"
43-
# Keep the `new` suffix so people's scripts don't break
44-
evolven3fit_new = "n3fit.scripts.evolven3fit:evolven3fit_new"
4543
vp-setupfit = "n3fit.scripts.vp_setupfit:main"
4644
postfit = "validphys.scripts.postfit:main"
4745
# validphys helpers and scripts
@@ -158,7 +156,6 @@ log_cli_level = "WARNING"
158156
omit = [
159157
"*/local*",
160158
"*/rule*",
161-
"deprecated_functions.py",
162159
"*/nnpdf_data/commondata/*",
163160
"*/nnpdf_data/filter_utils/*",
164161
"*test_*.py"

validphys2/src/validphys/config.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -419,9 +419,7 @@ def parse_dataset_input(self, dataset: Mapping, allow_legacy_names: bool = True)
419419
custom_group: str
420420
custom group to apply to the dataset
421421
422-
Note that the `sys` key is deprecated and allowed only for old-format dataset.
423-
424-
Old-format commondata will be translated to the new version in this function.
422+
Old-format names-sys will be translated to the new version in this function.
425423
"""
426424
accepted_keys = {"dataset", "sys", "cfac", "frac", "weight", "custom_group", "variant"}
427425
try:
@@ -476,7 +474,9 @@ def parse_dataset_input(self, dataset: Mapping, allow_legacy_names: bool = True)
476474
variant = map_variant
477475

478476
if sysnum is not None:
479-
log.warning("The key 'sys' is deprecated and will soon be removed")
477+
log.warning(
478+
f"The key 'sys' is deprecated and only used for variant discovery: {variant}"
479+
)
480480

481481
return DataSetInput(
482482
name=name,
@@ -485,7 +485,6 @@ def parse_dataset_input(self, dataset: Mapping, allow_legacy_names: bool = True)
485485
weight=weight,
486486
custom_group=custom_group,
487487
variant=variant,
488-
sys=sysnum,
489488
)
490489

491490
def parse_inconsistent_data_settings(self, settings):
@@ -536,11 +535,9 @@ def produce_commondata(self, *, dataset_input, use_fitcommondata=False, fit=None
536535
"""Produce a CommondataSpec from a dataset input"""
537536

538537
name = dataset_input.name
539-
sysnum = dataset_input.sys
540538
try:
541539
return self.loader.check_commondata(
542540
setname=name,
543-
sysnum=sysnum,
544541
use_fitcommondata=use_fitcommondata,
545542
fit=fit,
546543
variant=dataset_input.variant,
@@ -687,15 +684,13 @@ def produce_dataset(
687684
True, attempt to lod and check the PLOTTING files
688685
(note this may cause a noticeable slowdown in general)."""
689686
name = dataset_input.name
690-
sysnum = dataset_input.sys
691687
cfac = dataset_input.cfac
692688
frac = dataset_input.frac
693689
weight = dataset_input.weight
694690
variant = dataset_input.variant
695691
try:
696692
ds = self.loader.check_dataset(
697693
name=name,
698-
sysnum=sysnum,
699694
theoryid=theoryid,
700695
cfac=cfac,
701696
cuts=cuts,

validphys2/src/validphys/core.py

Lines changed: 6 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -264,44 +264,14 @@ class CommonDataSpec(TupleComp):
264264
and only to be used with ``legacy=True``
265265
"""
266266

267-
def __init__(self, name, metadata, legacy=False, datafile=None, sysfile=None, plotfiles=None):
268-
self.legacy = legacy
267+
def __init__(self, name, metadata, datafile=None):
269268
self._metadata = metadata
270-
271-
# Some checks
272-
if legacy:
273-
# TODO: this will start raising an error soon
274-
if datafile is None or sysfile is None or plotfiles is None:
275-
raise ValueError(
276-
"Legacy CommonDataSpec need datafile, sysfile and plotfiles arguments"
277-
)
278-
else:
279-
if sysfile is not None:
280-
raise ValueError("New CommonDataSpec don't need sysfile input")
281-
if plotfiles is not None:
282-
raise ValueError("New CommonDataSpec don't need plotfile input")
283-
284269
self.datafile = datafile
285-
self.sysfile = sysfile
286-
if legacy:
287-
self.plotfiles = tuple(plotfiles)
288-
super().__init__(datafile, sysfile, self.plotfiles)
289-
else:
290-
self.plotfiles = False
291-
super().__init__(name, self.metadata)
270+
self.plotfiles = False
271+
super().__init__(name, self.metadata)
292272

293273
def with_modified_data(self, central_data_file, uncertainties_file=None):
294274
"""Returns a copy of this instance with a new data file in the metadata"""
295-
if self.legacy:
296-
return self.__class__(
297-
self.name,
298-
self.metadata,
299-
legacy=True,
300-
datafile=central_data_file,
301-
sysfile=self.sysfile,
302-
plotfiles=self.plotfiles,
303-
)
304-
305275
modified_args = {"data_central": central_data_file}
306276

307277
if uncertainties_file is not None:
@@ -316,11 +286,7 @@ def name(self):
316286

317287
@functools.cached_property
318288
def nsys(self):
319-
if self.legacy:
320-
return self.metadata.nsys
321-
else:
322-
cd = self.load()
323-
return cd.nsys
289+
return self.load().nsys
324290

325291
@property
326292
def ndata(self):
@@ -340,8 +306,6 @@ def legacy_names(self):
340306

341307
@property
342308
def theory_metadata(self):
343-
if self.legacy:
344-
return None
345309
return self.metadata.theory
346310

347311
def __str__(self):
@@ -376,13 +340,10 @@ class DataSetInput(TupleComp):
376340
extra weight to apply to the dataset (default: 1.0)
377341
variant: str or tuple[str]
378342
variant or variants to apply (default: None)
379-
sysnum: int
380-
deprecated, systematic file to load for the dataset
381343
"""
382344

383-
def __init__(self, *, name, cfac, frac, weight, custom_group, variant, sys=None):
345+
def __init__(self, *, name, cfac, frac, weight, custom_group, variant):
384346
self.name = name
385-
self.sys = sys
386347
self.cfac = cfac
387348
self.frac = frac
388349
self.weight = weight
@@ -396,7 +357,7 @@ def __init__(self, *, name, cfac, frac, weight, custom_group, variant, sys=None)
396357
if isinstance(variant, list):
397358
variant = tuple(variant)
398359
self.variant = variant
399-
super().__init__(name, cfac, frac, weight, custom_group, variant, sys)
360+
super().__init__(name, cfac, frac, weight, custom_group, variant)
400361

401362
def __str__(self):
402363
return self.name
@@ -529,8 +490,6 @@ def __init__(
529490
self.frac = frac
530491

531492
# If OP is None, check whether the commondata is setting an operation
532-
# TODO: eventually the operation will _always_ be set from the commondata, but for legacy
533-
# compatibility it will be also controllable as an input argument
534493
if op is None:
535494
if commondata.theory_metadata is None:
536495
op = 'NULL'

validphys2/src/validphys/filters.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -639,13 +639,10 @@ def __init__(
639639
except LoaderError as e:
640640
raise RuleProcessingError(f"Could not find dataset {self.dataset}") from e
641641

642-
if cd.legacy:
642+
if cd.metadata.is_ported_dataset:
643643
self.variables = _get_kinlabel_process_type(cd.process_type)
644644
else:
645-
if cd.metadata.is_ported_dataset:
646-
self.variables = _get_kinlabel_process_type(cd.process_type)
647-
else:
648-
self.variables = cd.metadata.kinematic_coverage
645+
self.variables = cd.metadata.kinematic_coverage
649646
else:
650647
self.variables = _get_kinlabel_process_type(self.process_type)
651648
# TODO: for now this will be a string within this class

0 commit comments

Comments
 (0)