PySDM icon indicating copy to clipboard operation
PySDM copied to clipboard

Including sampling along X-direction

Open jtbuch opened this issue 1 year ago • 11 comments

Generalized spatial_sampling.py to also include sampling along X-direction. Possible options include sampling for Z-direction individually or both directions simultaneously.

jtbuch avatar Apr 19 '24 18:04 jtbuch

Thank you @jtbuch! Let's aim for covering the new logic with unit tests as a part this PR

slayoo avatar Apr 19 '24 18:04 slayoo

Hi @slayoo sure thing! Let me know what I can do to run these tests.

Edit: I figured out the pre-commit test from the FAQ here but still slightly lost about the pylint fail.

jtbuch avatar Apr 19 '24 18:04 jtbuch

Ah I think I understand what's going on. Will post another commit on Monday after cleaning up the code a little.

jtbuch avatar Apr 20 '24 03:04 jtbuch

@jtbuch We use pre-commit to ensure consistent formatting of source files (whitespaces, etc). To make the pre-commit hooks update code automatically before each commit (ensuring pre-commit will pass on CI), you can do:

pip install pre-commit
cd PySDM
pre-commit install

For the test coverage, I suggest to add a new test routine in tests/unit_tests/initialisation/test_spatial_discretisation.py which can be analogous to: https://github.com/open-atmos/PySDM/blob/main/tests/unit_tests/initialisation/test_spatial_discretisation.py#L42-L57 but testing the newly introduced logic

slayoo avatar Apr 25 '24 17:04 slayoo

Sounds good, @slayoo! I will update this within the next week.

jtbuch avatar May 03 '24 14:05 jtbuch

Thanks!

slayoo avatar May 03 '24 18:05 slayoo

@jtbuch rebasing onto (or merging in) the current main branch should help with the examples-setup failure

slayoo avatar May 13 '24 19:05 slayoo

@slayoo Thank you for the suggestion! I am trying to set up multiple branches for different cases (keep an eye out for more issues 👀) and I will rebase before the next commit.

jtbuch avatar May 13 '24 19:05 jtbuch

Hi @slayoo I've added a new function locally that tests for both x- and z-directions based on the existing one in https://github.com/open-atmos/PySDM/blob/main/tests/unit_tests/initialisation/test_spatial_discretisation.py#L42-L57

Is there a file that calls test_spatial_discretisation.py where I need to include the function declaration? Or just pushing a commit with the new unit test should suffice?

jtbuch avatar May 20 '24 14:05 jtbuch

Thanks @jtbuch !

Is there a file that calls test_spatial_discretisation.py where I need to include the function declaration? Or just pushing a commit with the new unit test should suffice?

It is enough to add the file to the repo, see https://docs.pytest.org/en/latest/explanation/goodpractices.html#conventions-for-python-test-discovery

slayoo avatar May 20 '24 18:05 slayoo

Ah that link was quite helpful, thanks! I have added the unit test to the repo now after verifying that it works locally.

jtbuch avatar May 20 '24 20:05 jtbuch

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 83.49%. Comparing base (c2b4850) to head (7e58c3d).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1316      +/-   ##
==========================================
+ Coverage   83.47%   83.49%   +0.01%     
==========================================
  Files         362      362              
  Lines        8868     8878      +10     
==========================================
+ Hits         7403     7413      +10     
  Misses       1465     1465              

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar May 29 '24 06:05 codecov[bot]

Thanks @jtbuch !

slayoo avatar May 29 '24 18:05 slayoo