signals.h

Author

Zhu Dengda (zhudengda@mail.iggcas.ac.cn)

Date

2024-12

Defines

GRT_SIG_PARABOLA

抛物波代号

GRT_SIG_TRAPEZOID

梯形波代号

GRT_SIG_RICKER

雷克子波信号

GRT_SIG_CUSTOM

自定义时间函数代码

Functions

bool grt_check_tftype_tfparams(const char tftype, const char *tfparams)

检查时间函数的类型设置和参数设置是否符合要求

参数:
  • tftype[in] 单个字符,指代时间函数类型

  • tfparams[in] 时间函数参数

返回:

检查是否通过

float *grt_get_time_function(int *TFnt, float dt, const char tftype, const char *tfparams)

获得时间函数,要求提前运行check_tftype_tfparams函数以检查参数

参数:
  • TFnt[out] 返回的点数

  • dt[in] 时间间隔

  • tftype[in] 单个字符,指代时间函数类型

  • tfparams[in] 时间函数参数

返回:

时间函数指针

void grt_linear_convolve_time_function(float *arr, int nt, float dt, const char tftype, const char *tfparams, float **TFarr, int *TFnt)

时域线性卷积,要求提前运行check_tftype_tfparams函数以检查参数 卷积结果会原地写入数组。

参数:
  • arr[inout] 待卷积的信号

  • nt[in] 信号点数

  • dt[in] 信号点时间间隔

  • tftype[in] 单个字符,指代时间函数类型

  • tfparams[in] 时间函数参数

  • TFarr[out] 指向时间函数的指针的指针

  • TFnt[out] 返回的时间函数点数

void grt_oaconvolve(float *x, int nx, float *h, int nh, float *y, int ny, bool iscircular)

时间序列卷积函数,只卷积x的长度

参数:
  • x[in] 长信号数组

  • nx[in] 长信号点数

  • h[in] 短信号数组

  • nh[in] 短信号点数

  • y[out] 输出数组

  • ny[in] 输出数组点数

  • iscircular[in] 是否使用循环卷积

float grt_trap_area(const float *x, int nx, float dt)

计算某序列整个梯形积分值

参数:
  • x[in] 信号数组

  • nx[in] 数组长度

  • dt[in] 时间间隔

返回:

积分结果

void grt_trap_integral(float *x, int nx, float dt)

使用梯形法对时间序列积分

参数:
  • x[inout] 信号数组

  • nx[in] 数组长度

  • dt[in] 时间间隔

void grt_differential(float *x, int nx, float dt)

对时间序列做中心一阶差分

参数:
  • x[inout] 信号数组

  • nx[in] 数组长度

  • dt[in] 时间间隔

float *grt_get_parabola_wave(float dt, float *Tlen, int *Nt)

生成抛物线波

参数:
  • dt[in] 采样间隔

  • tlen[inout] 信号时长

  • Nt[out] 返回的点数

返回:

float指针

float *grt_get_trap_wave(float dt, float *T1, float *T2, float *T3, int *Nt)

生成梯形波或三角波

*   ^
*   |
*   |
* 1-|       --------...--------
*   |      /                   \ 
*   |     /                     \ 
*   |   ...                     ...
*   |   /                         \
*   |  /                           \
*   | /                             \
*   |------+------------------+------+---------------->
*  O       T1                 T2     T3                T
* 
*
参数:
  • dt[in] 采样间隔

  • T1[inout] 上坡截止时刻

  • T2[inout] 平台截止时刻

  • T3[inout] 下坡截止时刻

  • Nt[out] 返回的点数

返回:

float指针

float *grt_get_ricker_wave(float dt, float f0, int *Nt)

生成雷克子波

\[ f(t)=(1-2 \pi^2 f_0^2 (t-t_0)^2 ) e^{ - \pi^2 f_0^2 (t-t_0)^2} \]

参数:
  • dt[in] 采样间隔

  • f0[in] 主频

  • Nt[out] 返回的点数

返回:

float指针

float *grt_get_custom_wave(int *Nt, const char *tfparams)

从文件中读入自定义时间函数

参数:
  • Nt[out] 返回的点数

  • tfparams[in] 文件路径

返回:

float指针

void grt_free1d(void *pt)

专用于在Python端释放C中申请的内存

参数:

pt[out] 指针