diff --git a/Example/script.py b/Example/script.py index 7909dca2266ba75dfe5ce118169f26068f3a1e8d..a6446793010e89af469c4bcc3a7682e9cf0dc667 100644 --- a/Example/script.py +++ b/Example/script.py @@ -77,14 +77,14 @@ config.templateShiftCorr = False # Whether to shift templates to align them t config.timeTol = 0.5 # (post-processing) Used to unify detections of templates # -- Scanning parameters -config.filtConf = [5, 30, 4]; config.stop50Hz = False -config.filterBuff = 1.0 # To avoid filter response in signal: - # Time to prepend and append before filtering waveform +config.filtConf = [5, 30, 4] # BP Filter limits & order +config.stop50Hz = False # 50Hz Bandstop? +config.filterBuff = 1.0 # Waveform filter margin to avoid filter response in signal config.FFT_filt = False # Filter in frequency domain? (useful if FFT resampling anyway) config.threshold = .40 # The general threshold (as fraction of 1) config.threshCred = .50 # The credible (more conservative) threshold -config.threshPerChannel = False # Apply thresh to EACH channel (and not MEAN among channels) +config.threshPerChannel = False # Apply thresh to EACH channel? (and not MEAN among channels) # -- Timing config.startdate = UTCDateTime("2015-01-01") @@ -101,7 +101,7 @@ config.parallelFilter = False # (process-based-parallel can take up huge a config.use_threads = True # Use threads for certain tasks (e.g., read, calc_std_window) # Immitate MPI-related config parameters (to avoid 'Value not set' error when NOT using MPI) -config.chunk_len = 24*60*60 +config.chunk_len = 24*60*60 # 24 hours config.overlap_len = 0 config.max_chunk_on_disk = 0 config.num_readers = 0 @@ -110,26 +110,30 @@ config.num_readers = 0 config.select_fastest_approach() # Will benchmark for 2x1 minute #config.conv_method = 'fftconvolve' # Choose method right away ['convolve', 'fftconvolve'] - -# Define more threshold values -threshs = sorted(set([config.threshold, config.threshCred] + - [0.45, 0.5, 0.55, 0.6, 0.8])) - # -- Set output directory (for results) config.set_dir(regionName=True, openEnd=True, moreInfo=False) - # -- Treat template selection ( = making a templateSet) # * Auto mode -templateSet = [] # Start with empty templateSet +templateSet = [] # Start with empty templateSet config.templateMagRange = (-2.0, 1.2) # Magnitude range of events to use for scanning config.firstTemplateMinMag = 0.5 # Minimum magnitude of first template event config.threshNewTemplate = .75 # Catalog events that were detected with CC smaller than - # this will become a new template + # this value will become a new template + +# -- Define more threshold values +threshs = sorted(set([config.threshold, config.threshCred] + + [0.45, 0.5, 0.55, 0.6, 0.8])) + +# +# [setup complete] #exit() # Maybe you want to stop here first? + +# --- Load the catalog (= potential templates) + # Run SQL script, and delete the events not needed in the csv # (i.e. events before startdate, or AUTOMATIC locations/magnitudes) #getEventsFromSC3DB() diff --git a/Example/script_mpi.py b/Example/script_mpi.py index a5b144b8009606bdeb4078471bbc0a4ee801b91f..8a28974023978150910dc431aefc4dd3750d8a44 100644 --- a/Example/script_mpi.py +++ b/Example/script_mpi.py @@ -54,7 +54,7 @@ config.FDSN_waveforms = False # Whether to use FDSN also as data source fo # -- Network / Station related parameters config.network = 'CH' config.region = 'Chamonix' -config.station = 'SALAN'; +config.station = 'SALAN' config.load_station_info() # Gets station meta data (e.g., channels, sampling rate) # Limit to certain channel codes @@ -70,14 +70,14 @@ config.templateShiftCorr = False # Whether to shift templates to align them t config.timeTol = 0.5 # (post-processing) Used to unify detections of templates # -- Scanning parameters -config.filtConf = [5, 30, 4]; config.stop50Hz = False -config.filterBuff = 1.0 # To avoid filter response in signal: - # Time to prepend and append before filtering waveform +config.filtConf = [5, 30, 4] # BP Filter limits & order +config.stop50Hz = False # 50Hz Bandstop? +config.filterBuff = 1.0 # Waveform filter margin to avoid filter response in signal config.FFT_filt = False # Filter in frequency domain? (useful if FFT resampling anyway) config.threshold = .40 # The general threshold (as fraction of 1) config.threshCred = .50 # The credible (more conservative) threshold -config.threshPerChannel = False # Apply thresh to EACH channel (and not MEAN among channels) +config.threshPerChannel = False # Apply thresh to EACH channel? (and not MEAN among channels) # -- Timing config.startdate = UTCDateTime("2015-01-01") @@ -93,7 +93,7 @@ config.set_resampling('auto') # or: 'none', or: 'manual' with srate= or fa config.parallelFilter = False # (process-based-parallel can take up huge amounts of memory) config.use_threads = False # Use threads for certain tasks (e.g., read, calc_std_window) -# MPI +# MPI settings config.chunk_len = 60*60*6 # 6 hours config.overlap_len = 30 # 30 seconds config.max_chunk_on_disk = 3 # max number of chunks on disks @@ -107,18 +107,23 @@ config.select_fastest_approach() # Will benchmark for 2x1 minute # -- Set output directory (for results) config.set_dir(regionName=True, openEnd=True, moreInfo=False) - # -- Treat template selection ( = making a templateSet) # * Auto mode -templateSet = [] # Start with empty templateSet +templateSet = [] # Start with empty templateSet config.templateMagRange = (-2.0, 1.2) # Magnitude range of events to use for scanning config.firstTemplateMinMag = 0.5 # Minimum magnitude of first template event config.threshNewTemplate = .75 # Catalog events that were detected with CC smaller than - # this will become a new template + # this value will become a new template + +# +# [setup complete] #exit() # Maybe you want to stop here first? + +# --- Load the catalog (= potential templates) + # Run SQL script, and delete the events not needed in the csv # (i.e. events before startdate, or AUTOMATIC locations/magnitudes) #getEventsFromSC3DB() @@ -127,6 +132,7 @@ catalog = readCatalogSEDDB() #preload_events(catalog, readALLagain=False) # NOW CHECK IF THERE ARE DOUBLE EVENTS (o qualcosa) ... and exclude them! + # --- Do the Template Matching # Adjust canditate catalog list diff --git a/TM/plotting.py b/TM/plotting.py index cc6bc0d190a596dd7155e4b7df403939d02b9585..8b3e264c900a424032cd08d7ff4b01e78ebf2062 100644 --- a/TM/plotting.py +++ b/TM/plotting.py @@ -313,7 +313,7 @@ def plot_hist_template_distribution(foundEvents, foundEvents_full=[], threshold= plt.legend() plt.savefig(config.directory + "/_templateSet_hist_distribution%s_thresh%.2f.png" - % (suffix, threshold), dpi=150) + % (suffix, threshold), dpi=150, bbox_inches='tight') plt.close() @@ -348,7 +348,7 @@ def plot_hist_template_counts(foundEvents, threshold=None): plt.xticks(np.arange(1, maxRange+1)) plt.tick_params(axis='x', which='major', labelsize=6) plt.savefig(config.directory + "/_templateSet_hist_counts_thresh%.2f.png" % threshold, - dpi=150) + dpi=150, bbox_inches='tight') plt.close() diff --git a/TM/setupclass.py b/TM/setupclass.py index f897a488af4ddbf494dbfb34e628a7ebea6ca472..2977dc7a7eaa95987bf58502d0c09201469f4fd7 100644 --- a/TM/setupclass.py +++ b/TM/setupclass.py @@ -47,8 +47,9 @@ class Setup: # Scanning parameters resampling = None # maximum sampling rate (to save memory) - filtConf = None # Upper & Lower bounds & Filter order + filtConf = None # BP Filter limits & order stop50Hz = None # Whether to remove the 50Hz + filterBuff = None # Waveform filter margin to avoid filter response in signal FFT_filt = None # Whether to filter in frequency domain threshold = None diff --git a/version b/version index 0ea3a944b399d25f7e1b8fe684d754eb8da9fe7f..0c62199f16ac1e2d7f7ae75b420c1231325dff4e 100644 --- a/version +++ b/version @@ -1 +1 @@ -0.2.0 +0.2.1