Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
scottshambaugh authored Dec 18, 2023
1 parent e682f91 commit b111d37
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion docs/gen_graphics.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def animate_2d_trefoil(savedir):

def animate(frame):
x, y, z = generate_trefoil(frame)
x, y, z = sort_by_z(x, y, z)
x, y, z, _ = sort_by_z(x, y, z, kwargs=dict())
offset_left, offset_right = calc_2d_offsets(axstereo.focal_plane, z, axstereo.z_scale,
axstereo.d, axstereo.ipd)
scatter[0].set_offsets(np.stack([x + offset_left, y]).T)
Expand Down
8 changes: 3 additions & 5 deletions src/mpl_stereo/AxesStereo.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from matplotlib.figure import Figure

## Functions
def sort_by_z(x: np.ndarray, y: np.ndarray, z: np.ndarray, kwargs: dict[str, Any] = None):
def sort_by_z(x: np.ndarray, y: np.ndarray, z: np.ndarray, kwargs: dict[str, Any]):
"""
Sorts the provided data arrays based on the z values, to avoid improper
occlusion in visualizations.
Expand All @@ -32,13 +32,11 @@ def sort_by_z(x: np.ndarray, y: np.ndarray, z: np.ndarray, kwargs: dict[str, Any
x = x[sort_idx]
y = y[sort_idx]
z = z[sort_idx]
if kwargs is None:
return x, y, z
elif 'c' in kwargs and np.array(kwargs['c']).shape == np.array(z).shape:
if 'c' in kwargs and np.array(kwargs['c']).shape == np.array(z).shape:
c = kwargs.pop('c')
c = c[sort_idx]
kwargs['c'] = c
return x, y, z, kwargs
return x, y, z, kwargs


def process_args(ax_method: Any, known_methods: list[str], args: Any, kwargs: dict[str, Any]):
Expand Down

0 comments on commit b111d37

Please sign in to comment.