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(plotting): remove dilation if images are large #914

Conversation

ns-rse
Copy link
Collaborator

@ns-rse ns-rse commented Sep 24, 2024

The section which automatically dilated masks had been commented out as part of the refactoring for better-tracing. This meant that the related test (tests/test_plottingfuncs.py::test_mask_dilation()) failed.

After discussion it was decided to remove this functionality completely. We have left the topostats.plottingfuncs.dilate_binary_image() which may be used elsewhere. It isn't currently but there is an argument/option in default_config.yaml under mask_smoothing_params which indicates the dilation is undertaken during smoothing so perhaps we can simplify the code by calling the dilate_binary_image() function we have in place with tests and reduce the amount of code within the smoothing module.

Further the step which turns a mask with numbered layers to binary (0/1) has been removed because plots now require there to be different layers of masking to differentiate individual molecules.

Another issue is that the tests were developed with a value of zrange: [null, null] but in this branch the
default_config.yaml has been modified to zrange: [-2, 6] which results in six tests failing. The
default_config.yaml has been reverted to zrange: [null, null].

This does raise a couple of issues.

  1. What should the defaults be in the main branch and in releases?

When developing features and testing new code it may be desirable to use custom configurations but what should we be using as defaults for releases? What set of values works best for most use cases?

  1. Use --config <custom_config>.yaml

Directly related to this is that we should not be changing values in default_config.yaml when undertaking development. Rather we should use the --config flag with a custom configuration file. When new options need adding that isn't a problem to add them to default_config.yaml but when modifying values it is important to ensure all tests pass.

It can take some time to track down and work out the root cause of these test failures!

This partially address the issues highlighted in #850.

The section which automatically dilated masks had been commented out as part of the refactoring for
`better-tracing`. This meant that the related test (`tests/test_plottingfuncs.py::test_mask_dilation()`) failed.

After discussion it was decided to remove this functionality completely. We have left the
`topostats.plottingfuncs.dilate_binary_image()` which may be used elsewhere. It isn't currently but there _is_ an
argument/option in `default_config.yaml` under `mask_smoothing_params` which indicates the dilation is undertaken during
smoothing so perhaps we can simplify the code by calling the `dilate_binary_image()` function we have in place with
tests and reduce the amount of code within the smoothing module.

Further the step which turns a mask with numbered layers to binary (`0`/`1`) has been removed because plots now require
there to be different layers of masking to differentiate individual molecules.

Another issue is that the tests were developed with a value of `zrange: [null, null]` but in this branch the
`default_config.yaml` has been modified to `zrange: [-2, 6]` which results in six tests failing. The
`default_config.yaml` has been reverted to `zrange: [null, null]`.

This does raise a couple of issues.

1. What should the defaults be in the `main` branch and in releases?

When developing features and testing new code it may be desirable to use custom configurations but what should we be
using as defaults for releases? What set of values works best for _most_ use cases?

2. Use `--config <custom_config>.yaml`

Directly related to this is that we should not be changing values in `default_config.yaml` when undertaking development.
Rather we should use the `--config` flag with a custom configuration file. When new options need adding that isn't a
problem to add them to `default_config.yaml` but when modifying values it is important to ensure all tests pass.

It can take some time to track down and work out the root cause of these test failures!
Copy link
Collaborator

@MaxGamill-Sheffield MaxGamill-Sheffield left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep nice and easy to check this one 👍

@ns-rse ns-rse merged commit 1fa9988 into maxgamill-sheffield/800-better-tracing Sep 27, 2024
2 checks passed
@ns-rse ns-rse deleted the ns-rse/fix-tests-test_plottingfuncs branch September 27, 2024 17:49
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