Skip to content

Commit 2b3978a

Browse files
committed
Black and isort
1 parent c214261 commit 2b3978a

14 files changed

+47
-43
lines changed

abr_analyze/data_handler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ def load(self, save_location, parameters=None, recursive=False):
229229
tmp = bool(tmp)
230230
elif tmp.dtype == "object":
231231
tmp = tmp.asstr()[()]
232-
if tmp == 'None':
232+
if tmp == "None":
233233
tmp = None
234234
# if not self.is_dataset(f"{save_location}/{key}"):
235235
# tmp = tmp.asstr()[()]

abr_analyze/data_logger.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,9 @@ def find_experiments_that_match_constants(dat, saved_exp_hashes, const_params):
260260
print(
261261
f"{red}Got AttributeError on {param_key} who's value is:\n{data[param_key]}{endc}"
262262
)
263-
print(f"{red}Or possibly from const params:\n{const_params[param_key]}{endc}")
263+
print(
264+
f"{red}Or possibly from const params:\n{const_params[param_key]}{endc}"
265+
)
264266
raise e
265267
elif isinstance(data[param_key], dict):
266268
raise NotImplementedError(
@@ -311,7 +313,9 @@ def get_common_experiments(
311313
saved_exp_hashes = find_experiments_that_match_constants(
312314
dat, saved_exp_hashes, const_params
313315
)
314-
print(f"{green}{len(saved_exp_hashes)} experiments found with matching parameters{endc}")
316+
print(
317+
f"{green}{len(saved_exp_hashes)} experiments found with matching parameters{endc}"
318+
)
315319
print(f"{green}{saved_exp_hashes}{endc}")
316320

317321
# Get a dictionary of common values and a list of keys for differing values

abr_analyze/data_processor.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ def calc_cartesian_points(robot_config, q):
209209
The list of recorded joint angles used to transform link centers of
210210
mass and joint positions to cartesian coordinates
211211
"""
212-
assert robot_config is not None, 'robot_config must be provided'
212+
assert robot_config is not None, "robot_config must be provided"
213213
if hasattr(robot_config, "xml_file"):
214214
mujoco_model = True
215215
else:
@@ -227,28 +227,28 @@ def calc_cartesian_points(robot_config, q):
227227
if not mujoco_model:
228228
# loop through the kinematic chain of joints
229229
for ii in range(0, robot_config.N_JOINTS):
230-
joints_t_xyz.append(robot_config.Tx('joint%i'%ii, q=q_t))
231-
joints_t_xyz.append(robot_config.Tx('EE', q=q_t))
230+
joints_t_xyz.append(robot_config.Tx("joint%i" % ii, q=q_t))
231+
joints_t_xyz.append(robot_config.Tx("EE", q=q_t))
232232

233233
# loop through the kinematic chain of links
234234
for ii in range(0, robot_config.N_LINKS):
235-
links_t_xyz.append(robot_config.Tx('link%i'%ii, q=q_t))
235+
links_t_xyz.append(robot_config.Tx("link%i" % ii, q=q_t))
236236
else:
237237
# loop through the kinematic chain of joints
238238
for ii in range(0, robot_config.N_JOINTS):
239-
joints_t_xyz.append(robot_config.Tx('joint%i'%ii, q=q_t, object_type="site"))
240-
joints_t_xyz.append(robot_config.Tx('EE', q=q_t))
239+
joints_t_xyz.append(
240+
robot_config.Tx("joint%i" % ii, q=q_t, object_type="site")
241+
)
242+
joints_t_xyz.append(robot_config.Tx("EE", q=q_t))
241243

242244
# loop through the kinematic chain of links
243-
for ii in range(0, robot_config.N_JOINTS+1):
245+
for ii in range(0, robot_config.N_JOINTS + 1):
244246
if ii == 0:
245-
name = 'base_link'
247+
name = "base_link"
246248
else:
247249
name = f"link{ii}"
248250
links_t_xyz.append(robot_config.Tx(name, q=q_t))
249251

250-
251-
252252
# append the cartesian coordinates of this time step to our list
253253
joints_xyz.append(joints_t_xyz)
254254
links_xyz.append(links_t_xyz)

abr_analyze/data_visualizer.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
import matplotlib.colors as colors
77
import matplotlib.pyplot as plt
88
import numpy as np
9+
from matplotlib import rcParams
910
from mpl_toolkits.axes_grid1 import make_axes_locatable
1011
from mpl_toolkits.mplot3d import axes3d # pylint: disable=W0611
11-
from matplotlib import rcParams
1212

1313

1414
def plot_arm(
@@ -20,7 +20,7 @@ def plot_arm(
2020
joint_color="k",
2121
arm_color="k",
2222
title=None,
23-
show_ground_collision=True
23+
show_ground_collision=True,
2424
):
2525
"""
2626
Accepts joint, end-effector, and link COM cartesian locations, and an
@@ -56,26 +56,26 @@ def plot_arm(
5656
for xyz in joints_xyz:
5757
# plot joint location
5858
if xyz[2] <= 0.0:
59-
marker = '*'
60-
col = 'r'
61-
s = rcParams['lines.markersize'] * 8
59+
marker = "*"
60+
col = "r"
61+
s = rcParams["lines.markersize"] * 8
6262
else:
63-
marker = 'o'
63+
marker = "o"
6464
col = joint_color
65-
s = rcParams['lines.markersize'] * 4
65+
s = rcParams["lines.markersize"] * 4
6666

6767
ax.scatter(xyz[0], xyz[1], xyz[2], c=col, marker=marker, s=s)
6868

6969
for xyz in links_xyz:
7070
# plot link location
7171
if xyz[2] <= 0.0:
72-
marker = 'x'
73-
col = 'r'
74-
s = rcParams['lines.markersize'] * 8
72+
marker = "x"
73+
col = "r"
74+
s = rcParams["lines.markersize"] * 8
7575
else:
76-
marker = 'o'
76+
marker = "o"
7777
col = link_color
78-
s = rcParams['lines.markersize'] * 4
78+
s = rcParams["lines.markersize"] * 4
7979

8080
ax.scatter(xyz[0], xyz[1], xyz[2], c=col, marker=marker, s=s)
8181

abr_analyze/nengo/intercepts_scan.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@
88
import timeit
99

1010
import matplotlib.pyplot as plt
11+
import nengo
1112
import numpy as np
13+
from abr_control.controllers import signals
1214

1315
import abr_analyze.nengo.network_utils as network_utils
14-
import nengo
1516
from abr_analyze.data_handler import DataHandler
16-
from abr_control.controllers import signals
1717

1818

1919
def run(

abr_analyze/nengo/network_utils.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,8 @@
1818
import warnings
1919

2020
import matplotlib.pyplot as plt
21-
import numpy as np
22-
2321
import nengo
22+
import numpy as np
2423
from abr_control._vendor.nengolib.stats import ScatteredHypersphere
2524
from nengo.utils.matplotlib import rasterplot
2625

abr_analyze/nengo_utils/tests/_test_network_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
import nengo
12
import numpy as np
23
import pytest
34

4-
import nengo
55
from abr_analyze.nengo_utils import network_utils
66

77

abr_analyze/plotting/draw_arm.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def plot(
4040
linestyle=None,
4141
label=None,
4242
title=None,
43-
show_ground_collision=True
43+
show_ground_collision=True,
4444
):
4545
"""
4646
Plots the parameters from save_location on the ax object
@@ -88,11 +88,11 @@ def plot(
8888
# plot our arm figure
8989
vis.plot_arm(
9090
ax=ax,
91-
joints_xyz=data['joints_xyz'][step],
92-
links_xyz=data['links_xyz'][step],
93-
ee_xyz=data['ee_xyz'][step],
91+
joints_xyz=data["joints_xyz"][step],
92+
links_xyz=data["links_xyz"][step],
93+
ee_xyz=data["ee_xyz"][step],
9494
title=title,
95-
show_ground_collision=show_ground_collision
95+
show_ground_collision=show_ground_collision,
9696
)
9797

9898
return ax, [self.xlimit, self.ylimit, self.zlimit]

examples/gif_arm.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111
import os
1212

1313
import matplotlib.pyplot as plt
14+
from abr_control.arms import jaco2
1415
from download_examples_db import check_exists as examples_db
1516
from mpl_toolkits.mplot3d import Axes3D
1617

1718
from abr_analyze.paths import figures_dir
1819
from abr_analyze.plotting import Draw3dData, DrawArm, MakeGif
19-
from abr_control.arms import jaco2
2020

2121
examples_db()
2222
gif = MakeGif()
@@ -49,7 +49,7 @@
4949
ax.set_xlim3d(-0.5, 0.5)
5050
ax.set_ylim3d(-0.5, 0.5)
5151
ax.set_zlim3d(0, 1)
52-
ax.set_aspect('auto')
52+
ax.set_aspect("auto")
5353

5454
draw_3d.plot(
5555
ax=ax,

examples/learning_profile_from_saved.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@
2121
import os
2222

2323
import matplotlib.pyplot as plt
24+
from abr_control.controllers import signals
2425
from download_examples_db import check_exists as examples_db
2526

2627
from abr_analyze import DataHandler
2728
from abr_analyze.nengo import network_utils
2829
from abr_analyze.paths import cache_dir, figures_dir
29-
from abr_control.controllers import signals
3030

3131
examples_db()
3232
dat = DataHandler("abr_analyze_examples")

examples/plot_arm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111
import os
1212

1313
import matplotlib.pyplot as plt
14+
from abr_control.arms import jaco2
1415
from download_examples_db import check_exists as examples_db
1516

1617
from abr_analyze.paths import figures_dir
1718
from abr_analyze.plotting import Draw3dData, DrawArm
18-
from abr_control.arms import jaco2
1919

2020
examples_db()
2121
# the number of samples to interpolate our data to, set to None for no

examples/plot_arm_grid.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77
import matplotlib.gridspec as gridspec
88
import matplotlib.pyplot as plt
99
import numpy as np
10+
from abr_control.arms import jaco2
1011
from download_examples_db import check_exists as examples_db
1112
from mpl_toolkits.mplot3d import Axes3D
1213

1314
from abr_analyze.paths import figures_dir
1415
from abr_analyze.plotting import Draw3dData, DrawArm, DrawCells
15-
from abr_control.arms import jaco2
1616

1717
examples_db()
1818
interpolated_samples = 100

examples/plot_grid.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
"""
55
import matplotlib.gridspec as gridspec
66
import matplotlib.pyplot as plt
7+
from abr_control.arms import jaco2
78
from download_examples_db import check_exists as examples_db
89

910
from abr_analyze.plotting import Draw2dData, Draw3dData, DrawArm, DrawCells
10-
from abr_control.arms import jaco2
1111

1212
examples_db()
1313
# the number of samples to interpolate our data to, set to None for no

examples/save_npz_to_hdf5.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import numpy as np
22
from download_examples_db import check_exists as examples_db
3+
34
from abr_analyze.utils import npz_to_hdf5
45

56
# TODO the name of the npz file you are sampling
67
save_name = "test.npz"
78
# this is the 'folder' in the database that the data will be saved to
8-
test_name = 'test_0000'
9+
test_name = "test_0000"
910

1011
examples_db()
1112
a = np.ones(11)
@@ -17,4 +18,4 @@
1718
db_name="abr_analyze_examples",
1819
save_location="my_converted_data/test1",
1920
overwrite=True,
20-
)
21+
)

0 commit comments

Comments
 (0)