icplot 0.0.12__tar.gz → 0.0.13__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {icplot-0.0.12/src/icplot.egg-info → icplot-0.0.13}/PKG-INFO +1 -1
- {icplot-0.0.12 → icplot-0.0.13}/pyproject.toml +1 -1
- icplot-0.0.13/src/icplot/graph/generator.py +84 -0
- {icplot-0.0.12 → icplot-0.0.13}/src/icplot/graph/plot.py +1 -0
- {icplot-0.0.12 → icplot-0.0.13/src/icplot.egg-info}/PKG-INFO +1 -1
- {icplot-0.0.12 → icplot-0.0.13}/src/icplot.egg-info/SOURCES.txt +1 -0
- {icplot-0.0.12 → icplot-0.0.13}/LICENSE +0 -0
- {icplot-0.0.12 → icplot-0.0.13}/README.md +0 -0
- {icplot-0.0.12 → icplot-0.0.13}/setup.cfg +0 -0
- {icplot-0.0.12 → icplot-0.0.13}/src/icplot/__init__.py +0 -0
- {icplot-0.0.12 → icplot-0.0.13}/src/icplot/cairo_interface.py +0 -0
- {icplot-0.0.12 → icplot-0.0.13}/src/icplot/color.py +0 -0
- {icplot-0.0.12 → icplot-0.0.13}/src/icplot/gantt/__init__.py +0 -0
- {icplot-0.0.12 → icplot-0.0.13}/src/icplot/gantt/gantt.py +0 -0
- {icplot-0.0.12 → icplot-0.0.13}/src/icplot/gantt/gantt_renderer.py +0 -0
- {icplot-0.0.12 → icplot-0.0.13}/src/icplot/gantt/pgfgantt.py +0 -0
- {icplot-0.0.12 → icplot-0.0.13}/src/icplot/geometry.py +0 -0
- {icplot-0.0.12 → icplot-0.0.13}/src/icplot/graph/__init__.py +0 -0
- {icplot-0.0.12 → icplot-0.0.13}/src/icplot/graph/axis.py +0 -0
- {icplot-0.0.12 → icplot-0.0.13}/src/icplot/graph/matplotlib.py +0 -0
- {icplot-0.0.12 → icplot-0.0.13}/src/icplot/graph/plotter.py +0 -0
- {icplot-0.0.12 → icplot-0.0.13}/src/icplot/graph/series.py +0 -0
- {icplot-0.0.12 → icplot-0.0.13}/src/icplot/image_utils.py +0 -0
- {icplot-0.0.12 → icplot-0.0.13}/src/icplot/main_cli.py +0 -0
- {icplot-0.0.12 → icplot-0.0.13}/src/icplot/py.typed +0 -0
- {icplot-0.0.12 → icplot-0.0.13}/src/icplot/tex.py +0 -0
- {icplot-0.0.12 → icplot-0.0.13}/src/icplot/trace/__init__.py +0 -0
- {icplot-0.0.12 → icplot-0.0.13}/src/icplot/trace/trace.py +0 -0
- {icplot-0.0.12 → icplot-0.0.13}/src/icplot.egg-info/dependency_links.txt +0 -0
- {icplot-0.0.12 → icplot-0.0.13}/src/icplot.egg-info/entry_points.txt +0 -0
- {icplot-0.0.12 → icplot-0.0.13}/src/icplot.egg-info/requires.txt +0 -0
- {icplot-0.0.12 → icplot-0.0.13}/src/icplot.egg-info/top_level.txt +0 -0
- {icplot-0.0.12 → icplot-0.0.13}/test/test_cairo_interface.py +0 -0
- {icplot-0.0.12 → icplot-0.0.13}/test/test_gantt_chart.py +0 -0
- {icplot-0.0.12 → icplot-0.0.13}/test/test_image_utils.py +0 -0
- {icplot-0.0.12 → icplot-0.0.13}/test/test_line_plots.py +0 -0
- {icplot-0.0.12 → icplot-0.0.13}/test/test_tex_interface.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: icplot
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.13
|
|
4
4
|
Summary: Utilities for generating plots and graphics for technical reports.
|
|
5
5
|
Author-email: "James Grogan, Irish Centre for High End Computing" <james.grogan@ichec.ie>
|
|
6
6
|
Project-URL: Repository, https://git.ichec.ie/performance/toolshed/icplot
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
from typing import Any, Callable
|
|
2
|
+
import copy
|
|
3
|
+
import os
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
|
|
6
|
+
from pydantic import BaseModel
|
|
7
|
+
|
|
8
|
+
from .plot import Plot
|
|
9
|
+
from .series import LinePlotSeries
|
|
10
|
+
from .matplotlib import MatplotlibPlotter
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class PlotConfig(BaseModel):
|
|
14
|
+
|
|
15
|
+
series_attr: str
|
|
16
|
+
x_attr: str
|
|
17
|
+
plots: dict[str, Plot]
|
|
18
|
+
colormap: Any
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def make_plots(
|
|
22
|
+
results: list[Any], config: PlotConfig, point_func: Callable
|
|
23
|
+
) -> list[Plot]:
|
|
24
|
+
"""
|
|
25
|
+
For a set of results and a given plot config generate a list of
|
|
26
|
+
plots.
|
|
27
|
+
"""
|
|
28
|
+
|
|
29
|
+
# The instance attribute value for 'series_attr' is used to generate
|
|
30
|
+
# a set of labels, one per plot series
|
|
31
|
+
series_labels = set(getattr(r, config.series_attr) for r in results)
|
|
32
|
+
|
|
33
|
+
plots: list[Plot] = []
|
|
34
|
+
# Each 'y attribute' in the config corresponds to a 'plot' of this
|
|
35
|
+
# attribute's values.
|
|
36
|
+
for y_attr, plot_template in config.plots.items():
|
|
37
|
+
new_plot = copy.deepcopy(plot_template)
|
|
38
|
+
new_plot.name = y_attr
|
|
39
|
+
series = []
|
|
40
|
+
|
|
41
|
+
for label in series_labels:
|
|
42
|
+
# Get results for this series
|
|
43
|
+
label_results = [
|
|
44
|
+
r for r in results if getattr(r, config.series_attr) == label
|
|
45
|
+
]
|
|
46
|
+
|
|
47
|
+
# Use a user-provided 'point_func' to get the series 'x, y' points
|
|
48
|
+
# from the results, given a 'x_attr, y_attr' pair
|
|
49
|
+
points = [point_func(r, config.x_attr, y_attr) for r in label_results].sort(
|
|
50
|
+
key=lambda x: x[0]
|
|
51
|
+
)
|
|
52
|
+
x, y = zip(*points)
|
|
53
|
+
|
|
54
|
+
if label in config.colormap:
|
|
55
|
+
series.append(
|
|
56
|
+
LinePlotSeries(
|
|
57
|
+
x=x,
|
|
58
|
+
y=y,
|
|
59
|
+
label=label,
|
|
60
|
+
highlight=True,
|
|
61
|
+
color=config.colormap[label],
|
|
62
|
+
)
|
|
63
|
+
)
|
|
64
|
+
else:
|
|
65
|
+
series.append(LinePlotSeries(x=x, y=y, label=label))
|
|
66
|
+
new_plot.series.extend(series)
|
|
67
|
+
plots.append(new_plot)
|
|
68
|
+
return plots
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
def plot(
|
|
72
|
+
results: list[Any],
|
|
73
|
+
config: PlotConfig,
|
|
74
|
+
point_func: Callable,
|
|
75
|
+
output_dir: Path = Path(os.getcwd()),
|
|
76
|
+
plotter=MatplotlibPlotter(),
|
|
77
|
+
):
|
|
78
|
+
"""
|
|
79
|
+
For a given set of results and plot config generate the
|
|
80
|
+
corresponding plots and render them to files.
|
|
81
|
+
"""
|
|
82
|
+
|
|
83
|
+
for p in make_plots(results, config, point_func):
|
|
84
|
+
plotter.plot(p, output_dir / f"{p.name}.svg")
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: icplot
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.13
|
|
4
4
|
Summary: Utilities for generating plots and graphics for technical reports.
|
|
5
5
|
Author-email: "James Grogan, Irish Centre for High End Computing" <james.grogan@ichec.ie>
|
|
6
6
|
Project-URL: Repository, https://git.ichec.ie/performance/toolshed/icplot
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|