![]() | ![]() | Gwyddion Data Processing Library Reference Manual | ![]() |
---|
GwyDataLine — Array representing 1D data
enum GwySFOutputType; enum GwyFitLineType; struct GwyDataLine; struct GwyDataLineClass; GObject* gwy_data_line_new (gint res, gdouble real, gboolean nullme); void gwy_data_line_resample (GwyDataLine *a, gint res, gint interpolation); gboolean gwy_data_line_resize (GwyDataLine *a, gint from, gint to); gboolean gwy_data_line_copy (GwyDataLine *a, GwyDataLine *b); gdouble* gwy_data_line_get_data (GwyDataLine *a); gint gwy_data_line_get_res (GwyDataLine *a); gdouble gwy_data_line_get_real (GwyDataLine *a); void gwy_data_line_set_real (GwyDataLine *a, gdouble real); gdouble gwy_data_line_itor (GwyDataLine *a, gdouble pixval); gdouble gwy_data_line_rtoi (GwyDataLine *a, gdouble realval); gdouble gwy_data_line_get_val (GwyDataLine *a, gint i); gint gwy_data_line_set_val (GwyDataLine *a, gint i, gdouble value); gdouble gwy_data_line_get_dval (GwyDataLine *a, gdouble x, gint interpolation); gdouble gwy_data_line_get_dval_real (GwyDataLine *a, gdouble x, gint interpolation); void gwy_data_line_invert (GwyDataLine *a, gboolean x, gboolean z); void gwy_data_line_fill (GwyDataLine *a, gdouble value); void gwy_data_line_multiply (GwyDataLine *a, gdouble value); void gwy_data_line_add (GwyDataLine *a, gdouble value); void gwy_data_line_part_fill (GwyDataLine *a, gint from, gint to, gdouble value); void gwy_data_line_part_multiply (GwyDataLine *a, gint from, gint to, gdouble value); void gwy_data_line_part_add (GwyDataLine *a, gint from, gint to, gdouble value); gdouble gwy_data_line_get_max (GwyDataLine *a); gdouble gwy_data_line_get_min (GwyDataLine *a); gdouble gwy_data_line_get_avg (GwyDataLine *a); gdouble gwy_data_line_get_rms (GwyDataLine *a); gdouble gwy_data_line_get_sum (GwyDataLine *a); gdouble gwy_data_line_part_get_max (GwyDataLine *a, gint from, gint to); gdouble gwy_data_line_part_get_min (GwyDataLine *a, gint from, gint to); gdouble gwy_data_line_part_get_avg (GwyDataLine *a, gint from, gint to); gdouble gwy_data_line_part_get_rms (GwyDataLine *a, gint from, gint to); gdouble gwy_data_line_part_get_sum (GwyDataLine *a, gint from, gint to); gint gwy_data_line_threshold (GwyDataLine *a, gdouble threshval, gdouble bottom, gdouble top); gint gwy_data_line_part_threshold (GwyDataLine *a, gint from, gint to, gdouble threshval, gdouble bottom, gdouble top); void gwy_data_line_line_coeffs (GwyDataLine *a, gdouble *av, gdouble *bv); void gwy_data_line_part_line_coeffs (GwyDataLine *a, gint from, gint to, gdouble *av, gdouble *bv); void gwy_data_line_line_level (GwyDataLine *a, gdouble av, gdouble bv); void gwy_data_line_line_rotate (GwyDataLine *a, gdouble angle, gint interpolation); gdouble gwy_data_line_get_der (GwyDataLine *a, gint i); void gwy_data_line_fft (GwyDataLine *ra, GwyDataLine *ia, GwyDataLine *rb, GwyDataLine *ib, void (*fft) (), GwyWindowingType windowing, gint direction, GwyInterpolationType interpolation, gboolean preserverms, gboolean level); void gwy_data_line_fft_hum (gint direction, GwyDataLine *ra, GwyDataLine *ia, GwyDataLine *rb, GwyDataLine *ib, gint interpolation); gdouble* gwy_data_line_part_fit_polynom (GwyDataLine *data_line, gint n, gdouble *coeffs, gint from, gint to); gdouble* gwy_data_line_fit_polynom (GwyDataLine *data_line, gint n, gdouble *coeffs); void gwy_data_line_part_subtract_polynom (GwyDataLine *data_line, gint n, gdouble *coeffs, gint from, gint to); void gwy_data_line_subtract_polynom (GwyDataLine *data_line, gint n, gdouble *coeffs); gdouble gwy_data_line_get_modus (GwyDataLine *data_line, gint histogram_steps); gdouble gwy_data_line_part_get_modus (GwyDataLine *data_line, gint from, gint to, gint histogram_steps);
This object represents 1D data arrays in Gwyddion. It is used for most of the data processing functions connected with 1D data, graphs, etc.
typedef enum { GWY_SF_OUTPUT_DH = 0, /*distribution of heights*/ GWY_SF_OUTPUT_CDH = 1, /*cumulative distribution of heights*/ GWY_SF_OUTPUT_DA = 2, /*distribution of angles*/ GWY_SF_OUTPUT_CDA = 3, /*cumulative distribution of angles*/ GWY_SF_OUTPUT_ACF = 4, /*autocorrelation fucntions*/ GWY_SF_OUTPUT_HHCF = 5, /*height-height correlation function*/ GWY_SF_OUTPUT_PSDF = 6 /*power spectral density fucntion*/ } GwySFOutputType;
Statistical functions selection.
GWY_SF_OUTPUT_DH | distribution of heights |
GWY_SF_OUTPUT_CDH | cumulative distribution of heights |
GWY_SF_OUTPUT_DA | distribution of angles (slopes) |
GWY_SF_OUTPUT_CDA | cumulative distribution of angles |
GWY_SF_OUTPUT_ACF | autocorrelation function |
GWY_SF_OUTPUT_HHCF | height-height correlation function |
GWY_SF_OUTPUT_PSDF | power spectral density function |
typedef enum { GWY_FIT_POLY_0 = 0, /*height fit*/ GWY_FIT_POLY_1 = 1, /*linear fit*/ GWY_FIT_POLY_2 = 2, /*quadratic fit*/ GWY_FIT_POLY_3 = 3 /*cubic fit*/ } GwyFitLineType;
Fit polynomial degree selection.
GObject* gwy_data_line_new (gint res, gdouble real, gboolean nullme);
res : | |
real : | |
nullme : | |
Returns : |
void gwy_data_line_resample (GwyDataLine *a, gint res, gint interpolation);
Resamples data line, i. e. changes the size of one dimensional field related with data line. The original values are used for resampling using a requested resampling alorithm.
a : | data line |
res : | new resolution |
interpolation : | interpolation method used |
gboolean gwy_data_line_resize (GwyDataLine *a, gint from, gint to);
Resamples data line to (from - to) and fills it by appropriate original data line part.
a : | data line |
from : | where to start |
to : | where to finish |
Returns : | TRUE if there were no problems. |
gboolean gwy_data_line_copy (GwyDataLine *a, GwyDataLine *b);
Copies the contents of a data line to another already allocated data line of the same size.
a : | Source data line. |
b : | Destination data line. |
Returns : | TRUE if there were no problems |
gdouble* gwy_data_line_get_data (GwyDataLine *a);
Returns the line data.
a : | data line |
Returns : | The data as an array of doubles of length gwy_data_line_get_res(). |
Since 1.3.
gint gwy_data_line_get_res (GwyDataLine *a);
a : | data line |
Returns : | Resolution (number of data points). |
gdouble gwy_data_line_get_real (GwyDataLine *a);
a : | data line |
Returns : | Real size of data line. |
void gwy_data_line_set_real (GwyDataLine *a, gdouble real);
Sets the real data line size.
a : | data line |
real : | value to be set |
gdouble gwy_data_line_itor (GwyDataLine *a, gdouble pixval);
a : | data line |
pixval : | value in pixel coordinates |
Returns : | value in real coordinates. |
gdouble gwy_data_line_rtoi (GwyDataLine *a, gdouble realval);
a : | data line |
realval : | value in real coordinates |
Returns : | value in pixel coordinates. |
gdouble gwy_data_line_get_val (GwyDataLine *a, gint i);
a : | data line |
i : | index (pixel coordinates) |
Returns : | value at given index. |
gint gwy_data_line_set_val (GwyDataLine *a, gint i, gdouble value);
Sets the value at given index.
a : | data line |
i : | pixel coordinates |
value : | value to be set |
Returns : | TRUE it there were no problems. |
gdouble gwy_data_line_get_dval (GwyDataLine *a, gdouble x, gint interpolation);
Using a specified interpolation returns value in any point wihin data line.
a : | data line |
x : | position requested (0 - resolution) |
interpolation : | interpolation used |
Returns : | value interpolated in the data line. |
gdouble gwy_data_line_get_dval_real (GwyDataLine *a, gdouble x, gint interpolation);
Same as gwy_data_line_get_dval() fucntion, but uses real coordinates input.
a : | data line |
x : | real coordinates position |
interpolation : | interpolation method used |
Returns : | Value interpolated in the data line. |
void gwy_data_line_invert (GwyDataLine *a, gboolean x, gboolean z);
Inverts values. If x is TRUE it inverts x-axis values (x1...xn) to (xn...x1), if z is TRUE inverts z-axis values (peaks to valleys and valleys to peaks).
a : | data line |
x : | invert x axis |
z : | invert z axis |
void gwy_data_line_fill (GwyDataLine *a, gdouble value);
Fills whole data lien with specified number.
a : | data line |
value : | value to be used for filling |
void gwy_data_line_multiply (GwyDataLine *a, gdouble value);
Multiplies whole data line with a specified number.
a : | data line |
value : | value to be used for multiplication |
void gwy_data_line_add (GwyDataLine *a, gdouble value);
Adds a specified number to whole data line.
a : | data line |
value : | value to be added. |
void gwy_data_line_part_fill (GwyDataLine *a, gint from, gint to, gdouble value);
Fills specified part of data line with specified number
a : | data line |
from : | where to start |
to : | where to finish |
value : | value to be used for filling |
void gwy_data_line_part_multiply (GwyDataLine *a, gint from, gint to, gdouble value);
Multiplies specified part of data line by specified number
a : | data line |
from : | where to start |
to : | where to finish |
value : | value to be used for multiplication |
void gwy_data_line_part_add (GwyDataLine *a, gint from, gint to, gdouble value);
Adds specified number to a part of data line.
a : | data line |
from : | where to start |
to : | where to finish |
value : | value to be added |
gdouble gwy_data_line_get_max (GwyDataLine *a);
a : | data line |
Returns : | Maximum value |
gdouble gwy_data_line_get_min (GwyDataLine *a);
a : | data line |
Returns : | Minimum value |
gdouble gwy_data_line_get_avg (GwyDataLine *a);
a : | data line |
Returns : | Average value |
gdouble gwy_data_line_get_rms (GwyDataLine *a);
a : | data line |
Returns : | Root mean square deviation of heights |
gdouble gwy_data_line_get_sum (GwyDataLine *a);
a : | data line |
Returns : | sum of all the values |
gdouble gwy_data_line_part_get_max (GwyDataLine *a, gint from, gint to);
a : | data line |
from : | where to start (in pixels) |
to : | where to finish (in pixels) |
Returns : | Maximum within given interval |
gdouble gwy_data_line_part_get_min (GwyDataLine *a, gint from, gint to);
a : | data line |
from : | where to start (in pixels) |
to : | where to finish (in pixels) |
Returns : | Minimum within given interval |
gdouble gwy_data_line_part_get_avg (GwyDataLine *a, gint from, gint to);
a : | data line |
from : | where to start (in pixels) |
to : | where to finish (in pixels) |
Returns : | Average within given interval |
gdouble gwy_data_line_part_get_rms (GwyDataLine *a, gint from, gint to);
a : | data line |
from : | where to start (in pixels) |
to : | where to finish (in pixels) |
Returns : | Root mean square deviation of heights within a given interval |
gdouble gwy_data_line_part_get_sum (GwyDataLine *a, gint from, gint to);
a : | data line |
from : | where to start (in pixels) |
to : | where to finish (in pixels) |
Returns : | Sum of all values within the interval |
gint gwy_data_line_threshold (GwyDataLine *a, gdouble threshval, gdouble bottom, gdouble top);
Sets all the values to bottom or top value depending on whether the original values are below or above threshold value
a : | data line |
threshval : | value used for thresholding |
bottom : | lower value |
top : | upper value |
Returns : | total number of values above threshold |
gint gwy_data_line_part_threshold (GwyDataLine *a, gint from, gint to, gdouble threshval, gdouble bottom, gdouble top);
Sets all the values within interval to bottom or top value depending on whether the original values are below or above threshold value.
a : | data line |
from : | where to start |
to : | where to finish |
threshval : | value used for thresholding |
bottom : | lower value |
top : | upper value |
Returns : | total number of values above threshold within interval |
void gwy_data_line_line_coeffs (GwyDataLine *a, gdouble *av, gdouble *bv);
Finds coefficients that can be used for line leveling using relation data[i] -= av + bv*real_index;
a : | data line |
av : | height coefficient |
bv : | slope coeficient |
void gwy_data_line_part_line_coeffs (GwyDataLine *a, gint from, gint to, gdouble *av, gdouble *bv);
a : | |
from : | |
to : | |
av : | |
bv : |
void gwy_data_line_line_level (GwyDataLine *a, gdouble av, gdouble bv);
Performs line leveling using relation data[i] -= av + bv*real_index.
a : | data line |
av : | height coefficient |
bv : | slope coefficient |
void gwy_data_line_line_rotate (GwyDataLine *a, gdouble angle, gint interpolation);
Performs line rotation. This is operation similar to leveling, but not changing the angles between line segments.
a : | data line |
angle : | angle of rotation (in degrees) |
interpolation : | interpolation mode used |
gdouble gwy_data_line_get_der (GwyDataLine *a, gint i);
a : | data line |
i : | pixel coordinate |
Returns : | derivation at given pixel |
void gwy_data_line_fft (GwyDataLine *ra, GwyDataLine *ia, GwyDataLine *rb, GwyDataLine *ib, void (*fft) (), GwyWindowingType windowing, gint direction, GwyInterpolationType interpolation, gboolean preserverms, gboolean level);
Performs Fast Fourier transform using a given algorithm. A windowing or data leveling can be applied if requested.
ra : | real input |
ia : | imaginary input |
rb : | real output |
ib : | imaginary output |
fft : | fft alorithm |
windowing : | windowing mode |
direction : | FFT direction (1 or -1) |
interpolation : | interpolation mode |
preserverms : | preserve RMS value while windowing |
level : | level line before computation |
void gwy_data_line_fft_hum (gint direction, GwyDataLine *ra, GwyDataLine *ia, GwyDataLine *rb, GwyDataLine *ib, gint interpolation);
Performs 1D FFT using the alogrithm ffthum (see simplefft.h). Resamples data to closest 2^N and then resamples result back. Resample data by yourself if you want further FFT processing as resampling of the FFT spectrum can destroy some information in it.
direction : | FFT direction (1 or -1) |
ra : | real input |
ia : | imaginary input |
rb : | real output |
ib : | imaginary output |
interpolation : | interpolation used |
gdouble* gwy_data_line_part_fit_polynom (GwyDataLine *data_line, gint n, gdouble *coeffs, gint from, gint to);
Fits a polynom through a part of a data line.
Please see gwy_data_line_fit_polynom() for more details.
data_line : | A data line. |
n : | Polynom degree. |
coeffs : | An array of size n+1 to store the coefficients to, or NULL (a fresh array is allocated then). |
from : | The index in data_line to start from (inclusive). |
to : | The index in data_line to stop (noninclusive). |
Returns : | The coefficients of the polynom (coeffs when it was not NULL, otherwise a newly allocated array). |
gdouble* gwy_data_line_fit_polynom (GwyDataLine *data_line, gint n, gdouble *coeffs);
Fits a polynom through a data line.
Note n is polynom degree, so the size of coeffs is n+1. X-values are indices in the data line.
For polynoms of degree 0 and 1 it's better to use gwy_data_line_get_avg() and gwy_data_line_line_coeffs() because they are faster.
data_line : | A data line. |
n : | Polynom degree. |
coeffs : | An array of size n+1 to store the coefficients to, or NULL (a fresh array is allocated then). |
Returns : | The coefficients of the polynom (coeffs when it was not NULL, otherwise a newly allocated array). |
void gwy_data_line_part_subtract_polynom (GwyDataLine *data_line, gint n, gdouble *coeffs, gint from, gint to);
data_line : | |
n : | |
coeffs : | |
from : | |
to : |
void gwy_data_line_subtract_polynom (GwyDataLine *data_line, gint n, gdouble *coeffs);
data_line : | |
n : | |
coeffs : |
gdouble gwy_data_line_get_modus (GwyDataLine *data_line, gint histogram_steps);
Finds approximate modus of a data line.
As each number in the data line is usually unique, this function does not return modus of the data itself, but modus of a histogram.
data_line : | A data line. |
histogram_steps : | Number of histogram steps used for modus searching, pass a nonpositive number to autosize. |
Returns : | The modus. |
Since 1.4.
gdouble gwy_data_line_part_get_modus (GwyDataLine *data_line, gint from, gint to, gint histogram_steps);
Finds approximate modus of a data line part.
data_line : | A data line. |
from : | The index in data_line to start from (inclusive). |
to : | The index in data_line to stop (noninclusive). |
histogram_steps : | Number of histogram steps used for modus searching, pass a nonpositive number to autosize. |
Returns : | The modus. |
Since 1.4.
<< Gwyddion Data Processing Library Reference Manual | GwyDataField >> |