Skip to content

Commit

Permalink
Merge branch 'release/0.1.1'
Browse files Browse the repository at this point in the history
Former-commit-id: 697c300232b8937ec46e3f77c0a2d441a7f262a9 [formerly 60d052f]
Former-commit-id: 9bd12fbd74a60e24961494ed1c396187f7bacce4
  • Loading branch information
calum-chamberlain committed Mar 8, 2016
2 parents b5f8e5a + a1550cc commit bc9c349
Show file tree
Hide file tree
Showing 273 changed files with 12,360 additions and 2,467 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ install:
pytest
pytest-pep8
opencv
pyflakes=0.9.0
- source activate test-environment
# install packages not available via conda
# - pip install -r requirements.txt
Expand Down
24 changes: 24 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,27 @@
## 0.1.1
* Cope with events not always having time_errors in them in eventtoSfile;
* Convert Quakeml depths from m to km;
* Multiple little fixes to make Sfile conversion play well with GeoNet QuakeML files;
* Add function to convert from obspy.core.inventory.station.Station to string format
for Seisan STATION0.HYP file;
* Merged feature branch - hypoDD into develop, this provides mappings for the
hypoDD location program, including generation of dt.cc files;
* Added tests for functions in catalog_to_dd;
* Implemented unittest tests;
* Changed name of EQcorrscan_plotting to plotting;
* Added depreciation warnings;
* Changed internal structure of pre-processing to aid long-term upkeep;
* Added warnings in docs for template_gen relating to template generation from
set length files;
* Updated template_creation tutorial to use day-long data;
* Renamed Sfile_util to sfile_util, and functions there-in: will warn about name changes;
* Updated template plotting to include pick labels;
* Updated template_creation tutorial to download S-picks as well as P-picks;
* Update sfile_util to cope with many possible unfilled objects;
* Added sac_util to convert from sac headers to useful event information - note,
does not convert all things, just origin and pick times;
* Added from_sac function to template_gen.

## 0.1.0
* Implimented tests for synthetic generation and match-filter functions
* Developed new tutorials that download from GeoNet and are much clearer
Expand Down
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@ prune eqcorrscan/doc/_build/latex
prune eqcorrscan/plot
prune eqcorrscan/detections
prune eqcorrscan/grid
prune eqcorrscan/tests/test_data
# prune eqcorrscan/stack_templates
# prune eqcorrscan/templates
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ Also within this package are:

We are currently hovering around 9,000 lines of code (including doc-strings) - it is probably worth
having a look at the docs to check what functions we have. We plan to write a series of tutorials to be
included on the EQcorrscan API to highlight key functions, currently our tutorial only shows
included on the EQcorrscan API to highlight key functions, currently our tutorials only show
how to do the core matched-filter detection.

# Licence
Expand Down Expand Up @@ -108,3 +108,4 @@ will keep us all branching in the same way.
* Thurber, C. H., Zeng, X., Thomas, A. M., & Audet, P. (2014). [Phase‐Weighted Stacking Applied to Low‐Frequency Earthquakes](http://www.bssaonline.org/content/early/2014/08/12/0120140077.abstract), __BSSA__, doi:10.1785/0120140077.
* Frank, W. B., & Shapiro, N. M. (2014). [Automatic detection of low-frequency earthquakes (LFEs) based on a beamformed network response](http://gji.oxfordjournals.org/content/197/2/1215.short), __Geophysical Journal International__, 197(2), 1215-1223, doi:10.1093/gji/ggu058.
* Rubinstein, J. L., & Ellsworth, W. L. (2010). [Precise estimation of repeating earthquake moment: Example from Parkfield, California](http://www.bssaonline.org/content/100/5A/1952.short), __BSSA__, doi:10.1785/0120100007
fa66e06971b2dd1e4bf766
76 changes: 74 additions & 2 deletions eqcorrscan/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,82 @@
You should have received a copy of the GNU General Public License
along with EQcorrscan. If not, see <http://www.gnu.org/licenses/>.
"""

import sys
import importlib
import warnings

__all__ = ['core', 'utils', 'par']
__version__ = '0.1.0'

__version__ = '0.1.1'

# Cope with changes to name-space to remove most of the camel-case
_import_map = {
"eqcorrscan.utils.catalogue2DD": "eqcorrscan.utils.catalog_to_dd",
"eqcorrscan.utils.EQcorrscan_plotting": "eqcorrscan.utils.plotting"
}


class EQcorrscanDeprecationWarning(UserWarning):
"""
Force pop-up of warnings.
"""
pass


class EQcorrscanRestructureAndLoad(object):
"""
Path finder and module loader for transitioning
"""
def find_module(self, fullname, path=None):
# Compatibility with namespace paths.
if hasattr(path, "_path"):
path = path._path

if not path or not path[0].startswith(__path__[0]):
return None

for key in _import_map.keys():
if fullname.startswith(key):
break
else:
return None
return self

def load_module(self, name):
# Use cached modules.
if name in sys.modules:
return sys.modules[name]
# Otherwise check if the name is part of the import map.
elif name in _import_map:
new_name = _import_map[name]
else:
new_name = name
for old, new in _import_map.items():
if not new_name.startswith(old):
continue
new_name = new_name.replace(old, new)
break
else:
return None

# Don't load again if already loaded.
if new_name in sys.modules:
module = sys.modules[new_name]
else:
module = importlib.import_module(new_name)

# Warn here as at this point the module has already been imported.
warnings.warn("Module '%s' is deprecated and will stop working "
"with the next EQcorrscan version. Please import module "
"'%s' instead." % (name, new_name),
EQcorrscanDeprecationWarning)
sys.modules[new_name] = module
sys.modules[name] = module
return module


sys.meta_path.append(EQcorrscanRestructureAndLoad())

if __name__ == '__main__':
import doctest
doctest.testmod(exclude_empty=True)
4 changes: 2 additions & 2 deletions eqcorrscan/core/bright_lights.py
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@ def brightness(stations, nodes, lags, stream, threshold, thresh_type,
from obspy.core.event import EventDescription, CreationInfo, Comment
import obspy.Stream
import matplotlib.pyplot as plt
from eqcorrscan.utils import EQcorrscan_plotting as plotting
from eqcorrscan.utils import plotting
# Check that we actually have the correct stations
realstations = []
for station in stations:
Expand Down Expand Up @@ -659,7 +659,7 @@ def brightness(stations, nodes, lags, stream, threshold, thresh_type,
del energy, indeces
else:
print('Reading the temp files and computing network response')
node_splits = len(nodes) // num_cores
node_splits = int(len(nodes) // num_cores)
indeces = [range(node_splits)]
for i in range(1, num_cores - 1):
indeces.append(range(node_splits * i, node_splits * (i + 1)))
Expand Down
22 changes: 11 additions & 11 deletions eqcorrscan/core/match_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -401,12 +401,12 @@ def match_filter(template_names, template_list, st, threshold,
import matplotlib.pyplot as plt
plt.ioff()
import copy
from eqcorrscan.utils import EQcorrscan_plotting
from eqcorrscan.utils import plotting
from eqcorrscan.utils import findpeaks
from obspy import Trace
import time

# Copy the stream here because we will fuck about with it
# Copy the stream here because we will muck about with it
stream = st.copy()
templates = copy.deepcopy(template_list)
# Debug option to confirm that the channel names match those in the
Expand Down Expand Up @@ -517,19 +517,19 @@ def match_filter(template_names, template_list, st, threshold,
cccsum_hist = cccsum_plot.copy()
cccsum_hist = cccsum_hist.decimate(int(stream[0].stats.
sampling_rate / 10)).data
cccsum_plot = EQcorrscan_plotting.chunk_data(cccsum_plot, 10,
'Maxabs').data
cccsum_plot = plotting.chunk_data(cccsum_plot, 10,
'Maxabs').data
# Enforce same length
stream_plot.data = stream_plot.data[0:len(cccsum_plot)]
cccsum_plot = cccsum_plot[0:len(stream_plot.data)]
cccsum_hist = cccsum_hist[0:len(stream_plot.data)]
EQcorrscan_plotting.triple_plot(cccsum_plot, cccsum_hist,
stream_plot, rawthresh, True,
plotdir + '/cccsum_plot_' +
template_names[i] + '_' +
stream[0].stats.starttime.
datetime.strftime('%Y-%m-%d') +
'.' + plot_format)
plotting.triple_plot(cccsum_plot, cccsum_hist,
stream_plot, rawthresh, True,
plotdir + '/cccsum_plot_' +
template_names[i] + '_' +
stream[0].stats.starttime.
datetime.strftime('%Y-%m-%d') +
'.' + plot_format)
if debug >= 4:
print(' '.join(['Saved the cccsum to:', template_names[i],
stream[0].stats.starttime.datetime.
Expand Down
Loading

0 comments on commit bc9c349

Please sign in to comment.