Commit b612e1ab authored by Sebastian Heimann's avatar Sebastian Heimann
Browse files

add possibility to give blacklists in files

parent 29b035ca
......@@ -773,10 +773,12 @@ class DatasetConfig(HasPaths):
apply_correction_factors = Bool.T(default=True)
apply_correction_delays = Bool.T(default=True)
picks_paths = List.T(Path.T())
blacklist_paths = List.T(Path.T())
blacklist = List.T(
String.T(),
help='stations/components to be excluded according to their STA, '
'NET.STA, NET.STA.LOC, or NET.STA.LOC.CHA codes.')
whitelist_paths = List.T(Path.T())
whitelist = List.T(
String.T(),
optional=True,
......@@ -844,8 +846,11 @@ class DatasetConfig(HasPaths):
filename=fp(picks_path))
ds.add_blacklist(self.blacklist)
ds.add_blacklist(filenames=self.blacklist_paths)
if self.whitelist:
ds.add_whitelist(self.whitelist)
if self.whitelist_paths:
ds.add_whitelist(filenames=self.whitelist_paths)
ds.set_synthetic_test(copy.deepcopy(self.synthetic_test))
self._ds[event_name] = ds
......@@ -1651,7 +1656,6 @@ def check(
ms, ns, results = problem.evaluate(x, result_mode='full')
results_list.append(results)
if show_plot:
for itarget, target in enumerate(problem.targets):
yabsmaxs = []
......
......@@ -165,15 +165,27 @@ class Dataset(object):
else:
self.clippings[k] = num.concatenate(self.clippings, atimes)
def add_blacklist(self, blacklist):
def add_blacklist(self, blacklist=[], filenames=None):
logger.debug('Loading blacklisted stations')
if filenames:
blacklist = list(blacklist)
for filename in filenames:
with open(filename, 'r') as f:
blacklist.extend(s.strip() for s in f.splitlines())
for x in blacklist:
if isinstance(x, basestring):
x = tuple(x.split('.'))
self.blacklist.add(x)
def add_whitelist(self, whitelist):
def add_whitelist(self, whitelist=[], filenames=None):
logger.debug('Loading whitelisted stations')
if filenames:
whitelist = list(whitelist)
for filename in filenames:
with open(filename, 'r') as f:
whitelist.extend(s.strip() for s in f.splitlines())
if self.whitelist_nslc is None:
self.whitelist_nslc = set()
self.whitelist_nsl = set()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment