tmp
This commit is contained in:
parent
2d047549a3
commit
497257ecc2
@ -5,7 +5,7 @@ project(GCTL_SEISMIC VERSION 1.0)
|
||||
include(CMakePackageConfigHelpers)
|
||||
|
||||
# 添加编译选项
|
||||
option(GCTL_SEISMIC_MATHGL "Use the mathGL library" ON)
|
||||
option(GCTL_SEISMIC_MATHGL "Use the mathGL library" OFF)
|
||||
|
||||
message(STATUS "Platform: " ${CMAKE_HOST_SYSTEM_NAME})
|
||||
message(STATUS "Install prefix: " ${CMAKE_INSTALL_PREFIX})
|
||||
|
@ -23,7 +23,7 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
gctl::SAC sac1("/Users/zhangyi/Desktop/GX_XC/MERGED.2016.121.15.59.58.7600.GX.BBX.00.SHZ.D.SAC");
|
||||
sac1.info();
|
||||
sac1.plot("tmp.eps");
|
||||
//sac1.plot("tmp.eps");
|
||||
//sac1.save("tmp.SAC_ASC");
|
||||
|
||||
/*
|
||||
|
@ -77,8 +77,8 @@ int main(int argc, char *argv[])
|
||||
gctl::SIG_UNIT a, b, c;
|
||||
a.init(10001, 0.0, 0.01);
|
||||
b.init(10001, 0.0, 0.01);
|
||||
gctl::random(a.val, 0.0, 0.02);
|
||||
gctl::random(b.val, 0.0, 0.02);
|
||||
a.val.random_float(0.0, 0.02);
|
||||
b.val.random_float(0.0, 0.02);
|
||||
|
||||
double f1 = 1.0/10.0;
|
||||
|
||||
@ -90,12 +90,12 @@ int main(int argc, char *argv[])
|
||||
if (t >= 60 && t <= 70) b.val[i] += sin(2.0*M_PI*t*f1);
|
||||
|
||||
}
|
||||
a.plot();
|
||||
b.plot();
|
||||
//a.plot();
|
||||
//b.plot();
|
||||
|
||||
gctl::SIG_UNIT xc;
|
||||
xc.linear_cross_correlation(b, a);
|
||||
xc.plot("tmp.eps");
|
||||
//xc.plot("tmp.eps");
|
||||
/*
|
||||
gctl::array<gctl::SIG_UNIT> xcs(sigs.size() - 1);
|
||||
for (size_t i = 0; i < sigs.size() -1 ; i++)
|
||||
|
@ -45,13 +45,13 @@ void gctl::SAC_PLOT::link_source(SIG_UNIT *sig, SAC_HD *hd, std::string filename
|
||||
int gctl::SAC_PLOT::Draw(mglGraph *gr)
|
||||
{
|
||||
gctl::array<float> x;
|
||||
gctl::sequence((float) 0.0, hd_ptr->delta, sig_ptr->val.size(), x);
|
||||
x.sequence((float) 0.0, hd_ptr->delta, sig_ptr->val.size());
|
||||
|
||||
mglData x_d, y_d;
|
||||
x_d.Set(x.get(), x.size());
|
||||
y_d.Set(sig_ptr->val.get(), sig_ptr->val.size());
|
||||
|
||||
float mean = gctl::mean(sig_ptr->val);
|
||||
float mean = sig_ptr->val.mean();
|
||||
std::string s_nk = hd_ptr->knetwk; s_nk.erase(s_nk.find_last_not_of(" ") + 1);
|
||||
std::string s_st = hd_ptr->kstnm; s_st.erase(s_st.find_last_not_of(" ") + 1);
|
||||
std::string s_cp = hd_ptr->kcmpnm; s_cp.erase(s_cp.find_last_not_of(" ") + 1);
|
||||
|
@ -45,13 +45,13 @@ void gctl::SIG_PLOT::link_source(SIG_UNIT *sig, std::string filename)
|
||||
int gctl::SIG_PLOT::Draw(mglGraph *gr)
|
||||
{
|
||||
gctl::array<double> x;
|
||||
gctl::sequence(sig_ptr->rt0, sig_ptr->delta, sig_ptr->val.size(), x);
|
||||
x.sequence(sig_ptr->rt0, sig_ptr->delta, sig_ptr->val.size());
|
||||
|
||||
mglData x_d, y_d;
|
||||
x_d.Set(x.get(), x.size());
|
||||
y_d.Set(sig_ptr->val.get(), sig_ptr->val.size());
|
||||
|
||||
double mean = gctl::mean(sig_ptr->val);
|
||||
double mean = sig_ptr->val.mean();
|
||||
double mini = sig_ptr->val[0], maxi = sig_ptr->val[0];
|
||||
for (size_t i = 1; i < sig_ptr->val.size(); i++)
|
||||
{
|
||||
@ -271,7 +271,7 @@ void gctl::SIG_UNIT::remove_mean(int win_size)
|
||||
double mean;
|
||||
if (win_size <= 1)
|
||||
{
|
||||
mean = gctl::mean(val);
|
||||
mean = val.mean();
|
||||
for (size_t i = 0; i < val.size(); i++)
|
||||
{
|
||||
val[i] -= mean;
|
||||
@ -309,8 +309,8 @@ void gctl::SIG_UNIT::remove_mean(int win_size)
|
||||
|
||||
void gctl::SIG_UNIT::remove_outliers(double factor)
|
||||
{
|
||||
double std = gctl::std(val);
|
||||
double mean = gctl::mean(val);
|
||||
double std = val.std();
|
||||
double mean = val.mean();
|
||||
|
||||
int vs = val.size();
|
||||
for (size_t i = 0; i < vs; i++)
|
||||
|
@ -28,12 +28,6 @@
|
||||
#ifndef _GCTL_SEISMIC_SIGNAL_H
|
||||
#define _GCTL_SEISMIC_SIGNAL_H
|
||||
|
||||
#include "gctl/core.h"
|
||||
#include "gctl/utility.h"
|
||||
#include "gctl/maths.h"
|
||||
#include "gctl/algorithm.h"
|
||||
#include "gctl/io.h"
|
||||
|
||||
#include "gctl_seismic_config.h"
|
||||
#ifdef GCTL_SEISMIC_MATHGL
|
||||
|
||||
@ -42,6 +36,12 @@
|
||||
|
||||
#endif // GCTL_SEISMIC_MATHGL
|
||||
|
||||
#include "gctl/core.h"
|
||||
#include "gctl/utility.h"
|
||||
#include "gctl/maths.h"
|
||||
#include "gctl/algorithms.h"
|
||||
#include "gctl/io.h"
|
||||
|
||||
namespace gctl
|
||||
{
|
||||
enum SIG_CHANNEL
|
||||
|
@ -338,16 +338,16 @@ void gctl::seismic::Xcorrelation::Xcorrelation_two_stations(std::string stn_sac_
|
||||
while ((!sac1.signal.cut_section(day_sig1, cut_t0, 24*3600)) &&
|
||||
(!sac2.signal.cut_section(day_sig2, cut_t0, 24*3600)))
|
||||
{
|
||||
day_std1 = gctl::std(day_sig1.val);
|
||||
day_std2 = gctl::std(day_sig2.val);
|
||||
day_std1 = day_sig1.val.std();
|
||||
day_std2 = day_sig2.val.std();
|
||||
|
||||
cut_t00 = cut_t0;
|
||||
while((!day_sig1.cut_section(sig1, cut_t00, frag_sec)) &&
|
||||
(!day_sig2.cut_section(sig2, cut_t00, frag_sec))) // Both successed
|
||||
{
|
||||
// Skiped by threshold selection
|
||||
sig_std1 = gctl::std(sig1.val);
|
||||
sig_std2 = gctl::std(sig2.val);
|
||||
sig_std1 = sig1.val.std();
|
||||
sig_std2 = sig2.val.std();
|
||||
if (sig_std1 > sigma*day_std1 || sig_std2 > sigma*day_std2)
|
||||
{
|
||||
cut_t00.add_duration(frag_sec*over_lap); continue;
|
||||
|
Loading…
Reference in New Issue
Block a user