[cig-commits] [commit] master: Added handling for no event filter (3bb3d3c)

cig_noreply at geodynamics.org cig_noreply at geodynamics.org
Wed Jan 28 22:38:01 PST 2015


Repository : https://github.com/geodynamics/vq

On branch  : master
Link       : https://github.com/geodynamics/vq/compare/4a71dae87966b80bfee7c194773543359a343617...941b3d7e55983967dea392d12aeac9ce3998ca30

>---------------------------------------------------------------

commit 3bb3d3cc5ec679652debbd27c4ca4b52fdbd597c
Author: kwschultz <kwschultz at ucdavis.edu>
Date:   Wed Jan 28 11:39:51 2015 -0800

    Added handling for no event filter


>---------------------------------------------------------------

3bb3d3cc5ec679652debbd27c4ca4b52fdbd597c
 examples/pyvq.py | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/examples/pyvq.py b/examples/pyvq.py
index 4653c7a..da607ec 100755
--- a/examples/pyvq.py
+++ b/examples/pyvq.py
@@ -105,12 +105,13 @@ class Events:
     def set_filters(self, filter_list):
         self._filtered_events = [evnum for evnum in range(len(self._events))]
         self._plot_str = ""
-        for cur_filter in filter_list:
-            new_filtered_events = [evnum for evnum in self._filtered_events if cur_filter.test_event(self._events[evnum])]
-            self._filtered_events = new_filtered_events
-            self._plot_str += cur_filter.plot_str()
-        if len(self._filtered_events) == 0:
-            raise "No events matching filters found!"
+        if filter_list!= []:
+            for cur_filter in filter_list:
+                new_filtered_events = [evnum for evnum in self._filtered_events if cur_filter.test_event(self._events[evnum])]
+                self._filtered_events = new_filtered_events
+                self._plot_str += cur_filter.plot_str()
+            if len(self._filtered_events) == 0:
+                raise "No events matching filters found!"
 
     def interevent_times(self):
         event_times = [self._events[evnum].getEventYear() for evnum in self._filtered_events]
@@ -441,6 +442,7 @@ if __name__ == "__main__":
     if args.model_file:
         model = quakelib.ModelWorld()
         model.read_file_ascii(args.model_file)
+        # TODO: add HDF5 compatibility
     else:
         model = None
 



More information about the CIG-COMMITS mailing list