Skip to content

Commit 3928d24

Browse files
authored
Merge pull request #9 from adjtomo/devel
General improvements for better compatibilities w/ external packages
2 parents 17db9f3 + 152f443 commit 3928d24

File tree

106 files changed

+1442978
-2514
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

106 files changed

+1442978
-2514
lines changed

.github/pull_request_template.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<!--
2+
Thank your for contributing to Pyatoa.
3+
Please fill out the following before submitting your PR.
4+
-->
5+
6+
### What does this PR do?
7+
8+
### Why was it initiated? Any relevant Issues?
9+
10+
### PR Checklist
11+
- [ ] `develop` base branch selected?
12+
- [ ] This PR is not directly related to an existing issue (which has no PR yet).
13+
- [ ] All tests still pass.
14+
- [ ] Any new features or fixed regressions covered by new tests.
15+
- [ ] Any new or changed features have been fully documented.
16+
- [ ] Significant changes have been added to `CHANGELOG.md`.
17+
- [ ] First time contributors have added your name to CONTRIBUTORS.txt .
18+
19+

CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
1-
## Version 0.0.1
1+
# Current (moving to v0.2.0)
2+
3+
- Replaced Basemap mapping dependency with Cartopy due to Basemap EOL
4+
- Refactored Gatherer class to simplify code structure. API remains the same.
5+
- New Executive class takes care of standalone parallel processing
6+
- Pyaflowa per-station parallel processing using concurrent.futures

CONTRIBUTORS.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Chow, Bryant
File renamed without changes.

TODO.md

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

pyatoa/__init__.py

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,12 @@
1111
ch.setFormatter(formatter)
1212
logger.addHandler(ch)
1313

14-
# Actually this is annoying, don't do that
15-
# Redirect warning messages into the logger
16-
# logging.captureWarnings(True)
17-
# warnings_logger = logging.getLogger("py.warnings")
18-
# warnings_logger.addHandler(logger)
19-
2014
from pyatoa.core.config import Config # NOQA
2115
from pyatoa.core.manager import Manager, ManagerError # NOQA
22-
from pyatoa.core.gatherer import (Gatherer, append_focal_mechanism,
23-
get_gcmt_moment_tensor) # NOQA
16+
from pyatoa.core.executive import Executive # NOQA
17+
from pyatoa.core.gatherer import Gatherer # NOQA
2418
from pyatoa.core.inspector import Inspector # NOQA
2519
from pyatoa.core.pyaflowa import Pyaflowa # NOQA
2620
from pyatoa.utils.read import read_sem, read_stations # NOQA
2721
from pyatoa.utils.write import write_sem, write_stations # NOQA
2822

29-
# Dont include this so that Mayavi is not a default requirement
30-
#from pyatoa.visuals.vtk_modeler import VTKModeler # NOQA
31-

pyatoa/core/config.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
currently it's obscured behind some private functions
88
"""
99
import yaml
10+
import numpy as np
11+
from copy import deepcopy
1012
from pyatoa import logger
1113
from pyatoa.utils.form import format_iter, format_step
1214
from pyatoa.plugins.pyflex_presets import pyflex_presets
@@ -260,8 +262,9 @@ def _check(self):
260262
assert(self.step_count >= 0), "Step count must start from 0"
261263

262264
# Check period range is acceptable
263-
assert(self.min_period < self.max_period), \
264-
"min_period must be less than max_period"
265+
if self.min_period and self.max_period:
266+
assert(self.min_period < self.max_period), \
267+
"min_period must be less than max_period"
265268

266269
# Check if unit output properly set, dictated by ObsPy units
267270
acceptable_units = ['DISP', 'VEL', 'ACC']
@@ -389,6 +392,12 @@ def _check_io_format(fid, fmt=None):
389392
else:
390393
return fmt
391394

395+
def copy(self):
396+
"""
397+
Simply convenience function to return a deep copy of the Config
398+
"""
399+
return deepcopy(self)
400+
392401
def write(self, write_to, fmt=None):
393402
"""
394403
Wrapper for underlying low-level write functions
@@ -465,10 +474,6 @@ def _write_asdf(self, ds):
465474
:type ds: pyasdf.asdf_data_set.ASDFDataSet
466475
:param ds: dataset to save the config file to
467476
"""
468-
# Lazy imports because this function isn't always called
469-
from numpy import array
470-
from copy import deepcopy
471-
472477
# Deep copy to ensure that we aren't editing the Config parameters
473478
attrs = vars(deepcopy(self))
474479

@@ -497,7 +502,7 @@ def _write_asdf(self, ds):
497502
attrs.pop(key)
498503
attrs.update(add_attrs)
499504

500-
ds.add_auxiliary_data(data_type="Configs", data=array([True]),
505+
ds.add_auxiliary_data(data_type="Configs", data=np.array([True]),
501506
path=self.aux_path, parameters=attrs
502507
)
503508

0 commit comments

Comments
 (0)