1919_logger = logging .getLogger (__name__ )
2020
2121
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+
2243def construct_eko_parser (subparsers ):
2344 parser = subparsers .add_parser (
2445 "produce_eko" ,
@@ -30,14 +51,7 @@ def construct_eko_parser(subparsers):
3051 provided number of points. The eko will be dumped in the provided path."""
3152 ),
3253 )
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 )
4155 parser .add_argument (
4256 "--legacy40" ,
4357 action = "store_true" ,
@@ -56,14 +70,7 @@ def construct_eko_photon_parser(subparsers):
5670 provided number of points. The eko will be dumped in the provided path."""
5771 ),
5872 )
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 )
6774 parser .add_argument (
6875 "-g" , "--q-gamma" , default = 100 , type = float , help = "Scale at which the photon is generated"
6976 )
@@ -76,7 +83,7 @@ def construct_evolven3fit_parser(subparsers):
7683 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." ,
7784 )
7885 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"
8087 )
8188 parser .add_argument (
8289 "-l" , "--load" , type = pathlib .Path , default = None , help = "Path of the EKO to be loaded"
@@ -99,32 +106,14 @@ def evolven3fit_new():
99106
100107
101108def 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" )
113110 parser .add_argument (
114111 "-q" , "--q-fin" , type = float , default = None , help = "Final q-value of the evolution"
115112 )
116113 parser .add_argument (
117114 "-p" , "--q-points" , type = int , default = None , help = "Number of q points for the evolution"
118115 )
119- parser .add_argument ("-n" , "--n-cores" , type = int , default = 1 , help = "Number of cores to be used" )
120116 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- )
128117
129118 subparsers = parser .add_subparsers (title = "actions" , dest = "actions" )
130119 construct_eko_parser (subparsers )
@@ -133,12 +122,7 @@ def main():
133122
134123 args = parser .parse_args ()
135124
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 = {}
142126 # Here we do not allow any modification of the theory card, for the moment.
143127 theory_card_info = {}
144128
@@ -149,7 +133,7 @@ def main():
149133
150134 if args .actions == "evolve" :
151135
152- fit_folder = pathlib .Path (args .configuration_folder )
136+ fit_folder = pathlib .Path (args .fit_folder )
153137 if args .load is None :
154138 theoryID = utils .get_theoryID_from_runcard (fit_folder )
155139 _logger .info (f"Loading eko from theory { theoryID } " )
@@ -194,6 +178,14 @@ def main():
194178 )
195179 else :
196180 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+
197189 if args .actions == "produce_eko" :
198190 tcard , opcard = eko_utils .construct_eko_cards (
199191 nnpdf_theory ,
0 commit comments