I suggest that either force the argument to --wc-vals be a single long string, ala NAME1=VAL1,NAME2=VAL2,... or change the action to 'extend' and indicate that each entry should be of the form NAME=VAL. To make the above code work with this latter case, you can do:
wc_vals = [x.split('=') for x in wc_vals]
wcs_dict = {k: float(x) for k,v in wc_vals}
I personally prefer the 2nd option as it only relies on the user needing to know to use the = as delimiter and this is made obvious if they look at the code, i.e. the x.split('=') line.
https://github.com/TopEFT/topeft/blob/e96fedb1b3a4fc44cc313d7e966100863b5e7cd1/analysis/topeft_run2/make_cards.py#L227-L229 These seems really fragile. If I'm not mistaken, it relies on the user specifying the arguments to
--wc-vals
asNAME=VAL,
(note the trailing,
).I suggest that either force the argument to
--wc-vals
be a single long string, alaNAME1=VAL1,NAME2=VAL2,...
or change theaction
to'extend'
and indicate that each entry should be of the formNAME=VAL
. To make the above code work with this latter case, you can do:I personally prefer the 2nd option as it only relies on the user needing to know to use the
=
as delimiter and this is made obvious if they look at the code, i.e. thex.split('=')
line._Originally posted by @Andrew42 in https://github.com/TopEFT/topeft/pull/406#discussion_r1593134696_