eisgenerator 1.0.x
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | List of all members
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 an 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 an 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 an 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 an EisSpectra.
 
 EisSpectra (const std::filesystem::path &path)
 Constructs a EisSpectra by loading an EIS file from disk.
 
void setLabel (size_t label, size_t maxLabel)
 Sets all input values up to a maximum given by maxLabel to the value given by label.
 
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.
 

Public Attributes

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 an 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 an 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 an 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 an 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 an 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.

This function has the attribute [[nodiscard]]

Exceptions
eis::file_errorif there is an error loading the file
Parameters
pathThe path to the file.
Returns
The EisSpectra parsed from the file.

Referenced by EisSpectra().

◆ loadFromStream()

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

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

This function has the attribute [[nodiscard]]

Exceptions
eis::file_errorif there is an error loading the file
Parameters
streamThe stream that contains the EIS file.
Returns
The EisSpectra parsed from the stream.

◆ 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 )

Sets all input values up to a maximum given by maxLabel to the value given by label.

Parameters
labelThe value to apply to all inputs.
maxLabelThe maximum number of values to set.

◆ 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.