TopEFT / topeft

15 stars 24 forks source link

Change how WC values are passed to datacard maker #413

Open bryates opened 4 months ago

bryates commented 4 months ago

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 as NAME=VAL, (note the trailing ,).

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.

_Originally posted by @Andrew42 in https://github.com/TopEFT/topeft/pull/406#discussion_r1593134696_