Stimfit
0.13.15
|
Classes | |
struct | stf::parInfo |
Information about parameters used in storedFunc. More... | |
struct | stf::storedFunc |
Function used for least-squares fitting. More... | |
class | Channel |
A Channel contains several data Sections representing observations of the same physical quantity. More... | |
class | Recording |
Represents the data within a file. More... | |
class | Section |
Represents a continuously sampled sweep of data points. More... | |
class | stf::wxProgressInfo |
Progress Info interface adapter; maps to wxProgressDialog. More... | |
class | stf::Table |
A table used for printing information. More... | |
struct | stf::UserInput |
Represents user input from dialogs that can be used in plugins. More... | |
struct | stf::Plugin |
User-defined plugin. More... | |
struct | stf::Extension |
User-defined Python extension. More... | |
struct | stf::ifstreamMan |
Resource manager for ifstream objects. More... | |
struct | stf::ofstreamMan |
Resource manager for ofstream objects. More... | |
class | stf::Event |
Describes the attributes of an event. More... | |
struct | stf::PyMarker |
A marker that can be set from Python. More... | |
struct | stf::SectionAttributes |
struct | stf::SectionPointer |
Typedefs | |
typedef boost::function < double(double, const Vector_double &)> | stf::Func |
A function taking a double and a vector and returning a double. | |
typedef boost::function < Vector_double(double, const Vector_double &)> | stf::Jac |
The jacobian of a stf::Func. | |
typedef boost::function < double(double, double, double, double, double)> | stf::Scale |
Scaling function for fit parameters. | |
typedef boost::function< Table(const Vector_double &, const std::vector< stf::parInfo > , double)> | stf::Output |
Print the output of a fit into a stf::Table. | |
typedef boost::function< void(const Vector_double &, double, double, double, double, double, Vector_double &)> | stf::Init |
Initialising function for the parameters in stf::Func to start a fit. | |
typedef boost::function < Recording(const Recording &, const Vector_double &, std::map< std::string, double > &)> | stf::PluginFunc |
Get a Recording, do something with it, return the new Recording. | |
Enumerations | |
enum | stf::cursor_type { stf::measure_cursor, stf::peak_cursor, stf::base_cursor, stf::decay_cursor, stf::latency_cursor, stf::zoom_cursor, stf::event_cursor, stf::undefined_cursor } |
Mouse cursor types. More... | |
enum | stf::direction { stf::up, stf::down, stf::both, stf::undefined_direction } |
The direction of peak calculations. More... | |
enum | stf::zoom_channels { stf::zoomch1, stf::zoomch2, stf::zoomboth } |
Determines which channels to scale. More... | |
enum | stf::latency_mode { stf::manualMode = 0, stf::peakMode = 1, stf::riseMode = 2, stf::halfMode = 3, stf::footMode = 4, stf::undefinedMode } |
Latency cursor settings. More... | |
enum | stf::latency_window_mode { stf::defaultMode = 0, stf::windowMode = 1 } |
Latency window settings. More... | |
enum | stf::extraction_mode { stf::criterion, stf::correlation, stf::deconvolution } |
Deconvolution. More... | |
Functions | |
template<typename T > | |
T | stf::linFit (const std::vector< T > &x, const std::vector< T > &y, T &m, T &c) |
Performs a linear fit. | |
double StfDll | stf::lmFit (const Vector_double &data, double dt, const stf::storedFunc &fitFunc, const Vector_double &opts, bool use_scaling, Vector_double &p, std::string &info, int &warning) |
Uses the Levenberg-Marquardt algorithm to perform a non-linear least-squares fit. | |
double | stf::flin (double x, const Vector_double &p) |
Linear function. | |
void | stf::flin_init (const Vector_double &data, double base, double peak, double RTLoHi, double HalfWidth, double dt, Vector_double &pInit) |
Dummy function to be passed to stf::storedFunc for linear functions. | |
stf::storedFunc | stf::initLinFunc () |
initializes a linear function | |
Vector_double | stf::get_scale (Vector_double &data, double oldx) |
Compute and perform normalisation. | |
Vector_double | stf::LM_default_opts () |
Return default LM options. | |
double | stf::base (double &var, const std::vector< double > &data, std::size_t llb, std::size_t ulb) |
Calculate the average of all sampling points between and including llb and ulb. | |
double | stf::peak (const std::vector< double > &data, double base, std::size_t llp, std::size_t ulp, int pM, stf::direction, double &maxT) |
Find the peak value of data between llp and ulp. | |
double | stf::threshold (const std::vector< double > &data, std::size_t llp, std::size_t ulp, double slope, double &thrT, std::size_t windowLength) |
Find the value within data between llp and ulp at which slope is exceeded. | |
double | stf::risetime (const std::vector< double > &data, double base, double ampl, double left, double right, double frac, std::size_t &tLoId, std::size_t &tHiId, double &tLoReal) |
Find 20 to 80% rise time of an event in data. | |
double | stf::risetime2 (const std::vector< double > &data, double base, double ampl, double left, double right, double frac, double &innerTLoReal, double &innerTHiReal, double &outerTLoReal, double &outerTHiReal) |
Find 20 to 80% rise time of an event in data. | |
double | stf::t_half (const std::vector< double > &data, double base, double ampl, double left, double right, double center, std::size_t &t50LeftId, std::size_t &t50RightId, double &t50LeftReal) |
Find the full width at half-maximal amplitude of an event within data. | |
double | stf::maxRise (const std::vector< double > &data, double left, double right, double &maxRiseT, double &maxRiseY, std::size_t windowLength) |
Find the maximal slope during the rising phase of an event within data. | |
double | stf::maxDecay (const std::vector< double > &data, double left, double right, double &maxDecayT, double &maxDecayY, std::size_t windowLength) |
Find the maximal slope during the decaying phase of an event within data. | |
double | stf::fexp (double x, const Vector_double &p) |
Sum of n exponential functions. | |
Vector_double | stf::fexp_jac (double x, const Vector_double &p) |
Computes the Jacobian of stf::fexp(). | |
void | stf::fexp_init (const Vector_double &data, double base, double peak, double RTLoHi, double HalfWidth, double dt, Vector_double &pInit) |
Initialises parameters for fitting stf::fexp() to data. | |
void | stf::fexp_init2 (const Vector_double &data, double base, double peak, double RTLoHi, double HalfWidth, double dt, Vector_double &pInit) |
Yet another initialiser for fitting stf::fexp() to data. | |
double | stf::fexpde (double x, const Vector_double &p) |
Monoexponential function with delay. | |
void | stf::fexpde_init (const Vector_double &data, double base, double peak, double RTLoHi, double HalfWidth, double dt, Vector_double &pInit) |
Initialises parameters for fitting stf::fexpde() to data. | |
double | stf::fexpbde (double x, const Vector_double &p) |
Biexponential function with delay. | |
void | stf::fexpbde_init (const Vector_double &data, double base, double peak, double RTLoHi, double HalfWidth, double dt, Vector_double &pInit) |
Initialises parameters for fitting stf::fexpde() to data. | |
double | stf::falpha (double x, const Vector_double &p) |
Alpha function. | |
Vector_double | stf::falpha_jac (double x, const Vector_double &p) |
Computes the Jacobian of stf::falpha(). | |
double | stf::fHH (double x, const Vector_double &p) |
Hodgkin-Huxley sodium conductance function. | |
double | stf::fgauss (double x, const Vector_double &p) |
Computes the sum of an arbitrary number of Gaussians. | |
Vector_double | stf::fgauss_jac (double x, const Vector_double &p) |
Computes the Jacobian of a sum of Gaussians. | |
double | stf::fgnabiexp (double x, const Vector_double &p) |
power of 1 sodium conductance function. | |
Vector_double | stf::fgnabiexp_jac (double x, const Vector_double &p) |
Computes the Jacobian of stf::fgnabiexp(). | |
void | stf::falpha_init (const Vector_double &data, double base, double peak, double RTLoHI, double HalfWidth, double dt, Vector_double &pInit) |
Initialises parameters for fitting stf::falpha() to data. | |
void | stf::fgauss_init (const Vector_double &data, double base, double peak, double RTLoHI, double HalfWidth, double dt, Vector_double &pInit) |
Initialises parameters for fitting stf::fgauss() to data. | |
void | stf::fHH_init (const Vector_double &data, double base, double peak, double RTLoHi, double HalfWidth, double dt, Vector_double &pInit) |
Initialises parameters for fitting stf::falpha() to data. | |
void | stf::fgnabiexp_init (const Vector_double &data, double base, double peak, double RTLoHi, double HalfWidth, double dt, Vector_double &pInit) |
Initialises parameters for fitting stf::falpha() to data. | |
double | stf::xscale (double param, double xscale, double xoff, double yscale, double yoff) |
Scales a parameter that linearly depends on x. | |
double | stf::xunscale (double param, double xscale, double xoff, double yscale, double yoff) |
Unscales a parameter that linearly depends on x. | |
double | stf::yscale (double param, double xscale, double xoff, double yscale, double yoff) |
Scales a parameter that linearly depends on y. | |
double | stf::yscaleoffset (double param, double xscale, double xoff, double yscale, double yoff) |
Scales a parameter that linearly depends on y and adds an offset. | |
double | stf::yunscale (double param, double xscale, double xoff, double yscale, double yoff) |
Unscales a parameter that linearly depends on y. | |
double | stf::yunscaleoffset (double param, double xscale, double xoff, double yscale, double yoff) |
Unscales a parameter that linearly depends on y and removes the offset. | |
std::vector< stf::parInfo > | stf::getParInfoExp (int n_exp) |
Creates stf::parInfo structs for n-exponential functions. | |
stf::Table | stf::outputWTau (const Vector_double &p, const std::vector< stf::parInfo > &parsInfo, double chisqr) |
Calculates a weighted time constant. | |
std::size_t | stf::whereis (const Vector_double &data, double value) |
Finds the index of data where value is encountered for the first time. | |
std::vector< stf::storedFunc > | stf::GetFuncLib () |
Returns the library of functions for non-linear regression. | |
Vector_double | stf::nojac (double x, const Vector_double &p) |
Dummy function, serves as a placeholder to initialize functions without a Jacobian. | |
double | stf::noscale (double param, double xscale, double xoff, double yscale, double yoff) |
Dummy function, serves as a placeholder to initialize parameters without a scaling function. | |
Table | stf::defaultOutput (const Vector_double &pars, const std::vector< parInfo > &parsInfo, double chisqr) |
Default fit output function, constructing a stf::Table from the parameters, their description and chisqr. | |
template<typename T > | |
T | stf::SQR (T a) |
Calculates the square of a number. | |
Vector_double | stf::filter (const Vector_double &toFilter, std::size_t filter_start, std::size_t filter_end, const Vector_double &a, int SR, stf::Func func, bool inverse=false) |
Convolves a data set with a filter function. | |
std::map< double, int > | stf::histogram (const Vector_double &data, int nbins=-1) |
Computes a histogram. | |
StfDll Vector_double | stf::deconvolve (const Vector_double &data, const Vector_double &templ, int SR, double hipass, double lopass, stfio::ProgressInfo &progDlg) |
Deconvolves a template from a signal. | |
template<class T > | |
std::vector< T > | stf::cubicSpline (const std::vector< T > &y, T oldF, T newF) |
Interpolates a dataset using cubic splines. | |
template<class T > | |
std::vector< T > | stf::diff (const std::vector< T > &input, T x_scale) |
Differentiate data. | |
double | stf::integrate_simpson (const Vector_double &input, std::size_t a, std::size_t b, double x_scale) |
Integration using Simpson's rule. | |
double | stf::integrate_trapezium (const Vector_double &input, std::size_t a, std::size_t b, double x_scale) |
Integration using the trapezium rule. | |
int | stf::linsolv (int m, int n, int nrhs, Vector_double &A, Vector_double &B) |
Solves a linear equation system using LAPACK. | |
Vector_double | stf::quad (const Vector_double &data, std::size_t begin, std::size_t end) |
Solve quadratic equations for 3 adjacent sampling points. | |
StfDll Vector_double | stf::detectionCriterion (const Vector_double &data, const Vector_double &templ, stfio::ProgressInfo &progDlg) |
Computes the event detection criterion according to Clements & Bekkers (1997). | |
StfDll std::vector< int > | stf::peakIndices (const Vector_double &data, double threshold, int minDistance) |
Searches for positive-going peaks. | |
StfDll Vector_double | stf::linCorr (const Vector_double &va1, const Vector_double &va2, stfio::ProgressInfo &progDlg) |
Computes the linear correlation between two arrays. | |
double | stf::fgaussColqu (double x, const Vector_double &p) |
Computes a Gaussian that can be used as a filter kernel. | |
double | stf::fboltz (double x, const Vector_double &p) |
Computes a Boltzmann function. | |
double | stf::fbessel (double x, int n) |
Computes a Bessel polynomial. | |
double | stf::fbessel4 (double x, const Vector_double &p) |
Computes a 4th-order Bessel polynomial that can be used as a filter kernel. | |
int | stf::fac (int arg) |
Computes the faculty of an integer. | |
int | stf::pow2 (int arg) |
Computes \( 2^{arg} \). Uses the bitwise-shift operator (<<). | |
std::string | stf::wx2std (const wxString &wxs) |
wxString | stf::std2wx (const std::string &sst) |
wxString | stf::sectionToString (const Section §ion) |
Converts a Section to a wxString. | |
wxString | stf::CreatePreview (const wxString &fName) |
Creates a preview of a text file. | |
wxString | stf::noPath (const wxString &fName) |
Strips the directory off a full path name, returns only the filename. | |
int | stf::round (double toRound) |
Does what it says. | |
Variables | |
const double | stf::PI = 3.14159265358979323846 |
Add decimals if you are not satisfied. |
typedef boost::function<double(double, const Vector_double&)> stf::Func |
enum stf::cursor_type |
Mouse cursor types.
measure_cursor |
Measurement cursor (crosshair). |
peak_cursor |
Peak calculation limits cursor. |
base_cursor |
Baseline calculation limits cursor. |
decay_cursor |
Fit limits cursor. |
latency_cursor |
Latency cursor. |
zoom_cursor |
Zoom rectangle cursor. |
event_cursor |
Event mode cursor. |
undefined_cursor |
Undefined cursor. |
enum stf::direction |
enum stf::extraction_mode |
enum stf::latency_mode |
Latency cursor settings.
enum stf::zoom_channels |
double stf::base | ( | double & | var, |
const std::vector< double > & | data, | ||
std::size_t | llb, | ||
std::size_t | ulb | ||
) |
Calculate the average of all sampling points between and including llb and ulb.
var | Will contain the variance on exit. |
data | The data waveform to be analysed. |
llb | Averaging will be started at this index. |
ulb | Index of the last data point included in the average (legacy of the PASCAL version). |
llp | Lower limit of the peak window (see stf::peak()). |
ulp | Upper limit of the peak window (see stf::peak()). |
Referenced by wxStfDoc::GetBase().
wxString stf::CreatePreview | ( | const wxString & | fName | ) |
Creates a preview of a text file.
fName | Full path name of the file. |
std::vector< T > stf::cubicSpline | ( | const std::vector< T > & | y, |
T | oldF, | ||
T | newF | ||
) |
StfDll Vector_double stf::deconvolve | ( | const Vector_double & | data, |
const Vector_double & | templ, | ||
int | SR, | ||
double | hipass, | ||
double | lopass, | ||
stfio::ProgressInfo & | progDlg | ||
) |
Deconvolves a template from a signal.
data | The input signal |
templ | The template |
SR | The sampling rate in kHz. |
hipass | Highpass filter cutoff frequency in kHz |
lopass | Lowpass filter cutoff frequency in kHz |
StfDll Vector_double stf::detectionCriterion | ( | const Vector_double & | data, |
const Vector_double & | templ, | ||
stfio::ProgressInfo & | progDlg | ||
) |
Computes the event detection criterion according to Clements & Bekkers (1997).
data | The valarray from which to extract events. |
templ | A template waveform that is used for event detection. |
int stf::fac | ( | int | arg | ) |
Computes the faculty of an integer.
arg | Argument of the function. |
double stf::falpha | ( | double | x, |
const Vector_double & | p | ||
) |
Alpha function.
\[f(x)=p_0 \frac{x}{p_1} \mathrm{e}^{\left(1 - \frac{x}{p_1} \right)} + p_2\]
x | Function argument. |
p | A valarray of parameters, where p[0] is the amplitude, p[1] is the rate and p[2] is the offset. |
void stf::falpha_init | ( | const Vector_double & | data, |
double | base, | ||
double | peak, | ||
double | RTLoHI, | ||
double | HalfWidth, | ||
double | dt, | ||
Vector_double & | pInit | ||
) |
Initialises parameters for fitting stf::falpha() to data.
data | The waveform of the data for the fit. |
base | Baseline of data. |
peak | Peak value of data. |
dt | The sampling interval. |
pInit | On entry, pass a valarray of size 3. On exit, will contain initial parameter estimates. |
Vector_double stf::falpha_jac | ( | double | x, |
const Vector_double & | p | ||
) |
Computes the Jacobian of stf::falpha().
\begin{eqnarray*} j_0(x) &=& \frac{\partial f(x)}{\partial p_0} = \frac{x \mathrm{e}^{\left(1 - \frac{x}{p_1} \right)}}{p_1} \\ j_1(x) &=& \frac{\partial f(x)}{\partial p_1} = \frac{x \mathrm{e}^{\left(1 - \frac{x}{p_1} \right)}}{p_1} \left(\frac{p_0 x}{p_1^2} - \frac{p_0}{p_1} \right) \\ j_2(x) &=& \frac{\partial f(x)}{\partial p_2} = 1 \end{eqnarray*}
x | Function argument. |
p | A valarray of parameters, where p[0] is the amplitude, p[1] is the rate and p[2] is the offset. |
double stf::fbessel | ( | double | x, |
int | n | ||
) |
Computes a Bessel polynomial.
\[ f(x, n) = \sum_{k=0}^n \frac{ \left( 2n - k \right) ! }{ \left( n - k \right) ! k! } \frac{x^k}{ 2^{n-k} } \]
x | Argument of the function. |
n | Order of the polynomial. |
double stf::fbessel4 | ( | double | x, |
const Vector_double & | p | ||
) |
Computes a 4th-order Bessel polynomial that can be used as a filter kernel.
\[ f(x) = \frac{b(0,4)}{b(\frac{0.355589x}{p_0},4)} \]
where \( b(a,n) \) is the bessel polynomial stf::fbessel().
x | Argument of the function. |
p | Function parameters, where p[0] is the corner frequency (-3 dB attenuation) |
double stf::fboltz | ( | double | x, |
const Vector_double & | p | ||
) |
Computes a Boltzmann function.
\[f(x)=\frac{1}{1+\mathrm{e}^{\frac{p_0-x}{p_1}}}\]
x | Argument of the function. |
p | Function parameters, where p[0] is the midpoint and p[1] is the slope of the function. |
double stf::fexp | ( | double | x, |
const Vector_double & | p | ||
) |
Sum of n exponential functions.
\[f(x)=p_{2n} + \sum_{i=0}^{n - 1}p_{2i}\mathrm{e}^{\left( \frac{x}{p_{2i + 1}}\right)}\]
x | Function argument. |
p | A valarray of parameters of size 2n+1, where n is the number of exponential terms, p[2i] is the amplitude term, p[2i+1] is the time constant, p[2n], the last element, contains the offset and i denotes the i -th exponential term (running from 0 to n-1). |
void stf::fexp_init | ( | const Vector_double & | data, |
double | base, | ||
double | peak, | ||
double | RTLoHi, | ||
double | HalfWidth, | ||
double | dt, | ||
Vector_double & | pInit | ||
) |
Initialises parameters for fitting stf::fexp() to data.
This needs to be made more robust.
data | The waveform of the data for the fit. |
base | Baseline of data. |
peak | Peak value of data. |
dt | The sampling interval. |
pInit | On entry, pass a valarray of size 2n+1, where n is the number of exponential functions. On exit, will contain initial parameter estimates. |
void stf::fexp_init2 | ( | const Vector_double & | data, |
double | base, | ||
double | peak, | ||
double | RTLoHi, | ||
double | HalfWidth, | ||
double | dt, | ||
Vector_double & | pInit | ||
) |
Yet another initialiser for fitting stf::fexp() to data.
In this case, one of the amplitude terms will have another sign than the others, making it more suitable for fitting PSCs or PSPs. However, this often fails to work in practice.
data | The waveform of the data for the fit. |
base | Baseline of data. |
peak | Peak value of data. |
dt | The sampling interval. |
pInit | On entry, pass a valarray of size 2n+1, where n is the number of exponential functions. On exit, will contain initial parameter estimates. |
Vector_double stf::fexp_jac | ( | double | x, |
const Vector_double & | p | ||
) |
Computes the Jacobian of stf::fexp().
\begin{eqnarray*} j_{2i}(x) &=& \frac{\partial f(x)}{\partial p_{2i}} = \mathrm{e}^{\left(\frac{-x}{p_{2i+1}}\right)} \\ j_{2i+1}(x) &=& \frac{\partial f(x)}{\partial p_{2i+1}} = \frac{p_{2i}}{p_{2i+1}^2} x \mathrm{e}^{\left( \frac{-x}{p_{2i+1}}\right)} \\ j_n(x) &=& \frac{\partial f(x)}{\partial p_{n}} = 1 \end{eqnarray*}
x | Function argument. |
p | A valarray of parameters of size 2n+1, where n is the number of exponential terms, p[2i] is the amplitude term, p[2i+1] is the time constant, p[2n], the last element, contains the offset and i denotes the i -th exponential term (running from 0 to n-1). |
double stf::fexpbde | ( | double | x, |
const Vector_double & | p | ||
) |
Biexponential function with delay.
\begin{eqnarray*} f(x)= \begin{cases} p_0 & \mbox{if }x < p_1 \\ p_3 \left( \mathrm{e}^{\frac{p_1 - x}{p_2}} - \mathrm{e}^{\frac{p_1 - x}{p_4}} \right) + p_0 & \mbox{if }x \geq p_1 \end{cases} \end{eqnarray*}
x | Function argument. |
p | A valarray of parameters, where p[0] is the baseline, p[1] is the delay, p[2] is the later (slower) time constant, p[3] is the amplitude and p[4] is the earlier (faster) time constant, |
void stf::fexpbde_init | ( | const Vector_double & | data, |
double | base, | ||
double | peak, | ||
double | RTLoHi, | ||
double | HalfWidth, | ||
double | dt, | ||
Vector_double & | pInit | ||
) |
Initialises parameters for fitting stf::fexpde() to data.
data | The waveform of the data for the fit. |
base | Baseline of data. |
peak | Peak value of data. |
dt | The sampling interval. |
pInit | On entry, pass a valarray of size 4. On exit, will contain initial parameter estimates. |
double stf::fexpde | ( | double | x, |
const Vector_double & | p | ||
) |
Monoexponential function with delay.
\begin{eqnarray*} f(x)= \begin{cases} p_0, & \mbox{if }x < p_3 \\ \left( p_0 - p_2 \right) \mathrm{e}^{\left (\frac{p_3 - x}{p_1}\right )} + p_2, & \mbox{if }x \geq p_3 \end{cases} \end{eqnarray*}
x | Function argument. |
p | A valarray of parameters, where p[0] is the baseline, p[1] is the time constant, p[2] is the amplitude and p[3] is the delay. |
void stf::fexpde_init | ( | const Vector_double & | data, |
double | base, | ||
double | peak, | ||
double | RTLoHi, | ||
double | HalfWidth, | ||
double | dt, | ||
Vector_double & | pInit | ||
) |
Initialises parameters for fitting stf::fexpde() to data.
data | The waveform of the data for the fit. |
base | Baseline of data. |
peak | Peak value of data. |
dt | The sampling interval. |
pInit | On entry, pass a valarray of size 4. On exit, will contain initial parameter estimates. |
double stf::fgauss | ( | double | x, |
const Vector_double & | p | ||
) |
Computes the sum of an arbitrary number of Gaussians.
\[ f(x) = \sum_{i=0}^{n-1}p_{3i}\mathrm{e}^{- \left( \frac{x-p_{3i+1}}{p_{3i+2}} \right) ^2} \]
x | Argument of the function. |
p | A valarray of function parameters of size 3n, where p[3i] is the amplitude of the Gaussian p[3i+1] is the position of the center of the peak, p[3i+2] is the width of the Gaussian, n is the number of Gaussian functions and i is the 0-based index of the i-th Gaussian. |
void stf::fgauss_init | ( | const Vector_double & | data, |
double | base, | ||
double | peak, | ||
double | RTLoHI, | ||
double | HalfWidth, | ||
double | dt, | ||
Vector_double & | pInit | ||
) |
Initialises parameters for fitting stf::fgauss() to data.
data | The waveform of the data for the fit. |
base | Baseline of data. |
peak | Peak value of data. |
dt | The sampling interval. |
pInit | On entry, pass a valarray of size 3. On exit, will contain initial parameter estimates. |
double stf::fgaussColqu | ( | double | x, |
const Vector_double & | p | ||
) |
Computes a Gaussian that can be used as a filter kernel.
\[ f(x) = \mathrm{e}^{-0.3466 \left( \frac{x}{p_{0}} \right) ^2} \]
x | Argument of the function. |
p | Function parameters, where p[0] is the corner frequency (-3 dB according to Colquhoun) |
double stf::fgnabiexp | ( | double | x, |
const Vector_double & | p | ||
) |
power of 1 sodium conductance function.
\[f(x)=p_0\left(1-\mathrm{e}^{\frac{-x}{p_1}}\right)\mathrm{e}^{\frac{-x}{p_2}} + p_3\]
x | Function argument. |
p | A valarray of parameters, where p[0] is the amplitude \(g'_{Na}\), p[1] is \(\tau_m\), p[2] is \(\tau_h\) and p[3] is the offset. |
void stf::fgnabiexp_init | ( | const Vector_double & | data, |
double | base, | ||
double | peak, | ||
double | RTLoHi, | ||
double | HalfWidth, | ||
double | dt, | ||
Vector_double & | pInit | ||
) |
Initialises parameters for fitting stf::falpha() to data.
data | The waveform of the data for the fit. |
base | Baseline of data. |
peak | Peak value of data. |
dt | The sampling interval. |
pInit | On entry, pass a valarray of size 4. On exit, will contain initial parameter estimates. |
Vector_double stf::fgnabiexp_jac | ( | double | x, |
const Vector_double & | p | ||
) |
Computes the Jacobian of stf::fgnabiexp().
\begin{eqnarray*} j_0(x) &=& \frac{\partial f(x)}{\partial p_0} = \left(1 -\mathrm{e}^{\frac{-x}{p_1}}\right) \mathrm{e}^{\frac{-x}{p_2}} \\ j_1(x) &=& \frac{\partial f(x)}{\partial p_1} = p_0 \frac{ -x \mathrm{e}^{\left(-\frac{x}{p_1} - \frac{x}{p_2} \right)}}{p_1^2} \\ j_2(x) &=& \frac{\partial f(x)}{\partial p_2} = p_0 \frac{ x \left(1 -\mathrm{e}^{\frac{-x}{p_1}}\right) \mathrm{e}^{\frac{-x}{p_2}}} {p_2^2}\\ j_3(x) &=& \frac{\partial f(x)}{\partial p_3} = 1 \end{eqnarray*}
x | Function argument. |
p | A valarray of parameters, where p[0] is the amplitude \(g'_{Na}\), p[1] is \(\tau_m\), p[2] is \(\tau_h\) and p[3] is the offset. |
double stf::fHH | ( | double | x, |
const Vector_double & | p | ||
) |
Hodgkin-Huxley sodium conductance function.
\[f(x)=p_0\left(1-\mathrm{e}^{\frac{-x}{p_1}}\right)^3\mathrm{e}^{\frac{-x}{p_2}} + p_3\]
x | Function argument. |
p | A valarray of parameters, where p[0] is the amplitude \(g'_{Na}\), p[1] is \(\tau_m\), p[2] is \(\tau_h\) and p[3] is the offset. |
void stf::fHH_init | ( | const Vector_double & | data, |
double | base, | ||
double | peak, | ||
double | RTLoHi, | ||
double | HalfWidth, | ||
double | dt, | ||
Vector_double & | pInit | ||
) |
Initialises parameters for fitting stf::falpha() to data.
data | The waveform of the data for the fit. |
base | Baseline of data. |
peak | Peak value of data. |
dt | The sampling interval. |
pInit | On entry, pass a valarray of size 4. On exit, will contain initial parameter estimates. |
Vector_double stf::filter | ( | const Vector_double & | toFilter, |
std::size_t | filter_start, | ||
std::size_t | filter_end, | ||
const Vector_double & | a, | ||
int | SR, | ||
stf::Func | func, | ||
bool | inverse = false |
||
) |
Convolves a data set with a filter function.
toFilter | The valarray to be filtered. |
filter_start | The index from which to start filtering. |
filter_end | The index at which to stop filtering. |
a | A valarray of parameters for the filter function. |
SR | The sampling rate. |
func | The filter function in the frequency domain. |
inverse | true if (1- func) should be used as the filter function, false otherwise |
double stf::flin | ( | double | x, |
const Vector_double & | p | ||
) |
Linear function.
\[f(x)=p_0 x + p_1\]
x | Function argument. |
p | A valarray of parameters, where p[0] is the slope and p[1] is the y intersection. |
Vector_double stf::get_scale | ( | Vector_double & | data, |
double | oldx | ||
) |
Compute and perform normalisation.
data | Data vector; will be scaled upon return |
oldx | original x interval |
std::vector<stf::storedFunc> stf::GetFuncLib | ( | ) |
Returns the library of functions for non-linear regression.
std::vector<stf::parInfo> stf::getParInfoExp | ( | int | n_exp | ) |
Creates stf::parInfo structs for n-exponential functions.
n_exp | Number of exponential terms. |
std::map<double, int> stf::histogram | ( | const Vector_double & | data, |
int | nbins = -1 |
||
) |
Computes a histogram.
data | The signal |
nbins | Number of bins in the histogram. |
initializes a linear function
double stf::integrate_simpson | ( | const Vector_double & | input, |
std::size_t | a, | ||
std::size_t | b, | ||
double | x_scale | ||
) |
Integration using Simpson's rule.
input | The valarray to be integrated. |
a | Start of the integration interval. |
b | End of the integration interval. |
x_scale | Sampling interval. |
double stf::integrate_trapezium | ( | const Vector_double & | input, |
std::size_t | a, | ||
std::size_t | b, | ||
double | x_scale | ||
) |
Integration using the trapezium rule.
input | The valarray to be integrated. |
a | Start of the integration interval. |
b | End of the integration interval. |
x_scale | Sampling interval. |
StfDll Vector_double stf::linCorr | ( | const Vector_double & | va1, |
const Vector_double & | va2, | ||
stfio::ProgressInfo & | progDlg | ||
) |
Computes the linear correlation between two arrays.
va1 | First array. |
va2 | Second array. |
T stf::linFit | ( | const std::vector< T > & | x, |
const std::vector< T > & | y, | ||
T & | m, | ||
T & | c | ||
) |
Performs a linear fit.
x | The x- values of the data that are to be fitted. |
y | The y- values of the data that are to be fitted. |
m | On exit, the slope of the regression line. |
c | On exit, the y-intercept of the regression line. |
int stf::linsolv | ( | int | m, |
int | n, | ||
int | nrhs, | ||
Vector_double & | A, | ||
Vector_double & | B | ||
) |
Solves a linear equation system using LAPACK.
Uses column-major order for matrices. For an example, see Section::SetIsIntegrated()
m | Number of rows of the matrix A. |
n | Number of columns of the matrix A. |
nrhs | Number of columns of the matrix B. |
A | On entry, the left-hand-side matrix. On exit, the factors L and U from the factorization A = P*L*U; the unit diagonal elements of L are not stored. |
B | On entry, the right-hand-side matrix. On exit, the solution to the linear equation system. |
Vector_double stf::LM_default_opts | ( | ) |
Return default LM options.
double StfDll stf::lmFit | ( | const Vector_double & | data, |
double | dt, | ||
const stf::storedFunc & | fitFunc, | ||
const Vector_double & | opts, | ||
bool | use_scaling, | ||
Vector_double & | p, | ||
std::string & | info, | ||
int & | warning | ||
) |
Uses the Levenberg-Marquardt algorithm to perform a non-linear least-squares fit.
data | A valarray containing the data. |
dt | The sampling interval of data. |
fitFunc | An stf::storedFunc to be fitted to data. |
opts | Options controlling Lourakis' implementation of the algorithm. |
use_scaling | Whether to scale x and y-amplitudes to 1.0 |
p | func's parameters. Should be set to an initial guess on entry. Will contain the best-fit values on exit. |
info | Information about why the fit stopped iterating |
warning | A warning code on return. |
double stf::maxDecay | ( | const std::vector< double > & | data, |
double | left, | ||
double | right, | ||
double & | maxDecayT, | ||
double & | maxDecayY, | ||
std::size_t | windowLength | ||
) |
Find the maximal slope during the decaying phase of an event within data.
data | The data waveform to be analysed. |
left | Delimits the search to the left. |
right | Delimits the search to the right. |
maxDecayT | The interpolated time point of the maximal slope of decay in units of sampling points. |
maxDecayY | The interpolated value of data at maxDecayT. |
windowLength | is the distance (in number of samples) used to compute the slope, the default value is 1. |
Referenced by wxStfDoc::GetMaxDecay().
double stf::maxRise | ( | const std::vector< double > & | data, |
double | left, | ||
double | right, | ||
double & | maxRiseT, | ||
double & | maxRiseY, | ||
std::size_t | windowLength | ||
) |
Find the maximal slope during the rising phase of an event within data.
data | The data waveform to be analysed. |
left | Delimits the search to the left. |
right | Delimits the search to the right. |
maxRiseT | The interpolated time point of the maximal slope of rise in units of sampling points. |
maxRiseY | The interpolated value of data at maxRiseT. |
windowLength | is the distance (in number of samples) used to compute the slope, the default value is 1. |
Referenced by wxStfDoc::GetMaxRise().
wxString stf::noPath | ( | const wxString & | fName | ) |
Strips the directory off a full path name, returns only the filename.
fName | The full path of a file. |
stf::Table stf::outputWTau | ( | const Vector_double & | p, |
const std::vector< stf::parInfo > & | parsInfo, | ||
double | chisqr | ||
) |
Calculates a weighted time constant.
p | Parameters of an exponential function (see stf::fexp()). |
parsInfo | Information about the parameters p. |
chisqr | The sum of squared errors, as returned from a least-squares fit. |
double stf::peak | ( | const std::vector< double > & | data, |
double | base, | ||
std::size_t | llp, | ||
std::size_t | ulp, | ||
int | pM, | ||
stf::direction | , | ||
double & | maxT | ||
) |
Find the peak value of data between llp and ulp.
Note that peaks will be detected by measuring from base, but the return value is given from 0. Data points at both llp and ulp will be included in the search (legacy of Stimfit for PASCAL).
data | The data waveform to be analysed. |
base | The baseline value. |
llp | Lower limit of the peak window. |
ulp | Upper limit of the peak window. |
pM | If pM > 1, a sliding (boxcar) average of width pM will be used to measure the peak. |
dir | Can be stf::up for positive-going peaks, stf::down for negative-going peaks or stf::both for negative- or positive-going peaks, whichever is larger. |
maxT | On exit, the index of the peak value. May be interpolated if pM > 1. |
Referenced by wxStfDoc::GetPeak().
StfDll std::vector<int> stf::peakIndices | ( | const Vector_double & | data, |
double | threshold, | ||
int | minDistance | ||
) |
Searches for positive-going peaks.
data | The valarray to be searched for peaks. |
threshold | Minimal amplitude of a peak. |
minDistance | Minimal distance between subsequent peaks. |
int stf::pow2 | ( | int | arg | ) | [inline] |
Vector_double stf::quad | ( | const Vector_double & | data, |
std::size_t | begin, | ||
std::size_t | end | ||
) |
Solve quadratic equations for 3 adjacent sampling points.
data | The data vector |
begin | Start of interval to be used |
end | End of interval to be used |
double stf::risetime | ( | const std::vector< double > & | data, |
double | base, | ||
double | ampl, | ||
double | left, | ||
double | right, | ||
double | frac, | ||
std::size_t & | tLoId, | ||
std::size_t & | tHiId, | ||
double & | tLoReal | ||
) |
Find 20 to 80% rise time of an event in data.
Although t80real is not explicitly returned, it can be calculated from t20Real+risetime.
data | The data waveform to be analysed. |
base | The baseline value. |
ampl | The amplitude of the event (typically, peak-base). |
left | Delimits the search to the left. |
right | Delimits the search to the right. |
t20Id | On exit, the index wich is closest to the 20%-point. |
t80Id | On exit, the index wich is closest to the 80%-point. |
t20Real | the linearly interpolated 20%-timepoint in units of sampling points. |
double stf::risetime2 | ( | const std::vector< double > & | data, |
double | base, | ||
double | ampl, | ||
double | left, | ||
double | right, | ||
double | frac, | ||
double & | innerTLoReal, | ||
double & | innerTHiReal, | ||
double & | outerTLoReal, | ||
double & | outerTHiReal | ||
) |
Find 20 to 80% rise time of an event in data.
Although t80real is not explicitly returned, it can be calculated from t20Real+risetime.
data | The data waveform to be analysed. |
base | The baseline value. |
ampl | The amplitude of the event (typically, peak-base). |
left | Delimits the search to the left. |
right | Delimits the search to the right. |
innerTLoReal | interpolated starting point of the inner risetime |
innerTHiReal | interpolated end point of the inner risetime |
outerTLoReal | interpolated starting point of the outer risetime |
outerTHiReal | interpolated end point of the outer risetime the inner rise time is (innerTHiReal-innerTLoReal), the outer rise time is (outerTHiReal-outerTLoReal), in case of noise free data, inner and outer rise time are the same. |
int stf::round | ( | double | toRound | ) | [inline] |
wxString stf::sectionToString | ( | const Section & | section | ) |
T stf::SQR | ( | T | a | ) | [inline] |
double stf::t_half | ( | const std::vector< double > & | data, |
double | base, | ||
double | ampl, | ||
double | left, | ||
double | right, | ||
double | center, | ||
std::size_t & | t50LeftId, | ||
std::size_t & | t50RightId, | ||
double & | t50LeftReal | ||
) |
Find the full width at half-maximal amplitude of an event within data.
Although t50RightReal is not explicitly returned, it can be calculated from t50LeftReal+t_half.
data | The data waveform to be analysed. |
base | The baseline value. |
ampl | The amplitude of the event (typically, peak-base). |
left | Delimits the search to the left. |
right | Delimits the search to the right. |
center | The estimated center of an event from which to start searching to the left and to the right (typically, the index of the peak). |
t50LeftId | On exit, the index wich is closest to the left 50%-point. |
t50RightId | On exit, the index wich is closest to the right 50%-point. |
t50LeftReal | the linearly interpolated left 50%-timepoint in units of sampling points. |
double stf::threshold | ( | const std::vector< double > & | data, |
std::size_t | llp, | ||
std::size_t | ulp, | ||
double | slope, | ||
double & | thrT, | ||
std::size_t | windowLength | ||
) |
Find the value within data between llp and ulp at which slope is exceeded.
data | The data waveform to be analysed. |
llp | Lower limit of the peak window. |
ulp | Upper limit of the peak window. |
thrT | On exit, The interpolated time point of the threshold crossing in units of sampling points, or a negative value if the threshold wasn't found. |
windowLength | is the distance (in number of samples) used to compute the difference, the default value is 1. |
Referenced by wxStfDoc::GetThreshold().
std::size_t stf::whereis | ( | const Vector_double & | data, |
double | value | ||
) |
Finds the index of data where value is encountered for the first time.
data | The waveform to be searched. |
value | The value to be found. |
double stf::xscale | ( | double | param, |
double | xscale, | ||
double | xoff, | ||
double | yscale, | ||
double | yoff | ||
) |
Scales a parameter that linearly depends on x.
The | parameter to scale |
xscale | x scaling factor |
xoff | x offset |
yscale | y scaling factor |
yoff | y offset |
double stf::xunscale | ( | double | param, |
double | xscale, | ||
double | xoff, | ||
double | yscale, | ||
double | yoff | ||
) |
Unscales a parameter that linearly depends on x.
The | parameter to scale |
xscale | x scaling factor |
xoff | x offset |
yscale | y scaling factor |
yoff | y offset |
double stf::yscale | ( | double | param, |
double | xscale, | ||
double | xoff, | ||
double | yscale, | ||
double | yoff | ||
) |
Scales a parameter that linearly depends on y.
The | parameter to scale |
xscale | x scaling factor |
xoff | x offset |
yscale | y scaling factor |
yoff | y offset |
double stf::yscaleoffset | ( | double | param, |
double | xscale, | ||
double | xoff, | ||
double | yscale, | ||
double | yoff | ||
) |
Scales a parameter that linearly depends on y and adds an offset.
The | parameter to scale |
xscale | x scaling factor |
xoff | x offset |
yscale | y scaling factor |
yoff | y offset |
double stf::yunscale | ( | double | param, |
double | xscale, | ||
double | xoff, | ||
double | yscale, | ||
double | yoff | ||
) |
Unscales a parameter that linearly depends on y.
The | parameter to scale |
xscale | x scaling factor |
xoff | x offset |
yscale | y scaling factor |
yoff | y offset |
double stf::yunscaleoffset | ( | double | param, |
double | xscale, | ||
double | xoff, | ||
double | yscale, | ||
double | yoff | ||
) |
Unscales a parameter that linearly depends on y and removes the offset.
The | parameter to scale |
xscale | x scaling factor |
xoff | x offset |
yscale | y scaling factor |
yoff | y offset |