Compare commits
5 Commits
a068bb8457
...
61c3f40063
Author | SHA1 | Date | |
---|---|---|---|
61c3f40063 | |||
213819c702 | |||
67f34cc871 | |||
f4f48a930f | |||
b41e2b2de6 |
20
README.md
20
README.md
@ -11,7 +11,7 @@ PILOT has originally been developed in Mathworks' MatLab. In order to distribute
|
|||||||
problems, it has been decided to redevelop the software package in Python. The great work of the ObsPy group allows easy
|
problems, it has been decided to redevelop the software package in Python. The great work of the ObsPy group allows easy
|
||||||
handling of a bunch of seismic data and PyLoT will benefit a lot compared to the former MatLab version.
|
handling of a bunch of seismic data and PyLoT will benefit a lot compared to the former MatLab version.
|
||||||
|
|
||||||
The development of PyLoT is part of the joint research project MAGS2 and AlpArray.
|
The development of PyLoT is part of the joint research project MAGS2, AlpArray and AdriaArray.
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
@ -27,28 +27,30 @@ Afterwards run (from the PyLoT main directory where the files *requirements.txt*
|
|||||||
conda env create -f pylot.yml
|
conda env create -f pylot.yml
|
||||||
or
|
or
|
||||||
|
|
||||||
conda create --name pylot_38 --file requirements.txt
|
conda create -c conda-forge --name pylot_311 python=3.11 --file requirements.txt
|
||||||
|
|
||||||
to create a new Anaconda environment called "pylot_38".
|
to create a new Anaconda environment called *pylot_311*.
|
||||||
|
|
||||||
Afterwards activate the environment by typing
|
Afterwards activate the environment by typing
|
||||||
|
|
||||||
conda activate pylot_38
|
conda activate pylot_311
|
||||||
|
|
||||||
#### Prerequisites:
|
#### Prerequisites:
|
||||||
|
|
||||||
In order to run PyLoT you need to install:
|
In order to run PyLoT you need to install:
|
||||||
|
|
||||||
- Python 3
|
- Python 3
|
||||||
- obspy
|
|
||||||
- pyside2
|
|
||||||
- pyqtgraph
|
|
||||||
- cartopy
|
- cartopy
|
||||||
|
- joblib
|
||||||
|
- obspy
|
||||||
|
- pyaml
|
||||||
|
- pyqtgraph
|
||||||
|
- pyside2
|
||||||
|
|
||||||
(the following are already dependencies of the above packages):
|
(the following are already dependencies of the above packages):
|
||||||
- scipy
|
- scipy
|
||||||
- numpy
|
- numpy
|
||||||
- matplotlib <= 3.3.x
|
- matplotlib
|
||||||
|
|
||||||
#### Some handwork:
|
#### Some handwork:
|
||||||
|
|
||||||
@ -108,4 +110,4 @@ Others: A. Bruestle, T. Meier, W. Friederich
|
|||||||
|
|
||||||
[ObsPy]: http://github.com/obspy/obspy/wiki
|
[ObsPy]: http://github.com/obspy/obspy/wiki
|
||||||
|
|
||||||
April 2022
|
August 2024
|
||||||
|
20
pylot.yml
20
pylot.yml
@ -1,16 +1,12 @@
|
|||||||
name: pylot_38
|
name: pylot_311
|
||||||
channels:
|
channels:
|
||||||
- conda-forge
|
- conda-forge
|
||||||
- defaults
|
- defaults
|
||||||
dependencies:
|
dependencies:
|
||||||
- cartopy=0.20.2
|
- cartopy=0.23.0=py311hcf9f919_1
|
||||||
- matplotlib-base=3.3.4
|
- joblib=1.4.2=pyhd8ed1ab_0
|
||||||
- numpy=1.22.3
|
- obspy=1.4.1=py311he736701_3
|
||||||
- obspy=1.3.0
|
- pyaml=24.7.0=pyhd8ed1ab_0
|
||||||
- pyqtgraph=0.12.4
|
- pyqtgraph=0.13.7=pyhd8ed1ab_0
|
||||||
- pyside2>=5.13.2
|
- pyside2=5.15.8=py311h3d699ce_4
|
||||||
- python=3.8.12
|
- pytest=8.3.2=pyhd8ed1ab_0
|
||||||
- qt>=5.12.9
|
|
||||||
- scipy=1.8.0
|
|
||||||
- pyaml=6.0.1
|
|
||||||
- joblib=1.4.2
|
|
@ -1,14 +1,7 @@
|
|||||||
# This file may be used to create an environment using:
|
Cartopy==0.23.0
|
||||||
# $ conda create --name <env> --file <this file>
|
joblib==1.4.2
|
||||||
# platform: win-64
|
obspy==1.4.1
|
||||||
cartopy=0.20.2
|
pyaml==24.7.0
|
||||||
matplotlib-base=3.3.4
|
pyqtgraph==0.13.7
|
||||||
numpy=1.22.3
|
PySide2==5.15.8
|
||||||
obspy=1.3.0
|
pytest==8.3.2
|
||||||
pyqtgraph=0.12.4
|
|
||||||
pyside2=5.13.2
|
|
||||||
python=3.8.12
|
|
||||||
qt=5.12.9
|
|
||||||
scipy=1.8.0
|
|
||||||
pyaml=6.0.1
|
|
||||||
joblib=1.4.2
|
|
@ -0,0 +1,76 @@
|
|||||||
|
import pytest
|
||||||
|
from obspy import read, Trace, UTCDateTime
|
||||||
|
|
||||||
|
from pylot.correlation.pick_correlation_correction import XCorrPickCorrection
|
||||||
|
|
||||||
|
|
||||||
|
class TestXCorrPickCorrection():
|
||||||
|
def setup(self):
|
||||||
|
self.make_test_traces()
|
||||||
|
self.make_test_picks()
|
||||||
|
self.t_before = 2.
|
||||||
|
self.t_after = 2.
|
||||||
|
self.cc_maxlag = 0.5
|
||||||
|
|
||||||
|
def make_test_traces(self):
|
||||||
|
# take first trace of test Stream from obspy
|
||||||
|
tr1 = read()[0]
|
||||||
|
# filter trace
|
||||||
|
tr1.filter('bandpass', freqmin=1, freqmax=20)
|
||||||
|
# make a copy and shift the copy by 0.1 s
|
||||||
|
tr2 = tr1.copy()
|
||||||
|
tr2.stats.starttime += 0.1
|
||||||
|
|
||||||
|
self.trace1 = tr1
|
||||||
|
self.trace2 = tr2
|
||||||
|
|
||||||
|
def make_test_picks(self):
|
||||||
|
# create an artificial reference pick on reference trace (trace1) and another one on the 0.1 s shifted trace
|
||||||
|
self.tpick1 = UTCDateTime('2009-08-24T00:20:07.7')
|
||||||
|
# shift the second pick by 0.2 s, the correction should be around 0.1 s now
|
||||||
|
self.tpick2 = self.tpick1 + 0.2
|
||||||
|
|
||||||
|
def test_slice_trace_okay(self):
|
||||||
|
|
||||||
|
self.setup()
|
||||||
|
xcpc = XCorrPickCorrection(UTCDateTime(), Trace(), UTCDateTime(), Trace(),
|
||||||
|
t_before=self.t_before, t_after=self.t_after, cc_maxlag=self.cc_maxlag)
|
||||||
|
|
||||||
|
test_trace = self.trace1
|
||||||
|
pick_time = self.tpick2
|
||||||
|
|
||||||
|
sliced_trace = xcpc.slice_trace(test_trace, pick_time)
|
||||||
|
assert ((sliced_trace.stats.starttime == pick_time - self.t_before - self.cc_maxlag / 2)
|
||||||
|
and (sliced_trace.stats.endtime == pick_time + self.t_after + self.cc_maxlag / 2))
|
||||||
|
|
||||||
|
def test_slice_trace_fails(self):
|
||||||
|
self.setup()
|
||||||
|
|
||||||
|
test_trace = self.trace1
|
||||||
|
pick_time = self.tpick1
|
||||||
|
|
||||||
|
with pytest.raises(ValueError):
|
||||||
|
xcpc = XCorrPickCorrection(UTCDateTime(), Trace(), UTCDateTime(), Trace(),
|
||||||
|
t_before=self.t_before + 20, t_after=self.t_after, cc_maxlag=self.cc_maxlag)
|
||||||
|
xcpc.slice_trace(test_trace, pick_time)
|
||||||
|
|
||||||
|
with pytest.raises(ValueError):
|
||||||
|
xcpc = XCorrPickCorrection(UTCDateTime(), Trace(), UTCDateTime(), Trace(),
|
||||||
|
t_before=self.t_before, t_after=self.t_after + 50, cc_maxlag=self.cc_maxlag)
|
||||||
|
xcpc.slice_trace(test_trace, pick_time)
|
||||||
|
|
||||||
|
def test_cross_correlation(self):
|
||||||
|
self.setup()
|
||||||
|
|
||||||
|
# create XCorrPickCorrection object
|
||||||
|
xcpc = XCorrPickCorrection(self.tpick1, self.trace1, self.tpick2, self.trace2, t_before=self.t_before,
|
||||||
|
t_after=self.t_after, cc_maxlag=self.cc_maxlag)
|
||||||
|
|
||||||
|
# execute correlation
|
||||||
|
correction, cc_max, uncert, fwfm = xcpc.cross_correlation(False, '', '')
|
||||||
|
|
||||||
|
# define awaited test result
|
||||||
|
test_result = (-0.09983091718314982, 0.9578431835689154, 0.0015285160561610929, 0.03625786256084631)
|
||||||
|
|
||||||
|
# check results
|
||||||
|
assert pytest.approx(test_result, rel=1e-6) == (correction, cc_max, uncert, fwfm)
|
Loading…
x
Reference in New Issue
Block a user