CosmoBolognaLib
Free Software C++/Python libraries for cosmological calculations
cbl::data::Data Class Reference

The class Data. More...

#include <Data.h>

Inheritance diagram for cbl::data::Data:

Public Member Functions

Non-virtual member functions
double correlation (const int i, const int j) const
 get the value of the data correlation at index i,j More...
 
std::vector< std::vector< double > > correlation () const
 get the value of the data correlation at index i,j More...
 
double inverse_covariance (const int i, const int j) const
 get the value of data inverse_covariance at index i,j More...
 
std::vector< std::vector< double > > inverse_covariance () const
 get the m_inverse_covariance std::vector More...
 
void reset (const int ndata)
 reset data object with new empty arrays large enough to store ndata data More...
 
virtual void invert_covariance (const double prec, const int Nres)
 invert the covariance matrix More...
 
Member functions to get the private/protected members
virtual double xx (const int i) const
 get value of x at index i More...
 
virtual std::vector< double > xx () const
 get the x std::vector More...
 
virtual double xx (const int i, const int j) const
 get value of x at position i,j, for Data1D_collection More...
 
virtual double yy (const int i) const
 get value of y at index i, for Data2D More...
 
virtual std::vector< double > yy () const
 get the y std::vector More...
 
virtual std::vector< std::vector< double > > IndipendentVariable (const int i=-1, const int j=-1) const
 get the independet variable, to be used in model computation More...
 
virtual double data (const int i, const int j) const
 get data at index i,j for Data1D_collection, Data2D More...
 
virtual void get_data (std::vector< double > &data) const
 get data for Data1D More...
 
virtual DataType dataType () const
 get the data type More...
 
virtual int ndata () const
 the total number of data More...
 
virtual double data (const int i) const
 get data at index i More...
 
virtual std::vector< double > data () const
 get data More...
 
virtual double error (const int i) const
 get value of data standard deviation at index i More...
 
virtual std::vector< double > error () const
 get standard deviation More...
 
virtual double covariance (const int i, const int j) const
 get the value of the data covariance at index i,j More...
 
virtual std::vector< std::vector< double > > covariance () const
 get the m_covariance vector More...
 
virtual double edges_xx (const int i) const
 get value of x variable bin edge at index i More...
 
virtual std::vector< double > edges_xx () const
 get x variable bin edges More...
 
virtual double edges_yy (const int i) const
 get value of y variable bin edge at index i More...
 
virtual std::vector< double > edges_yy () const
 get y variable bin edges More...
 
virtual void get_data (std::vector< std::vector< double >> &data) const
 get data for Data1D_collection, Data2D More...
 
virtual double error (const int i, const int j) const
 get value of f(x) error at index i,j for Data1D_collection, Data2D More...
 
virtual void get_error (std::vector< double > &error) const
 get standard deviation for Data1D More...
 
virtual void get_error (std::vector< std::vector< double >> &error) const
 get standard deviation for Data1D_Collection, Data2D More...
 
virtual double extra_info (const int i, const int j) const
 return the value of the extra information at index i,j More...
 
virtual std::vector< std::vector< double > > extra_info () const
 return the m_exta_info std::vector More...
 
Member functions to set the private/protected members
virtual void set_xx (const std::vector< double > x)
 set interval variable m_x More...
 
virtual void set_yy (const std::vector< double > y)
 set interval variable m_y, for Data2D More...
 
virtual void set_xx (const int i, const std::vector< double > x)
 set interval variable m_x in the i-th dataset, for Data1D_collection More...
 
virtual void set_xx (const std::vector< std::vector< double >> x)
 set interval variable m_x, for Data1D_collection More...
 
virtual void set_edges_xx (const std::vector< double > edges)
 set interval variable m_edges_xx More...
 
virtual void set_edges_yy (const std::vector< double > edges)
 set interval variable m_edges_yy More...
 
virtual void set_data (const std::vector< std::vector< double >> data)
 set interval variable m_data, for Data1D_collection, Data2D More...
 
virtual void set_extra_info (const std::vector< std::vector< double >> extra_info)
 set interval variable m_error_fx More...
 
void set_data (const std::vector< double > data)
 set interval variable data More...
 
void set_error (const std::vector< double > error)
 set interval variable m_error_fx More...
 
void set_error (const std::vector< std::vector< double >> covariance)
 set interval variable m_error_fx More...
 
void set_covariance (const std::string filename, const int cov_col=2, const int skipped_lines=0)
 set the interval variable m_covariance, reading from an input file More...
 
void set_covariance (const double value, const int i, const int j)
 set interval the variable m_covariance More...
 
void set_covariance (const std::vector< std::vector< double >> covariance)
 set interval the variable m_covariance More...
 
void set_covariance (const std::vector< double > error)
 set interval the variable m_covariance More...
 
Member functions to compute data properties
virtual int ndata (const int i) const
 function that returns number of data for one dataset, for Data1D_collection More...
 
virtual int ndataset () const
 function that returns total number of datasets More...
 
virtual int xsize () const
 get the number of points along x More...
 
virtual int xsize (const int i) const
 get the number of points along x More...
 
virtual int ysize () const
 get the number of points along y More...
 
Member functions for Input/Output
virtual void read (const std::string input_file, const int skip_nlines=0, const std::vector< int > column={0}, const std::vector< int > column_data={}, const std::vector< int > column_errors={}, const std::vector< int > column_edges={})
 read the data from one input file More...
 
virtual void read (const std::vector< std::string > input_file, const int skip_nlines=0, const std::vector< int > column={0}, const std::vector< int > column_data={}, const std::vector< int > column_errors={}, const std::vector< int > column_edges={})
 read the data from a set of input files More...
 
virtual void Print (const int prec=4) const
 print the data on screen More...
 
virtual void write (const std::string dir, const std::string file, const std::string header, const int prec=4, const int ww=8, const int rank=0) const
 write the data More...
 
virtual void write (const std::string dir, const std::string file, const std::string header, const bool full, const int prec=10, const int ww=8, const int rank=0) const
 write the data More...
 
virtual void write (const std::string dir, const std::vector< std::string > files, const std::string header, const int prec=10, const int ww=8, const int rank=0) const
 write the data More...
 
virtual void write_covariance (const std::string dir, const std::string file, const int precision=10) const
 write the interval variable m_covariance on a file, More...
 
Member functions for data cut
void cut (const std::vector< bool > mask, std::vector< double > &data, std::vector< double > &error, std::vector< std::vector< double >> &covariance_matrix) const
 cut the dataset using a mask More...
 
virtual std::shared_ptr< Datacut (const std::vector< bool > mask) const
 cut the data, for Data1D More...
 
virtual std::shared_ptr< Datacut (const double xmin, const double xmax) const
 cut the data, for Data1D More...
 
virtual std::shared_ptr< Datacut (const double xmin, const double xmax, const double ymin, const double ymax) const
 cut the data, for Data2D More...
 
virtual std::shared_ptr< Datacut (const int dataset, const double xmin, const double xmax) const
 cut the data, for Data1D_collection More...
 
virtual std::shared_ptr< Datacut (const std::vector< double > xmin, const std::vector< double > xmax) const
 cut the data, for Data1D_collection type More...
 

Protected Member Functions

void set_dataType (const DataType dataType)
 set the data type More...
 

Protected Attributes

DataType m_dataType
 type of data
 
int m_ndata
 number of data
 
std::vector< double > m_data
 data values
 
std::vector< double > m_error
 standard deviations
 
std::vector< double > m_edges_xx
 bin edges for the x variable
 
std::vector< double > m_edges_yy
 bin edges for the y variable
 
std::vector< std::vector< double > > m_covariance
 covariance matrix
 
std::vector< std::vector< double > > m_inverse_covariance
 inverse covariance matrix
 

Constructors/destructors

 Data ()=default
 default constructor
 
 Data (const DataType dataType)
 constructor which sets only the data type More...
 
 Data (const DataType dataType, const int ndata)
 constructor which sets both the data type and the number of data More...
 
 Data (const DataType dataType, const std::vector< double > data)
 constructor which gets the data from an input vector More...
 
 Data (const DataType dataType, const std::vector< double > data, const std::vector< double > error)
 constructor which gets both the data and the errors from input vectors More...
 
 Data (const DataType dataType, const std::vector< double > data, const std::vector< std::vector< double >> covariance)
 constructor which gets both the data and the covariance matrix from input vectors More...
 
virtual ~Data ()=default
 default destructor
 
virtual std::shared_ptr< Dataas_factory ()
 static factory used to construct objects of class Data1D More...
 
static std::shared_ptr< DataCreate (const DataType dataType)
 static factory used to construct objects of class Data1D More...
 

Detailed Description

The class Data.

"Headers/Data.h"

This is the base class used to manage 1D-2D data

Definition at line 88 of file Data.h.

Constructor & Destructor Documentation

◆ Data() [1/5]

cbl::data::Data::Data ( const DataType  dataType)
inline

constructor which sets only the data type

Parameters
dataTypethe data type

Definition at line 144 of file Data.h.

◆ Data() [2/5]

cbl::data::Data::Data ( const DataType  dataType,
const int  ndata 
)
inline

constructor which sets both the data type and the number of data

Parameters
dataTypethe data type
ndatathe number of data

Definition at line 156 of file Data.h.

◆ Data() [3/5]

cbl::data::Data::Data ( const DataType  dataType,
const std::vector< double >  data 
)

constructor which gets the data from an input vector

Parameters
dataTypethe data type
datavector containing the data

Definition at line 79 of file Data.cpp.

◆ Data() [4/5]

cbl::data::Data::Data ( const DataType  dataType,
const std::vector< double >  data,
const std::vector< double >  error 
)

constructor which gets both the data and the errors from input vectors

Parameters
dataTypethe data type
datavector containing the data
errorvector containing the errors

Definition at line 91 of file Data.cpp.

◆ Data() [5/5]

cbl::data::Data::Data ( const DataType  dataType,
const std::vector< double >  data,
const std::vector< std::vector< double >>  covariance 
)

constructor which gets both the data and the covariance matrix from input vectors

Parameters
dataTypethe data type
datavector containing the data
covariancematrix containing the covariance

Definition at line 105 of file Data.cpp.

Member Function Documentation

◆ as_factory()

virtual std::shared_ptr<Data> cbl::data::Data::as_factory ( )
inlinevirtual

static factory used to construct objects of class Data1D

Returns
a shared pointer to an object of class Data

Reimplemented in cbl::data::Data2D_extra, cbl::data::Data2D, cbl::data::Data1D_extra, cbl::data::Data1D_collection, and cbl::data::Data1D.

Definition at line 217 of file Data.h.

◆ correlation() [1/2]

std::vector< std::vector< double > > cbl::data::Data::correlation ( ) const

get the value of the data correlation at index i,j

Returns
the value of the correlation \( Corr_{i,j} = \frac{Cov_{i,j}}{\sqrt{Cov_{i,i} \cdot Cov{j,j}}} \)

Definition at line 119 of file Data.cpp.

◆ correlation() [2/2]

double cbl::data::Data::correlation ( const int  i,
const int  j 
) const
inline

get the value of the data correlation at index i,j

Parameters
iindex
jindex
Returns
the value of the correlation \( Corr_{i,j} = \frac{Cov_{i,j}}{\sqrt{Cov_{i,i} \cdot Cov{j,j}}} \)

Definition at line 235 of file Data.h.

◆ covariance() [1/2]

virtual std::vector<std::vector<double> > cbl::data::Data::covariance ( ) const
inlinevirtual

get the m_covariance vector

Returns
the vector containing the covariance matrix

Definition at line 403 of file Data.h.

◆ covariance() [2/2]

virtual double cbl::data::Data::covariance ( const int  i,
const int  j 
) const
inlinevirtual

get the value of the data covariance at index i,j

Parameters
iindex
jindex
Returns
the value of the m_covariance matrix at position i,j

Definition at line 397 of file Data.h.

◆ Create()

shared_ptr< Data > cbl::data::Data::Create ( const DataType  dataType)
static

static factory used to construct objects of class Data1D

Parameters
dataTypethe data type
Returns
a shared pointer to an object of class Data

Definition at line 50 of file Data.cpp.

◆ cut() [1/6]

virtual std::shared_ptr<Data> cbl::data::Data::cut ( const double  xmin,
const double  xmax 
) const
inlinevirtual

cut the data, for Data1D

Parameters
xminminumum value for the independet variable x
xmaxmaximum value for the independent variable x
Returns
pointer to an object of type Data1D

Reimplemented in cbl::data::Data1D_extra, and cbl::data::Data1D.

Definition at line 821 of file Data.h.

◆ cut() [2/6]

virtual std::shared_ptr<Data> cbl::data::Data::cut ( const double  xmin,
const double  xmax,
const double  ymin,
const double  ymax 
) const
inlinevirtual

cut the data, for Data2D

Parameters
xminminumum value for the independent variable x
xmaxmaximum value for the independent variable x
yminminumum value for the independent variable y
ymaxmaximum value for the independent variable y
Returns
pointer to an object of type Data2D

Reimplemented in cbl::data::Data2D_extra, and cbl::data::Data2D.

Definition at line 832 of file Data.h.

◆ cut() [3/6]

virtual std::shared_ptr<Data> cbl::data::Data::cut ( const int  dataset,
const double  xmin,
const double  xmax 
) const
inlinevirtual

cut the data, for Data1D_collection

Parameters
datasetthe dataset index
xminminumum value for the independet variable x
xmaxmaximum value for the independent variable x
Returns
pointer to an object of type Data1D

Reimplemented in cbl::data::Data1D_collection.

Definition at line 842 of file Data.h.

◆ cut() [4/6]

virtual std::shared_ptr<Data> cbl::data::Data::cut ( const std::vector< bool >  mask) const
inlinevirtual

cut the data, for Data1D

Parameters
[in]maskstd::vector containing values to be masked
Returns
pointer to an object of type Data1D

Reimplemented in cbl::data::Data1D_extra, and cbl::data::Data1D.

Definition at line 812 of file Data.h.

◆ cut() [5/6]

void cbl::data::Data::cut ( const std::vector< bool >  mask,
std::vector< double > &  data,
std::vector< double > &  error,
std::vector< std::vector< double >> &  covariance_matrix 
) const

cut the dataset using a mask

Parameters
[in]maskstd::vector containing values to be masked
[out]datastd::vector containing data
[out]errorstd::vector containing data standard deviations
[out]covariance_matrixstd::vector containing data covariance matrix

Definition at line 222 of file Data.cpp.

◆ cut() [6/6]

virtual std::shared_ptr<Data> cbl::data::Data::cut ( const std::vector< double >  xmin,
const std::vector< double >  xmax 
) const
inlinevirtual

cut the data, for Data1D_collection type

Parameters
xminstd::vector containing minumum values for the independet variable x
xmaxstd::vector containing maximum values for the independent variable x
Returns
pointer to an object of type Data1D_collection

Reimplemented in cbl::data::Data1D_collection.

Definition at line 851 of file Data.h.

◆ data() [1/3]

virtual std::vector<double> cbl::data::Data::data ( ) const
inlinevirtual

get data

Returns
the dataset

Definition at line 376 of file Data.h.

◆ data() [2/3]

virtual double cbl::data::Data::data ( const int  i) const
inlinevirtual

get data at index i

Parameters
iindex
Returns
the value of the data vector at position i

Definition at line 370 of file Data.h.

◆ data() [3/3]

virtual double cbl::data::Data::data ( const int  i,
const int  j 
) const
inlinevirtual

get data at index i,j for Data1D_collection, Data2D

Parameters
iindex
jindex
Returns
the value of the m_data std::vector at position i,j

Reimplemented in cbl::data::Data2D, and cbl::data::Data1D_collection.

Definition at line 342 of file Data.h.

◆ dataType()

virtual DataType cbl::data::Data::dataType ( ) const
inlinevirtual

get the data type

Returns
the data type

Definition at line 356 of file Data.h.

◆ edges_xx() [1/2]

virtual std::vector<double> cbl::data::Data::edges_xx ( ) const
inlinevirtual

get x variable bin edges

Returns
the x variable bin edges

Definition at line 416 of file Data.h.

◆ edges_xx() [2/2]

virtual double cbl::data::Data::edges_xx ( const int  i) const
inlinevirtual

get value of x variable bin edge at index i

Parameters
iindex
Returns
the value of the x variable bin edge vector at position i

Definition at line 410 of file Data.h.

◆ edges_yy() [1/2]

virtual std::vector<double> cbl::data::Data::edges_yy ( ) const
inlinevirtual

get y variable bin edges

Returns
the y variable bin edges

Definition at line 429 of file Data.h.

◆ edges_yy() [2/2]

virtual double cbl::data::Data::edges_yy ( const int  i) const
inlinevirtual

get value of y variable bin edge at index i

Parameters
iindex
Returns
the value of the y variable bin edge vector at position i

Definition at line 423 of file Data.h.

◆ error() [1/3]

virtual std::vector<double> cbl::data::Data::error ( ) const
inlinevirtual

get standard deviation

Returns
the standard deviation

Definition at line 389 of file Data.h.

◆ error() [2/3]

virtual double cbl::data::Data::error ( const int  i) const
inlinevirtual

get value of data standard deviation at index i

Parameters
iindex
Returns
the value of the error vector at position i

Definition at line 383 of file Data.h.

◆ error() [3/3]

virtual double cbl::data::Data::error ( const int  i,
const int  j 
) const
inlinevirtual

get value of f(x) error at index i,j for Data1D_collection, Data2D

Parameters
iindex
jindex
Returns
the value of the m_error std::vector at position i,j

Reimplemented in cbl::data::Data2D, and cbl::data::Data1D_collection.

Definition at line 444 of file Data.h.

◆ extra_info() [1/2]

virtual std::vector<std::vector<double> > cbl::data::Data::extra_info ( ) const
inlinevirtual

return the m_exta_info std::vector

Returns
std::vector containing std::vectors with extra information

Reimplemented in cbl::data::Data1D_extra, and cbl::data::Data2D_extra.

Definition at line 476 of file Data.h.

◆ extra_info() [2/2]

virtual double cbl::data::Data::extra_info ( const int  i,
const int  j 
) const
inlinevirtual

return the value of the extra information at index i,j

Parameters
iindex
jindex
Returns
the value of the extra_info at position i,j

Reimplemented in cbl::data::Data1D_extra, and cbl::data::Data2D_extra.

Definition at line 469 of file Data.h.

◆ get_data() [1/2]

virtual void cbl::data::Data::get_data ( std::vector< double > &  data) const
inlinevirtual

get data for Data1D

Parameters
[out]datastd::vector containing the dataset

Reimplemented in cbl::data::Data1D.

Definition at line 349 of file Data.h.

◆ get_data() [2/2]

virtual void cbl::data::Data::get_data ( std::vector< std::vector< double >> &  data) const
inlinevirtual

get data for Data1D_collection, Data2D

Parameters
[out]datastd::vector containing the dataset

Reimplemented in cbl::data::Data2D.

Definition at line 435 of file Data.h.

◆ get_error() [1/2]

virtual void cbl::data::Data::get_error ( std::vector< double > &  error) const
inlinevirtual

get standard deviation for Data1D

Parameters
[out]errorstd::vector containing the staandard deviation

Reimplemented in cbl::data::Data1D.

Definition at line 453 of file Data.h.

◆ get_error() [2/2]

virtual void cbl::data::Data::get_error ( std::vector< std::vector< double >> &  error) const
inlinevirtual

get standard deviation for Data1D_Collection, Data2D

Parameters
[out]errorstd::vector containing the staandard deviation

Reimplemented in cbl::data::Data2D.

Definition at line 460 of file Data.h.

◆ IndipendentVariable()

virtual std::vector<std::vector<double> > cbl::data::Data::IndipendentVariable ( const int  i = -1,
const int  j = -1 
) const
inlinevirtual

get the independet variable, to be used in model computation

Parameters
ifirst indipendent variable index
jsecond indipendent variable index
Returns
the independent variable

Reimplemented in cbl::data::Data2D, cbl::data::Data1D, cbl::data::Data2D_extra, cbl::data::Data1D_extra, and cbl::data::Data1D_collection.

Definition at line 333 of file Data.h.

◆ inverse_covariance() [1/2]

std::vector<std::vector<double> > cbl::data::Data::inverse_covariance ( ) const
inline

get the m_inverse_covariance std::vector

Returns
the std::vector containing the inverse convariance matrix

Definition at line 256 of file Data.h.

◆ inverse_covariance() [2/2]

double cbl::data::Data::inverse_covariance ( const int  i,
const int  j 
) const
inline

get the value of data inverse_covariance at index i,j

Parameters
iindex
jindex
Returns
the value of the m_inverse_covariance matrix at position i,j

Definition at line 250 of file Data.h.

◆ invert_covariance()

virtual void cbl::data::Data::invert_covariance ( const double  prec,
const int  Nres 
)
inlinevirtual

invert the covariance matrix

Parameters
precthe precision required in the inversion of the covariance matrix
Nres\(N_{res}\), the number of catalogue resamplings used to estimate the covariance matrix; \(N_{res}=-1\) if the covariance matrix has not been estimated with resampling methods

Definition at line 277 of file Data.h.

◆ ndata() [1/2]

virtual int cbl::data::Data::ndata ( ) const
inlinevirtual

the total number of data

Returns
total data number

Definition at line 363 of file Data.h.

◆ ndata() [2/2]

virtual int cbl::data::Data::ndata ( const int  i) const
inlinevirtual

function that returns number of data for one dataset, for Data1D_collection

Parameters
iindex to the i-th dataset
Returns
total number of data

Definition at line 612 of file Data.h.

◆ ndataset()

virtual int cbl::data::Data::ndataset ( ) const
inlinevirtual

function that returns total number of datasets

Returns
total number of dataset

Reimplemented in cbl::data::Data1D_collection.

Definition at line 619 of file Data.h.

◆ Print()

virtual void cbl::data::Data::Print ( const int  prec = 4) const
inlinevirtual

print the data on screen

Parameters
precthe float precision

Reimplemented in cbl::data::Data2D_extra, cbl::data::Data2D, cbl::data::Data1D_extra, cbl::data::Data1D_collection, and cbl::data::Data1D.

Definition at line 735 of file Data.h.

◆ read() [1/2]

virtual void cbl::data::Data::read ( const std::string  input_file,
const int  skip_nlines = 0,
const std::vector< int >  column = {0},
const std::vector< int >  column_data = {},
const std::vector< int >  column_errors = {},
const std::vector< int >  column_edges = {} 
)
inlinevirtual

read the data from one input file

Parameters
input_filethe input data file
skip_nlinesthe header lines to be skipped
columnvector containing the column(s) of x (and y) values in the input file; if it is not provided, the first column will be used by default
column_datathe column of data values in the input file; the size of column_data is the number of data to be read (e.g. the size should be 3 in the case of the 3 multipole moments of the two-point correlation function); if the size of column_data is larger than 1, more than 1 data vectors are read and then added one after the other in a single data object; if column_data is not provided, the first column after the column of x values will be used by default, assuming that only 1 data vector has to be read
column_errorsthe column of error values in the input file; the size of column_error must be equal to the size of column_data; if the size of column_error is larger than 1, more than 1 error vectors are read and then added one after the other in a single data object; if column_random is not provided, the second column after the column of x values will be used by default, assuming that only 1 random vector has to be read; if the input file has only 2 columns, the errors will be set to 1
column_edgesvector containing the columns of x (and y) bin edge values in the input file; if it is not provided, the third and four columns after the column of x values will be used; if these columns do no exist the edges are not read

Reimplemented in cbl::data::Data1D_extra, cbl::data::Data1D_collection, cbl::data::Data1D, cbl::data::Data2D_extra, and cbl::data::Data2D.

Definition at line 688 of file Data.h.

◆ read() [2/2]

virtual void cbl::data::Data::read ( const std::vector< std::string >  input_file,
const int  skip_nlines = 0,
const std::vector< int >  column = {0},
const std::vector< int >  column_data = {},
const std::vector< int >  column_errors = {},
const std::vector< int >  column_edges = {} 
)
inlinevirtual

read the data from a set of input files

Parameters
input_filevector containing the input data files
skip_nlinesthe header lines to be skipped
columnvector containing the column(s) of x (and y) values in the input file; if it is not provided, the first column will be used by default
column_datathe column of data values in the input file; the size of column_data is the number of data to be read (e.g. the size should be 3 in the case of the 3 multipole moments of the two-point correlation function); if the size of column_data is larger than 1, more than 1 data vectors are read and then added one after the other in a single data object; if column_data is not provided, the first column after the column of x values will be used by default, assuming that only 1 data vector has to be read
column_errorsthe column of error values in the input file; the size of column_error must be equal to the size of column_data; if the size of column_error is larger than 1, more than 1 error vectors are read and then added one after the other in a single data object; if column_random is not provided, the second column after the column of x values will be used by default, assuming that only 1 random vector has to be read; if the input file has only 2 columns, the errors will be set to 1
column_edgesvector containing the columns of x (and y) bin edge values in the input file; if it is not provided, the third and four columns after the column of x values will be used; if these columns do no exist the edges are not read

Reimplemented in cbl::data::Data1D_collection.

Definition at line 727 of file Data.h.

◆ reset()

void cbl::data::Data::reset ( const int  ndata)

reset data object with new empty arrays large enough to store ndata data

Parameters
ndatathe new number of data

Definition at line 66 of file Data.cpp.

◆ set_covariance() [1/4]

void cbl::data::Data::set_covariance ( const double  value,
const int  i,
const int  j 
)
inline

set interval the variable m_covariance

Parameters
valuecovariance matrix value
ithe first index
jthe second index

Definition at line 585 of file Data.h.

◆ set_covariance() [2/4]

void cbl::data::Data::set_covariance ( const std::string  filename,
const int  cov_col = 2,
const int  skipped_lines = 0 
)

set the interval variable m_covariance, reading from an input file

Parameters
filenamefile containing the covariance matrix in the format: column 0 \( \rightarrow \) xi, column 1 \( \rightarrow \) xj, column cov_col → cov(xi,xj)
cov_colcovariance matrix column, starting from 0
skipped_linescomment lines to be skipped

Definition at line 191 of file Data.cpp.

◆ set_covariance() [3/4]

void cbl::data::Data::set_covariance ( const std::vector< double >  error)

set interval the variable m_covariance

Parameters
errorstd::vector containing the data standard deviation

Definition at line 167 of file Data.cpp.

◆ set_covariance() [4/4]

void cbl::data::Data::set_covariance ( const std::vector< std::vector< double >>  covariance)

set interval the variable m_covariance

Parameters
covariancestd::vector containing the covariance matrix

Definition at line 179 of file Data.cpp.

◆ set_data() [1/2]

void cbl::data::Data::set_data ( const std::vector< double >  data)

set interval variable data

Parameters
datastd::vector containing data points

Definition at line 134 of file Data.cpp.

◆ set_data() [2/2]

virtual void cbl::data::Data::set_data ( const std::vector< std::vector< double >>  data)
inlinevirtual

set interval variable m_data, for Data1D_collection, Data2D

Parameters
datastd::vector containing data points

Definition at line 535 of file Data.h.

◆ set_dataType()

void cbl::data::Data::set_dataType ( const DataType  dataType)
inlineprotected

set the data type

Parameters
dataTypethe data type

Definition at line 121 of file Data.h.

◆ set_edges_xx()

virtual void cbl::data::Data::set_edges_xx ( const std::vector< double >  edges)
inlinevirtual

set interval variable m_edges_xx

Parameters
edgesstd::vector containing the x bin edges

Reimplemented in cbl::data::Data2D, and cbl::data::Data1D.

Definition at line 520 of file Data.h.

◆ set_edges_yy()

virtual void cbl::data::Data::set_edges_yy ( const std::vector< double >  edges)
inlinevirtual

set interval variable m_edges_yy

Parameters
edgesstd::vector containing the y bin edges

Reimplemented in cbl::data::Data2D.

Definition at line 527 of file Data.h.

◆ set_error() [1/2]

void cbl::data::Data::set_error ( const std::vector< double >  error)

set interval variable m_error_fx

Parameters
errorstd::vector containing data standard deviation

Definition at line 144 of file Data.cpp.

◆ set_error() [2/2]

void cbl::data::Data::set_error ( const std::vector< std::vector< double >>  covariance)

set interval variable m_error_fx

Parameters
covariancestd::vector containing the covariance matrix

Definition at line 154 of file Data.cpp.

◆ set_extra_info()

virtual void cbl::data::Data::set_extra_info ( const std::vector< std::vector< double >>  extra_info)
inlinevirtual

set interval variable m_error_fx

Parameters
extra_infostd::vector containing std::vectors with extra information

Reimplemented in cbl::data::Data1D_extra, and cbl::data::Data2D_extra.

Definition at line 543 of file Data.h.

◆ set_xx() [1/3]

virtual void cbl::data::Data::set_xx ( const int  i,
const std::vector< double >  x 
)
inlinevirtual

set interval variable m_x in the i-th dataset, for Data1D_collection

Parameters
iindex to the i-th dataset
xstd::vector containing x points

Reimplemented in cbl::data::Data1D_collection.

Definition at line 506 of file Data.h.

◆ set_xx() [2/3]

virtual void cbl::data::Data::set_xx ( const std::vector< double >  x)
inlinevirtual

set interval variable m_x

Parameters
xstd::vector containing x points

Reimplemented in cbl::data::Data2D, and cbl::data::Data1D.

Definition at line 490 of file Data.h.

◆ set_xx() [3/3]

virtual void cbl::data::Data::set_xx ( const std::vector< std::vector< double >>  x)
inlinevirtual

set interval variable m_x, for Data1D_collection

Parameters
xstd::vector containing x points

Definition at line 513 of file Data.h.

◆ set_yy()

virtual void cbl::data::Data::set_yy ( const std::vector< double >  y)
inlinevirtual

set interval variable m_y, for Data2D

Parameters
ystd::vector containing y points

Reimplemented in cbl::data::Data2D.

Definition at line 497 of file Data.h.

◆ write() [1/3]

virtual void cbl::data::Data::write ( const std::string  dir,
const std::string  file,
const std::string  header,
const bool  full,
const int  prec = 10,
const int  ww = 8,
const int  rank = 0 
) const
inlinevirtual

write the data

Parameters
diroutput directory
fileoutput file
headertext with the variable names to be written at the first line of the output file
fullfalse → simply store the data; true → duplicate the data in the other three quadrands (usefull e.g. when storing the 2D correlation function)
precthe float precision
wwnumber of characters to be used as field width
rankcpu index (for MPI usage)

Reimplemented in cbl::data::Data2D_extra, and cbl::data::Data2D.

Definition at line 764 of file Data.h.

◆ write() [2/3]

virtual void cbl::data::Data::write ( const std::string  dir,
const std::string  file,
const std::string  header,
const int  prec = 4,
const int  ww = 8,
const int  rank = 0 
) const
inlinevirtual

write the data

Parameters
diroutput directory
fileoutput file
headertext with the variable names to be written at the first line of the output file
precthe float precision
wwnumber of characters to be used as field width
rankcpu index (for MPI usage)

Reimplemented in cbl::data::Data1D_extra, cbl::data::Data1D_collection, and cbl::data::Data1D.

Definition at line 748 of file Data.h.

◆ write() [3/3]

virtual void cbl::data::Data::write ( const std::string  dir,
const std::vector< std::string >  files,
const std::string  header,
const int  prec = 10,
const int  ww = 8,
const int  rank = 0 
) const
inlinevirtual

write the data

Parameters
diroutput directory
filesoutput file
headertext with the variable names to be written at the first line of the output file
precthe float precision
wwnumber of characters to be used as field width
rankcpu index (for MPI usage)

Reimplemented in cbl::data::Data1D_collection.

Definition at line 777 of file Data.h.

◆ write_covariance()

virtual void cbl::data::Data::write_covariance ( const std::string  dir,
const std::string  file,
const int  precision = 10 
) const
inlinevirtual

write the interval variable m_covariance on a file,

Parameters
dirthe output directory
filethe output file
precisionthe float precision

Reimplemented in cbl::data::Data2D, cbl::data::Data1D_collection, and cbl::data::Data1D.

Definition at line 786 of file Data.h.

◆ xsize() [1/2]

virtual int cbl::data::Data::xsize ( ) const
inlinevirtual

get the number of points along x

Returns
the number of points along x

Reimplemented in cbl::data::Data2D, and cbl::data::Data1D.

Definition at line 626 of file Data.h.

◆ xsize() [2/2]

virtual int cbl::data::Data::xsize ( const int  i) const
inlinevirtual

get the number of points along x

Parameters
iindex to the i-th dataset
Returns
the number of points along x

Reimplemented in cbl::data::Data1D_collection.

Definition at line 634 of file Data.h.

◆ xx() [1/3]

virtual std::vector<double> cbl::data::Data::xx ( ) const
inlinevirtual

get the x std::vector

Returns
the x std::vector

Reimplemented in cbl::data::Data2D, and cbl::data::Data1D.

Definition at line 299 of file Data.h.

◆ xx() [2/3]

virtual double cbl::data::Data::xx ( const int  i) const
inlinevirtual

get value of x at index i

Parameters
iindex
Returns
the value of the m_x std::vector at position i

Reimplemented in cbl::data::Data2D, and cbl::data::Data1D.

Definition at line 292 of file Data.h.

◆ xx() [3/3]

virtual double cbl::data::Data::xx ( const int  i,
const int  j 
) const
inlinevirtual

get value of x at position i,j, for Data1D_collection

Parameters
iindex
jindex
Returns
the value of the m_x std::vector at position i,j

Reimplemented in cbl::data::Data1D_collection.

Definition at line 308 of file Data.h.

◆ ysize()

virtual int cbl::data::Data::ysize ( ) const
inlinevirtual

get the number of points along y

Returns
the number of points along y

Reimplemented in cbl::data::Data2D.

Definition at line 641 of file Data.h.

◆ yy() [1/2]

virtual std::vector<double> cbl::data::Data::yy ( ) const
inlinevirtual

get the y std::vector

Returns
the y std::vector

Reimplemented in cbl::data::Data2D.

Definition at line 323 of file Data.h.

◆ yy() [2/2]

virtual double cbl::data::Data::yy ( const int  i) const
inlinevirtual

get value of y at index i, for Data2D

Parameters
iindex
Returns
the value of the m_y std::vector at position i

Reimplemented in cbl::data::Data2D.

Definition at line 316 of file Data.h.


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