def generate_synth_data(nsta, ntemplates, nseeds, samp_rate, t_length,<EOL>max_amp, max_lag, debug=<NUM_LIT:0>):
<EOL>t_times = np.abs(np.random.random([nsta, ntemplates])) * max_lag<EOL>lats = np.random.random(ntemplates) * <NUM_LIT><EOL>lons = np.random.random(ntemplates) * <NUM_LIT><EOL>depths = np.abs(np.random.random(ntemplates) * <NUM_LIT>)<EOL>nodes = zip(lats, lons, depths)<EOL>stations = ['<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>',<EOL>'<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>',<EOL>'<STR_LIT>']<EOL>if debug > <NUM_LIT:1>:<EOL><INDENT>print(nodes)<EOL>print(t_times)<EOL>print(stations[<NUM_LIT:0>:nsta])<EOL><DEDENT>templates = template_grid(stations=stations[<NUM_LIT:0>:nsta], nodes=nodes,<EOL>travel_times=t_times, phase='<STR_LIT:S>',<EOL>samp_rate=samp_rate,<EOL>flength=int(t_length * samp_rate))<EOL>if debug > <NUM_LIT:2>:<EOL><INDENT>for template in templates:<EOL><INDENT>print(template)<EOL><DEDENT><DEDENT>seeds = []<EOL>data = templates[<NUM_LIT:0>].copy()  <EOL>for tr in data:<EOL><INDENT>tr.data = np.zeros(<NUM_LIT> * int(samp_rate))<EOL>tr.stats.starttime = UTCDateTime(<NUM_LIT:0>)<EOL><DEDENT>for i, template in enumerate(templates):<EOL><INDENT>impulses = np.zeros(<NUM_LIT> * int(samp_rate))<EOL>impulse_times = np.random.randint(<NUM_LIT> * int(samp_rate),<EOL>size=nseeds)<EOL>impulse_amplitudes = np.random.randn(nseeds) * max_amp<EOL>seeds.append({'<STR_LIT>': impulse_amplitudes,<EOL>'<STR_LIT:time>': impulse_times})<EOL>for j in range(nseeds):<EOL><INDENT>impulses[impulse_times[j]] = impulse_amplitudes[j]<EOL><DEDENT>mintime = min([template_tr.stats.starttime<EOL>for template_tr in template])<EOL>for j, template_tr in enumerate(template):<EOL><INDENT>offset = int((template_tr.stats.starttime - mintime) * samp_rate)<EOL>pad = np.zeros(offset)<EOL>tr_impulses = np.append(pad, impulses)[<NUM_LIT:0>:len(impulses)]<EOL>data[j].data += np.convolve(tr_impulses,<EOL>template_tr.data)[<NUM_LIT:0>:len(impulses)]<EOL><DEDENT><DEDENT>for tr in data:<EOL><INDENT>noise = np.random.randn(<NUM_LIT> * int(samp_rate))<EOL>tr.data += noise / max(noise)<EOL><DEDENT>return templates, data, seeds<EOL>
Generate a synthetic dataset to be used for testing.

This will generate both templates and data to scan through.
Templates will be generated using the utils.synth_seis functions.
The day of data will be random noise, with random signal-to-noise
ratio copies of the templates randomly seeded throughout the day.
It also returns the seed times and signal-to-noise ratios used.

:type nsta: int
:param nsta: Number of stations to generate data for < 15.
:type ntemplates: int
:param ntemplates: Number of templates to generate, will be generated \
    with random arrival times.
:type nseeds: int
:param nseeds: Number of copies of the template to seed within the \
    day of noisy data for each template.
:type samp_rate: float
:param samp_rate: Sampling rate to use in Hz
:type t_length: float
:param t_length: Length of templates in seconds.
:type max_amp: float
:param max_amp: Maximum signal-to-noise ratio of seeds.
:param max_lag: Maximum lag time in seconds (randomised).
:type max_lag: float
:type debug: int
:param debug: Debug level, bigger the number, the more plotting/output.

:returns: Templates: List of :class:`obspy.core.stream.Stream`
:rtype: list
:returns: Data: :class:`obspy.core.stream.Stream` of seeded noisy data
:rtype: :class:`obspy.core.stream.Stream`
:returns: Seeds: dictionary of seed SNR and time with time in samples.
:rtype: dict