Compare commits
No commits in common. "61c3f40063933418a202829eb660728ba092f742" and "a068bb84577c10d9af592f16f5b3e61448cf6f10" have entirely different histories.
61c3f40063
...
a068bb8457
18
README.md
18
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, AlpArray and AdriaArray.
|
The development of PyLoT is part of the joint research project MAGS2 and AlpArray.
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
@ -27,30 +27,28 @@ 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 -c conda-forge --name pylot_311 python=3.11 --file requirements.txt
|
conda create --name pylot_38 --file requirements.txt
|
||||||
|
|
||||||
to create a new Anaconda environment called *pylot_311*.
|
to create a new Anaconda environment called "pylot_38".
|
||||||
|
|
||||||
Afterwards activate the environment by typing
|
Afterwards activate the environment by typing
|
||||||
|
|
||||||
conda activate pylot_311
|
conda activate pylot_38
|
||||||
|
|
||||||
#### Prerequisites:
|
#### Prerequisites:
|
||||||
|
|
||||||
In order to run PyLoT you need to install:
|
In order to run PyLoT you need to install:
|
||||||
|
|
||||||
- Python 3
|
- Python 3
|
||||||
- cartopy
|
|
||||||
- joblib
|
|
||||||
- obspy
|
- obspy
|
||||||
- pyaml
|
|
||||||
- pyqtgraph
|
|
||||||
- pyside2
|
- pyside2
|
||||||
|
- pyqtgraph
|
||||||
|
- cartopy
|
||||||
|
|
||||||
(the following are already dependencies of the above packages):
|
(the following are already dependencies of the above packages):
|
||||||
- scipy
|
- scipy
|
||||||
- numpy
|
- numpy
|
||||||
- matplotlib
|
- matplotlib <= 3.3.x
|
||||||
|
|
||||||
#### Some handwork:
|
#### Some handwork:
|
||||||
|
|
||||||
@ -110,4 +108,4 @@ Others: A. Bruestle, T. Meier, W. Friederich
|
|||||||
|
|
||||||
[ObsPy]: http://github.com/obspy/obspy/wiki
|
[ObsPy]: http://github.com/obspy/obspy/wiki
|
||||||
|
|
||||||
August 2024
|
April 2022
|
||||||
|
20
pylot.yml
20
pylot.yml
@ -1,12 +1,16 @@
|
|||||||
name: pylot_311
|
name: pylot_38
|
||||||
channels:
|
channels:
|
||||||
- conda-forge
|
- conda-forge
|
||||||
- defaults
|
- defaults
|
||||||
dependencies:
|
dependencies:
|
||||||
- cartopy=0.23.0=py311hcf9f919_1
|
- cartopy=0.20.2
|
||||||
- joblib=1.4.2=pyhd8ed1ab_0
|
- matplotlib-base=3.3.4
|
||||||
- obspy=1.4.1=py311he736701_3
|
- numpy=1.22.3
|
||||||
- pyaml=24.7.0=pyhd8ed1ab_0
|
- obspy=1.3.0
|
||||||
- pyqtgraph=0.13.7=pyhd8ed1ab_0
|
- pyqtgraph=0.12.4
|
||||||
- pyside2=5.15.8=py311h3d699ce_4
|
- pyside2>=5.13.2
|
||||||
- pytest=8.3.2=pyhd8ed1ab_0
|
- python=3.8.12
|
||||||
|
- qt>=5.12.9
|
||||||
|
- scipy=1.8.0
|
||||||
|
- pyaml=6.0.1
|
||||||
|
- joblib=1.4.2
|
@ -1,7 +1,14 @@
|
|||||||
Cartopy==0.23.0
|
# This file may be used to create an environment using:
|
||||||
joblib==1.4.2
|
# $ conda create --name <env> --file <this file>
|
||||||
obspy==1.4.1
|
# platform: win-64
|
||||||
pyaml==24.7.0
|
cartopy=0.20.2
|
||||||
pyqtgraph==0.13.7
|
matplotlib-base=3.3.4
|
||||||
PySide2==5.15.8
|
numpy=1.22.3
|
||||||
pytest==8.3.2
|
obspy=1.3.0
|
||||||
|
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
|
@ -1,76 +0,0 @@
|
|||||||
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