genbazi - BSU program to generate a bash script to run bazi in a sliding time window
genbazi [ USAGE: genbazi filename tstart tend tstep tgate chR chT ipct tsw1 ]
Basic Seismic Utilities (BSU) bazi uses Principal Component Analysis (PCA) to determine direction to a seismic source based on hodogram motion in horizontal plane as recorded on a 3-C phone. This program generates a bash script which runs bazi a number of times on a time series. Each execution of bazi analyzes a sliding time window which progresses the horizontal components using PCA. All arguments must be provided on the command line (no prompting as in most BSU codes). Typing the command in a terminal will give the usage, and if less than all arguments are given on the command line, the code will abort and the usage message will be displayed. Program bazi outputs an appendable file, bazipca.dat which captures a quadruplet of values for the time window. Plotting of this output file will reveal when a source passes near by the geophone. At closest point, the signal amplitude will peak and the azimuth will switch from one direction to the next. The code is in the C-language.
Options
infile |
Input file name. | ||
tstart |
Start time for the first time window (float, seconds). | ||
tend |
End time for the sequence of windows (float, seconds). | ||
tstep |
Time shift forward of sliding window (float, seconds). Windows can overlap or be separate. | ||
tgate |
Length in time of the sliding window (float, seconds). If tstep < tgate, then overlap. | ||
chR |
Channel number corresponding to R-component (int) | ||
chT |
Channel number corresponding to T-component (int) | ||
ipct |
Percent of peak motion modulus. To be included in PCA, sample amplitude must be > ipct. | ||
tsw1 |
Switch to set T-component relative to R-component. Examples: |
tsw1=+90 If R=East, T=South
tsw1=-90 If R=East, T=North
You are specifying directions that arrows on phone point, motion in that direction negative volts.
NOTE:
If invoked with no options, will display USAGE: message.
EXAMPLE:
genbazi brsp0005.seg 0.00 20.0 .5 1.0 2 3 35 90.0
The R-component is channel 2, the T-component is channel 3, amplitudes larger than 35% of peak amplitude in window will be included in PCA. Windows start at 0.0 seconds and run to 20.0 seconds. Thus, the first window will be [0.0 to 1.0], the second window will overlap [0.5 to 1.5] . . . . and the last window will be [19.0 to 20.0] (since the gate is 1.0 and the move up is 0.5). The Postscript plots will be concatenated into a single file, bazihodo.ps with the script then executing the ps2pdf program. If this program is not installed on your machine, you will want to delete that line in the script.
gobazi |
The bash script that runs bazi commands. |
bazipca.dat
File with quadruplets (time, azimuth-1, azimuth-2, amplitude). File is appended so that multiple runs of genbazi will build up a list of azimuths and amplitude (see gengenbazi code).
PCA.gp |
Gnuplot script to plot bazipca.dat data. The bash script will automatically run gnuplot and the output will be both X11 and Postscript file PCA.gp. |
bazi.ps, bazihodo.pdf
Postscript plots of particle motion
standard output
produces a progress bar
bhelp(1), bazi(1), bzrt(1), bhod(1)
no known bugs
Copyright © 2021 by Paul Michaels
This program is 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; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
P. Michaels, PE. <[email protected]>