Removal of above/ below in grain thresholds#1381
Conversation
ubdbra001
left a comment
There was a problem hiding this comment.
I had a quick skim and made some comments on things that jump out at me.
The changes to the docs are minimal, and from looking at them I'm not clear about what values I can include for these config options (Does order matter, how many values can I include, etc.) I'm probably not remembering the context for these options, but I think it would be good to spell them out somewhere.
| above: 1.0 # Threshold for grains above the image background | ||
| area_thresholds: | ||
| above: [300, 3000] # above surface [Low, High] in nm^2 (also takes null) | ||
| threshold_std_dev: [-10, 1] # Thresholds for grains relative to the image background. Negative values are below and positive values are above. List[float]. |
There was a problem hiding this comment.
Just for my understanding:
- Is there a specific order for these (i.e. would
[-10, 1]produce the same result as[1, -10])? - Are only 2 values allowed?
- Should one be negative and one positive?
There was a problem hiding this comment.
-
There's no specific order but it's important to be aware of the order you chose as in the output
.csvs the thresholds are referenced by index. -
No, it can be any amount (except none)
-
No, you can have any configuration
I should definitely make this clearer, I will in the docs but would more information be good in the config file too?
There was a problem hiding this comment.
If you want to you can, but I don't think it's vital. It's worth bearing in mind that if you have the same info in multiple places and they both have to be manually updated for future changes there is a reasonable chance that one of those places will get overlooked and you will end up with differing information.
I saw you've updated the schema for validation. It would be good to update this to ensure an empty list can't be passed (if I'm interpreting your answer correctly)
01f0736 to
41483f7
Compare
|
One thing I'm noting here for documentation/ future reference purposes: In Assuming it is required... If the thresholds are
or
My immediate thought is that the second option seems better but might make On the other hand clear and obvious documentation will be needed if we reference the threshold by index so a Previously the closest thing we had to this value was called As far as I can see either option will require fairly minimal additions to implement, the threshold index is already stored and used in log messages and the actual threshold value can easily be found with that index value. |
(gently held opinion) I think we should use index for now. Perhaps in the future we make the user name the thresholds, ie: |
| # pylint: disable=too-many-statements | ||
|
|
||
|
|
||
| def pair_float(list_str: str): |
SylviaWhittle
left a comment
There was a problem hiding this comment.
This is great, thank you for redoing this work. I appreciate it.
I also like the sweeping up you've done, keeping our kitchen tidy. :)
|
That's very odd - its failing on the test for unet preprocessing for making bounding boxes square. This code should be very isolated and resilient... |
@SylviaWhittle Is it not the snapshot comparison in test_process_scan and test_unet_masking is just an xfail? |
Ah yes. I skimmed too rapidly hah. |

Remove above/ below from grain thresholds
Closes #1332
Closes #1333
Closes #1334
This PR simplifies the grain finding thresholds by removing a layer of indentation (
above/belowkeys). The direction of the threshold is now selected by the sign of the threshold value in the config. For example:old:
new:
This also means that
area_thresholdshas changed to lose the directional indentation layer:old:
new:
The new
area_thresholdsargument is a 2d list, each sub-list is for the threshold it shares an index number with.Any reference/ use of direction in loops through TopoStats have either been removed or changed into a single loop of all thresholds in the list regardless of their direction. They are referred to via their index in the thresholds list.
Before submitting a Pull Request please check the following.
docs/usage/configuration.mddocs/usage/data_dictionary.mddocs/usage/advanced.mdand new pages it should link to.topostats/default_config.yamlIf adding options to
topostats/default_config.yamlplease ensure.topostats/validation.pyto ensure entries are valid.topostats/entry_point.py.