eisgenerator 1.0.x
Public Member Functions | Static Public Member Functions | Data Fields | Static Public Attributes
eis::EisSpectra Class Reference

Public Member Functions

 EisSpectra (const std::vector< DataPoint > &data, const std::string &model, const std::string &header, std::vector< double > labels=std::vector< double >(), std::vector< std::string > labelNames=std::vector< std::string >())
 Constructs a EisSpectra.
 
 EisSpectra (const std::vector< DataPoint > &data, const std::string &model, const std::string &header, std::vector< float > labels, std::vector< std::string > labelNames=std::vector< std::string >())
 Constructs a EisSpectra this function differs from the above only in the datatype of the label.
 
 EisSpectra (const std::vector< DataPoint > &data, const std::string &model, const std::string &header, std::vector< size_t > labels, std::vector< std::string > labelNames=std::vector< std::string >())
 Constructs a EisSpectra this function differs from the above only in the datatype of the label.
 
 EisSpectra (const std::vector< DataPoint > &data, const std::string &model, const std::string &header, size_t label, size_t maxLabel, std::vector< std::string > labelNames=std::vector< std::string >())
 Constructs a EisSpectra this function differs from the above only in the datatype of the label.
 
 EisSpectra (const std::filesystem::path &path)
 Constructs a EisSpectra by loading a EIS file from disk.
 
void setLabel (size_t label, size_t maxLabel)
 Constructs a EisSpectra by loading a EIS file from a stream.
 
size_t getLabel ()
 Gets the input value of this model, where it is a single value.
 
void setSzLabels (std::vector< size_t > label)
 Sets the input values of this model.
 
void setLabels (const std::vector< double > &labelsIn)
 Sets the input values of this model.
 
void setLabels (const std::vector< float > &labelsIn)
 Sets the input values of this model.
 
std::vector< size_t > getSzLabels () const
 Sets the input values of this model.
 
bool isMulticlass ()
 Returns true if there are multiple inputs, false otherwise.
 
std::vector< fvalue > getFvalueLabels ()
 Returns the inputs as a vector.
 
bool saveToDisk (const std::filesystem::path &path) const
 Saves the spectra to disk.
 
void saveToStream (std::ostream &stream) const
 Saves the spectra in the given stream.
 

Static Public Member Functions

static EisSpectra loadFromDisk (const std::filesystem::path &path)
 Constructs a EisSpectra by loading a EIS file from disk.
 
static EisSpectra loadFromStream (std::istream &stream)
 Constructs a EisSpectra by loading a EIS file from a stream.
 

Data Fields

std::vector< DataPointdata
 
std::string model
 
std::string header
 
std::vector< double > labels
 
std::vector< std::string > labelNames
 

Static Public Attributes

static constexpr int F_VERSION_MAJOR = 1
 
static constexpr int F_VERSION_MINOR = 0
 
static constexpr int F_VERSION_PATCH = 0
 
static constexpr char F_MAGIC [] = "EISF"
 

Detailed Description

Examples
compileing.cpp, and simple.cpp.

Constructor & Destructor Documentation

◆ EisSpectra() [1/5]

eis::EisSpectra::EisSpectra ( const std::vector< DataPoint > &  data,
const std::string &  model,
const std::string &  header,
std::vector< double >  labels = std::vector< double >(),
std::vector< std::string >  labelNames = std::vector< std::string >() 
)

Constructs a EisSpectra.

Parameters
datavector of the data points of the spectra
modelmodel description string for this spectra
headera free-form text that will be included in any save of this spectra
labelsan optional vector of giving the values of the inputs of the model to get this spectra
labelNamesan optional vector of names describing every input of the model

◆ EisSpectra() [2/5]

eis::EisSpectra::EisSpectra ( const std::vector< DataPoint > &  data,
const std::string &  model,
const std::string &  header,
std::vector< float >  labels,
std::vector< std::string >  labelNames = std::vector< std::string >() 
)

Constructs a EisSpectra this function differs from the above only in the datatype of the label.

Parameters
datavector of the data points of the spectra
modelmodel description string for this spectra
headera free-form text that will be included in any save of this spectra
labelsan optional vector of giving the values of the inputs of the model to get this spectra
labelNamesan optional vector of names describing every input of the model

◆ EisSpectra() [3/5]

eis::EisSpectra::EisSpectra ( const std::vector< DataPoint > &  data,
const std::string &  model,
const std::string &  header,
std::vector< size_t >  labels,
std::vector< std::string >  labelNames = std::vector< std::string >() 
)

Constructs a EisSpectra this function differs from the above only in the datatype of the label.

Parameters
datavector of the data points of the spectra
modelmodel description string for this spectra
headera free-from text that will be included in any save of this spectra
labelsan optional vector of giving the values of the inputs of the model to get this spectra
labelNamesan optional vector of names describing every input of the model

◆ EisSpectra() [4/5]

eis::EisSpectra::EisSpectra ( const std::vector< DataPoint > &  data,
const std::string &  model,
const std::string &  header,
size_t  label,
size_t  maxLabel,
std::vector< std::string >  labelNames = std::vector< std::string >() 
)

Constructs a EisSpectra this function differs from the above only in the datatype of the label.

Parameters
datavector of the data points of the spectra
modelmodel description string for this spectra
headera free-form text that will be included in any save of this spectra
labela value corresponding to all inputs of the model
maxLabelthe number of inputs of the model

◆ EisSpectra() [5/5]

eis::EisSpectra::EisSpectra ( const std::filesystem::path &  path)
inline

Constructs a EisSpectra by loading a EIS file from disk.

Exceptions
eis::file_errorif there is an error loading the file
Parameters
paththe path to the file

References loadFromDisk().

Member Function Documentation

◆ getFvalueLabels()

std::vector< fvalue > eis::EisSpectra::getFvalueLabels ( )

Returns the inputs as a vector.

Returns
the inputs as a vector

◆ getLabel()

size_t eis::EisSpectra::getLabel ( )

Gets the input value of this model, where it is a single value.

Returns
the input value

◆ getSzLabels()

std::vector< size_t > eis::EisSpectra::getSzLabels ( ) const

Sets the input values of this model.

Parameters
labelthe input values

◆ isMulticlass()

bool eis::EisSpectra::isMulticlass ( )

Returns true if there are multiple inputs, false otherwise.

Returns
true if there are multiple inputs, false otherwise

◆ loadFromDisk()

static EisSpectra eis::EisSpectra::loadFromDisk ( const std::filesystem::path &  path)
static

Constructs a EisSpectra by loading a EIS file from disk.

Exceptions
eis::file_errorif there is an error loading the file
Parameters
paththe path to the file
Returns
the EisSpectra

Referenced by EisSpectra().

◆ loadFromStream()

static EisSpectra eis::EisSpectra::loadFromStream ( std::istream &  stream)
static

Constructs a EisSpectra by loading a EIS file from a stream.

Exceptions
eis::file_errorif there is an error loading the file
Parameters
streamthe stream that contains the EIS file
Returns
the EisSpectra

◆ saveToDisk()

bool eis::EisSpectra::saveToDisk ( const std::filesystem::path &  path) const

Saves the spectra to disk.

Parameters
patha path to the file on disk where the spectra shall be saved
Returns
true on success, false on failure
Examples
simple.cpp.

◆ saveToStream()

void eis::EisSpectra::saveToStream ( std::ostream &  stream) const

Saves the spectra in the given stream.

Parameters
streama std::ostream into which the spectra will be saved

◆ setLabel()

void eis::EisSpectra::setLabel ( size_t  label,
size_t  maxLabel 
)

Constructs a EisSpectra by loading a EIS file from a stream.

Parameters
streamthe stream that contains the EIS file
Returns
the EisSpectra

◆ setLabels() [1/2]

void eis::EisSpectra::setLabels ( const std::vector< double > &  labelsIn)

Sets the input values of this model.

Parameters
labelthe input values

◆ setLabels() [2/2]

void eis::EisSpectra::setLabels ( const std::vector< float > &  labelsIn)

Sets the input values of this model.

Parameters
labelthe input values

◆ setSzLabels()

void eis::EisSpectra::setSzLabels ( std::vector< size_t >  label)

Sets the input values of this model.

Parameters
labelthe input values