creativity  v1.3.0
Agent-based model of creativity and piracy
Public Member Functions | Public Attributes | Protected Member Functions | List of all members
creativity::cmdargs::SeriesQuantiles Class Reference

CmdArgs subclass for creativity-series-quantiles arguments (for extracting quantiles from series files). More...

#include <creativity/cmdargs/SeriesQuantiles.hpp>

Public Member Functions

 SeriesQuantiles ()
 Constructor for series arguments; takes no arguments.
 
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".
 
- Public Member Functions inherited from creativity::cmdargs::CmdArgs
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 quantiles = "0,.005,.01,.025,.05,.25,.5,.75,.95,.975,.99,.995,1"
 Quantiles to extract. More...
 
unsigned int double_precision = 10
 The precision of double values. The default is 10.
 
std::vector< std::string > input
 The input files to load data from.
 
std::string output_unprefix = "series-"
 Remove this filename prefix, if found. More...
 
std::string output_prefix = "quantiles-"
 The output prefix; output files will be placed in the same directory as input files, with this string prepended to the beginning of the filename. More...
 
bool overwrite = false
 Whether to overwrite output files if they exist. More...
 

Protected Member Functions

virtual void addOptions () override
 Adds series command-line options into the option descriptions.
 
- Protected Member Functions inherited from creativity::cmdargs::CmdArgs
 CmdArgs ()=default
 Default constructor is protected; use a suitable subclass.
 
virtual void postParse (boost::program_options::variables_map &vars)
 Does nothing; subclasses should override if needed to deal with argument values. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from creativity::cmdargs::CmdArgs
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)
 
- Protected Attributes inherited from creativity::cmdargs::CmdArgs
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.
 

Detailed Description

CmdArgs subclass for creativity-series-quantiles arguments (for extracting quantiles from series files).

Member Data Documentation

§ output_prefix

std::string creativity::cmdargs::SeriesQuantiles::output_prefix = "quantiles-"

The output prefix; output files will be placed in the same directory as input files, with this string prepended to the beginning of the filename.

The prefix is added removing the output_strip prefix (if found).

Defaults to "quantiles-".

See also
output_strip

§ output_unprefix

std::string creativity::cmdargs::SeriesQuantiles::output_unprefix = "series-"

Remove this filename prefix, if found.

If an input file starts with the given string, it is removed when constructing the output filename.

Defaults to "series-".

See also
output_prefix

§ overwrite

bool creativity::cmdargs::SeriesQuantiles::overwrite = false

Whether to overwrite output files if they exist.

(Note that input files will never be overwritten, even if this is true.)

§ quantiles

std::string creativity::cmdargs::SeriesQuantiles::quantiles = "0,.005,.01,.025,.05,.25,.5,.75,.95,.975,.99,.995,1"

Quantiles to extract.

If not specified, defaults to {0, 0.005, 0.01, 0.025, 0.05, 0.25, 0.5, 0.75, 0.95, 0.975, 0.99, 0.995, 1}. The 0 quantile is defined to be the minimum value, the 1 quantile the maximum.

When a requested quantile lies between observations, linear interpolation between immediate neighbours is used to construct the quantile. For example, if the data contains 5 values, {0, 1, 2, 5, 100}, the 0, 0.25, 0.5, 0.75, and 1 quantiles match the values 0, 1, 2, 5, and 100 exactly. The 0.95 quantile, for example, will equal 0.2(5) + 0.8(100) = 81.

The resulting file will have header values qXXX where XXX are the the significant digits following the decimal place, e.g. q005, q75, q975 for .005, .75, and .975 quantiles. The special values 0, 0.5, and 1 are replaced with min, median, and max, respectively.

Inheritance diagram for creativity::cmdargs::SeriesQuantiles:
[legend]
Collaboration diagram for creativity::cmdargs::SeriesQuantiles:
[legend]

The documentation for this class was generated from the following file: