Skip to content

Commit

Permalink
Issue #0: Clean up extraneous logging
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark2000 committed Oct 10, 2024
1 parent 817895e commit 45b941e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
3 changes: 2 additions & 1 deletion src/bsk_rl/data/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,8 @@ def reward(self, new_data_dict: dict[str, Data]) -> dict[str, float]:
for new_data in new_data_dict.values():
self.data += new_data

logger.info(f"Data reward: {reward}")
nonzero_reward = {k: v for k, v in reward.items() if v != 0}
logger.info(f"Data reward: {nonzero_reward}")
return reward


Expand Down
13 changes: 8 additions & 5 deletions src/bsk_rl/gym.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@


class GeneralSatelliteTasking(Env, Generic[SatObs, SatAct]):

def __init__(
self,
satellites: Union[Satellite, list[Satellite]],
Expand Down Expand Up @@ -314,7 +313,6 @@ def _get_obs(self) -> MultiSatObs:
tuple: Joint observation
"""
if self.generate_obs_retasking_only:

return tuple(
(
satellite.get_obs()
Expand Down Expand Up @@ -698,9 +696,14 @@ def step(
terminated = self._get_terminated()
truncated = self._get_truncated()
info = self._get_info()
logger.info(f"Step reward: {reward}")
logger.info(f"Episode terminated: {terminated}")
logger.info(f"Episode truncated: {truncated}")
nonzero_reward = {k: v for k, v in reward.items() if v != 0}
logger.info(f"Step reward: {nonzero_reward}")
if any(terminated.values()):
terminated_true = [k for k, v in terminated.items() if v]
logger.info(f"Episode terminated: {terminated_true}")
if any(truncated.values()):
truncated_true = [k for k, v in truncated.items() if v]
logger.info(f"Episode truncated: {truncated_true}")
logger.debug(f"Step info: {info}")
logger.debug(f"Step observation: {observation}")
return observation, reward, terminated, truncated, info
Expand Down

0 comments on commit 45b941e

Please sign in to comment.