pulsatrix 1.1.0
Loading...
Searching...
No Matches
series.hpp
Go to the documentation of this file.
1
14#pragma once
15
16#include <string>
17#include <string_view>
18#include <vector>
19
20#include "pulsatrix/viz/svg.hpp"
21
22namespace pulsatrix {
23
25struct Series {
27 std::string name;
28 std::vector<double> x;
29 std::vector<double> y;
31 std::vector<double> lo;
32 std::vector<double> hi;
33
34 [[nodiscard]] size_t size() const { return x.size(); }
35 [[nodiscard]] bool has_intervals() const { return !lo.empty(); }
36};
37
41 std::string title;
42 std::vector<Series> series;
43};
44
46enum class AxisScale { Linear, Log };
47
48[[nodiscard]] const char* AxisScaleName(AxisScale scale);
49
51 std::string title;
52 std::string x_label;
53 std::string y_label;
58 std::string interval;
60 std::vector<SeriesPanel> panels;
61};
62
68[[nodiscard]] std::string ToJson(const SeriesDocument& doc);
71[[nodiscard]] SeriesDocument ParseSeriesDocument(std::string_view json);
72
76 bool shared_y = false;
77};
78
88[[nodiscard]] std::string RenderSeriesSvg(const SeriesDocument& doc, const SeriesViewOptions& view = {},
89 const SvgOptions& options = {});
90
91} // namespace pulsatrix
Definition acquisition_functions.hpp:16
std::string RenderSeriesSvg(const SeriesDocument &doc, const SeriesViewOptions &view={}, const SvgOptions &options={})
The panels stacked top to bottom, each a line per series with a marker per point and a whisker per in...
const char * AxisScaleName(AxisScale scale)
@ Linear
One linear layer with a bias, not tied to the embeddings (MDLM).
JsonValue ToJson(const AttackResult &result, const AttackOptions &options)
The result as a pulsatrix.attack.v1 document, without the adversarial inputs.
AxisScale
How an axis maps values to positions.
Definition series.hpp:46
SeriesDocument ParseSeriesDocument(std::string_view json)
Definition series.hpp:50
std::string x_label
Definition series.hpp:52
std::string y_label
Definition series.hpp:53
std::vector< SeriesPanel > panels
At least one, each with at least one series.
Definition series.hpp:60
AxisScale y_scale
Definition series.hpp:55
std::string interval
What lo and hi are, for example "95% Wilson interval over 5 seeds". Shown under the chart when not em...
Definition series.hpp:58
AxisScale x_scale
Definition series.hpp:54
std::string title
Definition series.hpp:51
Several series on shared axes.
Definition series.hpp:39
std::vector< Series > series
Definition series.hpp:42
std::string title
Drawn above the panel when not empty.
Definition series.hpp:41
Options for RenderSeriesSvg().
Definition series.hpp:74
bool shared_y
Give every panel the same y range, so their heights compare directly.
Definition series.hpp:76
One line of points.
Definition series.hpp:25
std::vector< double > hi
Definition series.hpp:32
std::vector< double > x
Definition series.hpp:28
std::vector< double > y
Definition series.hpp:29
size_t size() const
Definition series.hpp:34
std::vector< double > lo
Empty, or one per point: the interval drawn around y. lo <= hi.
Definition series.hpp:31
std::string name
Names the series in the legend. A series keeps its color in every panel.
Definition series.hpp:27
bool has_intervals() const
Definition series.hpp:35
Dependency-free SVG figures from viz documents: bar, waterfall, heatmap, token strip,...