Skip to content

Commit

Permalink
Parameter scenarios now sample on both parameter group and parameter …
Browse files Browse the repository at this point in the history
…name
  • Loading branch information
mrvisscher committed Dec 17, 2024
1 parent 13a0321 commit 7d44823
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions activity_browser/bwutils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,8 @@ def update(self, new_values: dict[str, float]) -> None:
"""Replace parameters in the list if their linked value is not
NaN.
"""
param_by_name = {p.name: p for p in self.data}
index_by_name = {p.name: i for i, p in enumerate(self.data)}
param_by_name = {(p.group, p.name): p for p in self.data}
index_by_name = {(p.group, p.name): i for i, p in enumerate(self.data)}

for name, value in new_values.items():
if not np.isnan(value):
Expand Down
8 changes: 6 additions & 2 deletions activity_browser/ui/tables/models/scenarios.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,11 @@ def iterate_scenarios(self) -> Iterable[Tuple[str, Iterable]]:
TODO: Fix this so it returns the least amount of required information.
"""
df = self._dataframe.reset_index()
df = df.set_index(["Group", "Name"])


return (
(scenario, self._dataframe[scenario])
for scenario in self._dataframe.columns[1:]
(scenario, df[scenario])
for scenario in df.columns
)

0 comments on commit 7d44823

Please sign in to comment.