You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import re
key = "nue_cc"
crit_str = "(reco_zenith >= 0) & (reco_z >= 500)"
for variable_name in ['reco_z','reco_zenith']:
# Using word boundary \b to replace whole words only
crit_str = re.sub(r'\b{}\b'.format(variable_name), 'self["%s"]["%s"]' % (key, variable_name), crit_str)
print(crit_str)
A re module with a word boundary expression will solve the issue. If it looks ok, I can make a pull request.
This chunk of code does not work if one
variable_name
is a subset of anothervariable_name
:https://github.com/icecube/pisa/blob/master/pisa/core/events_pi.py#L553-L556
For example: when trying to load both
reco_z
andreco_zenith
, I end up with expressions likeself["nue_cc"]["reco_z"]enith
.The text was updated successfully, but these errors were encountered: