Next: , Previous: , Up: Data processing   [Contents][Index]


7.7 Data changing

These functions change the data in some direction like differentiations, integrations and so on. The direction in which the change will applied is specified by the string parameter, which may contain ‘x’, ‘y’ or ‘z’ characters for 1-st, 2-nd and 3-d dimension correspondingly.

MGL command: cumsum dat 'dir'
Method on mglData: void CumSum (const char *dir)
Method on mglDataC: void CumSum (const char *dir)
C function: void mgl_data_cumsum (HMDT dat, const char *dir)
C function: void mgl_datac_cumsum (HADT dat, const char *dir)

Cumulative summation of the data in given direction or directions.

MGL command: integrate dat 'dir'
Method on mglData: void Integral (const char *dir)
Method on mglDataC: void Integral (const char *dir)
C function: void mgl_data_integral (HMDT dat, const char *dir)
C function: void mgl_datac_integral (HADT dat, const char *dir)

Integrates (like cumulative summation) the data in given direction or directions.

MGL command: diff dat 'dir'
Method on mglData: void Diff (const char *dir)
Method on mglDataC: void Diff (const char *dir)
C function: void mgl_data_diff (HMDT dat, const char *dir)
C function: void mgl_datac_diff (HADT dat, const char *dir)

Differentiates the data in given direction or directions.

MGL command: diff dat xdat ydat [zdat=0]
Method on mglData: void Diff (const mglDataA &x, const mglDataA &y)
Method on mglData: void Diff (const mglDataA &x, const mglDataA &y, const mglDataA &z)
C function: void mgl_data_diff_par (HMDT dat, HCDT x, HCDTy, HCDTz)

Differentiates the data specified parametrically in direction x with y, z=constant. Parametrical differentiation uses the formula (for 2D case): da/dx = (a_j*y_i-a_i*y_j)/(x_j*y_i-x_i*y_j) where a_i=da/di, a_j=da/dj denotes usual differentiation along 1st and 2nd dimensions. The similar formula is used for 3D case. Note, that you may change the order of arguments – for example, if you have 2D data a(i,j) which depend on coordinates {x(i,j), y(i,j)} then usual derivative along ‘x’ will be Diff(x,y); and usual derivative along ‘y’ will be Diff(y,x);.

MGL command: diff2 dat 'dir'
Method on mglData: void Diff2 (const char *dir)
Method on mglDataC: void Diff2 (const char *dir)
C function: void mgl_data_diff2 (HMDT dat, const char *dir)
C function: void mgl_datac_diff2 (HADT dat, const char *dir)

Double-differentiates (like Laplace operator) the data in given direction.

MGL command: sinfft dat 'dir'
Method on mglData: void SinFFT (const char *dir)
C function: void mgl_data_sinfft (HMDT dat, const char *dir)

Do Sine transform of the data in given direction or directions. The Sine transform is \sum a_j \sin(k j) (see http://en.wikipedia.org/wiki/Discrete_sine_transform#DST-I).

MGL command: cosfft dat 'dir'
Method on mglData: void CosFFT (const char *dir)
C function: void mgl_data_cosfft (HMDT dat, const char *dir)

Do Cosine transform of the data in given direction or directions. The Cosine transform is \sum a_j \cos(k j) (see http://en.wikipedia.org/wiki/Discrete_cosine_transform#DCT-I).

Method on mglDataC: void FFT (const char *dir)
C function: void mgl_datac_fft (HADT dat, const char *dir)

Do Fourier transform of the data in given direction or directions. If dir contain ‘i’ then inverse Fourier is used. The Fourier transform is \sum a_j \exp(i k j) (see http://en.wikipedia.org/wiki/Discrete_Fourier_transform).

MGL command: hankel dat 'dir'
Method on mglData: void Hankel (const char *dir)
Method on mglDataC: void Hankel (const char *dir)
C function: void mgl_data_hankel (HMDT dat, const char *dir)
C function: void mgl_datac_hankel (HADT dat, const char *dir)

Do Hankel transform of the data in given direction or directions. The Hankel transform is \sum a_j J_0(k j) (see http://en.wikipedia.org/wiki/Hankel_transform).

MGL command: wavelet dat 'dir' k
Method on mglData: void Wavelet (const char *dir, int k)
C function: void mgl_data_wavelet (HMDT dat, const char *dir, int k)

Apply wavelet transform of the data in given direction or directions. Parameter dir set the kind of wavelet transform: ‘d’ for daubechies, ‘D’ for centered daubechies, ‘h’ for haar, ‘H’ for centered haar, ‘b’ for bspline, ‘B’ for centered bspline. If string dir contain symbol ‘i’ then inverse wavelet transform is applied. Parameter k set the size of wavelet transform.

MGL command: swap dat 'dir'
Method on mglData: void Swap (const char *dir)
Method on mglDataC: void Swap (const char *dir)
C function: void mgl_data_swap (HMDT dat, const char *dir)
C function: void mgl_datac_swap (HADT dat, const char *dir)

Swaps the left and right part of the data in given direction (useful for Fourier spectrum).

MGL command: roll dat 'dir' num
Method on mglData: void Roll (char dir, num)
Method on mglDataC: void Roll (char dir, num)
C function: void mgl_data_roll (HMDT dat, char dir, num)
C function: void mgl_datac_roll (HADT dat, char dir, num)

Rolls the data along direction dir. Resulting array will be out[i] = ini[(i+num)%nx] if dir='x'.

MGL command: mirror dat 'dir'
Method on mglData: void Mirror (const char *dir)
Method on mglDataC: void Mirror (const char *dir)
C function: void mgl_data_mirror (HMDT dat, const char *dir)
C function: void mgl_datac_mirror (HADT dat, const char *dir)

Mirror the left-to-right part of the data in given direction. Looks like change the value index i->n-i. Note, that the similar effect in graphics you can reach by using options (see Command options), for example, surf dat; xrange 1 -1.

MGL command: sew dat ['dir'='xyz' da=2*pi]
Method on mglData: void Sew (const char *dir, mreal da=2*M_PI)
C function: void mgl_data_sew (HMDT dat, const char *dir, mreal da)

Remove value steps (like phase jumps after inverse trigonometric functions) with period da in given direction.

MGL command: smooth data type ['dir'='xyz']
Method on mglData: void Smooth (const char *dir="xyz", mreal delta=0)
Method on mglDataC: void Smooth (const char *dir="xyz", mreal delta=0)
C function: void mgl_data_smooth (HMDT dat, const char *dir, mreal delta)
C function: void mgl_datac_smooth (HADT dat, const char *dir, mreal delta)

Smooths the data on specified direction or directions. String dirs specifies the dimensions which will be smoothed. It may contain characters: ‘x’ for 1st dimension, ‘y’ for 2nd dimension, ‘z’ for 3d dimension. If string dir contain: ‘0’ then does nothing, ‘3’ – linear averaging over 3 points, ‘5’ – linear averaging over 5 points. If string dir contain ‘dN’ (where ‘N’ is digit 1,2,...,9) then linear averaging over (2*N+1)-th points is used. By default quadratic averaging over 5 points is used.

MGL command: envelop dat ['dir'='x']
Method on mglData: void Envelop (char dir='x')
C function: void mgl_data_envelop (HMDT dat, char dir)

Find envelop for data values along direction dir.

MGL command: diffract dat 'how' q
Method on mglDataC: void Diffraction (const char *how, mreal q)
C function: void mgl_datac_diffr (HADT dat, const char *how, mreal q)

Calculates one step of diffraction by finite-difference method with parameter q=\delta t/\delta x^2 using method with 3-d order of accuracy. Parameter how may contain:

MGL command: norm dat v1 v2 [sym=off dim=0]
Method on mglData: void Norm (mreal v1=0, mreal v2=1, bool sym=false, long dim=0)
C function: void mgl_data_norm (HMDT dat, mreal v1, mreal v2, int sym, long dim)

Normalizes the data to range [v1,v2]. If flag sym=true then symmetrical interval [-max(|v1|,|v2|), max(|v1|,|v2|)] is used. Modification will be applied only for slices >=dim.

MGL command: normsl dat v1 v2 ['dir'='z' keep=on sym=off]
Method on mglData: void NormSl (mreal v1=0, mreal v2=1, char dir='z', bool keep_en=true, bool sym=false)
C function: void mgl_data_norm_slice (HMDT dat, mreal v1, mreal v2, char dir, int keep_en, int sym)

Normalizes data slice-by-slice along direction dir the data in slices to range [v1,v2]. If flag sym=true then symmetrical interval [-max(|v1|,|v2|), max(|v1|,|v2|)] is used. If keep_en is set then maximal value of k-th slice will be limited by \sqrt{\sum a_ij(k)/\sum a_ij(0)}.

MGL command: limit dat val
Method on mglData: void Limit (mreal val)
Method on mglDataC: void Limit (mreal val)
C function: void mgl_data_limit (HMDT dat, mreal val)
C function: void mgl_datac_limit (HADT dat, mreal val)

Limits the data values to be inside the range [-val,val], keeping the original sign of the value (phase for complex numbers). This is equivalent to operation a[i] *= abs(a[i])<val?1.:val/abs(a[i]);.





Next: , Previous: , Up: Data processing   [Contents][Index]