?? signal_package.c
字號:
/*..........................................................................*//* *//* L a s t W a v e P a c k a g e 'signal' 2.1 *//* *//* Copyright (C) 1998-2003 Emmanuel Bacry. *//* email : lastwave@cmap.polytechnique.fr *//* *//*..........................................................................*//* *//* This program is a free software, you can redistribute it and/or *//* modify it under the terms of the GNU General Public License as *//* published by the Free Software Foundation; either version 2 of the *//* License, or (at your option) any later version *//* *//* This program is distributed in the hope that it will be useful, *//* but WITHOUT ANY WARRANTY; without even the implied warranty of *//* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *//* GNU General Public License for more details. *//* *//* You should have received a copy of the GNU General Public License *//* along with this program (in a file named COPYRIGHT); *//* if not, write to the Free Software Foundation, Inc., *//* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *//* *//*..........................................................................*//****************************************************************************//* *//* signal.c Functions which deal with the signal package *//* *//****************************************************************************/#include "lastwave.h"#include "signals.h"/*********************************** * * CProcs related to signals * ***********************************//* In signal_functions.c */extern void C_Thresh(char **), C_Sort(char **);extern void C_Padd(char **), C_Stats(char **),C_Histo(char **), C_OldConv(char **), C_Conv(char **), C_CorrSig(char **); /* In signal_file.c */extern void C_Write(char **),C_Read(char **),C_ReadInfo(char **);/* In signal_create.c */extern void C_Cantor(char **),C_UCantor(char **);/* In fft_commands.c */extern void C_Fft(char **);static CProc signalCommands[] = { /* * CProcs in signal_functions.c */ "thresh",C_Thresh,"{{{<signalIn> <signalOut> -(x | y) (<min> | *) (<max> | *))} \{Thresholds the <signalIn> and sets the result in <signalOut>. All the values between <min> and <max> are set to 0. \n\ - If <min> is '*' then <min> is chosen as the minimum of <signalIn> \n\ - If <max> is '*' then <max> is chosen as the maximum of <signalIn> \n\ - If '-y' (resp '-x') then the thresholding affects the value of the Y (resp. X) array of <signalIn>.}}}", "sort",C_Sort,"{{<signalIn> {Sorts the values of <signalIn> according to X (if 'xysig') or Y (if 'ysig')}}}", "padd",C_Padd,"{{{<signalIn> [<signalOut>=<signalIn>] [*border*= (*bconst | *b0 | *bmirror | *bperiodic)] [-s <newSize>]} \{Padds a signal so that it ends having <newSize> points (if '-s' specified) or the closest size which is greater than the actual size and which is a power \2 (if '-s' not specified). The padding values are specified by the argument <border>. The resulting signal is stored in <signalOut> (by default it is stored in <signalIn>).}}}", "stats",C_Stats,"{{{mean <signalIn> [-c]} {Computes the mean of a signal ('-c' is the \"causal\" flag : if set, it means that the \mean is computed only from the indexes 'firstp' to 'lastp'of <signalIn>).}} \{{var <signalIn> [-c]} {Computes the variance of a signal ('-c' : same as in 'mean' command).}} \{{skew <signalIn> [-c]} {Computes the skewness of a signal ('-c' : same as in 'mean' command).}} \{{kurt <signalIn> [-c]} {Computes the kurtosis of a signal mu_4/mu_2^2 ('-c' : same as in 'mean' command).}} \{{nth <signalIn> <n> [-cCa]} {Computes the (NON centered) <n>th moment of a signal ('-c' : same as in 'mean' command). If '-C' then the moment is centered. If '-a' the absolute moment is computed (<n> can be a float).}} \{{minmax <signalIn> [-c]} {Computes the minimum and the maximum values of a signal and sends back the corresponding indexes in a listv {<imin> <imax>} ('-c' : same as in 'mean' command).}} \{{lp <signalIn> <p> [-c]} {Computes the Lp norm of a signal ('-c' : same as in 'mean' command).}} \{{corr <signalIn> [<signalIn1>] [-c]} {Computes the correlation function between the x array and the y array of <signalIn> or \(if <signalIn1> is specified) between the y arrays of <signalIn> and <signalIn1> ('-c' : same as in 'mean' command).}} \{{print <signalIn> [-c]} {Prints some statistical information about a signal ('-c' : same as in 'mean' command).}} \{{fit <signalIn> [-x <xMin> <xMax>]} {Computes a linear fit y = ax+b of <signalIn> between abscissa <xMin> and <xMax>. Returns the listv {a sigma_a b sigma_b iMin iMax}.}}}", "histo",C_Histo,"{{{<signalIn> <signalOut> <n> [-x <xMin> <xMax>] " "[-y <yMin> <yMax>] [-w <signalWeight>] [-c]} {Computes in <signalOut> the <n> " "branch histogram of the values of <signalIn>. \n" " -x : Only the values between the abscissa <xMin> and <xMax> are taken " "into account.\n" " -y : Only the values between the ordinate <yMin> and <yMax> are taken " "into account. \n" " So the histogram will be made of <n> bars between <ymin> and <ymax>.\n" " -c : Only points corresponding to indexes between firstp and lastp are " "taken into account. \n" " -w : Each value of <signalIn> is associated (for computing the histogram) " "to a given weight.}}}",/* "oldconv",C_OldConv,"{{{<signalIn> <filter> <signalOut> [<border>=pad] [-d]} \{Computes the convolution of a signal with a filter and puts it in <signalOut>. You can specify the border effects used \for the <signalIn> by specifying the <border> ('per'=periodic, 'mir'=mirror, 'pad0'=padding with 0 values, \'pad'=padding with constant extremity values). \If option '-d' is set then it forces the convolution to be computed explicitly in the direct space (no fft involved). If \it is not set, then it uses the fastest method (between fast convolution algorithm using fft or direct method). The firstp \and lastp fields of the <signalOut> are updated so that it points to the first and last points not affected by the border effects. \It returns the elapsed time in seconds.}}}",*/"conv", C_Conv ,"{{{<signal> <filter> <signalout> <border_effect> [-f] [-x [<xmin> <xmax>]]} \{Computes the convolution of <signal> by the compact support <filter>. \Border effect of <signal> can be chosen among 'b0', 'bconst', 'bperiodic', 'bmirror' or 'bmirror1' (same effect as for *option extractions of signals). \The fields firstp and lastp are updated (they allow you to keep track of the points affected by border effects). \If the flag -f is not set, the convolution is computed directly (no FFT) otherwise it is computed using an FFT. \If the flag -x is not set, the abscissa interval on which the result is computed is (i) the abscissa interval of <signal> (for 'bperiodic') \(ii) double the abscissa interval of <signal> (for 'bmirror' and 'bmirror1') (iii) the abscissa interval + the filter border effect \
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -