Skip to content

Commit

Permalink
Fix types.
Browse files Browse the repository at this point in the history
  • Loading branch information
vaxenburg committed Mar 22, 2024
1 parent 4d7352f commit e4067e1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions flybody/fly_envs.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

def flight_imitation(wpg_pattern_path: str,
ref_path: str,
random_state: np.random.RandomState = None,
random_state: np.random.RandomState | None = None,
terminal_com_dist: float = 2.0):
"""Requires a fruitfly to track a flying reference.
Expand Down Expand Up @@ -61,7 +61,7 @@ def flight_imitation(wpg_pattern_path: str,


def walk_imitation(ref_path: str,
random_state: np.random.RandomState = None,
random_state: np.random.RandomState | None = None,
terminal_com_dist: float = 0.3):
"""Requires a fruitfly to track a reference walking fly.
Expand All @@ -77,8 +77,8 @@ def walk_imitation(ref_path: str,
walker = fruitfly.FruitFly
arena = floors.Floor()
# Initialize a walking trajectory loader.
traj_generator = HDF5WalkingTrajectoryLoader(path=ref_path,
random_state=random_state)
traj_generator = HDF5WalkingTrajectoryLoader(
path=ref_path, random_state=random_state)
# Build a task that rewards the agent for tracking a walking ghost.
time_limit = 10.0
task = WalkImitation(walker=walker,
Expand All @@ -97,7 +97,7 @@ def walk_imitation(ref_path: str,
strip_singleton_obs_buffer_dim=True)


def walk_on_ball(random_state: np.random.RandomState = None):
def walk_on_ball(random_state: np.random.RandomState | None = None):
"""Requires a tethered fruitfly to walk on a floating ball.
Args:
Expand Down Expand Up @@ -128,7 +128,7 @@ def walk_on_ball(random_state: np.random.RandomState = None):

def vision_guided_flight(wpg_pattern_path: str,
bumps_or_trench: str = 'bumps',
random_state: np.random.RandomState = None,
random_state: np.random.RandomState | None = None,
**kwargs_arena):
"""Vision-guided flight tasks: 'bumps' and 'trench'.
Expand Down
4 changes: 2 additions & 2 deletions flybody/tasks/walk_imitation.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Walking imitation task for fruit fly."""
# ruff: noqa: F821

from typing import Optional, Sequence
from typing import Sequence
import numpy as np

from flybody.tasks.base import Walking
Expand All @@ -22,7 +22,7 @@ def __init__(self,
mocap_joint_names: Sequence[str],
mocap_site_names: Sequence[str],
terminal_com_dist: float = 0.33,
claw_friction: Optional[float] = 1.0,
claw_friction: float | None = 1.0,
trajectory_sites: bool = True,
**kwargs):
"""This task is a combination of imitation walking and ghost tracking.
Expand Down

0 comments on commit e4067e1

Please sign in to comment.