Including sampling along X-direction
Generalized spatial_sampling.py to also include sampling along X-direction. Possible options include sampling for Z-direction individually or both directions simultaneously.
Thank you @jtbuch! Let's aim for covering the new logic with unit tests as a part this PR
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.
Ah I think I understand what's going on. Will post another commit on Monday after cleaning up the code a little.
@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
Sounds good, @slayoo! I will update this within the next week.
Thanks!
@jtbuch rebasing onto (or merging in) the current main branch should help with the examples-setup failure
@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.
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?
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
Ah that link was quite helpful, thanks! I have added the unit test to the repo now after verifying that it works locally.
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.
Thanks @jtbuch !