-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
While reviewing the likelihood module, I noticed this code around line 183.
# fill in the free parameters
# free parameter names must match the order of values
fp_index = 0
for i,p in enumerate(params):
if p.name in self.free_param_names:
# translate the value in [0,1] to the actual parameter value
free_param_value = p.value_from_cube(values[fp_index])
params[i] = LikelihoodParameter(
name=p.name,
min_value=p.min_value,
max_value=p.max_value,
value=free_param_value)
fp_index += 1
I found this confusing, since you shouldn't need to use params[i] in that loop, you already have p pointing to that element in the list (thanks to enumerate). Shouldn't you be able to do this?
# fill in the free parameters
# free parameter names must match the order of values
fp_index = 0
for i,p in enumerate(params):
if p.name in self.free_param_names:
p.set_from_cube(values[fp_index])
fp_index += 1
This is not a bug or something urgent to fix, but I was wondering whether it had a deeper explanation that I'm missing.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels