diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml
new file mode 100644
index 0000000000000000000000000000000000000000..b7fce1df816ffebda85ab1e34394271080b31404
--- /dev/null
+++ b/.github/workflows/python-publish.yml
@@ -0,0 +1,37 @@
+# This workflow will upload a Python Package using Twine when a release is created
+# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
+
+# This workflow uses actions that are not certified by GitHub.
+# They are provided by a third-party and are governed by
+# separate terms of service, privacy policy, and support
+# documentation.
+
+name: Upload Python Package
+
+on:
+ pull_request:
+ branches:
+ - master
+
+jobs:
+ deploy:
+
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v2
+ - name: Set up Python
+ uses: actions/setup-python@v2
+ with:
+ python-version: '3.x'
+ - name: Install dependencies
+ run: |
+ python -m pip install --upgrade pip
+ sudo pip install twine
+ - name: Build package
+ run: python setup.py sdist build
+ - name: Publish package
+ uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
+ with:
+ user: __token__
+ password: ${{ secrets.PYPI_TOKEN }}
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index 81e2de1541d6a106f93e290c608d7d3604bf3f80..0000000000000000000000000000000000000000
--- a/.travis.yml
+++ /dev/null
@@ -1,42 +0,0 @@
-language: python
-
-install:
-- pip install .
-
-
-jobs:
- include:
- - stage: test
- python: '3.7'
-
- - stage: test
- python: '3.8'
-
-
- - stage: test
- python: '3.9'
-
-
- - stage: doc
- script: bash -c "$(curl -fsSL https://git.nju.edu.cn/xumi1993/source/-/raw/master/trigger.sh)"
-
- - stage: deploy
- python: 3.8
- script: skip
- deploy:
- provider: pypi
- username: "__token__"
- password:
- secure: "BsDdKkZlOSxIgfM/es1ta7S0UMxxnZFuHsvXZBfJlDYq2vI8zTi3IezB9BXCHx5MNxZJVC+LucE8mpFyJ6X5I6O0psFEHra/RDDt5wKo8FLSpqQzC8sGb+Bxc1o6BG6oVwbbvvYoZHxnLU4gDtnOcbUMVolHdIeXtR17zudyWhohN735/2cg1KSQg9wmk6d42Ze+BlNcZ6KWzoQPyyNf2j/7KLIhn6dZhj7oaj/Ib+z28xo4vi74EgGkCB4NRuoWl5ZyJWAUWBWnOUbw1QlgAQiEsgy5WW15JWhfCyCZ9xOtbu6ZW/+hsvMgic188tf8COUg2r8aAowQU2NAnVb5oGPvMrCyAQD93wd1ra2zvkXBY0/haFeNDeHeGE2XnZ70vg/YJdWEk+3i3WZTFTcXC9FsEZpnGUllBN0hE+1awfasv0nIRXM8Doo78wmXvkSUoAMc9DYEr+BMttwoWXK3hBJxTFCHym8up4Udm0oacw0Z7vGjH5pN1q/Ibn1NLc8lUbjXs/Sovz4d75yigWkH7kzqnfOq9JYxEsyPghtb9uXXiZ4nWw8PetROqGhsWZRYBFrCt2A543yxJmCvn2hl/1UkeeKp1943qaQ/iBHgwy2cu2XZAyO6/4vBDLs61cQ5Jcxmrn++9E8K1vLR1c9WZAAFezL/NVQnIKhWq2Ur87E="
- on:
- branch: master
-
-
-script:
- - git clone https://github.com/xumi1993/seispy-test test
- - cd test && bash run.sh
-
-
-
-
-
diff --git a/README.md b/README.md
index a1c2a4618da28bbcf39a343e0334025826343d5a..a6965fbd3a2016b9ce33dd649cd9c28d093e5fe7 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,12 @@
-# Seispy
+#
-[](https://travis-ci.com/xumi1993/seispy)
-[](https://seispy.xumijian.me)
+[](https://github.com/xumi1993/seispy/actions/workflows/python-publish.yml)
+[](https://github.com/xumi1993/seispy-doc.post/actions/workflows/deploy.yml)
+
+
+
+
+[](https://anaconda.org/conda-forge/seispy)
[](https://pypi.org/project/python-seispy/)
[](https://pypi.org/project/python-seispy/)
[]()
@@ -26,7 +31,7 @@ Seispy is a Python module for processing seismological data and calculating Rece
* [NumPy](http://www.numpy.org/) >= 1.16
* [SciPy](http://www.scipy.org/) >= 1.2.0
* [matplotlib](https://matplotlib.org/) >= 3.0.0
- * [PyQt5](https://www.riverbankcomputing.com/software/pyqt/) >= 5.15.0
+ * [PyQt5](https://www.riverbankcomputing.com/software/pyqt/) >= 5.12.0
## Installation
```
@@ -36,23 +41,49 @@ python setup.py install
# Inclusion
## Libraries
- * `seispy.distaz`: Calculate distance and azimuth (by [the lithospheric seismology program at USC](http://www.seis.sc.edu/software/distaz/)).
- * `seispy.geo`: Tiny codes of geophysics.
- * `seispy.bootstrap`: Bootstrap confidence interval estimation (by [scikits-bootstrap](https://github.com/cgevans/scikits-bootstrap))
- * `seispy.decon`: Iterative time domain deconvolution method (Ligorria and Ammon's 1999 BSSA)
- * `seispy.rfcorrect`: Subsequent process of PRFs includeing moveout correct and time to depth conversion (1D and 3D) (see [Mijian Xu et al., 2018 EPSL](https://www.sciencedirect.com/science/article/pii/S0012821X17306921?via%3Dihub))
- * `seispy.ccp`: CCP stacking along a profile.
+
+- `seispy.distaz`: Calculate distance and azimuth (by the
+ [lithospheric seismology program at USC][]).
+- `seispy.geo`: Tiny codes of geophysics.
+- `seispy.bootstrap`: Bootstrap confidence interval estimation (by
+ [scikits-bootstrap][])
+- `seispy.decon`: Functions of deconvolution transferred from
+ [iwbailey/processRFmatlab][] including
+ - Iterative time domain deconvolution method (LigorrĂa and Ammon
+ 1999 BSSA).
+ - Water level frequency domain deconvolution method (CJ. Ammon
+ 1991 BSSA)
+- `seispy.rf`: Procedure for RF calculation. The functions of
+ `match_eq`, `search_eq` invoked `obspy.core.UTCDateTime` and
+ `obspy.clients` from the [Obspy][].
+- `seispy.eq`: RF processing for each event, which invoked
+ `obspy.io.sac`, `obspy.signal`, `obspy.taup` and `obspy.core.Stream`
+ from the [Obspy][].
+- `seispy.rfcorrect`: Subsequent process of RFs including moveout
+ correction and time to depth conversion (1D and 3D) (see [Xu et al.,
+ 2018 EPSL][])
+- `seispy.ccpprofile`: CCP stacking along a profile.
+- `seispy.ccp3d`: 3-D CCP stacking with extracting depth D410 and
+ D660.
+
+ [lithospheric seismology program at USC]: http://www.seis.sc.edu/software/distaz/
+ [scikits-bootstrap]: https://github.com/cgevans/scikits-bootstrap
+ [iwbailey/processRFmatlab]: https://github.com/iwbailey/processRFmatlab
+ [Obspy]: https://docs.obspy.org/
+ [Xu et al., 2018 EPSL]: https://www.sciencedirect.com/science/article/pii/S0012821X17306921?via%3Dihub
## Commands
### Receiver Functions
* `prf`: Calculate PRFs for a station.
* `pickrf`: Pick PRFs with virtual quality control after the calculation.
- * `plotrt`: Plot PRFs in R and T components order by back-azimuth.
- * `plotr`: Plot PRFs in R component order by back-azimuth.
- * `hk`: H-Kappa stacking.
+ * `plotrt`: Plot PRFs with R and T components order by back-azimuth.
+ * `plotr`: Plot PRFs with R component order by back-azimuth.
+ * `hk`: H-Kappa stacking for estimating Moho depth and crustal Vp/Vs.
* `rf2depth`: Convert PRFs to depth axis.
* `ccp_profile`: Stack PRFs along a profile with a CCP stacking method.
+ * `ccp3d`: Stack PRFs with spaced bins.
+ * `rfani`: Estimating crustal anisotropy with a joint method.
### Others
* `ndk2dat`: Convert the GCMT catalog file ("ndk" format) to the list file for the `prf` command.
diff --git a/seispy/hk.py b/seispy/hk.py
index 1dd68390053a87127c27a909344d4a19e920c9a7..2b3959d35df2df3974cd3eafb81a93554ede4b67 100644
--- a/seispy/hk.py
+++ b/seispy/hk.py
@@ -129,7 +129,7 @@ def plot(stack, allstack, h, kappa, besth, bestk, cvalue, cmap=load_cyan_map(),
if path is None:
plt.show()
else:
- f.savefig(path, format='pdf', bbox_inches='tight')
+ f.savefig(path, format='png', dpi=400, bbox_inches='tight')
def ci(allstack, h, kappa, ev_num):
@@ -178,7 +178,7 @@ def hksta(hpara, isplot=False, isdisplay=False):
if isdisplay:
print_result(besth, bestk, maxhsig, maxksig, print_comment=True)
if isplot:
- img_path = join(hpara.hkpath, station+'_Hk.pdf')
+ img_path = join(hpara.hkpath, station+'_Hk.png')
plot(stack, allstack, hpara.hrange, hpara.krange, besth, bestk, cvalue, title=title, path=img_path)
else:
plot(stack, allstack, hpara.hrange, hpara.krange, besth, bestk, cvalue, title=title)
diff --git a/seispy/plotR.py b/seispy/plotR.py
index b672fd8071667a4a0823168fa412fdf5d3934086..6f3f5ae04d2e26c409afc2c2d78f539a3d716938 100644
--- a/seispy/plotR.py
+++ b/seispy/plotR.py
@@ -81,23 +81,20 @@ def plotr(rfpath, outpath='./', xlim=[-2, 80], enf=6, format='pdf'):
def main():
parser = argparse.ArgumentParser(description="Plot R&T receiver functions")
parser.add_argument('rfpath', help='Path to PRFs with a \'finallist.dat\' in it', type=str)
- parser.add_argument('-w', help="Time window from t1 to t2, defaults to -2/80", type=str, default='-2/80', metavar='t1/t2')
parser.add_argument('-e', help='Enlargement factor, defaults to 6', dest='enf', type=float, default=6, metavar='enf')
parser.add_argument('-o', help='Output path without file name, defaults to current path', dest='output', default='./', type=str, metavar='outpath')
parser.add_argument('-t', help='Specify figure format. f = \'.pdf\', g = \'.png\', defaults to \'g\'',
dest='format', default='g', type=str, metavar='f|g')
+ parser.add_argument('-x', help='The max time scale in sec, defaults to 85s', default=85, type=float, metavar='max_time')
+
arg = parser.parse_args()
- try:
- xlim = [float(v) for v in arg.w.split('/')]
- except:
- raise ValueError("Error format in time window")
if arg.format not in ('f', 'g'):
raise ValueError('Error: The format must be in \'f\' and \'g\'')
elif arg.format == 'g':
fmt = 'png'
elif arg.format == 'f':
fmt = 'pdf'
- plotr(arg.rfpath, arg.output, enf=arg.enf, xlim=xlim, format=fmt)
+ plotr(arg.rfpath, arg.output, enf=arg.enf, xlim=[-2, arg.x], format=fmt)
diff --git a/seispy/plotRT.py b/seispy/plotRT.py
index 628dcaf19c63233f28475c5193f8f0586fa73c0e..485f0f7f4f78acd5596e8f5eb3869cf0600c5fae 100644
--- a/seispy/plotRT.py
+++ b/seispy/plotRT.py
@@ -123,7 +123,7 @@ def set_fig(axr, axt, axb, axr_sum, axt_sum, stadata, station, xmin=-2, xmax=30,
axb.set_xlabel(r'Back-azimuth ($\circ$)', fontsize=13)
-def plotrt(rfpath, enf=3, out_path='./', outformat='g'):
+def plotrt(rfpath, enf=3, out_path='./', outformat='g', xmax=30):
"""[summary]
:param rfpath: [description]
@@ -146,11 +146,11 @@ def plotrt(rfpath, enf=3, out_path='./', outformat='g'):
h, axr, axt, axb, axr_sum, axt_sum = init_figure()
stadata = read_process_data(rfpath)
plot_waves(axr, axt, axb, axr_sum, axt_sum, stadata, enf=enf)
- set_fig(axr, axt, axb, axr_sum, axt_sum, stadata, station)
+ set_fig(axr, axt, axb, axr_sum, axt_sum, stadata, station, xmax=xmax, comp=stadata.comp)
if outformat == 'g':
- h.savefig(join(out_path, station+'_RT_bazorder_{:.1f}.png'.format(stadata.f0[0])), dpi=200)
+ h.savefig(join(out_path, station+'_RT_bazorder_{:.1f}.png'.format(stadata.f0[0])), dpi=400, bbox_inches='tight')
elif outformat == 'f':
- h.savefig(join(out_path, station+'_RT_bazorder_{:.1f}.pdf'.format(stadata.f0[0])), format='pdf')
+ h.savefig(join(out_path, station+'_RT_bazorder_{:.1f}.pdf'.format(stadata.f0[0])), format='pdf', bbox_inches='tight')
def main():
@@ -160,12 +160,11 @@ def main():
parser.add_argument('-o', help='Output path without file name, defaults to current path', dest='output', default='./', type=str, metavar='outpath')
parser.add_argument('-t', help='Specify figure format. f = \'.pdf\', g = \'.png\', defaults to \'g\'',
dest='format', default='g', type=str, metavar='f|g')
+ parser.add_argument('-x', help='The max time scale in sec, defaults to 30s', default=30, type=float, metavar='max_time')
arg = parser.parse_args()
if arg.format not in ('f', 'g'):
- print('Errpr: The format must be in \'f\' and \'g\'')
- parser.print_help()
- sys.exit(1)
- plotrt(rfpath=arg.path, enf=arg.enf, out_path=arg.output, outformat=arg.format)
+ raise ValueError('Error: The format must be in \'f\' and \'g\'')
+ plotrt(rfpath=arg.rfpath, enf=arg.enf, out_path=arg.output, outformat=arg.format, xmax=arg.x)
if __name__ == '__main__':
diff --git a/seispy/rfani.py b/seispy/rfani.py
index a53aaec60c07868f69bdba7f37a90a175c2b5e88..e91faf8df59a6ae21250ce64c4242b154eb6a341 100644
--- a/seispy/rfani.py
+++ b/seispy/rfani.py
@@ -260,7 +260,7 @@ class RFAni():
if show:
plt.show()
else:
- fig.savefig(join(outpath, 'joint_ani_'+self.sacdatar.staname+'.png'), dpi=400, bbox_inches='tight')
+ fig.savefig(join(outpath, self.sacdatar.staname+'_joint_ani.png'), dpi=400, bbox_inches='tight')
if __name__ == "__main__":
diff --git a/seispy/scripts.py b/seispy/scripts.py
index aed253d1ea33755990a694a15e5cc2e37298589d..09f862a35e4459e252730360854c98c208896c06 100644
--- a/seispy/scripts.py
+++ b/seispy/scripts.py
@@ -11,9 +11,9 @@ def rfani():
parser = argparse.ArgumentParser(description="Estimate crustal anisotropy with a Joint inversion method. See Liu and Niu (2012) in detail.")
parser.add_argument('rfpath', type=str, help="Path to PRFs")
parser.add_argument('-t', help="Time window cut from tb to te", metavar='tb/te', required=True)
- parser.add_argument('-c', help="List file in text format for saving results, defaults to rfani.dat",
+ parser.add_argument('-c', help="List file in text format for saving results, defaults to ./rfani.dat",
default="rfani.dat", metavar="list_file_name")
- parser.add_argument('-l', help="Half length of time window when cut out Pms phases",
+ parser.add_argument('-l', help="Half length of time window when cut out Pms phases, defaults to 3s",
default=3, metavar="half_time_length", type=float)
parser.add_argument('-o', dest='outpath', help="Directory to the image, defaults to current directory.", default='./')
parser.add_argument('-p', help="If plot RFs stacked by back-azimuth, defaults to \'False\'",
@@ -27,7 +27,7 @@ def rfani():
bf, bt = rfsta.jointani(timewin[0], timewin[1], tlen=arg.l, weight=weights)
with open(arg.c, 'a+') as fid:
for f, t in zip(bf, bt):
- fid.write('{}\t{:.3f}\t{:.3f}\t{:.2f}\t{:.2f}'.format(rfsta.staname, rfsta.stla, rfsta.stlo, f, t))
+ fid.write('{}\t{:.3f}\t{:.3f}\t{:.2f}\t{:.2f}\n'.format(rfsta.staname, rfsta.stla, rfsta.stlo, f, t))
if arg.isplot:
rfsta.ani.plot_stack_baz(outpath=arg.outpath)
rfsta.ani.plot_polar(outpath=arg.outpath)
diff --git a/setup.py b/setup.py
index b4d35a8ffdeaa87ed1d4b8709f4772669fc1a215..1bbc29cfd6c72929e77f20121a8ddb48ebfb8f15 100644
--- a/setup.py
+++ b/setup.py
@@ -5,7 +5,7 @@ packages = find_packages()
with open("README.md", "r") as fh:
long_description = fh.read()
-VERSION = "1.2.1"
+VERSION = "1.2.3"
setup(name='python-seispy',
version=VERSION,
author='Mijian Xu',
@@ -39,7 +39,7 @@ setup(name='python-seispy',
'rfani=seispy.scripts:rfani',
'ccp3d=seispy.scripts:ccp3d',
'get_pierce_points=seispy.scripts:get_pierce_points']},
- include_package_data=True,
+ # include_package_data=True,
zip_safe=False,
classifiers=['Programming Language :: Python',
'Programming Language :: Python :: 3.7',