eqcorrscan / EQcorrscan

Earthquake detection and analysis in Python.
https://eqcorrscan.readthedocs.io/en/latest/
Other
166 stars 86 forks source link

Converting from templates to Template and Tribe objects[HELP] #320

Closed ymrou closed 5 years ago

ymrou commented 5 years ago

What do you need help with?

I don't quite understand the parameters in the function. For example: name='test_template' refers to the name of the template created previously?

Provide an example so that we can reproduce your problem

What help would you like?

calum-chamberlain commented 5 years ago

name can be anything you like to help you identify the template object.

The Template could do with better docs regarding init parameters. This should be something like:

Parameters:
---
name
    A name associated with the template as a parsable string (no spaces allowed)
st
    The Stream object containing the Template waveform data
lowcut
    The low-cut filter used to achieve st (float, Hz)
highcut
    The high-cut filter used to achieve st (float, Hz)
samp_rate
    The Sampling-rate of the template (float, Hz) - note that this should be the
    same as the sampling-rate of all traces in st.
filt_order
    The order of the filter applied to achieve st (int), see pre-processing
    functions for a more complete description
process_length
    The length of data (in seconds) processed to achieve st. e.g. if you
    processed a day of data then cut the template st from this, then
    process_length would be 86400.0 (float)
prepick
    The time before picks that waveforms were cut to make st (seconds, float)
event
    The Event associated with the template (obspy.core.event.Event)

Let me know if anything above doesn't make sense and we can clarify them before I put them into the docs formally. Apologies for the lack of docs on those parameters!

ymrou commented 5 years ago

Hello, can you provide a specific case to help me understand better?

calum-chamberlain commented 5 years ago
from obspy.clients.fdsn import Client
from obspy.core.event import Catalog
from eqcorrscan import Template
from eqcorrscan.core.template_gen import template_gen
client = Client('NCEDC')
catalog = client.get_events(eventid='72572665', includearrivals=True)
lowcut, highcut, samp_rate, filt_order, length, prepick, process_len = (
    2.0, 9.0, 20.0, 4, 3.0, 0.15, 200)
templates = template_gen(method="from_client", catalog=catalog, 
                         client_id='NCEDC',  lowcut=lowcut, highcut=highcut, 
                         samp_rate=samp_rate,  filt_order=filt_order, length=length, 
                         prepick=prepick, swin='all', process_len=process_len)

template_object = Template(
    name="whateveryouwantittobe", st=templates[0], lowcut=lowcut,
    highcut=highcut, samp_rate=samp_rate, filt_order=filt_order,
    process_length=process_len, prepick=prepick, event=catalog[0])
calum-chamberlain commented 5 years ago

Added doc-strings to develop.