Class acol_manager (o2scl_acol)¶
-
class acol_manager¶
The driver for ‘acol’ command-line utility.
Todo
In class acol_manager:
(Future) Fix documentation for value-grid command.
(Future) There is quite a bit of code duplication in comm_autocorr() between the “table” and “other” types. This could be streamlined.
(Future) sum/max/min/output/interp/deriv/integ/deriv2 for hist, hist_2d, and v<c>
(Future) Commands xindex and yindex for table3d.
(Future) Fix fit for table.
(Future) Use swap instead of copy in ‘select’ for table objects.
(Future) Make sure get_input() is used more consistently.
(Future) Make sure preview, output, internal, generic, and create work consistently across all types.
(Future) Stack-like operations (push, pop, swap, stack-list, etc.)?
(Future) Add functionality to ensure that three digit exponents are still handled gracefully (do this by creating a new boolean setting which, if true, always makes three spaces for exponents?)
(Future) Fix insert and insert_full so that it automatically renames columns
(Future) Allow “insert” commands to be restrictive, avoiding extrapolation
(Future) For strings, allow selection of words or substrings
Parameters modifiable by the user
-
int precision¶
The output precision (default 6)
-
bool pretty¶
Output data into neat columns where possible (default true)
-
bool names_out¶
If true, output names at the top of some objects.
-
bool use_regex¶
If true, use regex (false)
-
std::string obj_name¶
The name of the table.
-
int ncols¶
The number of columns requested by the user (default 0 for autodetect)
-
int interp_type¶
The interpolation type (default is 1; linear)
The valid interpolation types are 1: linear, 2: cubic, 3: periodic cubic, 4: akima, 5: periodic akima, 6: monotonic [experimental], 7: Steffen’s monotonic, 8: nearest neighbor [experimental].
Note that when this value is modified and the current object is a table, table3d or a histogram object, it also modifies the interpolation type of the object.
-
int compress¶
If set, try to compress.
-
bool scientific¶
True for scientific output mode.
The parameter objects
-
o2scl::cli::parameter_string p_obj_name¶
-
o2scl::cli::parameter_string p_def_args¶
-
o2scl::cli::parameter_string p_color_spec¶
-
o2scl::cli::parameter_int p_verbose¶
-
o2scl::cli::parameter_int p_compress¶
-
o2scl::cli::parameter_int p_precision¶
-
o2scl::cli::parameter_int p_ncols¶
-
o2scl::cli::parameter_int p_interp_type¶
-
o2scl::cli::parameter_bool p_scientific¶
-
o2scl::cli::parameter_bool p_pretty¶
-
o2scl::cli::parameter_bool p_names_out¶
-
o2scl::cli::parameter_bool p_use_regex¶
-
std::string def_args¶
Default arguments from environment.
-
int verbose¶
The verbosity level (default 1)
-
std::string type¶
String designating the current type.
-
acol_manager()¶
-
inline virtual ~acol_manager()¶
Object storage
-
o2scl::table_units table_obj¶
-
int int_obj¶
-
char char_obj¶
-
double double_obj¶
-
size_t size_t_obj¶
-
std::string string_obj¶
-
std::vector<o2scl::contour_line> cont_obj¶
-
o2scl::uniform_grid<double> ug_obj¶
-
std::vector<int> intv_obj¶
-
std::vector<double> doublev_obj¶
-
std::vector<size_t> size_tv_obj¶
-
std::vector<std::string> stringv_obj¶
-
std::vector<std::vector<std::string>> vvstring_obj¶
-
std::vector<std::vector<double>> vvdouble_obj¶
-
o2scl::tensor_grid tensor_grid_obj¶
-
o2scl::prob_dens_mdim_amr pdma_obj¶
-
o2scl::prob_dens_mdim_gaussian pdmg_obj¶
-
o2scl::prob_dens_mdim_gmm pgmm_obj¶
-
o2scl::kde_python pkde_obj¶
-
bool post_interactive¶
True if we should run interactive mode after parsing the command-line.
-
std::string env_var_name¶
The environment variable to read from.
Colors
-
std::string command_color¶
Color for commands.
-
std::string type_color¶
Color for types.
-
std::string param_color¶
Color for parameters.
-
std::string help_color¶
Color for help topics.
-
std::string exec_color¶
Color for executable strings.
-
std::string url_color¶
Color for URLSs.
-
std::string default_color¶
Default color.
-
std::vector<o2scl::comm_option_s> opts_new¶
Default acol options for any type.
-
std::string color_spec¶
Color specification for terminal output.
Note that full 3 byte colors are not supported in OSX terminal and not yet supported here.
The 16 basic VT100 colors are 1-15 except for black which is assigned value 256. For 8 bit colors, use values greater than 15 and smaller than 256. The thousands digit is used for the underline attribute, the tens of thousands digit is used for the intensity attribute (0 is normal, 1 is high intensity, and 2 is low intensity). Background colors are specified similarly to foreground colors, but multipled by 100,000.
By default, commands are cyan, types are magenta, parameters are red, help topics are green, executable commands are white, and URLS are underlined.
-
bool help_found(std::string arg1, std::string arg2 = "")¶
Return true if acol can provide help on the specified arguments.
This function is used by o2graph to determine if the acol help command should be called.
-
void xml_replacements(std::string &s, std::vector<std::string> &clist)¶
Make all of the XML replacements in string
s
based on the command listclist
.
-
void command_add(std::string new_type)¶
Add new commands for type
new_type
.
-
void color_replacements(std::string &s)¶
Perform the current color replacements on string
s
.This function replaces “[c]”, “[d]”, etc. with the user-specified color strings.
-
void update_o2_docs(size_t narr, o2scl::comm_option_s *options_arr, std::string new_type = "")¶
Update the command documentation from the o2scl data file.
This function iterates through all of the command line interface options and sets their documentation from the o2scl file.
This function is called in command_add() to update the documentation for a new type and in setup_options() to set up the initial documentation.
-
void command_del(std::string ltype)¶
Remove the type-specific commands.
Note
This needs to be public for the o2graph interface
-
inline int get_verbose()¶
Get the verbose parameter.
This function is used in o2scl_acol_mult_vectors_to_conts() .
-
virtual int run(int argv, char *argc[], bool full_process = true)¶
Main run function.
Process command-line options using cli object, interface with the operating system via getenv(), instantiate and call the acol_manager object.
-
inline void parse_vec_string(std::vector<std::string> &args)¶
Process and call the arguments specified in the string vector
args
.
-
virtual int setup_cli()¶
Create the cli object (with readline support if available)
-
virtual int setup_options()¶
Add the options to the cli object.
-
virtual int setup_help()¶
Add the help text to the cli object.
-
virtual int setup_parameters()¶
Add the parameters for ‘set’ to the cli object.
-
void clear_obj()¶
Clear memory associated with the current object and set type to “”.
Functions for the command-line interface
-
virtual int comm_add_vec(std::vector<std::string> &sv, bool itive_com)¶
Add a vector_specification.
For objects of type table:
Add column from a vector specification to the table.
Arguments:
<vec. spec.> <column>
Add the vector specification <vec. spec.> to the table and store in the column named <column>.
See
o2scl_hdf::vector_spec()
for help on vector specifications.
-
virtual int comm_autocorr(std::vector<std::string> &sv, bool itive_com)¶
Compute autocorrelation coefficients.
Arguments:
<options> ...
This command computes autocorrelation coefficients for the specified vector(s) and then estimates the associated autocorrelation length(s).
There are three algorithms: a brute force algorithm (the default specified with the string “def”), the algorithm from “acor”, and a method using FFTW (“fft”). The choice of algorithm can be specified in the options argument. Note that the FFT method produces a mirror image of the autocorrelations on the RHS. The autocorrelation computation from thesethree methods is relatively good, but the estimate of the autocorrelation length is only approximate.
If multiple vectors are given, then there are two options. Option “max” (the default) means that autocorrelation coefficients are computed separately for each vector and then the maximum autocorrelation length is specified at the end. Option “avg” means that the autocorrelation coefficients are averaged over all vectors and a single autocorrelation length for the averaged data is reported at the end.
Finally, the “store” option, if specified, means that the autocorrelation coefficients are stored afterwards in a
vec_vec_double
object (and the current object, if present, is cleared).Options can be combined with commas (but no spaces), for example “fft,max,store” or “def,avg”.
If there is no current object, then the user may specify one or more multiple vector specifications. If the current object is of type
int[]
,double[]
, orsize_t[]
, then the autocorrelation coefficients of the current vector are computed. If the current object is of typetable
, then the user may specify either columns of the table or a multiple vector specification as additional arguments.For example, using
o2graph
from o2sclpy:o2graph -create table x grid:0,4000,1 -function "exp(x/400)*sin(floor(x/10)/5)+rand" z -autocorr store z -plot 0 -show
See
o2scl_hdf::mult_vector_spec()
for help on multiple vector specifications.
-
virtual int comm_fft(std::vector<std::string> &sv, bool itive_com)¶
Perform a forward or reverse FFT.
For objects of type table:
Perform an FFT on a pair of columns
Arguments:
<real part in> <complex part in> <real part out> <complex part out> ["backward"]
Perform an FFT.
For objects of type table3d:
Perform an FFT on a pair of slices
Arguments:
<real part in> <complex part in> <real part out> <complex part out> ["backward"]
Perform an FFT.
-
virtual int comm_assign(std::vector<std::string> &sv, bool itive_com)¶
Assign a constant.
For objects of type table:
Assign a constant to the table, e.g.
-assign pi "acos(-1)"
.Arguments:
<name> val
Assign a constant value to a name for the present table. Valid constant values are things like
1.618
,acos(-1.0)
orsin(4^5)
. To remove an assignment, call assign with a blank value.
-
virtual int comm_average_rows(std::vector<std::string> &sv, bool itive_com)¶
Average rows together.
For objects of type table:
Average rows of some or all columns together.
Arguments:
<column or '*' for all> <window> [block averages]
The first argument is the column to be modified. If the first argument is ‘*’, then all columns are averaged. The second argument is the size of the window. By default, rolling averages are computed and the size of the column is unchanged. If the third argument evaluates to true and the first argument is ‘*’, then block averages instead of rolling averages are computed, and then the number of rows is divided by the window parameter.
-
virtual int comm_binary(std::vector<std::string> &sv, bool itive_com)¶
Binary function for tensors.
For objects of type tensor_grid:
Apply a binary function to two tensor_grid objects.
Arguments:
<file> <object name> <function>
Read a
tensor_grid
named <object name> from file <file> and use it along with the function <function> to modify the currenttensor_grid
object. The <function> parameter should be a mathematical function of the value in the current tensor (v), the value in the tensor named <object
name> (w), the indices (i0, i1, …) or the grid points (x0, x1, …).
-
virtual int comm_calc(std::vector<std::string> &sv, bool itive_com)¶
Compute the value of a constant expression.
Arguments:
<expr> ["1" or "true" for adaptive multiprecision]
This computes the value of the constant mathematical expression <expr>. Examples are
-calc acos(-1)
or-calc 2+1/sqrt(2.0e4)
. To see which operators and functions can be used, use ‘-helpfunctions
’.Results are given at the current value of
precision
. Values of precision up to 50 are allowed, and multiprecision (rather than double precision) arithmetic is used if necessary. For example, try-set precision 45 -calc "acos(-1)"
. When adaptive multiprecision is not used, the calculations are relatively fast, but small errors due to the finite precision may give incorrect results at the requested precision. If the second optional argument evaluates to true, the calc command uses multiprecision to attempt to ensure the result is exact to within the requested precision. However, this option also makes the calculation slower by at least a factor of two.Note that adaptive multiprecision is only available for OSX at the moment.
Constant values from the constant library (see e.g. ‘-help
constant
’) will automatically be used, so long as they have a unique value in MKS units. However, some constant values are currently only stored to double precision and will be arbitrarily promoted to higher-precision without warning. Unicode is also supported for constants, so try, e.g.-set precision 15 -calc π
.Note that the variable
precision
is used for the argument to thecout.precision()
function, so a precision of 10 is actually 11 significant figures. When adaptive multiprecision is enabled, the value is computed to within a relative tolerance of \( 10^{-\mathrm{precision}-1} \).
-
virtual int comm_cat(std::vector<std::string> &sv, bool itive_com)¶
Concatenate two objects.
For objects of type table:
Concatenate a second table object onto current table.
Arguments:
<file> [name]
This command adds the rows in second table to the end of the current table. If [name] is not provided, then the second table will be first object of type
table
in the the specified file. The resulting table will always have a number of rows equal to the sum of the rows in the original two tables. If the two tables have column names which are the same, then the data from these two columns will be concatenated even if the column ordering is different.Columns which are present in only one of the two tables will result in columns which have multiple zero entries in the new resulting table. In particular, if the second table has a column not present in the current table, then a new column in the current table is created and initialized to zero before the concatenation. If the second table does not have a column present in the current table, then the additional rows in that column will be set to zero.
For example:
-create table x grid:0,5,1 -function "sin(x)" y -internal temp.o2 -create table x grid:0,3,1 -function "cos(x)" z -cat temp.o2 -output
For objects of type table3d:
Concatenate data from a second table3d onto current table3d.
Arguments:
<file> [name]
The
cat
command adds all slices from the firsttable3d
object in the specified file which are not already present in the currenttable3d
object. The x and y grids in the current table3d object are unmodified. If the x and y grids in the two tables are the same, then the values are simply copied over. If the grids are different, then the x and y grids are interpolated into the new table3d object (using it’s associated interpolation type) to fill the new slice in the current table3d object.
-
virtual int comm_clear(std::vector<std::string> &sv, bool itive_com)¶
Clear the current object.
Arguments: (No arguments.)
Deallocate the memory associated with the current object. This command does not clear the object name stored in
obj_name
.
-
virtual int comm_commands(std::vector<std::string> &sv, bool itive_com)¶
List commands, with an optional type argument.
Arguments:
[type]
If no argument is specified, list all valid commands for the current type (including those commands which do not require a current object). If a type argument is given, then list all valid commands for the specified type.
-
virtual int comm_constant(std::vector<std::string> &sv, bool itive_com)¶
Get or modify a physical or numerical constant.
Arguments:
<name, pattern, "add", "del", "list", or "list-full"> [unit] or [value unit flag source m kg s K A mol cd]
If the constant has no units, like the Euler-Mascheroni constant, then e.g.
-constant euler
will report the value 5.772157e-1 (at the default precision which is 6). If the user requests aprecision
larger than 15 (double precision), then theconstant
command fails and prints an error message.If the constant has units but no units are specified as arguments to the
constant
command, then all values of the constant in the library are written to the screen. If a unit is specified, then theconstant
command tries to find the unique value with the specified unit. The user can specify,mks
,cgs
, or the exact unit string of the constant. For example,-constant hbar cgs
and-constant hbar g*cm^2/s
both work and return the same value.Note that some constants in the library are not known to full double precision and
acol
currently has no way of reporting this.Search patterns are also allowed, for example
-constant "satur*"
returns all the constants related to Saturn in both MKS and CGS units. Ifuse_regex
is set to true, then regex is used to do the pattern matching, and otherwisefnmatch()
is used. Unicode is allowed, but pattern matching and Unicode do not work well together.To list all the constants in the library, use
-constant list
. Alternatively,-constant list-full
gives all information for all constants, including all aliases, the source, and all the decompositions into base units.One can delete a constant with, e.g.
-constant del pi
(this doesn’t quite work yet for constants with different values in different unit systems), but this deletion only lasts for the current invocation of the acol command.To add a constant, one must specify the name of the constant, the value, the unit system, the unit flag, the source, and then the 7 powers of the SI base units (in order m,kg,s,K,A,mol,cd).
-
virtual int comm_contours(std::vector<std::string> &sv, bool itive_com)¶
Compute contour lines.
For objects of type table3d:
Create contour lines from a table3d slice.
Arguments:
<val> <slice_name> ["output file" "object name"]
The
contours
command constructs a set of contour lines using the data in slice named <slice> at the fixed value given in <val>. If no additional arguments are given, then thetable3d
object is deleted from memory and the contour lines which were computed become the new current object of typevector<contour_line>
. If two additional arguments are given, then the contour lines are stored in the file named [output file] and the object is named object_name and the currenttable3d
object is retained. If the file does not exist, it is created. If no contours are found, then a message is output to the screen, no file I/O is performed, and the currenttable3d
object is unmodified.Countours are computed by the o2scl::contours class, by piecing together line segments across grid lines. The best way to obtain more accurate contours is to compute them using data with a smaller grid spacing. The
refine
command can be used to refine the data using a simple interpolation scheme, but the accuracy of the contours is then limited by the accuracy of the interpolation.For objects of type hist_2d:
Create contour lines from a table3d slice.
Arguments:
["frac" or "frac2"] <val> ["output file" "output name"]
If the optional arguments “frac” or “frac2” are not present, the
contours
command constructs a set of contour lines using at the fixed value given in <val>. If no additional arguments are given, then thehist_2d
object is deleted from memory and the contour lines which were computed become the new current object of typevector<contour_line>
If two additional arguments are given, then the contour lines are stored in the file named [output file], the object is named [object name], and the currenthist_2d
object retained. If the file does not exist, it is created. If no contours are found, then a message is output to the screen, no file I/O is performed, and the current hist_2d object is unmodified.If the argument “frac” is present, then the operation of the
contours
command is the same except that <val> is interpreted as a fraction of the total integral under the data. The integral is computed as the sum of (w-min) Δx Δy . where “min” is the minimum weight over all bins. This definition ensures that the contours exist for all values between 0 and 1.If the argument “frac2” is present, then the <val> is interpreted as a fraction of the total integral, but the integral is computed as the sum of w Δx Δy and thus there are no guarantees that the requested contours exist.
Countours are computed by the o2scl::contours class, by piecing together line segments across grid lines. The best way to obtain more accurate contours is to compute them using data with a smaller grid spacing. The
refine
command can be used to refine the data using a simple interpolation scheme, but the accuracy of the contours is then limited by the accuracy of the interpolation.
-
virtual int comm_convert(std::vector<std::string> &sv, bool itive_com)¶
Manipulate or use a unit conversion factor.
Arguments:
<old unit (or "list", "add", "del", or "nat")> <new unit> [value to convert]
The
convert
command handles unit conversions. To compute a unit conversion factor and then optionally apply than conversion factor to a user-specified value. use the form-convert <old unit> <new unit> [value]
. Conversions which presume ħ=c=kB=1 are allowed by default. For example,-convert MeV 1/fm
returns1.000000e+00 MeV = 5.067731e-03 1/fm
. The conversion factor is output at the current value ofprecision
, but is always internally stored with full double precision.If no value to convert is specified, then a value of 1.0 is assumed.
Conversions are cached, so that if the user requests an identical conversion with a different numerical value, then obtaining the conversion from the cache is faster than looking it up and processing it each time.
The
convert
command attempts to handle arbitrary combinations of powers of SI base units to automatically compute new unit conversion. For example,-convert "fm^10/g^30" "m^10/kg^30"
reports1.000000e+00 fm^10/g^30 = 1.000000e-60 m^10/kg^30
.Unit conversions containing constants stored in the
constant
library are also allowed. For example,-convert "Msun^2" "g^2"
gives1.000000e+00 Msun^2 = 3.953774e+66 g^2
. SI units are also understood, and both μ and “mu” are interpreted as the “micro” prefix. For example,-convert "μm" "pc"
or-convert "mum" "pc"
both report the conversion between micrometers and parsecs.To print the list of known units, SI prefixes, and the unit conversion cache, use
acol -convert list
.To add a unit (only MKS is supported) the format is:
-convert add <unit> <power of meters> <power of kg> <power of seconds> <power of Kelvin> <power of amps> <power of moles> <power of candelas> <val> <long name>
To delete a unit, the format is:
-convert del <unit>
However, note that deleting a unit does not delete its occurrences in the unit conversion cache.
While ħ=c=kB=1 is assumed by default, the user can disable conversions taking advantage of these assignments. To modify the use of natural units, use e.g.
-convert nat 0 1 0
. The second argument is 1 for c=1 and 0 otherwise, the third argument is 1 for ħ=1 and 0 otherwise, and finally the fourth argument is 1 for kB=1 and 0 otherwise.
-
virtual int comm_convert_unit(std::vector<std::string> &sv, bool itive_com)¶
Convert units.
For objects of type table:
Convert a column to a new unit.
Arguments:
<column> <new unit>
Convert the units of column <column> to <new unit>, multipliying all entries in that column by the appropriate factor. See
acol -convert list
for a list of units and prefixes which can be automatically converted.
-
virtual int comm_correl(std::vector<std::string> &sv, bool itive_com)¶
Compute correlation coefficients.
For objects of type table:
Compute the correlation coefficient between two columns.
Arguments:
[column 1, column 2]
Compute the correlation coefficient between two columns, or, if no arguments are given, then compute the correlation coefficients between all pairs of columns. Results are output to the screen.
-
virtual int comm_create(std::vector<std::string> &sv, bool itive_com)¶
Create an object.
Arguments:
<type> [...]
Create a new object of type <type>. If an object is currently in memory, it is deallocated before creating the new object.
create <type> <val>
: For typeschar
,int
,size_t
, andstring
, create an object and give it the initial value specified.create double <value spec.>
: Create adouble
object and set it equal to the value specified by <value spec.>.create <type> <size> <function of "i">
: For array typesint[]
andsize_t[]
, the user must specify the size of the array and a function of the array indexi
to fill the array.create double[] [<size> <function of "i">] or [vector spec.]
: Fordouble[]
the user must either give a vector specification, or specify the size of the array and a function of the array indexi
.create table <name> <vector spec.>
: Create a newtable
object with one column named <name> from a vector specification.create table-mv <mult. string spec.> <mult. vector spec.>
: Create a newtable
object with several columns with names taken from the multiple string specification and data taken from the multiple vector specification.create tensor <rank> <size 0> <size 1> ...
: Create atensor
object with the specified rank and sizes. All tensor entries are initialized to zero.create tensor_grid <rank> <size 0> <size 1> ...
: Create atensor_grid
object with the specified rank and sizes. The tensor grid is initialized to count each index (beginning with zero) and the entries of the tensor are initialized to zero. The grid can be specified afterwards usingset-grid
.create table3d <x name> <x vector spec.> <y name> <y vector spec.> <slice name> <slice func.>
: Create a newtable3d
object which has one slice. The x and y grids are given as vector specifications (see “acol -help
vector-spec” for the syntax). The slice function can be written in terms of the x- and y-grid values which are referred to by name.
For example, using
o2graph
from o2sclpy:o2graph -create table3d x func:100:i/200 y func:100:i/200 z "sin(1/(x+0.01))* sin(1/(y+0.01))" -den-plot z -xtitle x -ytitle y -show
create vec_vec_double <mult. vector spec.> [mult. vector spec. 2] ...
: Create avec_vec_double
object using the given multiple vector specification(s).See
o2scl_hdf::value_spec()
for help on value specifications,o2scl_hdf::functions()
for help on function specifications, ando2scl_hdf::mult_vector_spec()
for help on multiple vector specifications.
-
virtual int comm_delete_col(std::vector<std::string> &sv, bool itive_com)¶
Delete a column.
For objects of type table:
Delete a table column.
Arguments:
<name>
Delete the entire column named <name>.
-
virtual int comm_delete_rows(std::vector<std::string> &sv, bool itive_com)¶
Delete rows.
For objects of type table:
Delete rows selected by a function.
Arguments:
<function>
Delete the set of rows for which a function evaluates to a number greater than 0.5. For example,
-delete-rows if(col1+col2>10,1,0)
will delete all columns where the sum of the entries in col1 and col2 is larger than 10. See also theselect-rows
command.See
o2scl_hdf::functions()
for help on function specifications.
-
virtual int comm_delete_rows_tol(std::vector<std::string> &sv, bool itive_com)¶
Delete rows which match to within a specified tolerance.
For objects of type table:
Delete rows which match to within a specified tolerance
Arguments:
[relative tol.] [absolute tol.]
for every column, the entries in the two rows do not match if either of their absolute values are greater the absolute tolerance and their relative deviation is greater than the relative tolerance. if all columns match, then the rows match.
The
delete-rows-tol
command deletes all rows which match a row earlier in the table. if verbose is larger than zero then information about how many rows were deleted is provided.
-
virtual int comm_deriv(std::vector<std::string> &sv, bool itive_com)¶
Compute a derivative.
For objects of type table:
Derivative of a function defined by two columns.
Arguments:
<x> <y> <name>
Create a new column named <name> filled with the derivative of the function \( y(x) \) obtained from columns <x> and <y>.
For objects of type tensor:
Compute the derivative of the tensor object w.r.t. an index
Arguments:
<index>
The
deriv
command differentiates the tensor object with respect to one of the indices, replacing all of the entries in the tensor with the derivative.For objects of type tensor_grid:
Compute the derivative of the tensor object w.r.t. an index
Arguments:
<index>
The
deriv
command differentiates the tensor object with respect to one of the indices, replacing all of the entries in the tensor with the derivative.For objects of type double[]:
Replace the array with its derivative.
Arguments: (No arguments.)
Replace the array with its derivative using the current interpolation type.
For objects of type int[]:
Replace the array with its derivative.
Arguments: (No arguments.)
Replace the array with its derivative using the current interpolation type, converting it to a double[].
For objects of type size_t[]:
Replace the array with its derivative.
Arguments: (No arguments.)
Replace the array with its derivative using the current interpolation type, converting it to a double[].
-
virtual int comm_deriv_x(std::vector<std::string> &sv, bool itive_com)¶
Create a slice which is the derivative wrt x of another.
For objects of type table3d:
Derivative with respect to x.
Arguments:
<f> <dfdx>
Create a new slice named <dfdx> filled with the derivative of the function from the x grid and slice named <f>.
-
virtual int comm_deriv_y(std::vector<std::string> &sv, bool itive_com)¶
Create a slice which is the derivative wrt y of another.
For objects of type table3d:
Derivative with respect to y.
Arguments:
<f> <dfdy>
Create a new slice named <dfdy> filled with the derivative of the function from the y grid and slice named <f>.
-
virtual int comm_deriv2(std::vector<std::string> &sv, bool itive_com)¶
Compute a second derivative.
For objects of type table:
Second derivative of a function defined by two columns.
Arguments:
<x> <y> <name>
Create a new column named <name> filled with the second derivative of the function y(x) obtained from columns <x> and <y>.
-
virtual int comm_diag(std::vector<std::string> &sv, bool itive_com)¶
Get entries along the main diagonal.
For objects of type tensor:
Get diagonal elements.
Arguments: (No arguments.)
Extract only the elements on the main diagonal to create a
double[]
object.
-
virtual int comm_docs(std::vector<std::string> &sv, bool itive_com)¶
Open local HTML docs for O₂scl documentation.
Arguments:
[section, class, or function]
If [topic] is unspecified, this command opens up the local HTML documentation for O₂scl in the default web browser using ‘open’ on OSX and ‘xdg-open’ on other systems. If a topic is specified, then the
docs
command looks for the O₂scl local HTML documentation for the specified section, class, or function. If the documentation is found, then that web page is opened instead.The operation of the
docs
command depends on the assumption that the HTML documentation files have not been moved after the installation process. In order to open the remote version of the documentation instead of the local copy, use thewdocs
command instead.Note also that, e.g. the default installation of Firefox on Ubuntu is via snap, and thus Firefox does not have permission to read files in /usr by default. One way of fixing this is install firefox separately from snap.
-
virtual int comm_download(std::vector<std::string> &sv, bool itive_com)¶
Download a file from the specified URL.
Arguments:
<file> <URL> [hash, "file:"hash_filename, or "none"] [directory]
First, look for the file named <file> (in directory given [directory] if specified). If a hash is not specified and the file exists, then return success. If a hash is specified, then compare the file with the specified hash. If they match, then return success. If the file doesn’t exist or doesn’t match the specified hash, then use
curl
to download the file. Again compare with the hash if specified. If the download files or the file doesn’t match the hatch, then call the error handler.If the filename is “_”, then the file is extracted from the end of the URL.
This function exits immediately if it fails, preventing the user from reading a data file which is corrupted.
This function uses o2scl::cloud_file to handle the file acquisition.
-
virtual int comm_filelist(std::vector<std::string> &sv, bool itive_com)¶
List objects in a HDF5 file.
Arguments:
<file> [group]
This lists all the top-level datasets and groups in a HDF5 file and, for those groups which are in the O₂scl format, gives the type and name of the object stored in that HDF5 group.
If a group is specified, then all of the top-level datasets and groups inside that specified group are listed.
-
virtual int comm_find(std::vector<std::string> &sv, bool itive_com)¶
Find a value in an object.
For objects of type double[]:
Find a value in the array
Arguments:
Find the closest value to
in the array and print out the associated index.
For objects of type int[]:
Find a value in the array
Arguments:
Find the closest value to
in the array and print out the associated index.
For objects of type size_t[]:
Find a value in the array
Arguments:
Find the closest value to
in the array and print out the associated index.
-
virtual int comm_find_row(std::vector<std::string> &sv, bool itive_com)¶
Find a row.
For objects of type table:
Find a row which has a specified value or maximizes a function.
Arguments:
<func> or find-row <col> <val>
If one argument is given, then
find-row
finds the row which maximizes the value of the expression given in <func>, and then output the entire row. Otherwise,find-row
finds the row for which the value in column named <col> is as close as possible to the value <val>. See commandget-row
to get a row by its index.See
o2scl_hdf::functions()
for help on function specifications.
-
virtual int comm_fit(std::vector<std::string> &sv, bool itive_com)¶
Fit data to a function.
For objects of type table:
Fit two columns to a function (experimental).
Arguments:
<x> <y> <yerr> <ynew> <par names> <func> <vals>
Detailed desc.
-
virtual int comm_function(std::vector<std::string> &sv, bool itive_com)¶
Create a column from a function.
For objects of type table:
Create a column from a function
Arguments:
<func> <name>
Set the column named <name> to the result of a function, <func>, in terms of the other columns. If the column does not already exist, a new one is added to the table. For example, for a table containing columns named ‘c1’ and ‘c2’,
function c1-c2 c3
would create a new column c3 which contains the difference of columns ‘c1’ and ‘c2’.See
o2scl_hdf::functions()
for help on function specifications.For objects of type double[]:
Set the values of the array given a function.
Arguments:
<function>
Set the values of the array given a user-specified function of ‘i’. For example,
(sin(i)>1)*4
.See
o2scl_hdf::functions()
for help on function specifications.For objects of type int[]:
Set the values of the array given a function.
Arguments:
<function>
Set the values of the array given a user-specified function of ‘i’. For example,
(sin(i)>1)*4
.See
o2scl_hdf::functions()
for help on function specifications.For objects of type size_t[]:
Set the values of the array given a function.
Arguments:
<function>
Set the values of the array given a user-specified function of ‘i’. For example,
(sin(i)>1)*4
.See
o2scl_hdf::functions()
for help on function specifications.For objects of type hist:
Apply a function to the weights.
Arguments:
<function>
Apply a function to the weights.
See
o2scl_hdf::functions()
for help on function specifications.For objects of type table3d:
Create a new slice from a function.
Arguments:
<func> <name>
Set the slice named <name> to the result of a function, <func>, in terms of the other slices. If the slice does not already exist, a new one is created. For example, for a table3d containing slices named ‘s1’ and ‘s2’, ‘function s1-s2 s3’ would create a new column ‘s3’ which contains the difference of columns ‘s1’ and ‘s2’.
See
o2scl_hdf::functions()
for help on function specifications.For objects of type tensor:
Set the tensor values from a function.
Arguments:
[cond. function] <function of v, i0, i1, ...>
The
function
command sets all entries in a tensor equal to a user-specified mathematical function of the indices. When the conditional function evaluates to a number less than or equal to 0.5, then the tensor entry will be unchanged. (For more help with functions, type acol -help functions)See
o2scl_hdf::functions()
for help on function specifications.For objects of type tensor_grid:
Set the tensor values from a function.
Arguments:
[conditional func.] <func. of v, i0, i1, ... and x0, x1, ...>
The
function
command sets all the data entries in a tensor_grid equal to a user-specified mathematical function of the value in the tensor (v), the indices (i0, i1, …) or the grid points (x0, x1, …). If two function arguments are given and if the first function argument is not “none”, then the first function specifies which tensor entries are to be modified. When the conditional function evaluates to a number less than or equal to 0.5, then the tensor entry will be “
unchanged. (For more help with functions, type “acol -help functions.”.)
See
o2scl_hdf::functions()
for help on function specifications.
-
virtual int comm_generic(std::vector<std::string> &sv, bool itive_com)¶
Read an object from a generic text file.
Arguments:
<type> <file or "cin">
Read an object of type <type> from a text file named <file>, or from
std::cin
.For
int
,char
,double
, orsize_t
objects, the input is assumed to begin with the object and it is read usingoperator>>()
.For
int[]
,double[]
, orsize_t[]
objects, the input file is assumed to begin with the desired object and it is read using operator>>(). The array is presumed to end at the end of the file or the end of the input.To read a numeric array stored in a single line, use types
int[]-line
,double[]-line
, orsize_t[]-line
. The array is assumed to end when it reaches the end of the first line.If you want to read a column of numbers where the first number is the number of entries in the vector and subsequent numbers contain data (whitespace, including carriage returns is ignored), then use types
int[]-n
,double[]-n
, orsize_t[]-n
.For
string
orstring[]
objects, the strings are read usingstd::getline()
. The strings can contain whitespace, and they are presumed to end at the end of the line (i.e. at the carriage return).To read a list of strings stored in a single line, use type
string[]-line
. The strings cannot contain whitespace because the whitespace is presumed to separate individual strings. The array is assumed to end when it reaches the end of the first line.To read a list of strings where the first input is the number of strings, then use type
string[]-n
. The strings can contain whitespace, and they are presumed to end at the end of the line (i.e. at the carriage return).For
table
objects, the first line of the file must either contain numeric data or column names separated by white space, without carriage returns, except for the one at the end of the line. If the first line contains column names, the second line may optionally contain unit expressions for each column, enclosed by square brackets. All remaining lines are assumed to contain data with the same number of columns as the first line.For
table3d
objects, the data must be stored in columns with the first column specifying the x-axis grid point and the second column specifying the y-axis grid point. The remaining columns give the data for each slice at that point. Each grid point must correspond to a row in the file, but the lines need not be in any particular order. The columns may have one header line at top which specifies the names of the x- and y-grids and the names of each slice (in order).Objects of type
prob_dens_mdim_gaussians
andprob_dens_mdim_gmm
read a generic format which is defined in the O₂scl documentation for the read_generic() function for these classes.
-
virtual int comm_get_grid(std::vector<std::string> &sv, bool itive_com)¶
Get the grid.
For objects of type table3d:
Print out the table3d grid.
Arguments: (No arguments.)
Output the table3d grid as a series of columns.
For objects of type tensor_grid:
Get the tensor grid.
Arguments: (No arguments.)
Output the tensor grid as a series of columns.
-
virtual int comm_get_row(std::vector<std::string> &sv, bool itive_com)¶
Get a table row by index.
For objects of type table:
Get a table row by index.
Arguments:
<index>
Get a row by index. The first row has index 0, and the last row has index n-1, where n is the total number of rows (which can be determined by the
nlines
orlist
commands). Theindex
command creates a column of row indexes (which is called ‘N’ by default). To find a row which contains a particular value or maximizes a specified function, usefind-row
.
-
virtual int comm_get_unit(std::vector<std::string> &sv, bool itive_com)¶
Get units of a column.
For objects of type table:
Get the units for a specified column.
Arguments:
<column>
Obtains the units for the specified column.
-
virtual int comm_help(std::vector<std::string> &sv, bool itive_com)¶
Output help.
Arguments:
[command or parameter or type or topic]
If no argument is specified, this outputs all of the commands which are valid for the current type, and then some generic help for using acol. If a command is specified as the argument, then help for that command is printed. If a parameter which is modifiable by the
get
orset
commands is specified as the argument, then the help for that parameter is printed. If a type is specified as the argument, then a list of commands which operate on objects of that type is printed. Finally, if a help topic is specified as the argument, then that help information is printed.
-
virtual int comm_h5_copy(std::vector<std::string> &sv, bool itive_com)¶
Copy an O₂scl-generated HDF5 file.
Arguments:
<source> <destination>
Copy all O₂scl objects from one HDF5 file to another. This command may not work for HDF5 files generated outside of O₂scl. The source and destination filenames may not be identical. The destination file may not be the same size as the source, but will contain the same information.
-
virtual int comm_index(std::vector<std::string> &sv, bool itive_com)¶
Add a column for line numbers.
For objects of type table:
Add a column containing the row numbers.
Arguments:
[column name]
Define a new column named [column name] and fill the column with the row indexes, beginning with zero. If no argument is given, the new column is named ‘N’. If a column named ‘N’ is already present, then
index
adds underscores (up to a maximum of 10) in an attempt to create a new unique column name.
-
virtual int comm_insert(std::vector<std::string> &sv, bool itive_com)¶
Insert a column from an external table using interpolation.
For objects of type table:
Interpolate a column from another file.
Arguments:
<file> <oldy> <newx> [newy]
Insert a column from file <fname>, interpolating it into the current table. The column <oldy> is the column in the file which is to be inserted into the table, using the column <oldx> in the file and <newx> in the table. The new column in the table is named <oldy>, or it is named [newy] if the additional argument is given. Note that extrapolation is allowed, and the operation of the
insert
command is not well-defined if some of the column entries are not finite.For objects of type table3d:
Interpolate a slice from another file.
Arguments:
<file> [new]
Insert a slice from file <fname>, interpolating it into the current table. The slice <old> is the slice in the file which is to be inserted into the
table3d
object, using the slice <old> in the file and <new> in the currenttable3d
object. The new slice in the table is named <old>, or [new] if the additional argument is given. Note that extrapolation is allowed, and the operation of theinsert
command is not well-defined if some of the slice entries are not finite.
-
virtual int comm_insert_full(std::vector<std::string> &sv, bool itive_com)¶
Insert an external table using interpolation.
For objects of type table:
Insert a table from another file.
Arguments:
<fname> [table name] [old_x new_x]
Insert all columns from file <fname> into the current table. The first table is used or the table object named table_name, if specified. If index columns [old_x] and [new_x] are not specified, then the insert requires both the current and the source table to have the same number of rows. If they are specified, then interpolation using those index columns is used. If columns in the new table are not present in the current table, then they are added automatically. If a column in the current table has the same name as one in the new table then it is rewritten with new data, with one exception. If a column in the new table has the same name as [old_x], then it is left unmodified.
-
virtual int comm_integ(std::vector<std::string> &sv, bool itive_com)¶
Create a column which is the integral of another.
For objects of type table:
Integrate a function specified by two columns.
Arguments:
<x> <y> <name>
Create a new column named <name> filled with the integral of the function y(x) obtained from columns <x> and <y>. The lower limit of the integral is the value of the column <x> in the first row and the upper limit of the integral for each specified row is the value of the column <x> at that row.
-
virtual int comm_interactive(std::vector<std::string> &sv, bool itive_com)¶
Toggle interactive mode.
Arguments: (No arguments.)
If given as a command-line parameter, the
interactive
command toggles the execution of the interactive mode after the command-line parameters are processed. If zero arguments are given toacol
on the command-line then the interactive interface is automatically turned on.
-
virtual int comm_internal(std::vector<std::string> &sv, bool itive_com)¶
Output current object in the internal HDF5 format.
Arguments:
<file>
Output the current object to the specified file in the internal HDF5 format. If there is an object of the same name in the HDF5 file of the same type, then that object is overwritten. If there is an object of the same name in the HDF5 file with a different time, then the file write will fail and
acol
will exit.
-
virtual int comm_interp(std::vector<std::string> &sv, bool itive_com)¶
Perform an interpolation using the current object.
For objects of type table:
Interpolate a number into a column.
Arguments:
<x name> <x value> <y name>
Interpolate <x value> from column named <x name> into column named <y name> using the current interpolation type as specified in
interp_type
.For objects of type double[]:
Interpolate an index into the array using the current interpolation type as specified in
interp_type
.Arguments:
<x value>
Interpolate <x value> in the array using the current interpolation type as specified in
interp_type
.For objects of type int[]:
Interpolate an index into the array using the current interpolation type as specified in
interp_type
.Arguments:
<x value>
Interpolate <x value> in the array using the current interpolation type as specified in
interp_type
and print out the result as a double.For objects of type size_t[]:
Interpolate an index into the array
Arguments:
<x value>
Interpolate <x value> in the array using the current interpolation type as specified in
interp_type
and print out the result as a double.For objects of type table3d:
Interpolate x and y values into a slice.
Arguments:
<z name> <x value> <y value>
Interpolate (<x value>,<y value>) into the slice named <z
name> using the current interpolation type as specified in
interp_type
.For objects of type tensor_grid:
Linearly interpolate in the grid.
Arguments:
<value 1> <value 2> <value 3> ...
When the current object is a
tensor_grid
object, theinterp
uses linear interpolation (independent of the value ofinterp_type
) to interpolate an array with size equal to the tensor rank into the tensor grid and outputs the result.
-
virtual int comm_interp_table3d(std::vector<std::string> &sv, bool itive_com)¶
Interpolate into a table3d object.
For objects of type table:
Interpolate the values to create a table3d object
Arguments:
<method> <options> <x column> <y column> <x grid or "auto"> <y grid or "auto"> <z column 1> <z column 2> ...
-
virtual int comm_list(std::vector<std::string> &sv, bool itive_com)¶
List properties of an object.
For objects of type table:
List the constants, column names and other info.
Arguments: (No arguments.)
List the constants, column names and other info.
For objects of type table3d:
List the slice names and print out grid info.
Arguments: (No arguments.)
List the slice names and print out grid info.
For objects of type hist:
List the …
Arguments: (No arguments.)
List the …
For objects of type tensor:
List the tensor rank and index sizes.
Arguments: (No arguments.)
List the tensor rank and index sizes.
For objects of type vector<contour_line>:
List the contour line levels and sizes.
Arguments: (No arguments.)
List the contour line levels and sizes.
For objects of type vector<vector<double>>:
List the number of entries and their respective sizes.
Arguments: (No arguments.)
List the number of entries and their respective sizes.
For objects of type vector<vector<string>>:
List the number of entries and their respective sizes.
Arguments: (No arguments.)
List the number of entries and their respective sizes.
For objects of type tensor<int>:
List the tensor rank and index sizes.
Arguments: (No arguments.)
List the tensor rank and index sizes.
For objects of type tensor<size_t>:
List the tensor rank and index sizes.
Arguments: (No arguments.)
List the tensor rank and index sizes.
For objects of type tensor_grid:
List the tensor rank and index sizes.
Arguments: (No arguments.)
List the tensor rank and index sizes.
For objects of type hist_2d:
List the bin edges.
Arguments: (No arguments.)
For objects of type hist_2d:
List the bin edges.
-
virtual int comm_max(std::vector<std::string> &sv, bool itive_com)¶
Compute the maximum value of a column.
For objects of type table:
Compute the maximum value of a column.
Arguments:
<column name>
Compute the maximum value of a column.
For objects of type double[]:
Compute the maximum value and the associated index.
Arguments: (No arguments.)
Compute the maximum value and the associated index.
For objects of type int[]:
Compute the maximum value and the associated index.
(No arguments.)
Compute the maximum value and the associated index.
For objects of type size_t[]:
Compute the maximum value and the associated index.
(No arguments.)
Compute the maximum value and the associated index.
For objects of type table3d:
Compute the maximum value of a slice.
Arguments:
<slice name>
Compute the maximum value of <slice name>.
For objects of type tensor:
Compute the maximum value and the associated index.
(No arguments.)
Compute the maximum value and the associated index.
For objects of type tensor<int>:
Compute the maximum value and the associated index.
(No arguments.)
Compute the maximum value and the associated index.
For objects of type tensor<size_t>:
Compute the maximum value and the associated index.
(No arguments.)
Compute the maximum value and the associated index.
For objects of type tensor_grid:
Compute the maximum value and the associated index and grid point.
(No arguments.)
Compute the maximum value and the associated index and grid point.
For objects of type hist_2d:
Find the maximum weight.
(No arguments.)
Find the maximum weight and print out the location.
-
virtual int comm_min(std::vector<std::string> &sv, bool itive_com)¶
Compute the minimum value of a column.
For objects of type table:
Compute the minimum value of a column.
Arguments:
<column name>
Compute the minimum value of a column.
For objects of type double[]:
Compute the maximum value and the associated index.
(No arguments.)
Compute the maximum value and the associated index.
For objects of type int[]:
Compute the maximum value and the associated index.
(No arguments.)
Compute the maximum value and the associated index.
For objects of type size_t[]:
Compute the maximum value and the associated index.
(No arguments.)
Compute the maximum value and the associated index.
For objects of type table3d:
Compute the minimum value of a slice.
Arguments:
<slice name>
Compute the minimum value of a slice.
For objects of type tensor:
Compute the minimum value and the associated index.
(No arguments.)
Compute the minimum value and the associated index.
For objects of type tensor<int>:
Compute the minimum value and the associated index.
(No arguments.)
Compute the minimum value and the associated index.
For objects of type tensor<size_t>:
Compute the minimum value and the associated index.
(No arguments.)
Compute the minimum value and the associated index.
For objects of type tensor_grid:
Compute the minimum value and the associated index and grid point.
(No arguments.)
Compute the minimum value and the associated index and grid point.
For objects of type hist_2d:
Find the minimum weight.
(No arguments.)
Find the minimum weight and print out the location.
-
virtual int comm_ninteg(std::vector<std::string> &sv, bool itive_com)¶
Numerically integrate a user-specified function.
Arguments:
<function> <variable> <lower limit> <upper limit> [multip=false,method=kb]
This command numerically integrates <function> with respect to <variable> from <lower limit> to <upper limit>.
The fifth argument is a set of keyword arguments. If multip is set to either
"1"
or"true"
, then multiprecision is used to attempt to ensure the result is accurate to within the requested precision (multiprecision only works on OSX right now possibly because the Ubuntu release of boost is still behind).There are three methods, kb (Kronrod from boost), deb (double exponential from boost) or ac (adaptive integration based on CERNLIB).
Infinite upper or lower limits are supported (for all three methods), use “-infty” or “infty”, respectively.
Note that the variable
precision
is used for the argument to thecout.precision()
function, so precision of 10 is actually 11 significant figures. Thus in multiprecision mode, the integral is computed to within a relative tolerance of \( 10^{-11} \).Here is an example demonstrating a dilogarithm ladder. First, the exact result, computed using the
calc
command.acol -set verbose 2 -set precision 30 -calc "pi^2/10-(log((sqrt(5)-1)/2)^2)" 1
Result (cpp_dec_float_35): 7.553956195317414693865200287561e-01
In this example, the
calc
command begins by obtaining the value of π to 35 digits. It then starts with 35-digit precision and then compares that result to that obtained with 50-digit precision and finds that those two are equal to within the requested precision. Now, using theninteg
command to achieve the same result:acol -set verbose 2 -set precision 30 -ninteg "(-log(1-t)/t)" t 0 "(sqrt(5)-1)/2" multip=true
Result (cpp_dec_float_35): 7.553956195317414693865200287561e-01
The
ninteg
command computes this same value using numerical integration (and obtains the same result), using 42-digit precision internally to evaluate the integrand.
-
virtual int comm_nlines(std::vector<std::string> &sv, bool itive_com)¶
Add ‘nlines’ as a constant to a o2scl::table object.
For objects of type table:
Add ‘nlines’ as a constant to a
table
object.Arguments: (No arguments.)
Add a constant called ‘nlines’ to the table and set it equal to the number of lines (rows) in the table. The number of lines is also output to the screen.
-
virtual int comm_output(std::vector<std::string> &sv, bool itive_com)¶
Output the current object to screen or text file.
Arguments:
[file]
Output the object to the screen, or if the [file] argument is specified, to a file. This is (supposed to be) the same format as can be read using the
generic
command (independent of whether or not the pretty flag is true or false).
-
virtual int comm_read(std::vector<std::string> &sv, bool itive_com)¶
Read an object from an O₂scl-style HDF5 file.
Arguments:
<file> [object name]
Read an HDF5 file with the specified filename. If the [object name] argument is specified, then read the object with the specified name. Otherwise, look for the first
table
object, and if not found, look for the firsttable3d
object, and so on, attempting to find a readable O₂scl object.
-
virtual int comm_rearrange(std::vector<std::string> &sv, bool itive_com)¶
Rearrange a tensor.
For objects of type tensor:
Rearrange the tensor
Arguments:
<index spec. 1> [index spec. 2] ...
Index specifications are: index(ix), fixed(ix), sum(ix), trace(ix1,ix2), reverse(ix), and range(ix,start,end). Index specifications may be specified as separate arguments e.g. “index(1)” “fixed(2,10)” or multiple index specifications may be given in a single argument separated by spaces or commas, e.g. “index(1) fixed(2,10)” or “index(1),fixed(2,10)”.
See
o2scl_hdf::index_spec()
for help on index specifications.For objects of type tensor<int>:
Rearrange the tensor.
Arguments:
<index spec. 1> [index spec. 2] ...
Index specifications are: index(ix), fixed(ix), sum(ix), trace(ix1,ix2), reverse(ix), and range(ix,start,end). Index specifications may be specified as separate arguments e.g. “index(1)” “fixed(2,10)” or multiple index specifications may be given in a single argument separated by spaces or commas, e.g. “index(1) fixed(2,10)” or “index(1),fixed(2,10)”.
See
o2scl_hdf::index_spec()
for help on index specifications.For objects of type tensor<size_t>:
Rearrange the tensor.
Arguments:
<index spec. 1> [index spec. 2] ...
Index specifications are: index(ix), fixed(ix), sum(ix), trace(ix1,ix2), reverse(ix), and range(ix,start,end). Index specifications may be specified as separate arguments e.g. “index(1)” “fixed(2,10)” or multiple index specifications may be given in a single argument separated by spaces or commas, e.g. “index(1) fixed(2,10)” or “index(1),fixed(2,10)”.
See
o2scl_hdf::index_spec()
for help on index specifications.For objects of type tensor_grid:
Rearrange the tensor_grid object.
Arguments:
<index spec. 1> [index spec. 2] ...
Index specifications are: index(ix), fixed(ix), sum(ix), trace(ix1,ix2), reverse(ix), range(ix,start,end), interp(ix,value), grid(ix,begin,end,n_bins,log), and gridw(ix,begin,end,bin_width,log). Index specifications may be specified as separate arguments e.g. “index(1)” “fixed(2,10)” or multiple index specifications may be given in a single argument separated by spaces or commas, e.g. “index(1)
fixed(2,10)” or “index(1),fixed(2,10)”.
See
o2scl_hdf::index_spec()
for help on index specifications.
-
virtual int comm_refine(std::vector<std::string> &sv, bool itive_com)¶
Refine an object.
For objects of type table:
Refine the table.
Arguments:
<index column> <factor>
Refine the data by interpolating a fixed number of rows in between every row of the original table. The type of interpolation is determined by the value of
interp_type
. If the initial number of rows is N, then the final number of rows is 1+(N-1)*<factor>.For objects of type table3d:
Refine the table3d.
Arguments:
<factor> [log mode]
Refine the data by interpolating. The type of interpolation is determined by the value of
interp_type
. If the initial number of rows is N, then the final number of rows is 1+(N-1)*<factor>. If [log mode] is unspecified or “auto”, then O₂scl attempts to automatically determine if the x or y grids are more linear or logarithmic. Other options for [log mode] include “none” (for linear refinement), “x” (logarithmic in x and linear in y), “y”, or “xy”.For objects of type hist_2d:
Refine the hist_2d.
Arguments:
<factor> [log mode]
Refine the data by interpolating. The type of interpolation is determined by the value of
interp_type
. If the initial number of rows is N, then the final number of rows is 1+(N-1)*<factor>. If [log mode] is unspecified or “auto”, then O₂scl attempts to automatically determine if the x or y grids are more linear or logarithmic. Other options for [log mode] include “none” (for linear refinement), “x” (logarithmic in x and linear in y), “y”, or “xy”.
-
virtual int comm_rename(std::vector<std::string> &sv, bool itive_com)¶
Rename a part of an object.
For objects of type table:
Rename a column.
Arguments:
<old> <new>
Rename a column from <old> to <new>. Note that to rename the entire object, you should use
-set obj_name new_name
.This function currently works by creating a new column, copying the data into the new column, and then deleting the old column. This means that renaming a column effectively moves that column to the last column in the table. This may be fixed in future versions.
For objects of type table3d:
Rename a slice.
Arguments:
<old> <new>
Rename a slice from <old> to <new>. Note that to rename the entire object, you should use
-set obj_name new_name
.
-
virtual int comm_resize(std::vector<std::string> &sv, bool itive_com)¶
Resize an object.
For objects of type double[]:
Resize the vector.
Arguments:
<new size>
Resize the vector. If the new size is larger than the old size, then the old entries are retained and the new entries are set to zero. If the old size is larger, then the first new size entries are left unchanged.
For objects of type int[]:
Resize the vector.
Arguments:
<new size>
Resize the vector. If the new size is larger than the old size, then the old entries are retained and the new entries are set to zero. If the old size is larger, then the first new size entries are left unchanged.
For objects of type size_t[]:
Resize the vector.
Arguments:
<new size>
Resize the vector. If the new size is larger than the old size, then the old entries are retained and the new entries are set to zero. If the old size is larger, then the first new size entries are left unchanged.
For objects of type string[]:
Resize the vector.
Arguments:
<new size>
Resize the vector. If the new size is larger than the old size, then the old entries are retained and the new entries are set to zero. If the old size is larger, then the first new size entries are left unchanged.
-
virtual int comm_preview(std::vector<std::string> &sv, bool itive_com)¶
Preview the current object.
Arguments:
[number of lines] [number of columns]
Print out all or part of the current object in format suitable for the screen.
-
virtual int comm_sample(std::vector<std::string> &sv, bool itive_com)¶
Sample a distribution.
For objects of type prob_dens_mdim_gaussian:
Arguments: <number of samples>
Sample the distribution to create a
table
object.For objects of type prob_dens_mdim_gmm:
Arguments: <number of samples>
Sample the Gaussian mixture to create a
table
object.For objects of type prob_dens_mdim_amr:
Arguments: <number of samples>
Sample the distribution to create a
table
object.
-
virtual int comm_select(std::vector<std::string> &sv, bool itive_com)¶
Select part of an object.
For objects of type table:
Select columns for a new table.
Arguments:
<column, pattern, or function 1> [column, pattern, or function 2] ...
The
select
command creates a new table from the present table, including some or all of the columns based on the arguments. Each argument can be a column, a pattern, or a assignment and a new function, If the argument is a column, the specified column is added to the new table. If the argument begins with a colon ‘:’, then the remainder of the string is interpreted as a pattern. All columns which match the pattern are added to the new table. If a column in the old table is specified multiple times in the arguments, then it is only included in the new table once. Finally, if the argument contains an equals sign, ‘=’, then the string to the left of ‘=’ is interpreted as a new column name and the string to the right of the column is interpreted as a function (built from the columns in the old table).Depending on the value of
use_regex
, patterns are built upon the rules of fnmatch() or regex. For fnmatch(), ‘*’ represents multiple and ‘?’ represents a single character.For example, given a table with columns ‘c1dab c2dxy c13d c13def’ the command
-select c1dab :c?d* d2=c13d+c13def
creates a new table with columns ‘c1dab c2dxy d2’ where the third column in the new table is given by the sum of the third and fourth columns in the old table.For objects of type table3d:
Select columns for a new table3d object.
Arguments:
<slice, pattern, or function 1> [slice, pattern, or function 2] ...
The
select
command creates a newtable3d
object from the presenttable3d
object, including some or all of the slices based on the arguments. Each argument can be a slice, a pattern, or a assignment and a new function, If the argument is a slice, the specified slice is added to the newtable3d
object. If the argument begins with a colon ‘:’, then the remainder of the string is interpreted as a pattern. All slices which match the pattern are added to the newtable3d
object. If a slice in the oldtable3d
object is specified multiple times in the arguments, then it is only included in the newtable3d
object once. Finally, if the argument contains an equals sign, ‘=’, then the string to the left of ‘=’ is interpreted as a new slice name and the string to the right of the slice is interpreted as a function (built from the slices in the oldtable3d
object).Depending on the value of
use_regex
, patterns are built upon the rules of fnmatch() or regex. For fnmatch(), ‘*’ represents multiple and ‘?’ represents a single character.For example, given a
table3d
object with slices ‘c1dab c2dxy c13d c13def’ the command-select c1dab :c?d* d2=c13d+c13def
creates a newtable3d
object with slices ‘c1dab c2dxy d2’ where the third slice in the newtable3d
object is given by the sum of the third and fourth slices in the oldtable3d
object.
-
virtual int comm_select_rows(std::vector<std::string> &sv, bool itive_com)¶
Select rows from an object.
For objects of type table:
Select rows from the table
Arguments:
<row specification>
Select the rows from a table for which the function (based on columns in the current
table
) in <row_spec> evaluates to a number greater than 0.5.See
o2scl_hdf::functions()
for help on function specifications.
-
virtual int comm_ser_hist_t3d(std::vector<std::string> &sv, bool itive_com)¶
Convert a series of histograms to a table3d object.
For objects of type table:
Store a histogram series in a table3d object.
Arguments:
<grid vector spec.> <direction: "x" or "y"> <grid name> <bin spec.> <bin name> <pattern> <new slice>
Construct a series of histograms from a series of columns in a
table
object and then store them in atable3d
object. Theser-hist-t3d
command begins by creating a set of histograms, one for each entry of the grid specified in <grid vector spec.>. This grid is used as either the x or the y-grid in the new table3d object, depending on which is given for the <direction> argument.The bin edges for the histogram are specified in a “bin
specification”, <bin spec.>, which consists of two arguments. The first argument is the bin edges for the histograms, the second is the grid values of the table3d object. The grid values in the table3d object can be computed automatically as the average of the bin edges if the word “auto” is given for the second argument of the bin specification. The linear_or_log() function is used to attempt to automatically determine logarithmic bin edges.
The data for the histograms is pulled from the columns specified in the search pattern <pattern>. There must be one column for each histogram, and thus each element in <grid vector spec.>. The <bin name> argument is used as the name of the bin grid in the table3d object. Finally, the <new slice> argument is the name of the new slice in the table3d object which stores the histogram data.
Finally, if the bin specification is the string “auto” and then a number of bins, then the bin edges and the associated grid are automatically computed by the minimum and maximum value over all the columns specified in <pattern>.
-
virtual int comm_set(std::vector<std::string> &sv, bool itive_com)¶
Post-processing for setting a value.
-
virtual int comm_set_data(std::vector<std::string> &sv, bool itive_com)¶
Set an individual data point at a specified row and column.
For objects of type table:
Set the entries of a column.
Arguments:
<row_spec> <col> <val_spec>
Set the value of rows specifed by the ‘row_spec’ function in column ‘col’ to the value given by the ‘val_spec’ function. Rows are chosen if row_spec evaluates to a number greater than 0.5.
For objects of type table3d:
Set the entries of a slice.
Arguments:
<x value> <y value> <z name> <val>
Set the value of the slice named ‘z name’ at the grid point closest to (<x value>,<y value>) to the value <val>.
-
virtual int comm_set_grid(std::vector<std::string> &sv, bool itive_com)¶
Set the grid for a o2scl::tensor_grid object.
For objects of type tensor_grid:
Set the tensor grid.
Arguments:
<index> <func. or vector spec>
The first argument for the
set-grid
command specifies the index for which grid to set. The second argument specifies the grid. If it contains a ‘:’, it is assumed to be a vector specification. Otherwise, the argument is assumed to be a function which specifies the grid value as a function of the variables ‘i’, ‘m’, and ‘x’. The value of ‘i’ ranges from 0 to m-1, where ‘m’ is the tensor size for each rank and the value of ‘x’ is equal to the previous grid value.See
o2scl_hdf::vector_spec()
for help on vector specifications ando2scl_hdf::functions()
for help on function specifications.For objects of type table3d:
Set either the x or y grid of the table3d object.
Arguments:
<index or 'x' or 'y'> <func. or vector spec>
The first argument for the
set-grid
command specifies the index or label for which grid to set. The second argument specifies the grid. If it contains a ‘:’, it is assumed to be a vector specification. Otherwise, the argument is assumed to be a function which specifies the grid value as a function of the variables ‘i’, ‘j’, ‘m’, ‘n’, ‘x’, and ‘y’. The value of ‘i’ ranges from 0 to ‘m’-1, where ‘m’ is the size of the x index. Similarly, the value lf ‘j’ ranges from 0 to ‘n’-1, where ‘n’ is the size of the y index. The variables ‘x’ and ‘y’ hold the x and y grid values.See
o2scl_hdf::vector_spec()
for help on vector specifications ando2scl_hdf::functions()
for help on function specifications.
-
virtual int comm_set_unit(std::vector<std::string> &sv, bool itive_com)¶
Set units of a column.
For objects of type table:
Set the units for a specified column.
Arguments:
<column> <unit>
Set the unit string of <column>. Any string is allowed, but only those based on the output of
acol -convert list
can be automatically converted.
-
virtual int comm_slack(std::vector<std::string> &sv, bool itive_com)¶
Send a slack message.
Arguments:
["#channel"] <strings-spec>
Send a message to slack, using the specified channel. If the channel is not specified, it is taken from the environment variable O2SCL_SLACK_CHANNEL. The ‘#’ sign should be included with the channel name. The Slack webhook URL is taken from the environment variable O2SCL_SLACK_URL and the username is taken from the environment variable O2SCL_SLACK_USERNAME. The message is constructed from the string list specification in <strings-spec> (see ‘acol -help strings-spec’ for more information).
-
virtual int comm_slice(std::vector<std::string> &sv, bool itive_com)¶
Extract a slice from a table3d object to generate a o2scl::table object.
For objects of type table3d:
Convert a slice to a table object.
Arguments:
<"x" or "y"> <val>
Extract a slice of a table3d object at fixed x or fixed y to create a new table object. This function uses interpolation with the current interpolation type to interpolate all of the slices in the table3d object to create a table with a column for each slice.
TODO: explain how this is different from the
to-table
command.For objects of type tensor_grid:
Slice to a smaller rank tensor_grid object.
Arguments:
<index 1> <value 1> <index 2> <value 2> ...
Detailed desc.
TODO: explain how this is different from to-table
-
virtual int comm_slice_hist(std::vector<std::string> &sv, bool itive_com)¶
Convert a slice to a histogram.
For objects of type table3d:
Construct a histogram from a slice.
Arguments:
<slice>
Detailed desc.
-
virtual int comm_sort(std::vector<std::string> &sv, bool itive_com)¶
Sort data.
For objects of type int[]:
Sort the vector.
(No arguments.)
Sort the vector (in-place).
For objects of type size_t[]:
Sort the vector.
(No arguments.)
Sort the vector (in-place).
For objects of type double[]:
Sort the vector.
(No arguments.)
Sort the vector (in-place).
For objects of type string[]:
Sort the vector.
(No arguments.)
Sort the vector (in-place).
For objects of type table:
Sort the entire table by one column.
Arguments:
<column> [unique]
Sorts the entire table by the column specified in <column>. If the word “unique” is specified as the second argument, then delete duplicate rows after sorting.
-
virtual int comm_stats(std::vector<std::string> &sv, bool itive_com)¶
Get object statistics.
For objects of type table:
Show column statistics.
Arguments:
<column>
Output the average, standard deviation, max and min of <column>.
For objects of type double[]:
Show vector statistics.
Arguments: (None.)
Output the average, standard deviation, max and min.
For objects of type table3d:
Show slice statistics.
Arguments:
<slice>
Output the average, standard deviation, max and min of <slice>.
For objects of type tensor:
Show tensor statistics.
Arguments: (None.)
The
stats
command outputs the number of entries, their mean, standard deviation, minimum and maximum. It also counts the number of infinite or NaN values.For objects of type tensor_grid:
Show tensor statistics.
Arguments: (None.)
The
stats
command outputs the number of entries, their mean, standard deviation, minimum and maximum. It also counts the number of infinite or NaN values.
-
virtual int comm_sum(std::vector<std::string> &sv, bool itive_com)¶
Compute the sum of two objects.
For objects of type table:
Add data from a second table object to current table.
Arguments:
<file> [name]
Add all columns from the second table to their corresponding columns in the current table, creating new columns if necessary.
For objects of type double[]:
Compute the vector sum.
(No arguments.)
Compute the vector sum.
For objects of type int[]:
Compute the vector sum.
(No arguments.)
Compute the vector sum.
For objects of type size_t[]:
Compute the vector sum.
(No arguments.)
Compute the vector sum.
For objects of type table3d:
Add data from a second table3d object to current table3d.
Arguments:
<file> [name]
Add all slides from the second table3d to their corresponding slices in the current table3d, creating new slices if necessary.
For objects of type tensor:
Output the sum of all the tensor entries.
(No arguments.)
The
sum
command outputs the total tensor size and the sum over all entries. Note, to perform a partial sum over sum of the tensor indices, use therearrange
command.For objects of type tensor_grid:
Output the sum of all the tensor entries.
(No arguments.)
The
sum
command outputs the total tensor size and the sum over all entries. Note, to perform a partial sum over sum of the tensor indices, use therearrange
command.
-
virtual int comm_thin_mcmc(std::vector<std::string> &sv, bool itive_com)¶
Thin MCMC output.
For objects of type table:
Thin Markov chain Monte Carlo output
Arguments: <window> [mult. column]
The
thin-mcmc
command thins the rows of the table by including only one out of every <window> rows in the table. The value of <window> cannot be zero. A window of 1 effectively makes no changes to the table (unless the optional second argument is given). If a “multiplier column” is specified, then non-zero and positive values are interpreted as integer multipliers for each row. In this case, the table is interpreted as containing multiple copies of each row, where the number of copies is given in the specified column. Rows with a zero or negative multiplier are ignored. A window value of 1 creates a new table with[mult. column]
copies of each row. When the multiplier column is specified, it’s original value is retained in the table which results.
-
virtual int comm_to_gaussian(std::vector<std::string> &sv, bool itive_com)¶
Construct a multivariate Gaussian distribution.
For objects of type table:
Construct a multivariate Gaussian distribution
Arguments: <column 1> [column 2] …
This creates an object of type
prob_dens_mdim_gaussian
based on the given columns of data in the table.
-
virtual int comm_to_gmm(std::vector<std::string> &sv, bool itive_com)¶
Construct a Gaussian mixture model.
For objects of type table:
Construct a multivariate Gaussian distribution
Arguments: <number of Gaussians> <column 1> [column 2] …
This creates an object of type
prob_dens_mdim_gmm
based on the given columns of data in the table.
-
virtual int comm_to_kde(std::vector<std::string> &sv, bool itive_com)¶
Construct a KDE.
For objects of type table:
Construct a KDE
Arguments: <options or ‘none’> <column 1> [column 2] …
This creates an object of type
prob_dens_mdim_kde
based on the given columns of data in the table.
-
virtual int comm_to_pdma(std::vector<std::string> &sv, bool itive_com)¶
Construct a AMR-based probability distribution.
For objects of type table:
Construct a AMR-based probability distribution
Arguments: <column 1> [column 2] …
This creates an object of type
prob_dens_mdim_amr
based on the given columns of data in the table.
-
virtual int comm_to_hist(std::vector<std::string> &sv, bool itive_com)¶
Convert to a o2scl::hist object.
For objects of type table:
Convert a table column to a histogram.
Arguments:
<col> <n_bins> [wgts]
The
to-hist
command creates a 1D histogram from column <col> using exactly <n_bins> bins and (optionally) weighting the entries by the values in column [wgts].For objects of type table3d:
Convert a table3d slice to a histogram.
Arguments:
<slice> <n_bins>
The
to-hist
command creates a 1D histogram from slice <slice> using exactly <n_bins> bins.
-
virtual int comm_to_hist_2d(std::vector<std::string> &sv, bool itive_com)¶
Convert to a o2scl::hist_2d object.
For objects of type table:
Convert a table to a 2d histogram.
Arguments:
<col x> <col y> <n_x_bins> <n_y_bins> [wgts]
The
to-hist-2d
command creates a 2D histogram from <col x> and <col y> using <n_x_bins> bins in the x direction and <n_y_bins> bins in the y direction, optionally weighting the entries by the column [wgts].For objects of type table3d:
Convert a table3d slice to a 2d histogram.
<slice>
The
to-hist-2d
command creates a 2D histogram from slice <slice>.
-
virtual int comm_to_table(std::vector<std::string> &sv, bool itive_com)¶
Convert object to a o2scl::table object.
For objects of type double[]:
Convert to a table object.
Arguments:
<column name>
Convert the vector to a table with a single column named <column name>.
For objects of type int[]:
Convert to a table object.
Arguments:
<column name>
Convert the vector to a table with a single column named <column name>.
For objects of type size_t[]:
Convert to a table object.
Arguments:
<column name>
Convert the vector to a table with a single column named <column name>.
For objects of type tensor_grid:
Convert to a table object.
Arguments:
<index> <grid name> <data name> [values of fixed indices]
Convert the
tensor_grid
object to atable
object by choosing an index to vary and fixing the remaining indices. The resulting table has two columns. The grid associated with the specified index is stored in a new column named <grid
name> and the values of the tensor are stored in a column named <data name>. Linear interpolation is used, so the values for the fixed indices need not lie on grid points.
For objects of type table3d:
Convert to a table object.
Arguments: (No arguments.)
Given a
table3d
object with C slices which each have N values in the x direction and M values in the y direction, this command creates a table with C+2 columns and N times M rows. The x name from thetable3d
object is the first column, the y name from thetable3d
object is the second column, and the remaining columns correspond to the slices. Then theto-table
command loops through all of the x and y values, creating a row from the values in each slice.For objects of type hist:
Convert to a
hist
object to atable
object.Arguments: (No arguments.)
This function creates a new table with four columns from the current
hist
object. The columns are named “rep”, “low”, “high”, “wgt”. In order, for each bin, each row stores the bin representative, the lower edge, the upper edge, and the bin weight.For objects of type prob_dens_mdim_kde:
Convert to a
prob_dens_mdim_kde
object to atable
object.Arguments: (No arguments.)
This function creates a new table…
-
virtual int comm_to_table3d(std::vector<std::string> &sv, bool itive_com)¶
Convert object to a o2scl::table3d object.
For objects of type table:
Convert a
table
to atable3d
object.Arguments:
<x column> <y column> [empty value] [eps]
The
to-table3d
command converts the entiretable
to a atable3d
object assuming that thetable
is consists of a list of entries in the newtable3d
object. The <x column> and <y column> arguments are used as the data for the x and y grids in the newtable3d
object. If [empty value] is given, then this value is used for points not given by the table. If [eps] is specified, then that value (instead of the default of 10^{-12}) is used as the minimum value between grid points.For objects of type tensor:
Select two indices and convert to a table3d object.
Arguments:
<x index> <y index> <slice name> [fixed 1] [fixed 2] ...
The
to-table3d
command uses two indices in the current tensor object to create atable3d
object. The values for the remaining indices fixed to [fixed 1], [fixed 2], etc. in that order. For example,to-table3d 3 1 z 5 3
uses index 3 for the x coordinate of the new table3d object, uses index 1 for the y coordinate of the new table3d object, uses 5 for index 0, and uses 3 for index 2. The x- and y-grids in he table3d object are named “x” and “y” and filled with the grid index by default. To set the x- or y-grid names afterwards, use commands ‘x-name’ and ‘y-name’.For objects of type tensor<int>:
Select two indices and convert to a table3d object.
Arguments:
<x index> <y index> <slice name> [fixed 1] [fixed 2] ...
This command uses two indices in the current tensor object to create a table3d object. The values for the remaining indices fixed to [fixed 1], [fixed 2], etc. in that order. For example,
to-table3d 3 1 z 5 3
uses index 3 for the x coordinate of the new table3d object, uses index 1 for the y coordinate of the new table3d object, uses 5 for index 0, and uses 3 for index 2. The x- and y-grids in he table3d object are named “x” and “y” and filled with the grid index by default. To set the x- or y-grid names afterwards, use commands ‘x-name’ and ‘y-name’.For objects of type tensor<size_t>:
Select two indices and convert to a table3d object.
Arguments:
<x index> <y index> <slice name> [fixed 1] [fixed 2] ...
This command uses two indices in the current tensor object to create a table3d object. The values for the remaining indices fixed to [fixed 1], [fixed 2], etc. in that order. For example,
to-table3d 3 1 z 5 3
uses index 3 for the x coordinate of the new table3d object, uses index 1 for the y coordinate of the new table3d object, uses 5 for index 0, and uses 3 for index 2. The x- and y-grids in he table3d object are named “x” and “y” and filled with the grid index by default. To set the x- or y-grid names afterwards, use commands ‘x-name’ and ‘y-name’.For objects of type tensor_grid:
Select two indices and convert to a table3d object.
Arguments:
<x index> <y index> <slice name> [value 1] [value 2] ...
This command uses two indices in the current tensor_grid object to create a table3d object. The values for the remaining indices are by interpolation to [value 1], [value 2], etc. in that order. For example,
to-table3d 3 1 z 0.5 2.0
uses index 3 for the x coordinate of the new table3d object, uses index 1 for the y coordinate of the new table3d object, uses interpolation to set the value of the index 0 to 0.5, and uses interpolation to set the value of index 2 to to 2.0. The x- and y-grids in the table3d object are named “x” and “y” by default. To set the x- or y-grid names afterwards, use commands ‘x-name’ and ‘y-name’.For objects of type hist_2d:
Convert to a hist_2d object.
Arguments:
<x name> <y name> <weight name>
Convert to a hist_2d object using the specified names.
For objects of type prob_dens_mdim_amr:
Select two indices and convert to a table3d object.
Arguments:
<x index> <y index> <x name> <x points> <y
name> <y points> <slice name>
Select two indices and convert to a table3d object.
For objects of type prob_dens_mdim_kde:
Convert to a
prob_dens_mdim_kde
object to atable3d
object.Arguments: (No arguments.)
This function creates a new table3d…
-
virtual int comm_to_table3d_sum(std::vector<std::string> &sv, bool itive_com)¶
Convert object to a o2scl::table3d object by summing over tensor indices.
For objects of type tensor:
Select two indices and convert to a table3d object.
Arguments:
<x name> <x index> <y name> <y index> <slice name>
Convert the
tensor
object to atable3d
object by assigning index <x index> to the x value, index <y index> to the <y value>, and summing over all remaining indices to create a slice of named <slice name>.
-
virtual int comm_to_tensor(std::vector<std::string> &sv, bool itive_com)¶
Convert object to a o2scl::tensor object.
For objects of type tensor_grid:
Convert to a tensor object.
Arguments: (No arguments.)
Convert to a tensor object, removing the grid information.
-
virtual int comm_to_tensor_grid(std::vector<std::string> &sv, bool itive_com)¶
Convert object to a o2scl::tensor_grid object.
For objects of type table3d:
Convert a slice of the table3d object to a tensor_grid object.
Arguments:
<slice>
Convert a
table3d
object to a rank 2tensor_grid
object, directly copying the grid over.For objects of type tensor:
Convert the tensor to a tensor_grid object.
Arguments:
[function 1] [function 2] ...
Convert a
tensor
to atensor_grid
object, using functions to specify the grid for each index. The functions should be specified as functions of the variable ‘i’, which runs from 0 to size-1 for each index. Any user-specified functions are used up to the rank of the tensor, and if not enough functions are specified, then the function ‘i’ is used.
-
virtual int comm_to_tg_fermi(std::vector<std::string> &sv, bool itive_com)¶
Convert object to a o2scl::tensor_grid object.
For objects of type table3d:
Convert a slice of the table3d object to a tensor_grid object.
Arguments:
<slice> <n points>
Detailed desc.
For objects of type tensor:
Convert the tensor to a tensor_grid object.
Arguments:
[function 1] [function 2] ...
Convert a tensor to a tensor_grid object, using functions to specify the grid for each index. The functions should be specified as functions of the variable ‘i’, which runs from 0 to size-1 for each index. Any user-specified functions are used up to the rank of the tensor, and if not enough functions are specified, then the function ‘i’ is used.
-
virtual int comm_to_vector(std::vector<std::string> &sv, bool itive_com)¶
Convert the current object to a vector.
For objects of type uniform_grid<double>:
Convert the uniform_grid<double> to a double[] object.
Arguments: (none)
Convert to a vector.
-
virtual int comm_type(std::vector<std::string> &sv, bool itive_com)¶
Output the type of the current object.
Arguments: (No arguments.)
Show the current object type. Type can be
char
,double
,double[]
,hist
,hist_2d
,int
,int[]
,prob_dens_mdim_amr
,prob_dens_mdim_gaussian
,size_t
,size_t[]
,string
,string[]
,table
,table3d
,tensor
,tensor<int>
,tensor<size_t>
,tensor_grid
,uniform_grid<double>
,vec_vec_double
,vec_vec_string
, orvector<contour_line>
.
-
virtual int comm_value(std::vector<std::string> &sv, bool itive_com)¶
Get or set the value of an object.
For objects of type int:
Get or set the integer.
Arguments:
[value]
Get or set the integer.
For objects of type size_t:
Get or set the size_t object.
Arguments:
[value]
Get or set the size_t object.
For objects of type string:
Get or set the string.
Arguments:
[value]
Get or set the string.
For objects of type double:
Get or set the value of the double object.
Arguments:
[value spec.]
Get or set the value of the double object. See
Value specifications
for more information.For objects of type char:
Get or set the character.
Arguments:
[value]
Get or set the character.
For objects of type double[]:
Get or set an entry in the array
Arguments:
<index> [value]
Get or set entry at index <index>.
For objects of type int[]:
Get or set an entry in the array
Arguments:
<index> [value]
Get or set entry at index <index>.
For objects of type size_t[]:
Get or set an entry in the array
Arguments:
<index> [value]
Get or set entry at index <index>.
For objects of type string[]:
Get or set an entry in the array
Arguments:
<index> [value]
Get or set entry at index <index>.
For objects of type table:
Get or set a single entry in a table.
Arguments:
<column> <row> [value or "none"]
This command gets or sets the value in the specified column and row. If “none” is specified as the third argument, then the
value
command just prints out the specified entry as if the third argument was not specified.To refer to a location by the x and y values instead of indices, use the
value-grid
command.For objects of type table3d:
Get or set a single entry in a table3d object.
Arguments:
<slice> <x index> <y index> [value or "none"]
This command gets or sets the value in the specified slice at the location specified by <x index> and <y index>. If “none” is specified as the fourth argument, or if only three arguments are given, then the
value
command just prints out the specified value.To refer to a location by the x and y values instead of indices, use the
value-grid
command.For objects of type tensor:
Get or set a single entry in a tensor object.
Arguments:
<index 1> <index 2> <index 3> ... [value or "none"]
This command gets or sets the value in the tensor at the location given by the specified indices. If an an argument is given at the end and that arguemnt is not “none”, then it is used to set the new value. If only the indices are given, then the
value
command just prints out the specified value.For objects of type tensor_grid:
Get or set a single entry in a tensor_grid object.
Arguments:
<index 1> <index 2> <index 3> ... [value or "none"]
The
value
command gets or sets a value in thetensor_grid
object. The arguments are a list of indices and (optionally) a new value to store in that location.See the
value-grid
command to specify a grid location rather than specifying indices.
-
virtual int comm_value_grid(std::vector<std::string> &sv, bool itive_com)¶
Get an entry by grid point.
For objects of type table:
Get or set a single entry in a table.
Arguments:
<index column> <index value> <target column> [value or "none"]
The
value-grid
command first looks for the value closest to <index value> in the column <index column> to determine a row in the table. Nextvalue-grid
gets or sets the value of the target column in that row. If “none” is specified as the fourth argument, thenvalue-grid
just prints out the specified entry as if the third argument was not specified.For objects of type table3d:
Get a single entry in a table3d object.
Arguments:
<slice> <x value> <y value> [value or "none"]
The
value-grid
command first looks for the value closest to <x value> and <y value> in the slice <index slice> to determine a row in the table. Next,value-grid
gets or sets the value of of the specified slice in that location. If “none” is specified as the fourth argument, thenvalue-grid
just prints out the specified entry as if the third argument was not specified.For objects of type tensor_grid:
Get a single entry in a
tensor_grid
object.Arguments:
<value 1> <value 2> <value 3> ... [value or "none"]
The
value-grid
command gets or sets a value in thetensor_grid
object. The arguments are a list of grid values and (optionally) a new value to store in the location closest to the specified grid values.
-
virtual int comm_version(std::vector<std::string> &sv, bool itive_com)¶
Print version information and O₂scl settings.
Arguments: (No arguments.)
This prints the O₂scl version, when it was compiled, HDF5 version information, what packages were enabled during installation, the data and documentation directories, and other miscellaneous information about O₂scl.
-
virtual int comm_wdocs(std::vector<std::string> &sv, bool itive_com)¶
Open remote HTML docs for acol or an O₂scl topic.
Arguments:
["dev"] [search_term], [topic] or [section search_term]
If no arguments are given, this command opens up the remote HTML documentation for acol in the default web browser using
open
on OSX andxdg-open
on other systems. If a help topic, [topic] is specified, then the associated O₂scl web page is opened. If the argument does not match an already known topic, then the search feature on the O₂scl web page is opened using the specified search term. Note that, for search terms, spaces can be included using e.g.-wdocs "Simulated annealing"
If the optional argument “dev” is given, then the development rather than release documentation is used. In order to open the local version of the documentation instead of the remote copy, use
docs
instead ofwdocs
.
-
virtual int comm_wstats(std::vector<std::string> &sv, bool itive_com)¶
Get weighted statistics.
For objects of type table:
Show weighted column statistics.
Arguments:
<column> <weights>
Output the average, standard deviation, max and min of <column>, using the weights specified in <weights>.
-
virtual int comm_x_name(std::vector<std::string> &sv, bool itive_com)¶
Set the name of the x grid.
For objects of type table3d:
Get or set the name of the x grid.
Arguments:
[name]
Get the name of the x grid, or, if [name] is specified, change the x grid name to [name].
-
virtual int comm_xml_to_o2(std::vector<std::string> &sv, bool itive_com)¶
Parse doxygen XML to generate runtime docs.
Arguments: (No arguments.)
When pugixml is enabled, this function reads the doxygen XML output and generates an HDF5 file which acol reads to generate the runtime documentation. This command is principally designed for developers and requires several additional tools not otherwise required during installation.
-
virtual int comm_y_name(std::vector<std::string> &sv, bool itive_com)¶
Set the name of the y grid.
For objects of type table3d:
Get or set the name of the y grid.
Arguments:
[name]
Get the name of the y grid, or, if [name] is specified, change the y grid name to [name].
-
int validate_interp_type()¶
Validate the setting of interp_type.
Used in comm_set().
-
int get_input(std::vector<std::string> &sv, std::vector<std::string> &directions, std::vector<std::string> &in, std::string comm_name, bool itive_com)¶
An internal command for prompting the user for command arguments.
-
int get_input_one(std::vector<std::string> &sv, std::string directions, std::string &in, std::string comm_name, bool itive_com)¶
An internal command for prompting the user for one command argument.
Protected Attributes
-
o2scl::slack_messenger smess¶
The object which sends Slack messages.
-
std::map<std::string, std::vector<std::string>> type_comm_list¶
A list of all type-specific commands for each type.
-
std::vector<std::string> type_list¶
A list of all types.
-
o2scl::comm_option_mfptr<acol_manager> cset¶
The object for the set function.
-
std::vector<std::vector<std::string>> cmd_doc_strings¶
Document strings for commands.
-
std::vector<std::vector<std::string>> param_doc_strings¶
Document strings for parameters.
-
std::vector<std::vector<std::string>> help_doc_strings¶
Document strings for help topics.
-
o2scl::convert_units<double> &cng¶
Convert units object (initialized by constructor to global object)
-
o2scl::format_float ff¶
The number formatter for unicode output.