Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ repos:
- id: check-merge-conflict
- id: check-toml
- id: check-yaml
args: ["--unsafe"]
- id: debug-statements
- id: end-of-file-fixer
types: [python]
Expand Down
2 changes: 1 addition & 1 deletion docs/api/logs/index.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Logs API

[`logs.py`](logs.md)
[`logs.py`](logs.md)
2 changes: 1 addition & 1 deletion docs/api/logs/logs.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Log Modules

::: topostats.logs.logs
::: topostats.logs.logs
188 changes: 98 additions & 90 deletions docs/usage/configuration.md

Large diffs are not rendered by default.

38 changes: 19 additions & 19 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,14 @@ nav:
- Grainstats: api/grainstats.md
- IO: api/io.md
- Logs:
- api/logs/index.md
- Logs: api/logs/logs.md
- api/logs/index.md
- Logs: api/logs/logs.md
- Measure:
- api/measure/index.md
- Curvature: api/measure/curvature.md
- Feret: api/measure/feret.md
- Geometry: api/measure/geometry.md
- Height Profiles: api/measure/height_profiles.md
- api/measure/index.md
- Curvature: api/measure/curvature.md
- Feret: api/measure/feret.md
- Geometry: api/measure/geometry.md
- Height Profiles: api/measure/height_profiles.md
- Plotting: api/plotting.md
- PlottingFuncs: api/plottingfuncs.md
- Processing: api/processing.md
Expand All @@ -76,14 +76,14 @@ nav:
- Theme: api/theme.md
- Thresholds: api/thresholds.md
- Tracing:
- api/tracing/index.md
- Disorderd Tracing: api/tracing/disordered_tracing.md
- NodeStats: api/tracing/nodestats.md
- Ordered Tracing: api/tracing/ordered_tracing.md
- Pruning: api/tracing/pruning.md
- Skeletonize: api/tracing/skeletonize.md
- Splining: api/tracing/splining.md
- Tracing Funcs: api/tracing/tracingfuncs.md
- api/tracing/index.md
- Disorderd Tracing: api/tracing/disordered_tracing.md
- NodeStats: api/tracing/nodestats.md
- Ordered Tracing: api/tracing/ordered_tracing.md
- Pruning: api/tracing/pruning.md
- Skeletonize: api/tracing/skeletonize.md
- Splining: api/tracing/splining.md
- Tracing Funcs: api/tracing/tracingfuncs.md
- Utils: api/utils.md
- Validation: api/validation.md

Expand All @@ -96,10 +96,10 @@ plugins:
- search
- mkdocstrings:
handlers:
python:
options:
docstring_style: numpy
show_signature_annotations: true
python:
options:
docstring_style: numpy
show_signature_annotations: true
- mike:
version_selector: true

Expand Down
2 changes: 2 additions & 0 deletions tests/__snapshots__/test_classes.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -1274,6 +1274,7 @@
'savefig_dpi': 100,
'savefig_format': None,
'style': 'topostats.mplstyle',
'trace_linewidth': 1.0,
'zrange': list([
None,
None,
Expand Down Expand Up @@ -2764,6 +2765,7 @@
'savefig_dpi': 100,
'savefig_format': None,
'style': 'topostats.mplstyle',
'trace_linewidth': 1.0,
'zrange': list([
None,
None,
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions topostats/default_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ plotting:
# - 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: 1.0 # Linewidth for spline and cuvature traces.
axes: true # Options : true, false (due to off being a bool when parsed)
num_ticks: [null, null] # Number of ticks to have along the x and y axes. Options : null (auto) or integer > 1
cmap: null # Colormap/colourmap to use (default is 'nanoscope' which is used if null, other options are 'afmhot', 'viridis' etc.)
Expand Down
16 changes: 10 additions & 6 deletions topostats/plottingfuncs.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,9 @@ class Images:
savefig_dpi : str | float, optional
The resolution of the saved plot (default 'figure').
number_grains : bool
Optionally number each grain in a plot.
Optionally number each grain in a plot.
trace_linewidth : float
Width of lines when plotting splines/curvature.
"""

def __init__(
Expand Down Expand Up @@ -184,6 +186,7 @@ def __init__(
histogram_bins: int | None = None,
savefig_dpi: str | float | None = None,
number_grains: bool = False,
trace_linewidth: float = 1.0,
) -> None:
"""
Initialise the class.
Expand Down Expand Up @@ -251,6 +254,8 @@ def __init__(
The resolution of the saved plot (default 'figure').
number_grains : bool
Optionally number each grain in a plot.
trace_linewidth : float
Width of lines when plotting splines/curvature.
"""
if style is None:
style = "topostats.mplstyle"
Expand Down Expand Up @@ -283,6 +288,7 @@ def __init__(
self.histogram_bins = mpl.rcParams["hist.bins"] if histogram_bins is None else histogram_bins
self.savefig_dpi = mpl.rcParams["savefig.dpi"] if savefig_dpi is None else savefig_dpi
self.number_grains = number_grains
self.trace_linewidth = trace_linewidth

def plot_histogram_and_save(self) -> tuple | None:
"""
Expand Down Expand Up @@ -386,9 +392,8 @@ def plot_curvatures(
(image.shape[0] - (min_row + point[0])) * self.pixel_to_nm_scaling,
],
color=color,
linewidth=1,
linewidth=self.trace_linewidth,
)

# save the figure
plt.title(self.title)
plt.xlabel("Nanometres")
Expand Down Expand Up @@ -472,9 +477,8 @@ def plot_curvatures_individual_grain(
(grain_crop.image.shape[0] - point[0]) * self.pixel_to_nm_scaling,
],
color=colour,
linewidth=3,
linewidth=self.trace_linewidth,
)

plt.title(self.title)
plt.xlabel("Nanometres")
plt.ylabel("Nanometres")
Expand Down Expand Up @@ -566,7 +570,7 @@ def save_figure(self):
grain_coords[:, 1] * self.pixel_to_nm_scaling,
(shape[0] - grain_coords[:, 0]) * self.pixel_to_nm_scaling,
c="c",
linewidth=1,
linewidth=self.trace_linewidth,
)

plt.title(self.title)
Expand Down
5 changes: 5 additions & 0 deletions topostats/validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,11 @@ def validate_config(config: dict, schema: Schema, config_type: str) -> None:
False,
error=("Invalid value in config for 'plotting.number_grain_plots', valid values are 'True' or 'False'"),
),
"trace_linewidth": And(
Or(int, float),
lambda n: n > 0.0,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

In a similar vein to @SylviaWhittle suggestion about 100.0 being quite large would it be prudent to set an upper boundary on this?

Suggested change
lambda n: n > 0.0,
lambda n: 0.0 < n < 10.0,

error=("Invalid value in config for 'plotting.trace_linewidth', valid values are int or float"),
),
},
"summary_stats": {
"run": Or(
Expand Down
Loading