-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use specific config for certain llh #78
Conversation
Recover Rn220 & Ar37 combine fit
appletree/config.py
Outdated
self.value = _cached_configs[self.name] | ||
value = _cached_configs[self.name] | ||
if isinstance(value, dict): | ||
self.value = value[llh_name] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[pep8] reported by reviewdog 🐶
WPS601 Found shadowed class attribute: value
if isinstance(value, dict): | ||
self.value = value[llh_name] | ||
else: | ||
self.value = value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[pep8] reported by reviewdog 🐶
WPS601 Found shadowed class attribute: value
appletree/component.py
Outdated
@@ -289,7 +291,7 @@ def flush_source_code(self, | |||
# initialize new instances | |||
for work in self.worksheet: | |||
instance = work[0] + '_' + self.name | |||
code += f'{instance} = {work[0]}()\n' | |||
code += f"{instance} = {work[0]}('{self.llh_name}')\n" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[pep8] reported by reviewdog 🐶
WPS221 Found line with high Jones Complexity: 15 > 14
Pull Request Test Coverage Report for Build 4002889673
💛 - Coveralls |
appletree/plugin.py
Outdated
@@ -27,8 +27,10 @@ class Plugin(): | |||
# Set using the takes_config decorator | |||
takes_config = immutabledict() | |||
|
|||
def __init__(self): | |||
def __init__(self, llh_name): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if this is a good idea to require llh_name in the class lower than likelihood. Maybe give some default value?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is a good idea.
value = _cached_configs[self.name] | ||
if isinstance(value, dict): | ||
try: | ||
self.value = value[llh_name] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[pep8] reported by reviewdog 🐶
WPS601 Found shadowed class attribute: value
appletree/config.py
Outdated
if isinstance(value, dict): | ||
try: | ||
self.value = value[llh_name] | ||
except: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[pep8] reported by reviewdog 🐶
B001 Do not use bare except:
, it also catches unexpected events like memory errors, interrupts, system exit, and so on. Prefer except Exception:
. If you're sure what you're doing, be explicit and write except BaseException:
.
appletree/config.py
Outdated
if isinstance(value, dict): | ||
try: | ||
self.value = value[llh_name] | ||
except: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[pep8] reported by reviewdog 🐶
E722 do not use bare 'except'
appletree/config.py
Outdated
if isinstance(file_path, dict): | ||
try: | ||
self.file_path = file_path[llh_name] | ||
except: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[pep8] reported by reviewdog 🐶
B001 Do not use bare except:
, it also catches unexpected events like memory errors, interrupts, system exit, and so on. Prefer except Exception:
. If you're sure what you're doing, be explicit and write except BaseException:
.
appletree/config.py
Outdated
if isinstance(file_path, dict): | ||
try: | ||
self.file_path = file_path[llh_name] | ||
except: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[pep8] reported by reviewdog 🐶
E722 do not use bare 'except'
Otherwise the following initialization of components will overwrite map
appletree/plugin.py
Outdated
|
||
self.sanity_check() | ||
|
||
# Do not set configurations as |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[pep8] reported by reviewdog 🐶
W291 trailing whitespace
@@ -117,7 +122,7 @@ def get_normalization(self, hist, parameters, batch_size=None): | |||
if self._use_mcinput: | |||
bootstrap_name = self._plugin_class_registry['energy'].__name__ | |||
bootstrap_name = bootstrap_name + '_' + self.name | |||
n_events_selected = _cached_functions[bootstrap_name].g4.n_events_selected | |||
n_events_selected = _cached_functions[self.llh_name][bootstrap_name].g4.n_events_selected |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[pep8] reported by reviewdog 🐶
E501 line too long (105 > 100 characters)
@@ -75,6 +75,23 @@ def curve_interpolator(pos, ref_pos, ref_val): | |||
return val | |||
|
|||
|
|||
@export | |||
@jit | |||
def map_interpolator_regular_binning_1d(pos, ref_pos_lowers, ref_pos_uppers, ref_val): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[pep8] reported by reviewdog 🐶
WPS114 Found underscored number name pattern: map_interpolator_regular_binning_1d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this is tolerable.
Sometimes we do need to combine two likelihoods, but they can have different maps (s). In this PR, we specify the name of llh for
Map.build
, so that we do not need to write many similar plugins.Finally, we recover Rn220 & Ar37 combined fit.
Also add
map_interpolator_regular_binning_1d
performing 1D KNN with regular binning.