/*************************************************************************** * Copyright (C) gempa GmbH * * All rights reserved. * * Contact: gempa GmbH (seiscomp-dev@gempa.de) * * * * GNU Affero General Public License Usage * * This file may be used under the terms of the GNU Affero * * Public License version 3.0 as published by the Free Software Foundation * * and appearing in the file LICENSE included in the packaging of this * * file. Please review the following information to ensure the GNU Affero * * Public License version 3.0 requirements will be met: * * https://www.gnu.org/licenses/agpl-3.0.html. * * * * Other Usage * * Alternatively, this file may be used in accordance with the terms and * * conditions contained in a signed written agreement between you and * * gempa GmbH. * ***************************************************************************/ #include // Disable hilbert transformation for now #if 0 #include namespace Seiscomp { namespace Math { namespace Filtering { // low-level, real in-place hilbert transform // // The trace length need not be a power of 2 template void hilbert_transform(std::vector &trace, int direction=1) { TYPE *f = &trace[0]; int ndata=trace.size(), nfft = next_power_of_2(ndata), n2 = nfft/2; // temporary trace for real FFTW std::vector temp(nfft); double *g = &temp[0]; // copy real array and pad with zeros for (int i=0; i0) { for (int i=1; i void envelope(std::vector &trace) { std::vector copy(trace.begin(), trace.end()); hilbert_transform(copy); int nsamp = trace.size(); TYPE *f1 = &trace[0], *f2 = ©[0]; for(int i=0; i