Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 0.4.0dev tests #384

Merged
merged 13 commits into from
Jul 25, 2023
Merged

Fix 0.4.0dev tests #384

merged 13 commits into from
Jul 25, 2023

Conversation

talonchandler
Copy link
Collaborator

@talonchandler talonchandler commented Jul 25, 2023

This PR against 0.4.0dev includes the test fixes that should have appeared in #381 (see #383 for CI/CD fix).

@talonchandler talonchandler changed the base branch from main to 0.4.0dev July 25, 2023 17:30
@codecov
Copy link

codecov bot commented Jul 25, 2023

Codecov Report

Merging #384 (85b8285) into 0.4.0dev (c1ff28d) will increase coverage by 3.16%.
Report is 76 commits behind head on 0.4.0dev.
The diff coverage is 68.26%.

@@             Coverage Diff             @@
##           0.4.0dev    #384      +/-   ##
===========================================
+ Coverage      3.82%   6.98%   +3.16%     
===========================================
  Files            23      24       +1     
  Lines          4629    4450     -179     
===========================================
+ Hits            177     311     +134     
+ Misses         4452    4139     -313     
Files Changed Coverage Δ
recOrder/acq/acquisition_workers.py 0.00% <0.00%> (ø)
recOrder/calib/Calibration.py 0.00% <0.00%> (ø)
recOrder/calib/calibration_workers.py 0.00% <0.00%> (ø)
recOrder/io/utils.py 0.00% <0.00%> (ø)
recOrder/plugin/main_widget.py 0.00% <0.00%> (ø)
recOrder/tests/cli_tests/test_cli.py 100.00% <ø> (ø)
recOrder/tests/cli_tests/test_reconstruct.py 97.14% <97.14%> (ø)
recOrder/tests/cli_tests/test_compute_tf.py 100.00% <100.00%> (ø)
recOrder/tests/cli_tests/test_settings.py 100.00% <100.00%> (ø)
recOrder/tests/conftest.py 100.00% <100.00%> (ø)
... and 1 more

... and 1 file with indirect coverage changes

@talonchandler talonchandler marked this pull request as ready for review July 25, 2023 19:03
@talonchandler
Copy link
Collaborator Author

talonchandler commented Jul 25, 2023

@ziw-liu I'm having trouble getting the tests to pass on windows. Any idea how we might solve this?

>           assert tf_path.exists()
  E           AssertionError: assert False
  E            +  where False = <bound method Path.exists of WindowsPath('C:/Users/runneradmin/AppData/Local/Temp/pytest-of-unknown/pytest-0/test_reconstruct0/tf.zarr')>()
  E            +    where <bound method Path.exists of WindowsPath('C:/Users/runneradmin/AppData/Local/Temp/pytest-of-unknown/pytest-0/test_reconstruct0/tf.zarr')> = WindowsPath('C:/Users/runneradmin/AppData/Local/Temp/pytest-of-unknown/pytest-0/test_reconstruct0/tf.zarr').exists

@talonchandler talonchandler requested a review from ziw-liu July 25, 2023 19:04
@ziw-liu
Copy link
Contributor

ziw-liu commented Jul 25, 2023

I can reproduce the same error on a local Windows machine (automaton 2).

Edit: the tf.zarr is indeed missing...

@ziw-liu
Copy link
Contributor

ziw-liu commented Jul 25, 2023

OK found it. Same issue as czbiohub-sf/iohub#116

@ziw-liu
Copy link
Contributor

ziw-liu commented Jul 25, 2023

@talonchandler Some new warnings related to torch in addition to the overlay colormap things:

=============================== warnings summary ===============================
  recOrder/tests/cli_tests/test_compute_tf.py::test_compute_transfer
    /home/runner/work/recOrder/recOrder/.tox/py311-linux/lib/python3.11/site-packages/torch/functional.py:504: UserWarning: torch.meshgrid: in an upcoming release, it will be required to pass the indexing argument. (Triggered internally at ../aten/src/ATen/native/TensorShape.cpp:3483.)
      return _VF.meshgrid(tensors, **kwargs)  # type: ignore[attr-defined]
  
  recOrder/tests/cli_tests/test_compute_tf.py::test_compute_transfer
  recOrder/tests/cli_tests/test_compute_tf.py::test_compute_transfer_output_file
  recOrder/tests/cli_tests/test_compute_tf.py::test_absorption_and_phase_write
  recOrder/tests/cli_tests/test_compute_tf.py::test_phase_3dim_write
  recOrder/tests/cli_tests/test_compute_tf.py::test_fluorescence_write
  recOrder/tests/cli_tests/test_reconstruct.py::test_reconstruct
    /home/runner/work/recOrder/recOrder/.tox/py311-linux/lib/python3.11/site-packages/waveorder/optics.py:321: UserWarning: To copy construct from a tensor, it is recommended to use sourceTensor.clone().detach() or sourceTensor.clone().detach().requires_grad_(True), rather than torch.tensor(sourceTensor).
      * torch.tensor(z_position_list)[:, None, None]
  
  recOrder/tests/cli_tests/test_compute_tf.py::test_compute_transfer
  recOrder/tests/cli_tests/test_compute_tf.py::test_compute_transfer_output_file
  recOrder/tests/cli_tests/test_compute_tf.py::test_absorption_and_phase_write
  recOrder/tests/cli_tests/test_reconstruct.py::test_reconstruct
    /home/runner/work/recOrder/recOrder/.tox/py311-linux/lib/python3.11/site-packages/waveorder/optics.py:370: UserWarning: To copy construct from a tensor, it is recommended to use sourceTensor.clone().detach() or sourceTensor.clone().detach().requires_grad_(True), rather than torch.tensor(sourceTensor).
      * torch.tensor(z_position_list)[:, None, None]
  
  recOrder/tests/cli_tests/test_reconstruct.py::test_reconstruct
    /home/runner/work/recOrder/recOrder/.tox/py311-linux/lib/python3.11/site-packages/waveorder/stokes.py:2[91](https://github.com/mehta-lab/recOrder/actions/runs/5660655330/job/15336852512#step:7:92): UserWarning: To copy construct from a tensor, it is recommended to use sourceTensor.clone().detach() or sourceTensor.clone().detach().requires_grad_(True), rather than torch.tensor(sourceTensor).
      transmittance = torch.tensor(s0).clone()
  
  recOrder/tests/cli_tests/test_reconstruct.py::test_reconstruct
    /home/runner/work/recOrder/recOrder/.tox/py311-linux/lib/python3.11/site-packages/waveorder/util.py:711: RuntimeWarning: invalid value encountered in divide
      img_norm_stack[i] = img_stack[i] / uniform_filter(
  
  recOrder/tests/util_tests/test_overlays.py::test_ret_ori_overlay
  recOrder/tests/util_tests/test_overlays.py::test_ret_ori_overlay
  recOrder/tests/util_tests/test_overlays.py::test_ret_ori_overlay
  recOrder/tests/util_tests/test_overlays.py::test_ret_ori_overlay
    /home/runner/work/recOrder/recOrder/.tox/py311-linux/lib/python3.11/site-packages/recOrder/io/utils.py:271: RuntimeWarning: overflow encountered in divide
      ret_ / np.max(ret_),
  
  recOrder/tests/util_tests/test_overlays.py: 16 warnings
    /home/runner/work/recOrder/recOrder/.tox/py311-linux/lib/python3.11/site-packages/colorspacious/ciecam02.py:333: RuntimeWarning: invalid value encountered in divide
      t = (C
  
  recOrder/tests/util_tests/test_overlays.py::test_ret_ori_overlay
  recOrder/tests/util_tests/test_overlays.py::test_ret_ori_overlay
  recOrder/tests/util_tests/test_overlays.py::test_ret_ori_overlay
    /home/runner/work/recOrder/recOrder/.tox/py311-linux/lib/python3.11/site-packages/colorspacious/ciecam02.py:3[97](https://github.com/mehta-lab/recOrder/actions/runs/5660655330/job/15336852512#step:7:98): RuntimeWarning: invalid value encountered in power
      * ((27.13 * np.abs(RGBprime_a - 0.1))
  
  -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
  
  ---------- coverage: platform linux, python 3.11.4-final-0 -----------
  Coverage XML written to file coverage.xml
  
  ======================= 29 passed, 36 warnings in 11.07s =======================

@talonchandler
Copy link
Collaborator Author

Thanks @ziw-liu!

Let me work through these warnings then I'll merge this.

@talonchandler
Copy link
Collaborator Author

I've documented the warnings into issues in the correct repositories:

waveorder

  • #137 - meshgrid warning with fix PR
  • #139 - warning about copying tensors (slightly more involved to fix)
  • #140 - phase normalization divide by zero

recOrder

None of these warnings are critical, so I vote to merge this branch into 0.4.0dev then into main.

@talonchandler talonchandler merged commit 6e49667 into 0.4.0dev Jul 25, 2023
@talonchandler talonchandler deleted the fix-0.4.0dev-tests branch July 25, 2023 22:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants