Skip to content

Commit

Permalink
Show unique_id for reward
Browse files Browse the repository at this point in the history
  • Loading branch information
kngwyu committed Jan 19, 2024
1 parent 28c8649 commit f108bd5
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/emevo/analysis/qt_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ def _update_yrange(self, values: Iterable[float | list[float]]) -> None:
self.axis_y.setRange(yrange_min, np.max(values_arr))

@Slot(dict)
def updateValues(self, values: dict[str, float | list[float]]) -> None:
def updateValues(self, title: str, values: dict[str, float | list[float]]) -> None:
new_barsets = deque()
for name, value in values.items():
if name not in self.barsets:
Expand All @@ -263,6 +263,7 @@ def updateValues(self, values: dict[str, float | list[float]]) -> None:
new_barsets.popleft().setColor(old_bs.color())
self.series.remove(old_bs)
self._update_yrange(values.values())
self.chart.setTitle(title)


class CBarState(enum.Enum):
Expand All @@ -273,7 +274,7 @@ class CBarState(enum.Enum):

class CFEnvReplayWidget(QtWidgets.QWidget):
energyUpdated = Signal(float)
rewardUpdated = Signal(dict)
rewardUpdated = Signal(str, dict)

def __init__(
self,
Expand Down Expand Up @@ -431,7 +432,10 @@ def updateRewards(self, selected_slot: int) -> None:
last_log = self._log_cached[-1]
for slot, uid in zip(last_log["slots"], last_log["unique_id"]):
if slot == selected_slot:
self.rewardUpdated.emit(self._get_rewards(uid))
self.rewardUpdated.emit(
f"Reward function of {uid}",
self._get_rewards(uid),
)
return

@Slot(bool)
Expand Down

0 comments on commit f108bd5

Please sign in to comment.