19
19
_logger = logging .getLogger (__name__ )
20
20
21
21
22
+ def _add_production_options (parser ):
23
+ """Adds the production options that are shared between the normal and the QED EKOs to their parsers"""
24
+ parser .add_argument ("theoryID" , type = int , help = "ID of the theory used to produce the eko" )
25
+ parser .add_argument ("dump" , type = pathlib .Path , help = "Path where the EKO is dumped" )
26
+ parser .add_argument (
27
+ "-i" , "--x-grid-ini" , default = None , type = float , help = "Starting point of the x-grid"
28
+ )
29
+ parser .add_argument (
30
+ "-p" , "--x-grid-points" , default = None , type = int , help = "Number of points of the x-grid"
31
+ )
32
+ parser .add_argument ("-n" , "--n-cores" , type = int , default = 1 , help = "Number of cores to be used" )
33
+ parser .add_argument ('--use_polarized' , action = 'store_true' , help = "Use polarized evolution" )
34
+ parser .add_argument (
35
+ "-e" ,
36
+ "--ev-op-iterations" ,
37
+ type = int ,
38
+ default = None ,
39
+ help = "ev_op_iterations for the EXA theory. Overrides the settings given in the theory card." ,
40
+ )
41
+
42
+
22
43
def construct_eko_parser (subparsers ):
23
44
parser = subparsers .add_parser (
24
45
"produce_eko" ,
@@ -30,14 +51,7 @@ def construct_eko_parser(subparsers):
30
51
provided number of points. The eko will be dumped in the provided path."""
31
52
),
32
53
)
33
- parser .add_argument ("theoryID" , type = int , help = "ID of the theory used to produce the eko" )
34
- parser .add_argument ("dump" , type = pathlib .Path , help = "Path where the EKO is dumped" )
35
- parser .add_argument (
36
- "-i" , "--x-grid-ini" , default = None , type = float , help = "Starting point of the x-grid"
37
- )
38
- parser .add_argument (
39
- "-p" , "--x-grid-points" , default = None , type = int , help = "Number of points of the x-grid"
40
- )
54
+ _add_production_options (parser )
41
55
parser .add_argument (
42
56
"--legacy40" ,
43
57
action = "store_true" ,
@@ -56,14 +70,7 @@ def construct_eko_photon_parser(subparsers):
56
70
provided number of points. The eko will be dumped in the provided path."""
57
71
),
58
72
)
59
- parser .add_argument ("theoryID" , type = int , help = "ID of the theory used to produce the eko" )
60
- parser .add_argument ("dump" , type = pathlib .Path , help = "Path where the EKO is dumped" )
61
- parser .add_argument (
62
- "-i" , "--x-grid-ini" , default = None , type = float , help = "Starting point of the x-grid"
63
- )
64
- parser .add_argument (
65
- "-p" , "--x-grid-points" , default = None , type = int , help = "Number of points of the x-grid"
66
- )
73
+ _add_production_options (parser )
67
74
parser .add_argument (
68
75
"-g" , "--q-gamma" , default = 100 , type = float , help = "Scale at which the photon is generated"
69
76
)
@@ -76,7 +83,7 @@ def construct_evolven3fit_parser(subparsers):
76
83
help = "Evolves the fitted PDFs. The q_grid starts at the Q0 given by the theory but the last point is q_fin and its number of points can be specified by q_points. If a path is given for the dump option, the eko will be dumped in that path after the computation. If a path is given for the load option, the eko to be used for the evolution will be loaded from that path. The two options are mutually exclusive." ,
77
84
)
78
85
parser .add_argument (
79
- "configuration_folder " , help = "Path to the folder containing the (pre-DGLAP) fit result"
86
+ "fit_folder " , help = "Path to the folder containing the (pre-DGLAP) fit result"
80
87
)
81
88
parser .add_argument (
82
89
"-l" , "--load" , type = pathlib .Path , default = None , help = "Path of the EKO to be loaded"
@@ -99,32 +106,14 @@ def evolven3fit_new():
99
106
100
107
101
108
def main ():
102
- parser = ArgumentParser (
103
- description = "evolven3fit - a script with tools to evolve PDF fits" ,
104
- usage = """evolven3fit [-h] [-q Q_FIN] [-p Q_POINTS] [-n N_CORES] [-e EV_OP_ITERATIONS]
105
- {produce_eko,produce_eko_photon,evolve} [fit folder]
106
-
107
- Note that with the now removed apfel-based version of `evolven3fit` the syntax was
108
- `evolven3fit [fit folder] [number of replicas]`. This syntax is no longer supported in the
109
- eko-based version of evolven3fit.
110
- """ ,
111
- )
112
- parser .add_argument ('--use_polarized' , action = 'store_true' , help = "Use polarized evolution" )
109
+ parser = ArgumentParser (description = "evolven3fit - a script with tools to evolve PDF fits" )
113
110
parser .add_argument (
114
111
"-q" , "--q-fin" , type = float , default = None , help = "Final q-value of the evolution"
115
112
)
116
113
parser .add_argument (
117
114
"-p" , "--q-points" , type = int , default = None , help = "Number of q points for the evolution"
118
115
)
119
- parser .add_argument ("-n" , "--n-cores" , type = int , default = 1 , help = "Number of cores to be used" )
120
116
parser .add_argument ("--no-net" , action = "store_true" , help = "Emulates validphys' --no-net" )
121
- parser .add_argument (
122
- "-e" ,
123
- "--ev-op-iterations" ,
124
- type = int ,
125
- default = None ,
126
- help = "ev_op_iterations for the EXA theory. Overrides the settings given in the theory card." ,
127
- )
128
117
129
118
subparsers = parser .add_subparsers (title = "actions" , dest = "actions" )
130
119
construct_eko_parser (subparsers )
@@ -133,12 +122,7 @@ def main():
133
122
134
123
args = parser .parse_args ()
135
124
136
- op_card_info = {
137
- "configs" : {"n_integration_cores" : args .n_cores , "polarized" : args .use_polarized }
138
- }
139
- if args .ev_op_iterations is not None :
140
- op_card_info ["configs" ]["ev_op_iterations" ] = args .ev_op_iterations
141
-
125
+ op_card_info = {}
142
126
# Here we do not allow any modification of the theory card, for the moment.
143
127
theory_card_info = {}
144
128
@@ -149,7 +133,7 @@ def main():
149
133
150
134
if args .actions == "evolve" :
151
135
152
- fit_folder = pathlib .Path (args .configuration_folder )
136
+ fit_folder = pathlib .Path (args .fit_folder )
153
137
if args .load is None :
154
138
theoryID = utils .get_theoryID_from_runcard (fit_folder )
155
139
_logger .info (f"Loading eko from theory { theoryID } " )
@@ -194,6 +178,14 @@ def main():
194
178
)
195
179
else :
196
180
x_grid = np .geomspace (args .x_grid_ini , 1.0 , args .x_grid_points )
181
+
182
+ # Prepare the op card config
183
+ op_card_info = {
184
+ "configs" : {"n_integration_cores" : args .n_cores , "polarized" : args .use_polarized }
185
+ }
186
+ if args .ev_op_iterations is not None :
187
+ op_card_info ["configs" ]["ev_op_iterations" ] = args .ev_op_iterations
188
+
197
189
if args .actions == "produce_eko" :
198
190
tcard , opcard = eko_utils .construct_eko_cards (
199
191
nnpdf_theory ,
0 commit comments