Skip to content

Commit 6286e4f

Browse files
Merge branch 'develop' into master
2 parents e464bda + 9b2849f commit 6286e4f

File tree

16 files changed

+724
-396
lines changed

16 files changed

+724
-396
lines changed

.github/workflows/runtest.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,73 @@ jobs:
158158
yml: ./codecov.yml
159159
fail_ci_if_error: true
160160

161+
test-code-fmf:
162+
runs-on: "ubuntu-latest"
163+
strategy:
164+
matrix:
165+
python-version: [3.8]
166+
fail-fast: false
167+
168+
steps:
169+
- uses: actions/checkout@v2
170+
171+
- name: Cache conda
172+
uses: actions/cache@v2
173+
env:
174+
# Increase this value to reset cache if needed by env file has not changed
175+
CACHE_NUMBER: 0
176+
with:
177+
path: ~/conda_pkgs_dir
178+
key:
179+
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{
180+
hashFiles('.github/test_conda_env.yml') }}
181+
182+
- name: Setup conda
183+
uses: conda-incubator/setup-miniconda@v2
184+
with:
185+
miniconda-version: 'latest'
186+
python-version: ${{ matrix.python-version }}
187+
activate-environment: eqcorrscan-test
188+
environment-file: .github/test_conda_env.yml
189+
condarc-file: .github/test_condarc.yml
190+
use-only-tar-bz2: true # Must be set for caching to work properly
191+
192+
- name: install fmf
193+
shell: bash -l {0}
194+
run: |
195+
cd ..
196+
git clone https://github.com/beridel/fast_matched_filter.git
197+
cd fast_matched_filter
198+
pip install -e .
199+
cd ../EQcorrscan
200+
201+
- name: install eqcorrscan
202+
shell: bash -l {0}
203+
run: |
204+
pip install -e .
205+
206+
- name: print package info
207+
shell: bash -l {0}
208+
run: |
209+
conda info -a
210+
conda list
211+
212+
- name: run correlation test
213+
shell: bash -l {0}
214+
run: |
215+
export OMP_NUM_THREADS=2
216+
py.test eqcorrscan/tests/correlate_test.py --cov-report=xml
217+
218+
- name: upload coverage
219+
uses: codecov/codecov-action@v1
220+
with:
221+
token: ${{ secrets.CODECOV_TOKEN }}
222+
file: ./coverage.xml
223+
flags: unittests
224+
name: codecov-umbrella
225+
yml: ./codecov.yml
226+
fail_ci_if_error: true
227+
161228
# This is a very useful step for debugging, it allows you to ssh into the CI
162229
# machine (https://github.com/marketplace/actions/debugging-with-tmate).
163230
# Make sure to open the log before the job starts else you cant see the tmate

CHANGES.md

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,26 @@
11
## Current
2-
* utils.mag_calc:
3-
- relative_magnitude: implemented full magnitude bias-correction for CC and SNR
4-
- relative_amplitude: returns dicts for SNR measurements
2+
* core.match_filter.tribe
3+
- Detect now allows passing of pre-processed data
4+
* utils.correlate
5+
- Fast Matched Filter now supported natively for version >= 1.4.0
6+
- Only full correlation stacks are returned now (e.g. where fewer than than
7+
the full number of channels are in the stack at the end of the stack, zeros
8+
are returned).
9+
* utils.mag_calc.relative_magnitude
10+
- fixed bug where S-picks / traces were used for relative-magnitude calculation
11+
against user's choice.
12+
- implemented full magnitude bias-correction for CC and SNR
13+
* utils.mag_calc.relative_amplitude:
14+
- returns dicts for SNR measurements
15+
* utils.catalog_to_dd.write_correlations
16+
- Fixed bug on execution of parallel execution.
17+
- Added parallel-options for catalog-dt measurements and for stream-preparation
18+
before cross correlation-dt measurements.
19+
- Default parallelization of dt-computation is now across events (loads CPUs
20+
more efficiently), and there is a new option ``max_trace_workers` to use
21+
the old parallelization strategy across traces.
22+
- Now includes `all_horiz`-option that will correlate all matching horizontal
23+
channels no matter to which of these the S-pick is linking.
524

625
## 0.4.3
726
* core.match_filter

eqcorrscan/core/match_filter/tribe.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ def detect(self, stream, threshold, threshold_type, trig_int, plot=False,
428428
xcorr_func=None, concurrency=None, cores=None,
429429
ignore_length=False, ignore_bad_data=False, group_size=None,
430430
overlap="calculate", full_peaks=False, save_progress=False,
431-
process_cores=None, **kwargs):
431+
process_cores=None, pre_processed=False, **kwargs):
432432
"""
433433
Detect using a Tribe of templates within a continuous stream.
434434
@@ -505,6 +505,10 @@ def detect(self, stream, threshold, threshold_type, trig_int, plot=False,
505505
:param process_cores:
506506
Number of processes to use for pre-processing (if different to
507507
`cores`).
508+
:type pre_processed: bool
509+
:param pre_processed:
510+
Whether the stream has been pre-processed or not to match the
511+
templates.
508512
509513
:return:
510514
:class:`eqcorrscan.core.match_filter.Party` of Families of
@@ -581,12 +585,16 @@ def detect(self, stream, threshold, threshold_type, trig_int, plot=False,
581585
"""
582586
party = Party()
583587
template_groups = group_templates(self.templates)
588+
if len(template_groups) > 1 and pre_processed:
589+
raise NotImplementedError(
590+
"Inconsistent template processing and pre-processed data - "
591+
"something is wrong!")
584592
# now we can compute the detections for each group
585593
for group in template_groups:
586594
group_party = _group_detect(
587595
templates=group, stream=stream.copy(), threshold=threshold,
588596
threshold_type=threshold_type, trig_int=trig_int,
589-
plot=plot, group_size=group_size, pre_processed=False,
597+
plot=plot, group_size=group_size, pre_processed=pre_processed,
590598
daylong=daylong, parallel_process=parallel_process,
591599
xcorr_func=xcorr_func, concurrency=concurrency, cores=cores,
592600
ignore_length=ignore_length, overlap=overlap, plotdir=plotdir,

eqcorrscan/doc/submodules/utils.correlate.fast_matched_filter.rst

Lines changed: 0 additions & 206 deletions
This file was deleted.

eqcorrscan/doc/submodules/utils.correlate.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ Selecting a correlation function
5858

5959
EQcorrscan strives to use sensible default algorithms for calculating
6060
correlation values, however, you may want to change how correlations are
61-
caclulated to be more advantageous to your specific needs.
61+
calculated to be more advantageous to your specific needs.
6262

6363

6464
There are currently 3 different correlations functions currently included in EQcorrscan:
@@ -71,6 +71,9 @@ There are currently 3 different correlations functions currently included in EQc
7171

7272
Number 3 is the default.
7373

74+
A further time-domain correlation backend is available, see note below on using
75+
Fast Matched Filter within EQcorrscan.
76+
7477
Setting FFT length
7578
~~~~~~~~~~~~~~~~~~
7679
For version 0.4.0 onwards, the "fftw" backend allows the user to pass an `fft_len`
@@ -92,11 +95,8 @@ Using Fast Matched Filter within EQcorrscan
9295
|FMF| provides fast time-domain correlations for both CPU and GPU
9396
architectures. For massively multi-threaded environment this runs faster than
9497
the frequency-domain routines native to EQcorrscan (when more than 40 CPU cores,
95-
or an NVIDIA GPU card is available) with less memory consumption. Documentation
96-
on how to call Fast Matched Filter from within EQcorrscan is provided here:
97-
fast_matched_filter_
98-
99-
.. _fast_matched_filter: utils.correlate.fast_matched_filter.html
98+
or an NVIDIA GPU card is available) with less memory consumption. |FMF| is now
99+
supported natively, and can be used as a backend by setting `xcorr_func="fmf"`.
100100

101101
.. |FMF| raw:: html
102102

0 commit comments

Comments
 (0)