Skip to content

Commit

Permalink
update stx-machinery
Browse files Browse the repository at this point in the history
  • Loading branch information
mieskolainen committed Jan 16, 2024
1 parent 2cc6259 commit cd27fdb
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 16 deletions.
2 changes: 1 addition & 1 deletion configs/dqcd/plots.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ contours:
ROC:
active: true
num_bootstrap: 200
xmin: 1.0E-5
xmin: 1.0E-6
set_filter: *FILTER

## Binned ROC plots can be 1D or 2D
Expand Down
14 changes: 7 additions & 7 deletions configs/dqcd/plots_new.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ FILTER: &FILTER
expand: 'set' # 'set', 'vetoset' or 'powerset'
cutset:
# Latex description is for boolean [0,1] per cut
[{cut: 'GEN_mpi == 1 && GEN_mA == 0.33', latex: ['$\neq(m_\pi = 1 & m_A = 0.33)$', '$m_\pi = 1 & m_A = 0.33$']},
{cut: 'GEN_mpi == 2 && GEN_mA == 0.67', latex: ['$\neq(m_\pi = 2 & m_A = 0.67)$', '$m_\pi = 2 & m_A = 0.67$']},
{cut: 'GEN_mpi == 4 && GEN_mA == 0.40', latex: ['$\neq(m_\pi = 4 & m_A = 0.40)$', '$m_\pi = 4 & m_A = 0.40$']},
{cut: 'GEN_mpi == 4 && GEN_mA == 1.33', latex: ['$\neq(m_\pi = 4 & m_A = 1.33)$', '$m_\pi = 4 & m_A = 1.33$']},
{cut: 'GEN_mpi == 10 && GEN_mA == 1.00', latex: ['$\neq(m_\pi = 10 & m_A = 1.00)$', '$m_\pi = 10 & m_A = 1.00$']},
{cut: 'GEN_mpi == 10 && GEN_mA == 3.33', latex: ['$\neq(m_\pi = 10 & m_A = 3.33)$', '$m_\pi = 10 & m_A = 3.33$']}]
[{cut: 'GEN_mpi == 1 && GEN_mA == 0.33', latex: ['$\neq(m_\pi = 1$ & $m_A = 0.33)$', '$m_\pi = 1$ & $m_A = 0.33$']},
{cut: 'GEN_mpi == 2 && GEN_mA == 0.67', latex: ['$\neq(m_\pi = 2$ & $m_A = 0.67)$', '$m_\pi = 2$ & $m_A = 0.67$']},
{cut: 'GEN_mpi == 4 && GEN_mA == 0.40', latex: ['$\neq(m_\pi = 4$ & $m_A = 0.40)$', '$m_\pi = 4$ & $m_A = 0.40$']},
{cut: 'GEN_mpi == 4 && GEN_mA == 1.33', latex: ['$\neq(m_\pi = 4$ & $m_A = 1.33)$', '$m_\pi = 4$ & $m_A = 1.33$']},
{cut: 'GEN_mpi == 10 && GEN_mA == 1.00', latex: ['$\neq(m_\pi = 10$ & $m_A = 1.00)$', '$m_\pi = 10$ & $m_A = 1.00$']},
{cut: 'GEN_mpi == 10 && GEN_mA == 3.33', latex: ['$\neq(m_\pi = 10$ & $m_A = 3.33)$', '$m_\pi = 10$ & $m_A = 3.33$']}]

set[1]:
expand: 'set' # 'set', 'vetoset' or 'powerset'
Expand Down Expand Up @@ -46,7 +46,7 @@ contours:
ROC:
active: true
num_bootstrap: 200
xmin: 1.0E-5
xmin: 1.0E-6
set_filter: *FILTER

## Binned ROC plots can be 1D or 2D
Expand Down
2 changes: 1 addition & 1 deletion configs/eid/mctargets.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def target_e(X, ids, xcorr_flow=False):
""" Classification signal target """

# Define cuts
cutlist = [f'BOOL@is_e== True']
cutlist = [f'BOOL@is_e == True']

# Construct and apply
cuts, names = stx.construct_columnar_cuts(X=X, ids=ids, cutlist=cutlist)
Expand Down
21 changes: 14 additions & 7 deletions icenet/tools/stx.py
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,10 @@ def is_in(a, b):
f = lambda x : 1.0/x
elif func_name == 'BOOL':
f = lambda x : x.astype(bool)
elif func_name == 'FLOAT':
f = lambda x : x.astype(float)
elif func_name == 'INT':
f = lambda x : x.astype(int)
else:
raise Exception(__name__ + f'.eval_boolean_exptree: Unknown function {func_name}')

Expand All @@ -525,20 +529,23 @@ def is_in(a, b):

# Middle binary operators g(x,y)
if operator == '<':
g = lambda x,y : x < float(y)
g = lambda x,y : x < y
elif operator == '>':
g = lambda x,y : x > float(y)
g = lambda x,y : x > y
elif operator == '<=':
g = lambda x,y : x <= float(y)
g = lambda x,y : x <= y
elif operator == '>=':
g = lambda x,y : x >= float(y)
g = lambda x,y : x >= y
elif operator == '!=':
g = lambda x,y : x != int(y)
g = lambda x,y : ~np.isclose(x,y) # use default tolerance
elif operator == '==':
g = lambda x,y : x == int(y)
g = lambda x,y : np.isclose(x,y)
else:
raise Exception(__name__ + f'.eval_boolean_exptree: Unknown binary operator "{operator}"')


if isinstance(rhs, str):
rhs = float(rhs)

# Evaluate
return g(f(X[:, ind]), rhs)

Expand Down

0 comments on commit cd27fdb

Please sign in to comment.