librelaxisloader 1.0.x
Data Structures | Functions
User API

API for use by librelaxisloader users. More...

Data Structures

struct  rlx_project
 This struct represents a RelaxIS "project" containing any number of spectra. More...
 
struct  rlx_datapoint
 This struct is used to house a single impedance data point. More...
 
struct  rlx_spectra
 This struct is used to house an EIS spectra and associated meta-data. More...
 
struct  rlx_fitparam
 

Functions

void rlx_project_free (struct rlx_project *proj)
 This frees a project struct.
 
void rlx_project_free_array (struct rlx_project **proj_array)
 This frees an array of project structs.
 
void rlx_spectra_free (struct rlx_spectra *spectra)
 This frees a spectra struct.
 
void rlx_spectra_free_array (struct rlx_spectra **spectra_array)
 Frees an array of spectra structs.
 
void rlx_fitparam_free (struct rlx_fitparam *param)
 Frees a fitparam struct.
 
void rlx_fitparam_free_array (struct rlx_fitparam **param_array)
 Frees an array of fitparam structs.
 
struct rlxfile * rlx_open_file (const char *path, const char **error)
 Frees a project struct.
 
void rlx_close_file (struct rlxfile *file)
 
struct rlx_project ** rlx_get_projects (struct rlxfile *file, size_t *length)
 Gets all the projects in a given RelaxIS file.
 
struct rlx_spectra ** rlx_get_all_spectra (struct rlxfile *file, const struct rlx_project *project)
 Loads all spectra from file in given project.
 
int * rlx_get_spectra_ids (struct rlxfile *file, const struct rlx_project *project, size_t *length)
 Loads spectra ids that are associated with a given project.
 
struct rlx_spectrarlx_get_spectra (struct rlxfile *file, const struct rlx_project *project, int id)
 Loads spectra with a given spectra id and project from file.
 
int rlx_get_float_arrays (const struct rlx_spectra *spectra, float **re, float **im, float **omega)
 transforms a rlx_spectra struct into a set of newly allocated arrays, float version.
 
int rlx_get_double_arrays (const struct rlx_spectra *spectra, double **re, double **im, double **omega)
 transforms a rlx_spectra struct into a set of newly allocated arrays, double version.
 
struct rlx_fitparam ** rlx_get_fit_parameters (struct rlxfile *file, const struct rlx_project *project, int id, size_t *length)
 Loads the parameters for a given spectra id from file.
 
int rlx_get_errnum (const struct rlxfile *file)
 Returns the last error returned on a file operation.
 
const char * rlx_get_errnum_str (int errnum)
 Returns a human readable error string for a given error number.
 

Detailed Description

API for use by librelaxisloader users.

This API allows you to load RelaxIS files and get the data therein

Function Documentation

◆ rlx_fitparam_free()

void rlx_fitparam_free ( struct rlx_fitparam * param)

Frees a fitparam struct.

Parameters
fitparamfitparam struct to be freed

◆ rlx_fitparam_free_array()

void rlx_fitparam_free_array ( struct rlx_fitparam ** param_array)

Frees an array of fitparam structs.

Parameters
param_arrayarray of fitparam structs to be freed

◆ rlx_get_all_spectra()

struct rlx_spectra ** rlx_get_all_spectra ( struct rlxfile * file,
const struct rlx_project * project )

Loads all spectra from file in given project.

If this function encounters an error it will return NULL and set an error at rlx_get_errnum.

Parameters
filefile to load spectra from
projectproject to load spectra from
Returns
A NULL terminated array of spectra structs will be allocated here, to be freed with rlx_spectra_free_array, or NULL on error

◆ rlx_get_double_arrays()

int rlx_get_double_arrays ( const struct rlx_spectra * spectra,
double ** re,
double ** im,
double ** omega )

transforms a rlx_spectra struct into a set of newly allocated arrays, double version.

If this function encounters an error it will return NULL and set an error at rlx_get_errnum.

Parameters
spectrathe spectra to convert
rean array with the real part of the spectra will be allocated here. To be freed by free().
iman array with the imaginary part of the spectra will be allocated here. To be freed by free().
omegaan array with the omega values of the spectra will be allocated here. To be freed by free().
Returns
0 if successful or an error number < 0 interpertable by rlx_get_errnum_str otherwise, no allocations will be performed on error.

◆ rlx_get_errnum()

int rlx_get_errnum ( const struct rlxfile * file)

Returns the last error returned on a file operation.

Returns
relaxisloader error number

◆ rlx_get_errnum_str()

const char * rlx_get_errnum_str ( int errnum)

Returns a human readable error string for a given error number.

Returns
Error string, static lifetime, owned by librelaxisloader do not free

◆ rlx_get_fit_parameters()

struct rlx_fitparam ** rlx_get_fit_parameters ( struct rlxfile * file,
const struct rlx_project * project,
int id,
size_t * length )

Loads the parameters for a given spectra id from file.

If this function encounters an error it will return NULL and set an error at rlx_get_errnum.

Parameters
filefile to load spectra from
projectproject to load spectra from
idspectra id for which to load parameters
lengtha pointer to a size_t where the number of parameters will be stored, or NULL
Returns
A NULL terminated array of rlx_fitparam structs will be allocated here, to be freed with rlx_fitparam_free_array, or NULL on error

◆ rlx_get_float_arrays()

int rlx_get_float_arrays ( const struct rlx_spectra * spectra,
float ** re,
float ** im,
float ** omega )

transforms a rlx_spectra struct into a set of newly allocated arrays, float version.

If this function encounters an error it will return NULL and set an error at rlx_get_errnum.

Parameters
spectrathe spectra to convert
rean array with the real part of the spectra will be allocated here. To be freed by free().
iman array with the imaginary part of the spectra will be allocated here. To be freed by free().
omegaan array with the omega values of the spectra will be allocated here. To be freed by free().
Returns
0 if successful or an error number < 0 interpertable by rlx_get_errnum_str otherwise, no allocations will be performed on error.

◆ rlx_get_projects()

struct rlx_project ** rlx_get_projects ( struct rlxfile * file,
size_t * length )

Gets all the projects in a given RelaxIS file.

If this function encounters an error it will return NULL and set an error at rlx_get_errnum.

Parameters
filefile to load projects from
lengthpointer to a size_t where the number of projects will be stored, or NULL
Returns
A NULL terminated array of project structs will be allocated here, to be freed with rlx_project_free_array, or NULL on error

◆ rlx_get_spectra()

struct rlx_spectra * rlx_get_spectra ( struct rlxfile * file,
const struct rlx_project * project,
int id )

Loads spectra with a given spectra id and project from file.

If this function encounters an error it will return NULL and set an error at rlx_get_errnum.

Parameters
filefile to load spectra from
projectproject to load spectra from
idspectra id to load
Returns
spectra struct or NULL if unsuccessful, to be freed with rlx_spectra_free

◆ rlx_get_spectra_ids()

int * rlx_get_spectra_ids ( struct rlxfile * file,
const struct rlx_project * project,
size_t * length )

Loads spectra ids that are associated with a given project.

If this function encounters an error it will return NULL and set an error at rlx_get_errnum.

Parameters
filefile to load spectra from
projectproject to load spectra from
idspectra id for which to load parameters
lengthpointer to size_t where the number of ids will be stored or NULL
Returns
A a newly allocated array of integers with the ids, to be freed with free(), or NULL on error

◆ rlx_open_file()

struct rlxfile * rlx_open_file ( const char * path,
const char ** error )

Frees a project struct.

Parameters
paththe file system path where the file shall be opened
errorif an error occurs and NULL is returned, pointer to an error string is set here, owned by librelaxisloader, do not free, valid only until next call to librelaxisloader
Returns
a rlxfile struct or NULL if opening was unsuccessful, to be closed with rlx_close_file

◆ rlx_project_free()

void rlx_project_free ( struct rlx_project * proj)

This frees a project struct.

This function must always be used for every singular rlx_project struct to avoid memory leaks. It is safe to pass NULL to this function.

Parameters
projthe Project struct to be freed, or NULL.

◆ rlx_project_free_array()

void rlx_project_free_array ( struct rlx_project ** proj_array)

This frees an array of project structs.

This function must always be used for array of rlx_project structs to avoid memory leaks.

Parameters
proj_arrayThe Array of project structs to be freed.

◆ rlx_spectra_free()

void rlx_spectra_free ( struct rlx_spectra * spectra)

This frees a spectra struct.

This function must always be used for every singular rlx_spectra struct to avoid memory leaks. It is safe to pass NULL to this function.

Parameters
spectraThe spectra to be freed.

◆ rlx_spectra_free_array()

void rlx_spectra_free_array ( struct rlx_spectra ** spectra_array)

Frees an array of spectra structs.

This function must always be used for every array of rlx_spectra structs to avoid memory leaks.

Parameters
spectra_arrayThe array of spectra structs to be freed.