Skip to content

Commit a12af09

Browse files
Format OVPhysX asset benchmarks
Apply the repository Ruff format to the newly tracked benchmark scripts and keep fill-ratio selection conditions within the line-length limit.
1 parent 095acc4 commit a12af09

6 files changed

Lines changed: 23 additions & 28 deletions

source/isaaclab_ovphysx/benchmark/assets/benchmark_articulation.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,8 @@
2424

2525
from __future__ import annotations
2626

27-
2827
import argparse
2928

30-
3129
# add argparse arguments
3230
parser = argparse.ArgumentParser(description="Benchmark Articulation methods (OVPhysX backend).")
3331
parser.add_argument("--num_iterations", type=int, default=1000, help="Number of iterations")
@@ -44,11 +42,9 @@
4442
args = parser.parse_args()
4543

4644

47-
4845
import logging
4946
import warnings
5047

51-
import numpy as np
5248
import torch
5349
import warp as wp
5450
from isaaclab_ovphysx.test.mock_interfaces import MockOvPhysxBindingSet
@@ -1137,7 +1133,12 @@ def generator(config):
11371133
inputs[key] = (
11381134
torch.randperm(config.num_instances, device=config.device)[:n].sort().values.to(torch.int32)
11391135
)
1140-
elif key not in {"joint_ids", "body_ids"} and isinstance(val, torch.Tensor) and val.dim() >= 1 and val.shape[0] == config.num_instances:
1136+
elif (
1137+
key not in {"joint_ids", "body_ids"}
1138+
and isinstance(val, torch.Tensor)
1139+
and val.dim() >= 1
1140+
and val.shape[0] == config.num_instances
1141+
):
11411142
inputs[key] = val[:n]
11421143
else:
11431144
inputs[key] = val
@@ -1207,7 +1208,7 @@ def main():
12071208
mode=args.mode,
12081209
)
12091210

1210-
# Create the test articulation
1211+
# Create the test articulation
12111212
articulation, _ = create_test_articulation(
12121213
num_instances=config.num_instances,
12131214
num_bodies=config.num_bodies,

source/isaaclab_ovphysx/benchmark/assets/benchmark_articulation_data.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,8 @@
1919

2020
from __future__ import annotations
2121

22-
2322
import argparse
2423

25-
2624
# add argparse arguments
2725
parser = argparse.ArgumentParser(
2826
description="Micro-benchmarking framework for ArticulationData class (OVPhysX backend).",
@@ -40,7 +38,6 @@
4038
args = parser.parse_args()
4139

4240

43-
4441
import warnings
4542

4643
from isaaclab_ovphysx.test.mock_interfaces import MockOvPhysxBindingSet, MockOvPhysxView

source/isaaclab_ovphysx/benchmark/assets/benchmark_rigid_object.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,8 @@
2424

2525
from __future__ import annotations
2626

27-
2827
import argparse
2928

30-
3129
# add argparse arguments
3230
parser = argparse.ArgumentParser(description="Benchmark RigidObject methods (OVPhysX backend).")
3331
parser.add_argument("--num_iterations", type=int, default=1000, help="Number of iterations")
@@ -43,11 +41,9 @@
4341
args = parser.parse_args()
4442

4543

46-
4744
import logging
4845
import warnings
4946

50-
import numpy as np
5147
import torch
5248
import warp as wp
5349
from isaaclab_ovphysx.test.mock_interfaces import MockOvPhysxBindingSet
@@ -477,7 +473,12 @@ def generator(config):
477473
inputs[key] = (
478474
torch.randperm(config.num_instances, device=config.device)[:n].sort().values.to(torch.int32)
479475
)
480-
elif key not in {"joint_ids", "body_ids"} and isinstance(val, torch.Tensor) and val.dim() >= 1 and val.shape[0] == config.num_instances:
476+
elif (
477+
key not in {"joint_ids", "body_ids"}
478+
and isinstance(val, torch.Tensor)
479+
and val.dim() >= 1
480+
and val.shape[0] == config.num_instances
481+
):
481482
inputs[key] = val[:n]
482483
else:
483484
inputs[key] = val
@@ -547,7 +548,7 @@ def main():
547548
mode=args.mode,
548549
)
549550

550-
# Create the test rigid object
551+
# Create the test rigid object
551552
rigid_object, _ = create_test_rigid_object(
552553
num_instances=config.num_instances,
553554
num_bodies=config.num_bodies,

source/isaaclab_ovphysx/benchmark/assets/benchmark_rigid_object_collection.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,8 @@
2424

2525
from __future__ import annotations
2626

27-
2827
import argparse
2928

30-
3129
# add argparse arguments
3230
parser = argparse.ArgumentParser(description="Benchmark RigidObjectCollection methods (OVPhysX backend).")
3331
parser.add_argument("--num_iterations", type=int, default=1000, help="Number of iterations")
@@ -43,11 +41,9 @@
4341
args = parser.parse_args()
4442

4543

46-
4744
import logging
4845
import warnings
4946

50-
import numpy as np
5147
import torch
5248
import warp as wp
5349
from isaaclab_ovphysx.test.mock_interfaces import MockOvPhysxBindingSet
@@ -90,10 +86,11 @@ def create_test_collection(
9086
device: str = "cuda:0",
9187
):
9288
"""Create a test RigidObjectCollection instance with mocked dependencies."""
93-
from isaaclab.assets.rigid_object.rigid_object_cfg import RigidObjectCfg
9489
from isaaclab_ovphysx.assets.rigid_object_collection.rigid_object_collection import RigidObjectCollection
9590
from isaaclab_ovphysx.assets.rigid_object_collection.rigid_object_collection_data import RigidObjectCollectionData
9691

92+
from isaaclab.assets.rigid_object.rigid_object_cfg import RigidObjectCfg
93+
9794
object_names = [f"object_{i}" for i in range(num_bodies)]
9895
binding_set = MockOvPhysxBindingSet(
9996
num_instances=num_instances,
@@ -501,7 +498,12 @@ def generator(config):
501498
inputs[key] = (
502499
torch.randperm(config.num_instances, device=config.device)[:n].sort().values.to(torch.int32)
503500
)
504-
elif key not in {"joint_ids", "body_ids"} and isinstance(val, torch.Tensor) and val.dim() >= 1 and val.shape[0] == config.num_instances:
501+
elif (
502+
key not in {"joint_ids", "body_ids"}
503+
and isinstance(val, torch.Tensor)
504+
and val.dim() >= 1
505+
and val.shape[0] == config.num_instances
506+
):
505507
inputs[key] = val[:n]
506508
else:
507509
inputs[key] = val
@@ -571,7 +573,7 @@ def main():
571573
mode=args.mode,
572574
)
573575

574-
# Create the test collection
576+
# Create the test collection
575577
collection, _ = create_test_collection(
576578
num_instances=config.num_instances,
577579
num_bodies=config.num_bodies,

source/isaaclab_ovphysx/benchmark/assets/benchmark_rigid_object_collection_data.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,8 @@
1919

2020
from __future__ import annotations
2121

22-
2322
import argparse
2423

25-
2624
# add argparse arguments
2725
parser = argparse.ArgumentParser(
2826
description="Micro-benchmarking framework for RigidObjectCollectionData class (OVPhysX backend).",
@@ -39,7 +37,6 @@
3937
args = parser.parse_args()
4038

4139

42-
4340
import warnings
4441

4542
from isaaclab_ovphysx.test.mock_interfaces import MockOvPhysxBindingSet, MockOvPhysxView

source/isaaclab_ovphysx/benchmark/assets/benchmark_rigid_object_data.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,8 @@
1919

2020
from __future__ import annotations
2121

22-
2322
import argparse
2423

25-
2624
# add argparse arguments
2725
parser = argparse.ArgumentParser(
2826
description="Micro-benchmarking framework for RigidObjectData class (OVPhysX backend).",
@@ -38,7 +36,6 @@
3836
args = parser.parse_args()
3937

4038

41-
4239
import warnings
4340

4441
from isaaclab_ovphysx.test.mock_interfaces import MockOvPhysxBindingSet, MockOvPhysxView

0 commit comments

Comments
 (0)