IMP.bff
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
DecayCurve Class Reference

Class for fluorescence decay curves. More...

#include <DecayCurve.h>

Collaboration diagram for DecayCurve:
Collaboration graph

Public Member Functions

size_t size () const
 Get the size of the curve.
 
bool empty ()
 Check if the curve is empty.
 
std::vector< double > get_dx ()
 Get the x-value differences.
 
void resize (size_t n, double v=0.0, double dx=1.0)
 Resize the curve.
 
double get_average_dx ()
 Get the average x-value difference.
 
std::vector< double > & get_x ()
 Get the x-values of the curve.
 
void set_x (const std::vector< double > &v)
 
void set_x (double *input, int n_input)
 Sets the x values of the decay curve.
 
std::vector< double > & get_y ()
 Returns the y values of the decay curve.
 
void set_y (std::vector< double > &v)
 Sets the y values of the decay curve.
 
void set_y (double *input, int n_input)
 Sets the y values of the decay curve.
 
std::vector< double > & get_ey ()
 Returns the error values of the decay curve.
 
void set_ey (std::vector< double > &v)
 Sets the error values of the decay curve.
 
void set_ey (double *input, int n_input)
 Sets the error values of the decay curve.
 
void set_acquisition_time (double v)
 Sets the acquisition time of the decay curve.
 
double get_acquisition_time () const
 Returns the acquisition time of the decay curve.
 
void set_shift (double v)
 Sets the time shift of the decay curve.
 
double get_shift ()
 Returns the time shift of the decay curve.
 
std::string get_json () const
 Returns the JSON representation of the decay curve.
 
int read_json (std::string json_string)
 Reads the decay curve from a JSON string.
 
 DecayCurve (std::vector< double > x=std::vector< double >(), std::vector< double > y=std::vector< double >(), std::vector< double > ey=std::vector< double >(), double acquisition_time=std::numeric_limits< double >::max(), int noise_model=NOISE_POISSON, int size=-1)
 
double sum (int start=0, int stop=-1)
 Calculates the sum of y values within a given range.
 
void apply_simple_moving_average (int start, int stop, int n_window=5, bool normalize=false)
 Applies a simple moving average (SMA) filter to the data.
 
DecayCurveoperator+ (double v) const
 Overloads the addition operator to add a constant value to the decay curve.
 
DecayCurveoperator- (double v) const
 Overloads the subtraction operator to subtract a constant value from the decay curve.
 
DecayCurveoperator* (double v) const
 Overloads the multiplication operator to multiply the decay curve by a constant value.
 
DecayCurveoperator/ (double v) const
 Overloads the division operator to divide the decay curve by a constant value.
 
DecayCurveoperator+= (double v)
 Adds a value to the decay curve.
 
DecayCurveoperator-= (double v)
 Subtracts a value from the decay curve.
 
DecayCurveoperator*= (double v)
 Multiplies the decay curve by a value.
 
DecayCurveoperator/= (double v)
 Divides the decay curve by a value.
 
DecayCurveoperator+ (const DecayCurve &other) const
 Overloads the '+' operator to add two DecayCurve objects.
 
DecayCurveoperator- (const DecayCurve &other) const
 Overloads the '-' operator to subtract two DecayCurve objects.
 
DecayCurveoperator* (const DecayCurve &other) const
 Overloads the '*' operator to multiply two DecayCurve objects.
 
DecayCurveoperator/ (const DecayCurve &other) const
 Overloads the '/' operator to divide two DecayCurve objects.
 
DecayCurveoperator= (const DecayCurve &other)
 Assignment operator.
 
DecayCurveoperator<< (double v)
 Shifts the curve by a float value.
 

Static Public Member Functions

static std::vector< double > shift_array (double *input, int n_input, double shift)
 Shift an array by a given value.
 

Detailed Description

Class for fluorescence decay curves.

This class represents fluorescence decay curves. It stores the x-values, y-values, and error values of the curve. It also provides various operations and transformations on the curve.

Constructor & Destructor Documentation

◆ DecayCurve()

DecayCurve::DecayCurve ( std::vector< double >  x = std::vector< double >(),
std::vector< double >  y = std::vector< double >(),
std::vector< double >  ey = std::vector< double >(),
double  acquisition_time = std::numeric_limits< double >::max(),
int  noise_model = NOISE_POISSON,
int  size = -1 
)

Member Function Documentation

◆ apply_simple_moving_average()

void DecayCurve::apply_simple_moving_average ( int  start,
int  stop,
int  n_window = 5,
bool  normalize = false 
)

Applies a simple moving average (SMA) filter to the data.

Parameters
startThe start index.
stopThe stop index.
n_windowThe window size for the SMA filter.
normalizeFlag indicating whether to normalize the filtered data.

◆ empty()

bool DecayCurve::empty ( )

Check if the curve is empty.

This function checks if the curve is empty, i.e., it has no data points.

Returns
True if the curve is empty, false otherwise

◆ get_acquisition_time()

double DecayCurve::get_acquisition_time ( ) const

Returns the acquisition time of the decay curve.

Returns
The acquisition time.

◆ get_average_dx()

double DecayCurve::get_average_dx ( )

Get the average x-value difference.

This function returns the average difference between consecutive x-values.

Returns
The average x-value difference

◆ get_dx()

std::vector< double > DecayCurve::get_dx ( )

Get the x-value differences.

This function returns the differences between consecutive x-values.

Returns
The x-value differences

◆ get_ey()

std::vector< double > & DecayCurve::get_ey ( )

Returns the error values of the decay curve.

Returns
The error values.

◆ get_json()

std::string DecayCurve::get_json ( ) const

Returns the JSON representation of the decay curve.

Returns
The JSON string.

◆ get_shift()

double DecayCurve::get_shift ( )

Returns the time shift of the decay curve.

Returns
The time shift.

◆ get_x()

std::vector< double > & DecayCurve::get_x ( )

Get the x-values of the curve.

This function returns the x-values of the curve.

Returns
The x-values of the curve

◆ get_y()

std::vector< double > & DecayCurve::get_y ( )

Returns the y values of the decay curve.

Returns
The y values.

◆ operator*() [1/2]

DecayCurve & DecayCurve::operator* ( const DecayCurve other) const

Overloads the '*' operator to multiply two DecayCurve objects.

Parameters
otherThe DecayCurve object to be multiplied.
Returns
A new DecayCurve object that is the result of the multiplication.

◆ operator*() [2/2]

DecayCurve & DecayCurve::operator* ( double  v) const

Overloads the multiplication operator to multiply the decay curve by a constant value.

Parameters
vThe constant value to be multiplied by.
Returns
A new DecayCurve object representing the result of the multiplication.

◆ operator*=()

DecayCurve & DecayCurve::operator*= ( double  v)

Multiplies the decay curve by a value.

Parameters
vThe value to be multiplied by.
Returns
A reference to the modified DecayCurve object.

◆ operator+() [1/2]

DecayCurve & DecayCurve::operator+ ( const DecayCurve other) const

Overloads the '+' operator to add two DecayCurve objects.

Parameters
otherThe DecayCurve object to be added.
Returns
A new DecayCurve object that is the result of the addition.

◆ operator+() [2/2]

DecayCurve & DecayCurve::operator+ ( double  v) const

Overloads the addition operator to add a constant value to the decay curve.

Parameters
vThe constant value to be added.
Returns
A new DecayCurve object representing the result of the addition.

◆ operator+=()

DecayCurve & DecayCurve::operator+= ( double  v)

Adds a value to the decay curve.

Parameters
vThe value to be added.
Returns
A reference to the modified DecayCurve object.

◆ operator-() [1/2]

DecayCurve & DecayCurve::operator- ( const DecayCurve other) const

Overloads the '-' operator to subtract two DecayCurve objects.

Parameters
otherThe DecayCurve object to be subtracted.
Returns
A new DecayCurve object that is the result of the subtraction.

◆ operator-() [2/2]

DecayCurve & DecayCurve::operator- ( double  v) const

Overloads the subtraction operator to subtract a constant value from the decay curve.

Parameters
vThe constant value to be subtracted.
Returns
A new DecayCurve object representing the result of the subtraction.

◆ operator-=()

DecayCurve & DecayCurve::operator-= ( double  v)

Subtracts a value from the decay curve.

Parameters
vThe value to be subtracted.
Returns
A reference to the modified DecayCurve object.

◆ operator/() [1/2]

DecayCurve & DecayCurve::operator/ ( const DecayCurve other) const

Overloads the '/' operator to divide two DecayCurve objects.

Parameters
otherThe DecayCurve object to be divided.
Returns
A new DecayCurve object that is the result of the division.

◆ operator/() [2/2]

DecayCurve & DecayCurve::operator/ ( double  v) const

Overloads the division operator to divide the decay curve by a constant value.

Parameters
vThe constant value to be divided by.
Returns
A new DecayCurve object representing the result of the division.

◆ operator/=()

DecayCurve & DecayCurve::operator/= ( double  v)

Divides the decay curve by a value.

Parameters
vThe value to be divided by.
Returns
A reference to the modified DecayCurve object.

◆ operator<<()

DecayCurve & DecayCurve::operator<< ( double  v)

Shifts the curve by a float value.

Parameters
vThe value to shift the curve by.
Returns
A reference to the modified DecayCurve object.

◆ operator=()

DecayCurve & DecayCurve::operator= ( const DecayCurve other)

Assignment operator.

Parameters
otherThe DecayCurve object to be assigned.
Returns
A reference to the assigned DecayCurve object.

◆ read_json()

int DecayCurve::read_json ( std::string  json_string)

Reads the decay curve from a JSON string.

Parameters
json_stringThe JSON string.
Returns
0 if successful, -1 otherwise.

◆ resize()

void DecayCurve::resize ( size_t  n,
double  v = 0.0,
double  dx = 1.0 
)

Resize the curve.

This function resizes the curve to a given size. If the new size is larger than the current size, the new elements are initialized with a given value.

Parameters
nThe new size of the curve
vThe value to initialize the new elements with (default: 0.0)
dxThe x-value difference (default: 1.0)

◆ set_acquisition_time()

void DecayCurve::set_acquisition_time ( double  v)

Sets the acquisition time of the decay curve.

Parameters
vThe acquisition time.

◆ set_ey() [1/2]

void DecayCurve::set_ey ( double *  input,
int  n_input 
)

Sets the error values of the decay curve.

Parameters
inputThe array of error values.
n_inputThe number of error values.

◆ set_ey() [2/2]

void DecayCurve::set_ey ( std::vector< double > &  v)

Sets the error values of the decay curve.

Parameters
vThe error values.

◆ set_shift()

void DecayCurve::set_shift ( double  v)

Sets the time shift of the decay curve.

Parameters
vThe time shift.

◆ set_x() [1/2]

void DecayCurve::set_x ( const std::vector< double > &  v)

◆ set_x() [2/2]

void DecayCurve::set_x ( double *  input,
int  n_input 
)

Sets the x values of the decay curve.

Parameters
inputThe array of x values.
n_inputThe number of x values.

◆ set_y() [1/2]

void DecayCurve::set_y ( double *  input,
int  n_input 
)

Sets the y values of the decay curve.

Parameters
inputThe array of y values.
n_inputThe number of y values.

◆ set_y() [2/2]

void DecayCurve::set_y ( std::vector< double > &  v)

Sets the y values of the decay curve.

Parameters
vThe y values.

◆ shift_array()

static std::vector< double > DecayCurve::shift_array ( double *  input,
int  n_input,
double  shift 
)
static

Shift an array by a given value.

This static function shifts the elements of an array by a given value.

Parameters
inputThe input array
n_inputThe size of the input array
shiftThe shift value
Returns
The shifted array

◆ size()

size_t DecayCurve::size ( ) const

Get the size of the curve.

This function returns the size of the curve, i.e., the number of data points.

Returns
The size of the curve

◆ sum()

double DecayCurve::sum ( int  start = 0,
int  stop = -1 
)

Calculates the sum of y values within a given range.

Parameters
startThe start index.
stopThe stop index.
Returns
The sum of y values.

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