Skip to content

Commit

Permalink
fixing too long lines in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
hmd101 committed Oct 16, 2024
1 parent 5cf2a12 commit 5a0751f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
15 changes: 9 additions & 6 deletions tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,11 @@ def test_match_pyrtools(self, curie_img, n_scales):
for x_po, x_pt in zip(y_po, y_pt):
x_po = x_po.squeeze().detach().cpu().numpy()
assert np.abs(x_po - x_pt)[:-2, :-2].max() < 1e-5
# The pyrtools implementation `pt.upConv performs`` padding after upsampling.
# Our implementation `po.tools.upsample_convolve`` performs padding before upsampling,
# and, depending on the parity of the image, sometimes performs additional zero padding
# after upsampling up to one row/column. This causes inconsistency on the right and
# The pyrtools implementation `pt.upConv performs`` padding after
# upsampling. Our implementation `po.tools.upsample_convolve``
# performs padding before upsampling, and, depending on the parity of
# the image, sometimes performs additional zero padding after upsampling
# up to one row/column. This causes inconsistency on the right and
# bottom edges, so they are exluded in the comparison.


Expand Down Expand Up @@ -512,7 +513,8 @@ def remove_redundant_and_normalize(
plen_ps: po.simul.PortillaSimoncelli,
normalizing_dict: dict,
) -> torch.Tensor:
"""Remove redundant stats from dictionary of representation, and normalize correlations
"""Remove redundant stats from dictionary of representation, and normalize
correlations
Redundant stats fall in two categories: those that are not included at all
anymore (e.g., magnitude means, extra zero placeholders), and those that
Expand Down Expand Up @@ -621,7 +623,8 @@ def test_portilla_simoncelli(
).to(DEVICE)
ps(einstein_img)

# tests for whether output matches the original matlab output. This implicitly tests that Portilla_simoncelli.forward() returns an object of the correct size.
# tests for whether output matches the original matlab output. This implicitly
# tests that Portilla_simoncelli.forward() returns an object of the correct size.
@pytest.mark.parametrize("n_scales", [1, 2, 3, 4])
@pytest.mark.parametrize("n_orientations", [2, 3, 4])
@pytest.mark.parametrize("spatial_corr_width", [3, 5, 7, 9])
Expand Down
3 changes: 2 additions & 1 deletion tests/test_steerable_pyr.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,8 @@ def spyr_multi(self, multichannel_img, request):
pyr.to(DEVICE)
return pyr

# can't use one of the spyr fixtures here because we need to instantiate separately for each of these shapes
# can't use one of the spyr fixtures here because we need to instantiate separately
# for each of these shapes
@pytest.mark.parametrize("height", ["auto", 1, 3, 4, 5])
@pytest.mark.parametrize("order", [1, 2, 3])
@pytest.mark.parametrize("is_complex", [True, False])
Expand Down
6 changes: 4 additions & 2 deletions tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,10 @@ def update_ps_torch_output(save_dir):
)
np.save(fname, output)
print(
f"All outputs have been saved in directory {save_dir}, now go to {save_dir.parent} "
f"and run `tar czf {save_dir.name} --directory={save_dir.with_suffix('.tar.gz').name}/ .`"
f"All outputs have been saved in directory {save_dir},"
+ f"now go to {save_dir.parent} "
f"and run `tar czf {save_dir.name}"
+ f" --directory={save_dir.with_suffix('.tar.gz').name}/ .`"
)


Expand Down

0 comments on commit 5a0751f

Please sign in to comment.