Skip to content

Commit 6ea1293

Browse files
committed
precommit to exec script
1 parent 3db217b commit 6ea1293

File tree

3 files changed

+20
-19
lines changed

3 files changed

+20
-19
lines changed

n3fit/src/n3fit/scripts/evolven3fit.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""
2+
23
This module contains the CLI for evolven3fit
34
"""
45

@@ -177,11 +178,7 @@ def main():
177178

178179
if args.actions == "produce_eko":
179180
tcard, opcard = eko_utils.construct_eko_cards(
180-
nnpdf_theory,
181-
x_grid,
182-
op_card_info,
183-
theory_card_info,
184-
args.legacy40,
181+
nnpdf_theory, x_grid, op_card_info, theory_card_info, args.legacy40
185182
)
186183
elif args.actions == "produce_eko_photon":
187184
tcard, opcard = eko_utils.construct_eko_photon_cards(

n3fit/src/n3fit/scripts/n3fit_exec.py

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,19 @@
99
import re
1010
import shutil
1111
import sys
12-
import pandas as pd
1312

13+
import pandas as pd
1414
from ruamel.yaml import error
1515

1616
from reportengine import colors
1717
from reportengine.namespaces import NSList
18+
from validphys.api import API
1819
from validphys.app import App
1920
from validphys.config import Config, ConfigError, Environment, EnvironmentError_
2021
from validphys.core import FitSpec
21-
from validphys.utils import yaml_safe
22-
from validphys.loader import FallbackLoader, HyperscanNotFound
23-
from validphys.api import API
2422
from validphys.hyperoptplot import generate_dictionary
23+
from validphys.loader import FallbackLoader, HyperscanNotFound
24+
from validphys.utils import yaml_safe
2525

2626
loader = FallbackLoader()
2727

@@ -240,38 +240,42 @@ def produce_hyperscanner(self, parameters, hyperscan_config=None, hyperopt=None)
240240
"db_path": db_path,
241241
}
242242
return HyperScanner(parameters, hyperscan_config, **extra_args)
243-
243+
244244
def parse_trial_specs(self, trial_specs):
245245
return trial_specs
246-
246+
247247
def produce_trials(self, trial_specs={}):
248-
"""Read the input hyperscan and produce a dictionary containing
248+
"""Read the input hyperscan and produce a dictionary containing
249249
the settings of the best trials"""
250-
250+
251251
if not trial_specs:
252252
return {}
253253
else:
254254
try:
255255
hyperscan = loader.check_hyperscan(trial_specs['hyperscan'])
256256
except HyperscanNotFound as e:
257257
log.warning(e)
258-
dict_trials = generate_dictionary(hyperscan.tries_files[1].parent,"average")
258+
dict_trials = generate_dictionary(hyperscan.tries_files[1].parent, "average")
259259
hyperopt_dataframe = pd.DataFrame(dict_trials)
260260
n_termalization = trial_specs['thermalization']
261261
n_best = trial_specs['number_of_trials']
262-
best = hyperopt_dataframe[n_termalization:].sort_values('loss')[:n_best].to_dict(orient='list')
262+
best = (
263+
hyperopt_dataframe[n_termalization:]
264+
.sort_values('loss')[:n_best]
265+
.to_dict(orient='list')
266+
)
263267
best['number_of_trials'] = n_best
264268
return best
265-
269+
266270

267271
class N3FitApp(App):
268272
"""The class which parsers and performs the fit"""
269273

270274
environment_class = N3FitEnvironment
271275
config_class = N3FitConfig
272276

273-
def __init__(self):
274-
super().__init__(name="n3fit", providers=N3FIT_PROVIDERS)
277+
def __init__(self, name="n3fit", providers=N3FIT_PROVIDERS):
278+
super().__init__(name=name, providers=providers)
275279

276280
@property
277281
def argparser(self):

n3fit/src/n3fit/scripts/vp_setupfit.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ def from_yaml(cls, o, *args, **kwargs):
217217
trials_config = file_content.get('trial_specs', {})
218218
if trials_config:
219219
loader.check_hyperscan(trials_config['hyperscan'])
220-
220+
221221
# Sets default values if they are not present in the runcard
222222
for k, v in SETUPFIT_DEFAULTS.items():
223223
file_content.setdefault(k, v)

0 commit comments

Comments
 (0)