Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove assumptions about where viz params and assets live. #9

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
14 changes: 10 additions & 4 deletions src/run_track_visualization.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ def create_args():
type=str)
cs.add_argument('--recording', default="26",
help="Name of the recording given by a number with a leading zero.", type=str)
cs.add_argument('--visualizer_params_dir', default="../data/visualizer_params/",
help="Name of the recording given by a number with a leading zero.", type=str)
cs.add_argument('--visualizer_params_dir', default=None,
help="Name of the visualizer params file given by a number with a leading zero.", type=str)
cs.add_argument('--assets_dir', default=None, help="Path to the assets directory.", type=str)

# --- Visualization settings ---
cs.add_argument('--playback_speed', default=4,
Expand Down Expand Up @@ -62,8 +63,13 @@ def create_args():
help="Show the track Visualizer maximized. Might affect performance.",
type=str2bool)

return vars(cs.parse_args())

# If no visualizer params/assets directory provided, then append default directory names appropriately.
args = vars(cs.parse_args())
if args["visualizer_params_dir"] is None:
args["visualizer_params_dir"] = args["dataset_dir"] + "/visualizer_params/"
if args["assets_dir"] is None:
args["assets_dir"] = os.path.join(args["visualizer_params_dir"] , "assets/")
return args

def main():
config = create_args()
Expand Down
13 changes: 7 additions & 6 deletions src/track_visualizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,22 +159,23 @@ def __init__(self, config: dict, tracks: List[dict], tracks_meta: List[dict], re
# Define the widgets
self.textbox_frame = TextBox(self.ax_textbox, 'Set Frame ', initial=str(self.minimum_frame))

assets_dir = Path(config["assets_dir"])
self.button_previous2 = Button(self.ax_button_previous2, '',
image=plt.imread("../assets/button_icons/previous2.png"))
image=plt.imread(assets_dir / "button_icons/previous2.png"))
self.button_previous2.ax.axis('off')

self.button_previous = Button(self.ax_button_previous, '',
image=plt.imread("../assets/button_icons/previous.png"))
image=plt.imread(assets_dir / "button_icons/previous.png"))
self.button_previous.ax.axis('off')

self.button_next = Button(self.ax_button_next, '', image=plt.imread("../assets/button_icons/next.png"))
self.button_next = Button(self.ax_button_next, '', image=plt.imread(assets_dir / "button_icons/next.png"))
self.button_next.ax.axis('off')

self.button_next2 = Button(self.ax_button_next2, '', image=plt.imread("../assets/button_icons/next2.png"))
self.button_next2 = Button(self.ax_button_next2, '', image=plt.imread(assets_dir / "button_icons/next2.png"))
self.button_next2.ax.axis('off')

self.play_image = plt.imread("../assets/button_icons/play.png")
self.stop_image = plt.imread("../assets/button_icons/stop.png")
self.play_image = plt.imread(assets_dir / "button_icons/play.png")
self.stop_image = plt.imread(assets_dir / "button_icons/stop.png")
self.button_play = Button(self.ax_button_play, '', image=self.play_image)
self.button_play.ax.axis('off')

Expand Down