creativity
v1.3.0
Agent-based model of creativity and piracy
|
CmdArgs subclass for creativity-series-plots arguments (for plotting quantiles from series and/or quantiles files). More...
#include <creativity/cmdargs/SeriesGraphs.hpp>
Public Member Functions | |
SeriesGraphs () | |
Constructor for series arguments; takes no arguments. | |
virtual void | postParse (boost::program_options::variables_map &vars) override |
Overridden to handle t-min/t-max options. | |
virtual std::string | usage () const override |
Overridden to add " FILE [FILE ...]". | |
virtual std::string | help () const override |
Overridden to add info about input files. | |
virtual std::string | versionSuffix () const override |
Overridden to add " -- simulation data series generator". | |
![]() | |
void | parse (int argc, char const *const *argv) |
Parses options and verifies them. More... | |
template<typename T , typename A > | |
std::enable_if< not std::is_unsigned< T >::value, boost::program_options::typed_value< std::vector< T, A > > * >::type | value (std::vector< T, A > &store) |
Takes a std::vector of values for options that store multiple values. More... | |
template<typename T , typename A > | |
std::enable_if< std::is_unsigned< T >::value, boost::program_options::typed_value< std::vector< Validation< T > > > * >::type | value (std::vector< T, A > &store) |
Takes a std::vector of values for options that store multiple values. More... | |
virtual std::string | version () const |
Returns a version string. | |
Public Attributes | |
std::string | levels = "median,0.5,0.9,0.95" |
The confidence levels to plot as a comma-separated list. More... | |
bool | per_t_confidence = true |
If true, we're in per-t confidence mode. If false, we're in per-source file confidence mode. | |
std::vector< std::string > | input |
The input files (series or quantiles) to plot. More... | |
std::string | output = "series-plots.pdf" |
The output filename, which must end in ".pdf", ".png", or ".svg". More... | |
bool | overwrite = false |
Whether to overwrite the output file(s) if it (they) exist. | |
std::string | title = "%w (%u)" |
The title for the graph, with possible substitutions: More... | |
double | width = 6 |
The width of the resulting graph, in inches. | |
double | height = 4 |
The height of the resulting graph, in inches. | |
int | graph_min_t = -1 |
The t value at which to start the graph display. More... | |
int | graph_max_t = -1 |
The t value at which to end the graph display. More... | |
int | data_min_t = 1 |
The minimum t value required to actually include an observation in the graph. More... | |
int | data_max_t = -1 |
The maximum t value to display in the graph. More... | |
std::vector< int > | t_extra |
Draw heavier graph t grid marks at these points. More... | |
double | graph_min_value = std::numeric_limits<double>::quiet_NaN() |
Determines the minimum value to include in the series plot. More... | |
double | graph_max_value = std::numeric_limits<double>::quiet_NaN() |
Determines the maximum value to include in the series plot. More... | |
bool | same_horizontal_scale = false |
Determines what happens when input series have different maximum time periods, and graph_max_t is set to 0. More... | |
bool | same_vertical_scale = true |
Controls vertical axes when graph_min_value or graph_max_value are not set to finite values. More... | |
creativity::data::graph::Series::LegendPosition | legend_position = creativity::data::graph::Series::LegendPosition::Right |
The legend position. | |
double | legend_rel_x = 1 |
The legend relative x value. More... | |
double | legend_rel_y = 0 |
The legend relative y value. More... | |
std::string | legend_position_input |
The input string, such as "top-left", "outside-center", etc. More... | |
double | resolution = 96 |
The resolution (pixels per inch) for PNG output. More... | |
Protected Member Functions | |
virtual void | addOptions () override |
Adds series command-line options into the option descriptions. | |
![]() | |
CmdArgs ()=default | |
Default constructor is protected; use a suitable subclass. | |
Additional Inherited Members | |
![]() | |
template<typename T > | |
static std::enable_if< not std::is_unsigned< T >::value and not std::is_same< T, bool >::value, boost::program_options::typed_value< T > *>::type | value (T &store) |
Creates an option value object without any special validation wrapper class. More... | |
template<typename T > | |
static std::enable_if< std::is_unsigned< T >::value and not std::is_same< T, bool >::value, boost::program_options::typed_value< Validation< T > > * >::type | value (T &storage) |
Creates an option value object around an unsigned primitive type, with automatic value storage and default value. More... | |
static boost::program_options::typed_value< bool > * | value (bool &store) |
Creates an option value for a boolean value, that is, for an switch without an argument, with default value as given in store . | |
template<typename V > | |
static boost::program_options::typed_value< V > * | value (typename V::value_type &store) |
Creates an option value object with explicit validation wrapper class V. More... | |
template<typename V , typename A > | |
static boost::program_options::typed_value< std::vector< V > > * | value (std::vector< typename V::value_type, A > &store) |
Creates an option value object around a vector of options with validation wrapper class V applied to each element of the vector. More... | |
template<long minimum, long denom = 1, typename T > | |
static boost::program_options::typed_value< Min< T, minimum, denom > > * | min (T &store) |
Shortcut for value<Min<T, n, d>>(val) with T last (so that it can be inferred from val ) | |
template<long maximum, long denom = 1, typename T > | |
static boost::program_options::typed_value< Max< T, maximum, denom > > * | max (T &store) |
Shortcut for value<Max<T, n, d>>(val) with T last (so that it can be inferred from val ) | |
template<long min, long max, long denom = 1, typename T > | |
static boost::program_options::typed_value< Range< T, min, max, denom > > * | range (T &store) |
Shortcut for value<Range<T, a, b, d>>(val) with T last (so that it can be inferred from val ) | |
template<long lower, long denom = 1, typename T > | |
static boost::program_options::typed_value< Above< T, lower, denom > > * | above (T &store) |
Shortcut for value<Above<T, a, d>>(val) with T last (so that it can be inferred from val ) | |
template<long upper, long denom = 1, typename T > | |
static boost::program_options::typed_value< Below< T, upper, denom > > * | below (T &store) |
Shortcut for value<Below<T, b, d>>(val) with T last (so that it can be inferred from val ) | |
![]() | |
std::string | prog_name_ |
The program name, populated by parse(). More... | |
boost::program_options::options_description | options_ |
The options descriptions variable for all options. | |
boost::program_options::options_description | invisible_ |
Like options_, but for hidden options that aren't to be displayed in –help output. | |
boost::program_options::positional_options_description | positional_ |
Positional options object. | |
CmdArgs subclass for creativity-series-plots arguments (for plotting quantiles from series and/or quantiles files).
int creativity::cmdargs::SeriesGraphs::data_max_t = -1 |
The maximum t value to display in the graph.
-1 means unlimited.
If this is greater than graph_max_t it has no effect; if less, observations between this and graph_max_t won't be plotted (even though there is space for them on the graph).
int creativity::cmdargs::SeriesGraphs::data_min_t = 1 |
The minimum t value required to actually include an observation in the graph.
-1 means unlimited.
The default is 1, since t=0 observations are pre-simulation observations and typically irrelevant.
If this is less than graph_min_t it has no effect; if larger, observations between graph_min_t and this won't be plotted (even though there is space for them on the graph).
int creativity::cmdargs::SeriesGraphs::graph_max_t = -1 |
The t
value at which to end the graph display.
If equal to -1, the graph display range is determined by the input data. Note that this only controls the graph range: observations can be further limited by setting data_max_t.
double creativity::cmdargs::SeriesGraphs::graph_max_value = std::numeric_limits<double>::quiet_NaN() |
Determines the maximum value to include in the series plot.
The default, NaN, determines the maximum from the data.
int creativity::cmdargs::SeriesGraphs::graph_min_t = -1 |
The t
value at which to start the graph display.
If equal to -1, the graph display range is determined by the input data. Note that this only controls the graph range: the observations can be further limited by setting data_min_t.
double creativity::cmdargs::SeriesGraphs::graph_min_value = std::numeric_limits<double>::quiet_NaN() |
Determines the minimum value to include in the series plot.
The default, NaN, determines the minimum from the data.
std::vector<std::string> creativity::cmdargs::SeriesGraphs::input |
The input files (series or quantiles) to plot.
Plot axes scales will be identical across files, so typically this should be called with series files for the same (or at least directly comparable) variables.
std::string creativity::cmdargs::SeriesGraphs::legend_position_input |
The input string, such as "top-left", "outside-center", etc.
If blank, we just leave legend_position/legend_rel_x/legend_rel_y alone.
double creativity::cmdargs::SeriesGraphs::legend_rel_x = 1 |
The legend relative x value.
double creativity::cmdargs::SeriesGraphs::legend_rel_y = 0 |
The legend relative y value.
std::string creativity::cmdargs::SeriesGraphs::levels = "median,0.5,0.9,0.95" |
The confidence levels to plot as a comma-separated list.
If input is a series file, the needed quantiles are calculated (as would be done by creativity-series-quantiles); if given a quantiles file, the necessary quantiles must exist in the file.
A value of .9, for example, uses the .05 and .95 quantiles.
The special value of 0 corresponds to the median.
Order is not important, and duplicate values are ignored.
The default plots the median, 50%, 90%, and 95% confidence intervals.
std::string creativity::cmdargs::SeriesGraphs::output = "series-plots.pdf" |
The output filename, which must end in ".pdf", ".png", or ".svg".
If this ends in ".pdf" or ".svg", the file will be a single PDF or SVG file with one page per input file; if the output file is "something.png", files "something-1.png", ..., "something-n.png", one image per input file.
The default is "series-plots.pdf".
double creativity::cmdargs::SeriesGraphs::resolution = 96 |
The resolution (pixels per inch) for PNG output.
The PNG will have a pixel size of this value times width
and height
, but will have the resolution encoded (so that attempting to print it at default sizes should respect the width and height values).
For PDF and SVG output, this value is ignored.
bool creativity::cmdargs::SeriesGraphs::same_horizontal_scale = false |
Determines what happens when input series have different maximum time periods, and graph_max_t is set to 0.
If false, the horizontal axes of graphs will be scaled so that all graphs fill the graph space, but axes are not directly comparable–that is, each graph has a maximum graph t
value determined by its file. If true, the implicit graph maximum will be determined by the maximum t
value across all input files, not just the one being graphed.
For example, if called with two input files A.csv and B.csv, where A.csv has periods t=0 through t=100 and B.csv has t=0 through t=200, when this is false, the graph for A will go from 0 to 100 while B's goes from 0 to 200; when this is true, both graphs will run from 0 to 200 (and the plotted data in A will simply stop at 100).
The default is false (adjust the axes so each plot takes up the full width).
bool creativity::cmdargs::SeriesGraphs::same_vertical_scale = true |
Controls vertical axes when graph_min_value or graph_max_value are not set to finite values.
When false the vertical axis of each plot will be set so as to include all plotted quantile values for only the values in the displayed file. If true, the vertical axes will be set to include all displayed quantile values for all displayed files, thus making the vertical axis directly comparable across plots.
The default is true (axes are the same across graphs).
std::vector<int> creativity::cmdargs::SeriesGraphs::t_extra |
Draw heavier graph t grid marks at these points.
Typically the piracy-begins and policy-begins periods.
std::string creativity::cmdargs::SeriesGraphs::title = "%w (%u)" |
The title for the graph, with possible substitutions:
F - the full path of the input as given in input
p - the dirname of the input file (empty if no directory at all) f - the basename (i.e. filename) of the input path u - the unique portion of the input path w - the last word ([0-9A-Za-z_]) of the input file, not counting the extension. %% - a literal %
Any other x string is reserved for future use.