Skip to content

Commit

Permalink
make_scaling function added
Browse files Browse the repository at this point in the history
  • Loading branch information
emcgrady committed Oct 9, 2024
1 parent 486aa0e commit 61c1536
Showing 1 changed file with 0 additions and 8 deletions.
8 changes: 0 additions & 8 deletions topcoffea/modules/histEFT.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,43 +333,35 @@ def make_scaling(self, wc_list=None):
wcs = {}
index = 0
wc_names_lst = ['sm'] + self.wc_names

#Construct a dictionary of indicies for the WCs in self
for i in range(len(wc_names_lst)):
for j in range(i+1):
wcs[(wc_names_lst[i], wc_names_lst[j])] = index
index += 1

if wc_list is not None:
new_wcs = {}
index = 0
wc_names_lst = ['sm'] + wc_list

#Construct a dictionary of indicies for the WCs passed with wc_list
for i in range(len(wc_names_lst)):
for j in range(i+1):
new_wcs[(wc_names_lst[i], wc_names_lst[j])] = index
index += 1

#slice off extra columns which do not correlate with an WCs and make new scaling matrix
old_scaling = self.values(flow=True)[:,1:-1]
scaling = np.zeros((old_scaling.shape[0], len(new_wcs)))

#place columns from old scaling matrix into new scaling matrix based on new mapping
for key in new_wcs.keys():
if key in wcs.keys():
scaling[:,new_wcs[key]] = old_scaling[:,wcs[key]]
wcs = new_wcs

else:
#slice off extra columns which do not correlate with an WCs
scaling = self.values(flow=True)[:,1:-1]

#divide off-diagonal elements by 2
for key in wcs.keys():
if key[0] != key[1]:
scaling[:,wcs[key]] /= 2

return (scaling/np.expand_dims(scaling[:,0], 1)) #divide by sm

@classmethod
Expand Down

0 comments on commit 61c1536

Please sign in to comment.