CSV file data storage The constructor creates Data
matrix from the records in a CSV file fname
. The orientation can be of two types: 1. BY_COL
which is default - the data are stored in columns; one column per time , one row per data item. 2. BY_ROW
if the data are stored the classical CSV style. Then each column stores the values for data item, for ex. , one row for each discrete time instant.
More...
#include <datasources.h>
Public Member Functions | |
CsvFileDS (const string &fname, const string &orientation="BY_COL") | |
Constructor - create DS from a CSV file. | |
void | getdata (vec &dt) |
Returns full vector of observed data=[output, input]. | |
void | getdata (vec &dt, const ivec &indices) |
Returns data records at indeces. | |
int | ndat () |
returns number of data in the file; | |
void | log_add (logger &L) |
no sense to log this type | |
void | logit (logger &L) |
no sense to log this type | |
int | max_length () |
Returns maximum number of provided data, by default it is set to maximum allowed length, shorter DS should overload this method! See, MemDS.max_length(). | |
void | set_rvs (RV &drv, RV &urv) |
void | write (vec &ut) |
Accepts action variable and schedule it for application. | |
void | write (vec &ut, ivec &indices) |
virtual void | write (vec &ut, const ivec &indeces) |
Accepts action variables at specific indeces. | |
void | step () |
Moves from to , i.e. perfroms the actions and reads response of the system. | |
void | from_setting (const Setting &set) |
virtual const RV & | _drv () const |
access function | |
const RV & | _urv () const |
access function | |
const RV & | _yrv () const |
access function | |
virtual void | set_drv (const RV &yrv, const RV &urv) |
set random variables | |
virtual string | to_string () |
This method returns a basic info about the current instance. | |
virtual void | to_setting (Setting &set) const |
This method save all the instance properties into the Setting structure. | |
virtual void | validate () |
This method TODO. | |
Protected Attributes | |
mat | Data |
internal matrix of data | |
int | time |
active column in the Data matrix | |
ivec | rowid |
vector of rows that are presented in Dt | |
int | dtsize |
size of data returned by getdata() | |
int | utsize |
size of data | |
int | ytsize |
size of output | |
RV | Drv |
Description of data returned by getdata() . | |
RV | Urv |
Description of data witten by by write() . | |
RV | Yrv |
Description of output data. | |
int | L_dt |
Remember its own index in Logger L. | |
int | L_ut |
CSV file data storage The constructor creates Data
matrix from the records in a CSV file fname
. The orientation can be of two types: 1. BY_COL
which is default - the data are stored in columns; one column per time , one row per data item. 2. BY_ROW
if the data are stored the classical CSV style. Then each column stores the values for data item, for ex. , one row for each discrete time instant.
void bdm::MemDS::from_setting | ( | const Setting & | set | ) | [inline, virtual, inherited] |
Create object from the following structure
{ class = "MemDS"; Data = (...); // Data matrix or data vector --- optional --- drv = {class="RV"; ...} // Identification how rows of the matrix Data will be known to others time = 0; // Index of the first column to user_info, rowid = [1,2,3...]; // ids of rows to be used }
If the optional fields are not given, they will be filled as follows:
rowid= [0, 1, 2, ...number_of_rows_of_Data]; drv = {names=("ch0", "ch1", "ch2", ..."number_of_rows_of_Data"); sizes=( 1 1 1 ...); times=( 0 0 0 ...); }; time = 0;
If rowid
is given, drv
will be named after indeces in rowids.
Hence the data provided by method getdata()
will be full column of matrix Data starting from the first record.
Reimplemented from bdm::root.
Reimplemented in bdm::ITppFileDS, and bdm::mxArrayDS.
References bdm::MemDS::Data, bdm::DS::dtsize, bdm::UI::get(), bdm::MemDS::rowid, bdm::DS::set_drv(), bdm::MemDS::time, and bdm::DS::utsize.