Added "trace_linewidth" parameter to make the spline and curvature thickness user defined for visibility#1326
Conversation
topostats/validation.py
Outdated
| int, | ||
| float, |
There was a problem hiding this comment.
It would be worth validating that these numbers are >= <some_minimum_value>, they should at least be > 0 but some other value may make sense as an absolute minimum for the lines to be visible.
There should be examples of how to do this with lambda functions but likely need to use nested And(...) to check both type and the value is lambda n: n >= <some_minimum_value>
topostats/default_config.yaml
Outdated
| # - curvature | ||
| zrange: [null, null] # low and high height range for core images (can take [null, null]). low <= high | ||
| colorbar: true # Options : true, false | ||
| trace_linewidth: 100.0 # Linewidth for spline and cuvature traces. |
There was a problem hiding this comment.
Is this not quite thick?
SylviaWhittle
left a comment
There was a problem hiding this comment.
Works. Good change, thank you.
SylviaWhittle
left a comment
There was a problem hiding this comment.
Oh wait, please fix the pre-commit issues.
ns-rse
left a comment
There was a problem hiding this comment.
Thanks for adding the more formal check @TFirth2
Some extraneous blank lines have crept in and I've made suggestions to remove them to make it easy to submit the changes (or you can do it locally and use git add -u . && git commit --amend which will add the changes into your last commit).
Suggesting having consistent defaults between the function parameter and the parameter as defined in the default_config.yaml.
Finally I wonder about putting an upper bound on the width to help users from mistakenly setting the value too large.
topostats/plottingfuncs.py
Outdated
| linewidth=self.trace_linewidth, | ||
| ) | ||
|
|
||
topostats/processing.py
Outdated
| filename=f"{topostats_object.filename}_curvature", | ||
| output_dir=core_out_path, | ||
| **plotting_config["plot_dict"]["curvature"], | ||
|
|
| ), | ||
| "trace_linewidth": And( | ||
| Or(int, float), | ||
| lambda n: n > 0.0, |
There was a problem hiding this comment.
In a similar vein to @SylviaWhittle suggestion about 100.0 being quite large would it be prudent to set an upper boundary on this?
| lambda n: n > 0.0, | |
| lambda n: 0.0 < n < 10.0, |
topostats/plottingfuncs.py
Outdated
|
|
||
|
|
topostats/plottingfuncs.py
Outdated
| histogram_bins: int | None = None, | ||
| savefig_dpi: str | float | None = None, | ||
| number_grains: bool = False, | ||
| trace_linewidth: float = 3.0 |
There was a problem hiding this comment.
Why not set this the same as the value in default_config.yaml?
| trace_linewidth: float = 3.0 | |
| trace_linewidth: float = 1.0 |
(Alternatively set the value in default_config.yaml to be 3.0)
|
Some of the pre-commit checks you won't be able to fix, only work-around For example the complaint from I have also remembered that we try to keep the documentation up-to-date when adding options into |
… the new parameter in the config file
7b6741d to
aa6341d
Compare
- Update `.pre-commit-config.yaml` so `yaml-check` passes - add missing docstring for `trace_linewidth` to class.
- classes snapshot needed `trace_linewidth` in coverted dictionary. - linewidths have change in plotting of curvature so images needed updating
|
@TFirth2 : I added the missing line to the I've fixed the Finally I updated the tests that were failing, there were two, one where a class was converted to a dictionary which failed as there is now a new configuration parameter that isn't in the test target and needed updating. The solution here was to update the snapshot |
TopoStats Pull Requests
Please provide a descriptive summary of the changes your Pull Request introduces.
The Software Development section of
the Contributing Guidelines may be useful if you are unfamiliar with linting, pre-commit, docstrings and testing.
NB - This header should be replaced with the description but please complete the below checklist or a short
description of why a particular item is not relevant.
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.Optional
topostats/default_config.yamlIf adding options to
topostats/default_config.yamlplease ensure.topostats/validation.pyto ensure entries are valid.topostats/entry_point.py.