示例#1
0
 def test_corr_unclustered(self):
     """Test the corr_cluster function."""
     trace_list = [Trace(np.random.randn(200)) for _ in range(20)]
     corr_cluster(trace_list=trace_list, thresh=1.0)
     self.assertEqual(len(self.log_messages['warning']), 1)
     self.assertTrue('Nothing made it past the first 80% threshold' in
                     self.log_messages['warning'][0])
示例#2
0
    def test_corr_cluster(self):
        """Test the corr_cluster function."""
        from obspy import read
        import glob
        import os
        from eqcorrscan.utils.clustering import corr_cluster

        samp_rate = 100
        testing_path = os.path.join(os.path.abspath(os.path.dirname(__file__)),
                                    'test_data', 'similar_events')
        stream_files = glob.glob(os.path.join(testing_path, '*'))
        stream_list = [read(stream_file) for stream_file in stream_files]
        for stream in stream_list:
            for tr in stream:
                if not (tr.stats.station == 'WHAT2'
                        and tr.stats.channel == 'SH1'):
                    stream.remove(tr)
                    continue
                tr.detrend('simple')
                tr.filter('bandpass', freqmin=5.0, freqmax=15.0)
                tr.resample(sampling_rate=samp_rate)
                tr.trim(tr.stats.starttime + 40, tr.stats.endtime - 45)
        trace_list = [stream[0] for stream in stream_list]
        output = corr_cluster(trace_list=trace_list, thresh=0.7)
        self.assertFalse(output.all())
示例#3
0
 def test_corr_unclustered(self):
     """Test the corr_cluster function."""
     samp_rate = 40
     testing_path = os.path.join(self.testing_path, 'similar_events')
     stream_files = glob.glob(os.path.join(testing_path, '*'))
     stream_list = [read(stream_file) for stream_file in stream_files]
     for stream in stream_list:
         for tr in stream:
             if not (tr.stats.station == 'WHAT2' and
                     tr.stats.channel == 'SH1'):
                 stream.remove(tr)
                 continue
             tr.detrend('simple')
             tr.filter('bandpass', freqmin=2.0, freqmax=10.0)
             tr.resample(sampling_rate=samp_rate)
             tr.trim(tr.stats.starttime + 40, tr.stats.endtime - 45)
     trace_list = [stream[0] for stream in stream_list]
     with warnings.catch_warnings(record=True) as w:
         corr_cluster(trace_list=trace_list, thresh=0.7)
         self.assertEqual(len(w), 1)
         self.assertTrue('Nothing made it past the first 0.6 threshold'
                         in str(w[0].message))
示例#4
0
 def test_corr_cluster(self):
     """Test the corr_cluster function."""
     testing_path = os.path.join(self.testing_path,
                                 'similar_events_processed')
     stream_files = glob.glob(os.path.join(testing_path, '*'))
     stream_list = [read(stream_file) for stream_file in stream_files]
     for stream in stream_list:
         for tr in stream:
             if not (tr.stats.station == 'GCSZ'
                     and tr.stats.channel == 'EHZ'):
                 stream.remove(tr)
                 continue
     trace_list = [stream[0] for stream in stream_list]
     output = corr_cluster(trace_list=trace_list, thresh=0.7)
     self.assertFalse(output.all())
示例#5
0
 def test_corr_cluster(self):
     """Test the corr_cluster function."""
     samp_rate = 40
     testing_path = os.path.join(self.testing_path, 'similar_events')
     stream_files = glob.glob(os.path.join(testing_path, '*'))
     stream_list = [read(stream_file) for stream_file in stream_files]
     for stream in stream_list:
         for tr in stream:
             if not (tr.stats.station == 'GCSZ' and
                     tr.stats.channel == 'EHZ'):
                 stream.remove(tr)
                 continue
             tr.detrend('simple')
             tr.filter('bandpass', freqmin=2.0, freqmax=10.0)
             tr.resample(sampling_rate=samp_rate)
             tr.trim(tr.stats.starttime + 40, tr.stats.endtime - 45)
     trace_list = [stream[0] for stream in stream_list]
     output = corr_cluster(trace_list=trace_list, thresh=0.7)
     self.assertFalse(output.all())
示例#6
0
 def test_corr_cluster(self):
     """Test the corr_cluster function."""
     from obspy import read
     import glob
     import os
     from eqcorrscan.utils.clustering import corr_cluster
     samp_rate=100
     testing_path = os.path.join(os.path.abspath(os.path.dirname(__file__)),
                                 'test_data', 'similar_events')
     stream_files = glob.glob(os.path.join(testing_path, '*'))
     stream_list = [read(stream_file) for stream_file in stream_files]
     for stream in stream_list:
         for tr in stream:
             if not (tr.stats.station == 'WHAT2' and
                     tr.stats.channel == 'SH1'):
                 stream.remove(tr)
                 continue
             tr.detrend('simple')
             tr.filter('bandpass', freqmin=5.0, freqmax=15.0)
             tr.resample(sampling_rate=samp_rate)
             tr.trim(tr.stats.starttime + 40, tr.stats.endtime - 45)
     trace_list = [stream[0] for stream in stream_list]
     output = corr_cluster(trace_list=trace_list, thresh=0.7)
     self.assertFalse(output.all())