Skip to content

Commit

Permalink
Fix setting inits
Browse files Browse the repository at this point in the history
  • Loading branch information
teddygroves committed Oct 16, 2023
1 parent cfed202 commit c96c2d7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
20 changes: 15 additions & 5 deletions maud/data_model/maud_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,19 @@ def inits_dict(self) -> Dict:
for p in self.parameters.dict().keys()
if isinstance(getattr(self.parameters, p), MaudParameter)
]
for p in params:
inits_dict[p.name] = p.inits.inits_unscaled
if p.inits.inits_scaled is not None:
scaled_pref = "log_" if p.non_negative else ""
inits_dict[scaled_pref + p.name + "_z"] = p.inits.inits_scaled
for param in params:
inits_dict[param.name] = param.inits.inits_unscaled
if param.inits.inits_scaled is not None:
scaled_pref = "log_" if param.non_negative else ""
inits_dict[
scaled_pref + param.name + "_z"
] = param.inits.inits_scaled
if param.fixed_ids is not None:
inits_dict[param.name + "_free"] = [
v
for k, v in zip(
param.inits.ids[0], param.inits.inits_unscaled
)
if k not in param.fixed_ids[0]
]
return inits_dict
2 changes: 1 addition & 1 deletion maud/data_model/maud_parameter.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def fixed_values(self) -> Optional[List[List[float]]]:
if self.user_input.fixed_values is None:
return None
else:
return list(self.user_input.fixed_values.values())
return [list(self.user_input.fixed_values.values())]
else:
raise ValueError(f"Something wrong with input {self.user_input}")

Expand Down

0 comments on commit c96c2d7

Please sign in to comment.