Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 19 additions & 9 deletions src/ethopy/core/experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -679,15 +679,25 @@ def _update_block_difficulty(self, perf: float) -> None:
perf: Current performance metric

"""
if self.cur_block_sz >= self.curr_cond["staircase_window"]:
if perf >= self.curr_cond["stair_up"]:
self.cur_block = self.curr_cond["next_up"]
self.cur_block_sz = 0
self.logger.update_setup_info({"difficulty": self.cur_block})
elif perf < self.curr_cond["stair_down"]:
self.cur_block = self.curr_cond["next_down"]
self.cur_block_sz = 0
self.logger.update_setup_info({"difficulty": self.cur_block})
if self.cur_block_sz < self.curr_cond["staircase_window"]:
return

if perf >= self.curr_cond["stair_up"]:
next_block = self.curr_cond["next_up"]
elif perf < self.curr_cond["stair_down"]:
next_block = self.curr_cond["next_down"]
else:
return

self.cur_block_sz = 0
if next_block not in self.blocks:
raise ValueError(
f"No conditions with difficulty {next_block}, "
f"cannot move from difficulty {self.cur_block}."
)

self.cur_block = next_block
self.logger.update_setup_info({"difficulty": self.cur_block})

def _get_valid_conditions(self, condition_idx: np.ndarray) -> List[Dict]:
"""Get list of valid conditions based on condition index.
Expand Down
Loading