import os | |
import subprocess | |
# Define the folder containing the .npy files | |
folder_path = "/home/haytham/ProtoMotions/parallel2" | |
# Iterate through all files in the folder | |
for file_name in os.listdir(folder_path): | |
if file_name.endswith(".npy"): | |
npz_file_name = file_name.replace(".npy", ".npz") | |
# Construct the command | |
if os.path.exists(os.path.join(folder_path, npz_file_name)): | |
continue | |
command = [ | |
"python", | |
"phys_anim/scripts/play_motion.py", | |
f"parallel2/{file_name}", | |
"isaaclab", | |
"g1" | |
] | |
# Run the command | |
subprocess.run(command, cwd="/home/haytham/ProtoMotions") | |
# Rename 'test_motion_data.npz' to match the .npy file name | |
os.rename( | |
os.path.join(folder_path, "test_motion_data.npz"), | |
os.path.join(folder_path, npz_file_name) | |
) | |