seisnn.components.TFRecordConverter¶
- class seisnn.components.TFRecordConverter(phase=('P', 'S', 'N'), trace_length=30, shape='triang')[source]¶
Bases:
object
Main class for TFRecord Converter.
Consumes data from external source and emit TFRecord.
- __init__(phase=('P', 'S', 'N'), trace_length=30, shape='triang')[source]¶
Initialize self. See help(type(self)) for accurate signature.
Methods
__init__
([phase, trace_length, shape])Initialize self.
convert_training_from_picks
(pick_list, tag, …)Convert training TFRecords from database picks.
get_instance_list
(picks, tag, database)Returns instance list form list of picks and SQL database.
get_time_window
(anchor_time, station[, shift])Returns metadata from anchor time.
signal_preprocessing
(stream)Return a signal processed stream.
trim_trace
(stream[, points])Return trimmed stream in a given length.
write_tfrecord
(picks, sub_dir, tag, database)- convert_training_from_picks(pick_list, tag, database, cpu_count=None)[source]¶
Convert training TFRecords from database picks.
- Parameters
pick_list – List of picks from Pick SQL query.
tag (str) – Pick tag in SQL database.
database (str) – SQL database name.
- get_instance_list(picks, tag, database)[source]¶
Returns instance list form list of picks and SQL database.
- Parameters
picks – List of picks.
tag (str) – Pick tag in SQL database.
database (str) – SQL database root.
- Returns
- get_time_window(anchor_time, station, shift=0)[source]¶
Returns metadata from anchor time.
- Parameters
anchor_time – Anchor of the time window.
station (str) – Station name.
or str shift (float) – (Optional.) Shift in sec, if ‘random’ will shift randomly within the trace length.
- Return type
dict
- Returns
Metadata object.