Obsidian
Probabilistic Geophysical Joint Inversion
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
obsidian::io Namespace Reference

Namespaces

 csv
 For reading and writing csv files.
 

Classes

class  NpzWriter
 Used for writing to an NPZ file. More...
 

Functions

void writeNPY (const Eigen::MatrixXd &matrix, const std::string &filename)
 
Eigen::MatrixXd readNPY (const std::string &filename)
 Read from an NPY file containing a single floating point matrix. More...
 
Eigen::MatrixXi readNPYi (const std::string &filename)
 Read from an NPY file containing a single integer matrix. More...
 
Eigen::MatrixXcd readNPYc (const std::string &filename)
 Read from an NPY file containing a single complex matrix. More...
 
Eigen::MatrixXd readNPZ (const std::string &filename, const std::string &key)
 Read from a specific key of an NPZ file containing a single floating point matrix. More...
 
void writeNPZ (const std::string &filename, const std::map< std::string, Eigen::MatrixXd > &mats, bool overwrite)
 
void writeNPY (const std::string &filename, const Eigen::MatrixXd &matrix)
 
std::vector< std::string > & split (const std::string &s, const char delim, std::vector< std::string > &elems)
 
std::vector< std::string > split (const std::string &stringToSplit, const char delimiterForSplitting= ' ')
 Split string. More...
 
std::string join (const std::vector< std::string > &stringArray, const std::string glue=" ")
 Concatenate String. More...
 
template<typename ValueType >
ValueType from_string (const std::string &stringToParse)
 Parse value from string.
 
template<typename ValueType >
std::string to_string (const ValueType &v)
 Convert Value to String.
 
template<typename ValueType , typename... Vr>
std::string to_string (const ValueType &v, Vr...vr)
 Convert Value to String.
 
template<>
std::string to_string< bool > (const bool &v)
 Convert bool to string.
 
template<>
std::string to_string< float > (const float &v)
 Convert float to string with 10 significant digits.
 
template<>
std::string to_string< double > (const double &v)
 Convert double to string with 20 significant digits.
 
template<>
std::string to_string< long double > (const long double &v)
 Convert long double to string with 40 significant digits.
 

Detailed Description

Namespace for input output functions.

Function Documentation

std::string obsidian::io::join ( const std::vector< std::string > &  stringArray,
const std::string  glue = " " 
)

Concatenate String.

Returns
concatenated string
Eigen::MatrixXd obsidian::io::readNPY ( const std::string &  filename)

Read from an NPY file containing a single floating point matrix.

Parameters
filenameThe name of the file.
Returns
The matrix from the file.
Eigen::MatrixXcd obsidian::io::readNPYc ( const std::string &  filename)

Read from an NPY file containing a single complex matrix.

Parameters
filenameThe name of the file.
Returns
The matrix from the file.
Eigen::MatrixXi obsidian::io::readNPYi ( const std::string &  filename)

Read from an NPY file containing a single integer matrix.

Parameters
filenameThe name of the file.
Returns
The matrix from the file.
Eigen::MatrixXd obsidian::io::readNPZ ( const std::string &  filename,
const std::string &  key 
)

Read from a specific key of an NPZ file containing a single floating point matrix.

Parameters
filenameThe name of the file.
keyThe key for the matrix.
Returns
The matrix from the file.
std::vector< std::string > obsidian::io::split ( const std::string &  stringToSplit,
const char  delimiterForSplitting = ' ' 
)

Split string.

Returns
Split String; ignores empty tokens
void obsidian::io::writeNPY ( const std::string &  filename,
const Eigen::MatrixXd &  matrix 
)

Write to a NPY file. This type of a file stores a single matrix.

Parameters
filenameThe name of the file
matrixThe matrix to store
void obsidian::io::writeNPZ ( const std::string &  filename,
const std::map< std::string, Eigen::MatrixXd > &  mats,
bool  overwrite = false 
)

Write to a NPZ file. This type of files can have multiple matrices stored as one file. The matrices are indexed by name.

Parameters
filenameThe name of the NPZ file
matsA map containing keys and their corresponding matrices
overwriteWhether to overwrite any existing file with same filename