Example #1
0
    def __init__(self):
        ''' Initialize the instance.

        '''
        plugins.CommandPlugin.__init__(self,
                                       name = 'export',
                                       category = 'export',
                                       tags = ['export']
                                       )

        # Create the logging logger instance.
        logger_prefix = psysmon.logConfig['package_prefix']
        loggerName = logger_prefix + "." + __name__ + "." + self.__class__.__name__
        self.logger = logging.getLogger(loggerName)

        self.icons['active'] = icons.iconsBlack16.export_icon_16


        # Add the plugin preferences.
        item = preferences_manager.SingleChoicePrefItem(name = 'source',
                                                        label = 'source',
                                                        value = 'visible',
                                                        limit = ['original', 'visible'],
                                                        tool_tip = 'The data to export.')
        self.pref_manager.add_item(item = item)

        obspy_export_formats = ['GSE2', 'MSEED', 'PICKLE', 'Q',
                                'SAC', 'SACXY', 'SEGY', 'SH_ASC', 'SLIST',
                                'SU', 'TSPAIR']
        self.export_format_ext = {'GSE2' : 'gse2',
                                  'MSEED' : 'msd',
                                  'PICKLE' : 'pkl',
                                  'Q' : 'q',
                                  'SAC' : 'sac',
                                  'SACYX' : 'sacyx',
                                  'SEGY' : 'segy',
                                  'SH_ASC' : 'asc',
                                  'SLIST' : 'asc',
                                  'SU' : 'su',
                                  'TSPAIR' : 'asc'}
        item = preferences_manager.SingleChoicePrefItem(name = 'export_format',
                                                        label = 'export format',
                                                        value = 'TSPAIR',
                                                        limit = obspy_export_formats,
                                                        tool_tip = 'The available export file formats. See the obspy documentation for further details on specific formats.')
        self.pref_manager.add_item(item = item)


        item = preferences_manager.DirBrowsePrefItem(name = 'export_dir',
                                                     label = 'export directory',
                                                     value = '',
                                                     tool_tip = 'The directory where to save the exported files.')
        self.pref_manager.add_item(item = item)
Example #2
0
    def create_preferences(self):
        ''' Create the psysmon preferences items.
        '''
        logging_page = self.pref_manager.add_page('logging')
        log_levels_group = logging_page.add_group('log levels')
        status_group = logging_page.add_group('status')

        # The log levels group items.
        pref_item = pm.SingleChoicePrefItem(
            name='main_loglevel',
            label='main log level',
            limit=('DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL'),
            value='INFO',
            tool_tip='The level of the main logger.')
        log_levels_group.add_item(item=pref_item)

        pref_item = pm.SingleChoicePrefItem(
            name='shell_loglevel',
            label='shell log level',
            limit=('DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL'),
            value='INFO',
            tool_tip='The level of the logger writing to the shell.')
        log_levels_group.add_item(item=pref_item)

        pref_item = pm.SingleChoicePrefItem(
            name='gui_status_loglevel',
            label='status log level',
            limit=('DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL'),
            value='INFO',
            tool_tip=
            'The level of the logger writing to the psysmon status logging area.'
        )
        log_levels_group.add_item(item=pref_item)

        pref_item = pm.SingleChoicePrefItem(
            name='collection_loglevel',
            label='collection log level',
            limit=('DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL'),
            value='INFO',
            tool_tip=
            'The level of the logger writing to a log file when executing a collection.'
        )
        log_levels_group.add_item(item=pref_item)

        # The status group items.
        pref_item = pm.IntegerSpinPrefItem(
            name='n_status_messages',
            label='# status messages',
            limit=(10, 1000),
            value=100,
            tool_tip='The number of messages to show in the log area status.')
        status_group.add_item(item=pref_item)
    def create_output_preferences(self):
        ''' Create the output preferences.
        '''
        output_page = self.pref_manager.add_page('Output')
        dest_group = output_page.add_group('destination')
        folder_group = output_page.add_group('folder')
        ds_group = output_page.add_group('data source')

        # The destination option.
        item = psy_pm.SingleChoicePrefItem(
            name='destination',
            label='destination',
            limit=('folder', 'data source'),
            value='folder',
            hooks={'on_value_change': self.on_destination_changed},
            tool_tip='The location where the exported data files will be saved.'
        )
        dest_group.add_item(item)

        # The destination folder.
        item = psy_pm.DirBrowsePrefItem(
            name='folder',
            value='',
            tool_tip='The folder where the data files will be saved.')
        folder_group.add_item(item)

        # The waveclient to work with.
        item = psy_pm.SingleChoicePrefItem(
            name='waveclient',
            label='waveclient',
            limit=(),
            value='',
            tool_tip='The available database waveclients.',
            hooks={'on_value_change': self.on_waveclient_selected})
        ds_group.add_item(item)

        # The waveform directories of the waveclient.
        column_labels = [
            'db_id', 'waveclient', 'waveform dir', 'alias', 'description',
            'data file extension', 'first import', 'last scan'
        ]
        item = psy_pm.ListCtrlEditPrefItem(
            name='wf_dir',
            label='waveform directory',
            value=[],
            column_labels=column_labels,
            limit=[],
            tool_tip='The available waveform directories.',
            hooks={'on_value_change': self.on_wf_dir_selected})

        ds_group.add_item(item)
    def __init__(self, **args):
        psysmon.core.packageNodes.CollectionNode.__init__(self, **args)

        select_page = self.pref_manager.add_page('Select')
        source_group = select_page.add_group('source')

        # The waveclient to work with.
        item = psy_pm.SingleChoicePrefItem(
            name='waveclient',
            label='waveclient',
            limit=(),
            value='',
            tool_tip='The available database waveclients.',
            hooks={'on_value_change': self.on_waveclient_selected})
        source_group.add_item(item)

        # The waveform directories of the waveclient.
        column_labels = [
            'db_id', 'waveclient', 'waveform dir', 'alias', 'description',
            'data file extension', 'first import', 'last scan'
        ]
        item = psy_pm.ListCtrlEditPrefItem(
            name='wf_dir',
            label='waveform directory',
            value=[],
            column_labels=column_labels,
            limit=[],
            tool_tip='The available waveform directories.',
            hooks={'on_value_change': self.on_wf_dir_selected})

        source_group.add_item(item)
Example #5
0
    def create_parameters_prefs(self):
        ''' Create the preference items of the parameters section.
        '''
        pagename = '2 parameters'
        self.pref_manager.add_page(pagename)

        pref_item = psy_pm.FloatSpinPrefItem(
            name='ppsd_length',
            label='ppsd length [s]',
            group='PPSD',
            value=3600,
            limit=[0, 1e10],
            increment=1,
            digits=3,
            tool_tip='Length of data segments passed to psd [s].')
        self.pref_manager.add_item(pagename=pagename, item=pref_item)

        pref_item = psy_pm.IntegerSpinPrefItem(
            name='ppsd_overlap',
            label='ppsd overlap [%]',
            group='PPSD',
            value=50,
            limit=[0, 99],
            tool_tip='Overlap of segments passed to psd [%].')
        self.pref_manager.add_item(pagename=pagename, item=pref_item)

        pref_item = psy_pm.SingleChoicePrefItem(
            name='plot_interval',
            label='plot interval',
            group='PPSD',
            limit=('day', 'week', 'complete'),
            value='week',
            tool_tip='The length of the PPSD plots.')
        self.pref_manager.add_item(pagename=pagename, item=pref_item)
Example #6
0
    def create_selector_preferences(self):
        ''' Create the preference items of the event selection section.
        '''
        events_page = self.pref_manager.add_page('events')
        time_group = events_page.add_group('time span')
        event_group = events_page.add_group('event selection')

        item = psy_pm.DateTimeEditPrefItem(
            name='start_time',
            label='start time',
            value=UTCDateTime('2015-01-01T00:00:00'),
            tool_tip=
            'The start time of the selection time span (UTCDateTime string format YYYY-MM-DDTHH:MM:SS).'
        )
        time_group.add_item(item)

        item = psy_pm.DateTimeEditPrefItem(
            name='end_time',
            label='end time',
            value=UTCDateTime('2015-01-01T00:00:00'),
            tool_tip=
            'The end time of the selection time span (UTCDateTime string format YYYY-MM-DDTHH:MM:SS).'
        )
        time_group.add_item(item)

        item = psy_pm.SingleChoicePrefItem(
            name='event_catalog',
            label='event catalog',
            value='',
            limit=[],
            tool_tip='Select an event catalog for which to load the events.')
        event_group.add_item(item)

        item = psy_pm.CheckBoxPrefItem(
            name='select_individual',
            label='select individual events',
            value=False,
            tool_tip='Do a manual selection of the events to process.',
            hooks={'on_value_change': self.on_select_individual})
        event_group.add_item(item)

        item = psy_pm.ActionItem(name='load_events',
                                 label='load events',
                                 mode='button',
                                 action=self.on_load_events,
                                 tool_tip='Load events from the database.')
        event_group.add_item(item)

        item = psy_pm.CustomPrefItem(
            name='events',
            label='events',
            value=[],
            gui_class=EventListField,
            tool_tip=
            'The available events. Selected events will be used for processing.'
        )
        event_group.add_item(item)
Example #7
0
    def create_sta_lta_page(self):
        ''' Create the sta/lta preferences.
        '''
        sta_lta_page = self.pref_manager.add_page('STA/LTA')
        det_group = sta_lta_page.add_group('detection')



        # The STA/LTA parameters
        item = psy_pm.SingleChoicePrefItem(name = 'cf_type',
                                           label = 'characteristic function',
                                           limit = ('abs', 'square'),
                                           value = 'square',
                                           tool_tip = 'The type of the characteristic function used to compute the STA and LTA.')
        det_group.add_item(item)

        item = psy_pm.FloatSpinPrefItem(name = 'sta_len',
                                        label = 'STA length [s]',
                                        value = 1,
                                        limit = (0, 1000),
                                        digits = 1,
                                        tool_tip = 'The length of the STA in seconds.')
        det_group.add_item(item)

        item = psy_pm.FloatSpinPrefItem(name = 'lta_len',
                                        label = 'LTA length [s]',
                                        value = 10,
                                        limit = (0, 1000),
                                        digits = 1,
                                        tool_tip = 'The length of the LTA in seconds.')
        det_group.add_item(item)

        item = psy_pm.FloatSpinPrefItem(name = 'thr',
                                        label = 'threshold',
                                        value = 3,
                                        limit = (0, 1000),
                                        digits = 1,
                                        tool_tip = 'The threshold of STA/LTA when to trigger an event.')
        det_group.add_item(item)

        item = psy_pm.FloatSpinPrefItem(name = 'pre_et',
                                        label = 'pre-event time [s]',
                                        value = 1,
                                        limit = (0, 1000),
                                        digits = 1,
                                        tool_tip = 'The time window to add before the detected event start [s].')
        det_group.add_item(item)

        item = psy_pm.FloatSpinPrefItem(name = 'post_et',
                                        label = 'post-event time [s]',
                                        value = 1,
                                        limit = (0, 1000),
                                        digits = 1,
                                        tool_tip = 'The time window to add after the detected event end [s].')
        det_group.add_item(item)
Example #8
0
    def create_processing_preferences(self):
        ''' Create the preference items of the processing stack section.
        '''
        ps_page = self.pref_manager.add_page('processing')
        mode_group = ps_page.add_group('mode')

        item = psy_pm.SingleChoicePrefItem(
            name='processing_interval',
            label='processing interval',
            limit=('hour', 'day', 'week', 'month', 'whole'),
            value='day',
            tool_tip='The interval of the processing.')
        mode_group.add_item(item)
    def create_pick_selector_preferences(self):
        ''' Create the preference items of the pick section.
       
        '''
        picks_page = self.pref_manager.add_page('picks')
        pick_group = picks_page.add_group('pick selection')

        item = psy_pm.SingleChoicePrefItem(name = 'pick_catalog_name',
                                          label = 'pick catalog',
                                          value = '',
                                          limit = [],
                                          tool_tip = 'Select a pick catalog to work on.')
        pick_group.add_item(item)
Example #10
0
 def __init__(self, **args):
     CollectionNode.__init__(self, **args)
     pref_item = psy_pm.SingleChoicePrefItem(name = 'bulletin_format',
                                             label = 'bulletin format',
                                             limit = ['IMS1.0', 'QuakeML'],
                                             value = 'IMS1.0')
     self.pref_manager.add_item(item = pref_item)
     pref_item = CustomPrefItem(name = 'input_files', value = [])
     self.pref_manager.add_item(item = pref_item)
     pref_item = CustomPrefItem(name = 'last_dir', value = [])
     self.pref_manager.add_item(item = pref_item)
     pref_item = CustomPrefItem(name = 'filter_pattern', value = ['*.txt',])
     self.pref_manager.add_item(item = pref_item)
    def __init__(self, **args):
        # Initialize the instance.
        psysmon.core.packageNodes.CollectionNode.__init__(self, **args)

        logger_prefix = psysmon.logConfig['package_prefix']
        loggerName = logger_prefix + "." + __name__ + "." + self.__class__.__name__
        self.logger = logging.getLogger(loggerName)
        
        select_page = self.pref_manager.add_page('Select')
        wfdir_group = select_page.add_group('waveform directory')
        import_group = select_page.add_group('import options')


        item = psy_pm.SingleChoicePrefItem(name = 'waveclient',
                                           label = 'waveclient',
                                           limit = (),
                                           value = '',
                                           tool_tip = 'The available database waveclients.',
                                           hooks = {'on_value_change': self.on_waveclient_selected})
        wfdir_group.add_item(item)


        column_labels = ['db_id', 'waveclient', 'waveform dir', 'alias', 'description',
                         'data file extension', 'first import', 'last scan']
        item = psy_pm.ListCtrlEditPrefItem(name = 'wf_dir',
                                           label = 'waveform directory',
                                           value = [],
                                           column_labels = column_labels,
                                           limit = [],
                                           tool_tip = 'The available waveform directories.',
                                           hooks = {'on_value_change': self.on_wf_dir_selected})
        wfdir_group.add_item(item)


        item = psy_pm.CheckBoxPrefItem(name = 'import_new_only',
                                       label = 'import new files only',
                                       value = True,
                                       tool_tip = 'Import only files not yet imported to the database. New files are detected based on the file name and file size. If unchecked all existing data associated with the selected waveform directory is deleted from the database before importing the new files in the waveform directory.')
        import_group.add_item(item)

        item = psy_pm.CheckBoxPrefItem(name = 'restrict_search_path',
                                       label = 'restrict search path',
                                       value = False,
                                       tool_tip = 'Restrict the search within the waveform directory to the directory specified below.')
        import_group.add_item(item)

        item = psy_pm.DirBrowsePrefItem(name = 'search_path',
                                        label = 'search path',
                                        value = '',
                                        tool_tip = 'The search path used to restrict the search.')
        import_group.add_item(item)
    def __init__(self):
        ''' Initialize the instance.

        '''
        InteractivePlugin.__init__(self,
                                   name='create event',
                                   category='edit',
                                   tags=['create', 'event'])

        # Create the logging logger instance.
        logger_prefix = psysmon.logConfig['package_prefix']
        loggerName = logger_prefix + "." + __name__ + "." + self.__class__.__name__
        self.logger = logging.getLogger(loggerName)

        self.icons['active'] = icons.event_new_16
        self.cursor = wx.CURSOR_CROSS

        # The event catalog library used to manage the catalogs.
        self.library = event_core.Library('event library')

        # The name of the selected catalog.
        self.selected_catalog_name = None

        self.begin_line = {}
        self.end_line = {}
        self.bg = {}
        self.motion_notify_cid = []
        self.startTime = None
        self.endTime = None

        # Add the pages to the preferences manager.
        self.pref_manager.add_page('tool options')

        # Add the plugin preferences.
        item = psy_pm.SingleChoicePrefItem(
            name='event_catalog',
            label='event catalog',
            group='catalog',
            value='',
            limit=[],
            tool_tip='Select an event catalog to work on.',
            hooks={'on_value_change': self.on_select_catalog})
        self.pref_manager.add_item(pagename='tool options', item=item)

        item = psy_pm.ActionItem(name='create_new_catalog',
                                 label='create new catalog',
                                 group='catalog',
                                 mode='button',
                                 action=self.on_create_new_catalog)
        self.pref_manager.add_item(pagename='tool options', item=item)
    def create_filter_preferences(self):
        ''' Create the filter preferences.
        '''
        pref_page = self.pref_manager.add_page('Filter')
        event_group = pref_page.add_group('event')

        # The event type to pass.
        item = psy_pm.SingleChoicePrefItem(
            name='event_type',
            label='event type',
            limit=[],
            value=None,
            tool_tip='The event type to pass to the next nodes.')
        event_group.add_item(item)
Example #14
0
    def create_select_preferences(self):
        ''' Create the select preferences.
        '''
        select_page = self.pref_manager.add_page('Select')
        ds_group = select_page.add_group('detection selection')

        item = psy_pm.SingleChoicePrefItem(
            name='detection_catalog',
            label='detection catalog',
            value='',
            limit=[],
            hooks={'on_value_change': self.on_catalog_selected},
            tool_tip='Select the detection catalog to show.')
        ds_group.add_item(item)
    def create_format_preferences(self):
        ''' Create the format preferences.
        '''
        format_page = self.pref_manager.add_page('Format')
        format_group = format_page.add_group('format')

        obspy_formats = list(
            obspy.core.util.base.ENTRY_POINTS['waveform'].keys())
        obspy_formats = sorted(obspy_formats)
        item = psy_pm.SingleChoicePrefItem(
            name='file_format',
            label='file format',
            limit=obspy_formats,
            value='MSEED',
            tool_tip='The export file format supported by obspy.')
        format_group.add_item(item)
    def create_output_preferences(self):
        ''' Create the preference items of the output section.

        '''
        output_page = self.pref_manager.add_page('output')
        output_group = output_page.add_group('output')

        item = psy_pm.DirBrowsePrefItem(name = 'output_dir',
                                        label = 'output directory',
                                        value = '',
                                        tool_tip = 'Specify a directory where to save the processing results.'
                                       )
        output_group.add_item(item)

        item = psy_pm.SingleChoicePrefItem(name = 'output_interval',
                                          label = 'output interval',
                                          limit = ('hour', 'day', 'week', 'month', 'whole'),
                                          value = 'day',
                                          tool_tip = 'The interval for which the output should be grouped.')
        output_group.add_item(item)
Example #17
0
    def __init__(self, **args):
        CollectionNode.__init__(self, **args)

        pref_page = self.pref_manager.add_page('Preferences')
        bulletin_group = pref_page.add_group('bulletin')

        pref_item = psy_pm.SingleChoicePrefItem(name='bulletin_format',
                                                label='bulletin format',
                                                limit=['IMS1.0', 'CSV'],
                                                value='IMS1.0')
        bulletin_group.add_item(pref_item)

        pref_item = CustomPrefItem(name='input_files', value=[])
        bulletin_group.add_item(pref_item)

        pref_item = CustomPrefItem(name='last_dir', value=[])
        bulletin_group.add_item(pref_item)

        pref_item = CustomPrefItem(name='filter_pattern', value=[
            '*.txt',
        ])
        bulletin_group.add_item(pref_item)
Example #18
0
    def create_output_preferences(self):
        ''' Create the preference items of the output section.

        '''
        self.pref_manager.add_page('output')

        item = psy_pm.DirBrowsePrefItem(
            name='output_dir',
            label='output directory',
            group='output',
            value='',
            tool_tip='Specify a directory where to save the processing results.'
        )
        self.pref_manager.add_item(pagename='output', item=item)

        item = psy_pm.SingleChoicePrefItem(
            name='output_interval',
            label='output interval',
            group='output',
            limit=('daily', 'weekly', 'monthly'),
            value='monthly',
            tool_tip='The interval for which to save the results.')
        self.pref_manager.add_item(pagename='output', item=item)
    def __init__(self):
        ''' The constructor.

        '''
        ViewPlugin.__init__(self,
                            name='STA/LTA detection',
                            category='visualize',
                            tags=None)

        # Create the logging logger instance.
        logger_prefix = psysmon.logConfig['package_prefix']
        loggerName = logger_prefix + "." + __name__ + "." + self.__class__.__name__
        self.logger = logging.getLogger(loggerName)

        # Define the plugin icons.
        self.icons['active'] = icons.hand_pro_icon_16

        # Create the preferences.
        pref_page = self.pref_manager.add_page('Preferences')
        gen_group = pref_page.add_group('general')
        thr_group = pref_page.add_group('threshold')
        sc_group = pref_page.add_group('stop criterium')
        filter_group = pref_page.add_group('filter')

        # The CF type.
        item = preferences_manager.SingleChoicePrefItem(
            name='cf_type',
            label='cf type',
            limit=('abs', 'square', 'envelope', 'envelope^2'),
            value='square',
            tool_tip='The type of the characteristic function.')
        gen_group.add_item(item)

        # STA length
        item = preferences_manager.FloatSpinPrefItem(name='sta_length',
                                                     label='STA length [s]',
                                                     value=1,
                                                     limit=(0, 3600))
        gen_group.add_item(item)

        # LTA length
        item = preferences_manager.FloatSpinPrefItem(name='lta_length',
                                                     label='LTA length [s]',
                                                     value=5,
                                                     limit=(0, 3600))
        gen_group.add_item(item)

        # Threshold value
        item = preferences_manager.FloatSpinPrefItem(name='thr',
                                                     label='Threshold',
                                                     value=3,
                                                     limit=(0, 100))
        thr_group.add_item(item)

        # Fine threshold value
        item = preferences_manager.FloatSpinPrefItem(name='fine_thr',
                                                     label='Fine threshold',
                                                     value=2,
                                                     limit=(0, 100))
        thr_group.add_item(item)

        # Turn limit.
        item = preferences_manager.FloatSpinPrefItem(name='turn_limit',
                                                     label='turn limit',
                                                     value=0.05,
                                                     limit=(0, 10))
        thr_group.add_item(item)

        # stop growth
        item = preferences_manager.FloatSpinPrefItem(name='stop_growth',
                                                     label='stop grow ratio',
                                                     value=0.001,
                                                     digits=10,
                                                     limit=(0, 0.1))
        sc_group.add_item(item)

        # stop growth exponent
        item = preferences_manager.FloatSpinPrefItem(
            name='stop_growth_exp',
            label='stop grow exponent',
            value=1,
            digits=1,
            limit=(0.1, 100))
        sc_group.add_item(item)

        # stop growth increase percentage
        item = preferences_manager.FloatSpinPrefItem(
            name='stop_growth_inc',
            label='stop grow increase [%]',
            value=0,
            digits=10,
            limit=(0, 100))
        sc_group.add_item(item)

        # stop growth increase percentage
        item = preferences_manager.FloatSpinPrefItem(
            name='stop_growth_inc_begin',
            label='stop grow inc. begin',
            value=10,
            digits=3,
            limit=(0, 100000),
            tool_tip=
            "When to start growing the stop grow value using the stop grow increase percentage [s]."
        )
        sc_group.add_item(item)

        # Stop criterium delay.
        item = preferences_manager.FloatSpinPrefItem(
            name='stop_delay',
            label='Stop delay [s]',
            value=0.1,
            limit=(0, 100),
            tool_tip=
            'The time prepend to the triggered event start to set the initial value of the stop criterium.'
        )
        sc_group.add_item(item)

        # Detection reject length
        item = preferences_manager.FloatSpinPrefItem(
            name='reject_length',
            label='reject lenght',
            value=0.5,
            limit=(0, 10000),
            tool_tip='Detections with a smaller length are rejected [s].')
        filter_group.add_item(item)
    def __init__(self):
        ''' Initialize the instance.

        '''
        OptionPlugin.__init__(self,
                              name='select event',
                              category='select',
                              tags=['event', 'select'])

        # Create the logging logger instance.
        logger_prefix = psysmon.logConfig['package_prefix']
        loggerName = logger_prefix + "." + __name__ + "." + self.__class__.__name__
        self.logger = logging.getLogger(loggerName)

        self.icons['active'] = icons.flag_icon_16

        # The events library.
        self.library = ev_core.Library(name=self.rid)

        # The currently selected event.
        self.selected_event = {}

        # The plot colors used by the plugin.
        self.colors = {}

        # Setup the pages of the preference manager.
        select_page = self.pref_manager.add_page('Select')
        dts_group = select_page.add_group('detection time span')
        es_group = select_page.add_group('event selection')

        item = psy_pm.DateTimeEditPrefItem(
            name='start_time',
            label='start time',
            value=UTCDateTime('2015-01-01T00:00:00'),
            tool_tip=
            'The start time of the detection time span (UTCDateTime string format YYYY-MM-DDTHH:MM:SS).'
        )
        dts_group.add_item(item)

        item = psy_pm.FloatSpinPrefItem(
            name='window_length',
            label='window length [s]',
            value=3600,
            limit=(0, 86400),
            digits=1,
            tool_tip=
            'The length of the time window for which events should be loaded.')
        dts_group.add_item(item)

        item = psy_pm.SingleChoicePrefItem(
            name='event_catalog',
            label='event catalog',
            value='',
            limit=[],
            tool_tip='Select an event catalog for which to load the events.')
        es_group.add_item(item)

        item = psy_pm.ActionItem(name='load_events',
                                 label='load events',
                                 mode='button',
                                 action=self.on_load_events)
        es_group.add_item(item)

        column_labels = [
            'db_id', 'start_time', 'length', 'public_id', 'description',
            'agency_uri', 'author_uri', 'comment'
        ]
        item = psy_pm.ListCtrlEditPrefItem(
            name='events',
            label='events',
            value=[],
            column_labels=column_labels,
            limit=[],
            hooks={'on_value_change': self.on_event_selected},
            tool_tip='The available events.')
        es_group.add_item(item)
Example #21
0
    def create_preferences(self):
        ''' Create the collection node preferences.
        '''
        pref_page = self.pref_manager.add_page('Preferences')
        cat_group = pref_page.add_group('catalog')
        bind_group = pref_page.add_group('binding')

        # The detection catalog to process.
        item = preferences_manager.SingleChoicePrefItem(
            name='detection_catalog',
            label='detection catalog',
            limit=[],
            value=None,
            tool_tip='The detection catalog to use for binding.')
        cat_group.add_item(item)

        # The event catalog to which to write the new events.
        item = preferences_manager.SingleChoicePrefItem(
            name='event_catalog',
            label='event catalog',
            limit=[],
            value=None,
            tool_tip='The event catalog for new events.')
        cat_group.add_item(item)

        # The minimum length of the detecions used for binding.
        item = preferences_manager.FloatSpinPrefItem(
            name='min_detection_length',
            label='min. detection length',
            value=0.1,
            limit=(0, 1000000),
            tool_tip=
            'The minimum length of the detections used for the binding [s].')
        bind_group.add_item(item)

        # The number of nearest neighbors used for searching neighboring
        # detections.
        item = preferences_manager.IntegerSpinPrefItem(
            name='n_neighbors',
            label='neighbors to search',
            value=2,
            limit=(0, 100),
            tool_tip=
            'The number of nearest neighbors used to search for corresponding detections.'
        )
        bind_group.add_item(item)

        # The minimum number of matching neighbors needed to declare an event.
        item = preferences_manager.IntegerSpinPrefItem(
            name='min_match_neighbors',
            label='match neighbors',
            value=2,
            limit=(0, 100),
            tool_tip=
            'The minimum number of matching neighbors needed to declare an event.'
        )
        bind_group.add_item(item)

        # The velocity used for search window computation.
        item = preferences_manager.IntegerSpinPrefItem(
            name='search_win_vel',
            label='search window velocity',
            value=1000,
            limit=(1, 100000),
            tool_tip=
            'The velocity used to compute the search window lengths [m/s].')
        bind_group.add_item(item)

        # The lenght of the search window extension.
        item = preferences_manager.FloatSpinPrefItem(
            name='search_win_extend',
            label='search window extend',
            value=0.1,
            limit=(0, 100000),
            tool_tip=
            'The lenght of the time window added to the search windwo [s].')
        bind_group.add_item(item)
Example #22
0
    def __init__(self, **args):
        CollectionNode.__init__(self, **args)

        # Setup the pages of the preference manager.
        self.pref_manager.add_page('General')
        self.pref_manager.add_page('STA/LTA')
        self.pref_manager.add_page('Processing')

        # The start_time.
        item = psy_pm.DateTimeEditPrefItem(name = 'start_time',
                                           label = 'start time',
                                           group = 'detection time span',
                                           value = UTCDateTime('2015-01-01T00:00:00'),
                                           tool_tip = 'The start time of the detection time span (UTCDateTime string format YYYY-MM-DDTHH:MM:SS).')
        self.pref_manager.add_item(pagename = 'General',
                                   item = item)

        # The end time.
        item = psy_pm.DateTimeEditPrefItem(name = 'end_time',
                                           label = 'end time',
                                           group = 'detection time span',
                                           value = UTCDateTime('2015-01-01T00:00:00'),
                                           tool_tip = 'The end time of the detection time span (UTCDateTime string format YYYY-MM-DDTHH:MM:SS).')
        self.pref_manager.add_item(pagename = 'General',
                                   item = item)

        # The stations to process.
        item = psy_pm.MultiChoicePrefItem(name = 'stations',
                                          label = 'stations',
                                          group = 'components to process',
                                          limit = ('value 1', 'value 2', 'value 3', 'value 4', 'value 5'),
                                          value = [],
                                          tool_tip = 'The stations which should be used for the detection.')
        self.pref_manager.add_item(pagename = 'General',
                                   item = item)

        # The channels to process.
        item = psy_pm.MultiChoicePrefItem(name = 'channels',
                                          label = 'channels',
                                          group = 'components to process',
                                          limit = ('value 1', 'value 2', 'value 3', 'value 4', 'value 5'),
                                          value = [],
                                          tool_tip = 'The channels which should be used for the detection.')
        self.pref_manager.add_item(pagename = 'General',
                                   item = item)

        # The STA/LTA parameters
        item = psy_pm.SingleChoicePrefItem(name = 'cf_type',
                                           label = 'characteristic function',
                                           group = 'detection',
                                           limit = ('abs', 'square'),
                                           value = 'square',
                                           tool_tip = 'The type of the characteristic function used to compute the STA and LTA.')
        self.pref_manager.add_item(pagename = 'STA/LTA',
                                   item = item)

        item = psy_pm.FloatSpinPrefItem(name = 'sta_len',
                                        label = 'STA length [s]',
                                        group = 'detection',
                                        value = 1,
                                        limit = (0, 1000),
                                        digits = 1,
                                        tool_tip = 'The length of the STA in seconds.')
        self.pref_manager.add_item(pagename = 'STA/LTA',
                                   item = item)

        item = psy_pm.FloatSpinPrefItem(name = 'lta_len',
                                        label = 'LTA length [s]',
                                        group = 'detection',
                                        value = 10,
                                        limit = (0, 1000),
                                        digits = 1,
                                        tool_tip = 'The length of the LTA in seconds.')
        self.pref_manager.add_item(pagename = 'STA/LTA',
                                   item = item)

        item = psy_pm.FloatSpinPrefItem(name = 'thr',
                                        label = 'threshold',
                                        group = 'detection',
                                        value = 3,
                                        limit = (0, 1000),
                                        digits = 1,
                                        tool_tip = 'The threshold of STA/LTA when to trigger an event.')
        self.pref_manager.add_item(pagename = 'STA/LTA',
                                   item = item)

        item = psy_pm.FloatSpinPrefItem(name = 'pre_et',
                                        label = 'pre-event time [s]',
                                        group = 'detection',
                                        value = 1,
                                        limit = (0, 1000),
                                        digits = 1,
                                        tool_tip = 'The time window to add before the detected event start [s].')
        self.pref_manager.add_item(pagename = 'STA/LTA',
                                   item = item)

        item = psy_pm.FloatSpinPrefItem(name = 'post_et',
                                        label = 'post-event time [s]',
                                        group = 'detection',
                                        value = 1,
                                        limit = (0, 1000),
                                        digits = 1,
                                        tool_tip = 'The time window to add after the detected event end [s].')
        self.pref_manager.add_item(pagename = 'STA/LTA',
                                   item = item)

        item = psy_pm.CustomPrefItem(name = 'processing_stack',
                                     label = 'processing stack',
                                     group = 'signal processing',
                                     value = None,
                                     gui_class = PStackEditField,
                                     tool_tip = 'Edit the processing stack nodes.')
        self.pref_manager.add_item(pagename = 'Processing',
                                   item = item)
Example #23
0
    def __init__(self):
        ''' The constructor.

        '''
        InteractivePlugin.__init__(self,
                                   name = 'pick',
                                   category = 'edit',
                                   tags = None
                                  )
        # Create the logging logger instance.
        logger_prefix = psysmon.logConfig['package_prefix']
        loggerName = logger_prefix + "." + __name__ + "." + self.__class__.__name__
        self.logger = logging.getLogger(loggerName)

        self.icons['active'] = icons.hand_2_icon_16
        self.cursor = wx.CURSOR_CROSS

        # The pick catalog library used to manage the catalogs.
        self.library = pick_core.Library('pick library')

        # The name of the selected catalog.
        self.selected_catalog_name = None

        # A flag indicating if the pick catalog was loaded for a selected
        # event.
        self.catalog_loaded_for_selected_event = False

        # The lines of the picks.
        self.pick_lines = {}

        # Add the pages to the preferences manager.
        to_page = self.pref_manager.add_page('tool options')
        cat_group = to_page.add_group('catalog')
        po_group = to_page.add_group('pick options')

        # Add the plugin preferences.
        item = psy_pm.SingleChoicePrefItem(name = 'catalog_mode',
                                          label = 'mode',
                                          value = 'time',
                                          limit = ['time',],
                                          tool_tip = 'Select a pick catalog to work on.')
        cat_group.add_item(item)

        item = psy_pm.SingleChoicePrefItem(name = 'pick_catalog',
                                          label = 'pick catalog',
                                          value = '',
                                          limit = [],
                                          tool_tip = 'Select a pick catalog to work on.',
                                          hooks = {'on_value_change': self.on_select_catalog})
        cat_group.add_item(item)

        item = psy_pm.ActionItem(name = 'create_new_catalog',
                                 label = 'create new catalog',
                                 mode = 'button',
                                 action = self.on_create_new_catalog)
        cat_group.add_item(item)



        item = psy_pm.TextEditPrefItem(name = 'label',
                                       label = 'label',
                                       value = 'P',
                                       tool_tip = 'The label of the pick.')
        po_group.add_item(item)

        item = psy_pm.FloatSpinPrefItem(name = 'delete_snap_length',
                                       label = 'delete snap [s]',
                                       value = 0.1,
                                       limit = (0, 1000),
                                       tool_tip = 'The snap length used when deleting picks.')
        po_group.add_item(item)
Example #24
0
    def __init__(self):
        ''' The constructor.

        '''
        ViewPlugin.__init__(self,
                            name='plot seismogram',
                            category='visualize',
                            tags=None)

        # Create the logging logger instance.
        logger_prefix = psysmon.logConfig['package_prefix']
        loggerName = logger_prefix + "." + __name__ + "." + self.__class__.__name__
        self.logger = logging.getLogger(loggerName)

        # Define the plugin icons.
        self.icons['active'] = icons.waveform_icon_16

        # Add the plugin preferences.
        # Show or hide the seismogram envelope.
        item = preferences_manager.CheckBoxPrefItem(
            name='show_wiggle_trace',
            label='show wiggle trace',
            value=True,
            tool_tip='Show the seismogram wiggle trace.')
        self.pref_manager.add_item(item=item)

        # Show or hide the seismogram envelope.
        item = preferences_manager.CheckBoxPrefItem(
            name='show_envelope',
            label='show envelope',
            value=False,
            tool_tip='Show the seismogram envelope.')
        self.pref_manager.add_item(item=item)

        # The envelope style.
        item = preferences_manager.SingleChoicePrefItem(
            name='envelope_style',
            label='envelope style',
            limit=('top', 'bottom', 'top-bottom', 'filled'),
            value='top',
            tool_tip='The style of the envelope.')
        self.pref_manager.add_item(item=item)

        # Set the scaling mode.
        item = preferences_manager.SingleChoicePrefItem(
            name='scaling_mode',
            label='scaling',
            limit=('channel', 'station', 'window', 'manual'),
            value='channel',
            tool_tip='Set the scaling mode.')
        self.pref_manager.add_item(item=item)

        # Set the manual scaling value.
        item = preferences_manager.FloatSpinPrefItem(name='manual_y_lim',
                                                     label='manual y limit',
                                                     value=10,
                                                     limit=(0, None),
                                                     spin_format='%e')
        self.pref_manager.add_item(item=item)

        # Set the limit when the display changes to the min-max method.
        item = preferences_manager.FloatSpinPrefItem(name='minmax_limit',
                                                     label='min-max limit [s]',
                                                     value=20.,
                                                     limit=(0, None),
                                                     digits=1,
                                                     increment=1)
        self.pref_manager.add_item(item=item)
    def __init__(self):
        ''' Initialize the instance.

        '''
        InteractivePlugin.__init__(self,
                              name = 'create event',
                              category = 'edit',
                              tags = ['create', 'event']
                             )

        # Create the logging logger instance.
        logger_prefix = psysmon.logConfig['package_prefix']
        loggerName = logger_prefix + "." + __name__ + "." + self.__class__.__name__
        self.logger = logging.getLogger(loggerName)

        self.icons['active'] = icons.event_new_16
        self.cursor = wx.CURSOR_CROSS

        # The event catalog library used to manage the catalogs.
        self.library = event_core.Library('event library')

        # The name of the selected catalog.
        self.selected_catalog_name = None

        # The plot colors used by the plugin.
        self.colors = {}
        self.colors['event_vspan'] = '0.9'

        # Animation stuff.
        self.bg = {}
        self.startTime = None
        self.endTime = None


        # Add the pages to the preferences manager.
        options_page = self.pref_manager.add_page('tool options')
        event_group = options_page.add_group('event')
        catalog_group = options_page.add_group('catalog')

        item = psy_pm.SingleChoicePrefItem(name = 'default_event_type',
                                           label = 'defaul event type',
                                           limit = [],
                                           value = None,
                                           tool_tip = 'The default event type when creating a new event.',
                                           hooks = {'on_value_change': self.on_select_default_event_type})
        event_group.add_item(item)

        # Add the plugin preferences.
        item = psy_pm.SingleChoicePrefItem(name = 'event_catalog',
                                           label = 'event catalog',
                                           value = '',
                                           limit = [],
                                           tool_tip = 'Select an event catalog to work on.',
                                           hooks = {'on_value_change': self.on_select_catalog})
        catalog_group.add_item(item)

        item = psy_pm.ActionItem(name = 'create_new_catalog',
                                 label = 'create new catalog',
                                 mode = 'button',
                                 action = self.on_create_new_catalog)
        catalog_group.add_item(item)
    def __init__(self):
        ''' Initialize the instance.

        '''
        OptionPlugin.__init__(self,
                              name='show events',
                              category='view',
                              tags=['show', 'events'])

        # Create the logging logger instance.
        logger_prefix = psysmon.logConfig['package_prefix']
        loggerName = logger_prefix + "." + __name__ + "." + self.__class__.__name__
        self.logger = logging.getLogger(loggerName)

        self.icons['active'] = icons.flag_icon_16

        # The currently selected event.
        self.selected_event = {}

        # The plot colors used by the plugin.
        self.colors = {}
        self.colors['event_vspan'] = '0.9'

        # Setup the pages of the preference manager.
        self.pref_manager.add_page('Select')
        self.pref_manager.add_page('Display')

        item = psy_pm.DateTimeEditPrefItem(
            name='start_time',
            label='start time',
            group='detection time span',
            value=UTCDateTime('2015-01-01T00:00:00'),
            tool_tip=
            'The start time of the detection time span (UTCDateTime string format YYYY-MM-DDTHH:MM:SS).'
        )
        self.pref_manager.add_item(pagename='Select', item=item)

        item = psy_pm.FloatSpinPrefItem(
            name='window_length',
            label='window length [s]',
            group='detection time span',
            value=3600,
            limit=(0, 86400),
            digits=1,
            tool_tip=
            'The length of the time window for which events should be loaded.')
        self.pref_manager.add_item(pagename='Select', item=item)

        item = psy_pm.SingleChoicePrefItem(
            name='event_catalog',
            label='event catalog',
            group='event selection',
            value='',
            limit=[],
            tool_tip='Select an event catalog for which to load the events.')
        self.pref_manager.add_item(pagename='Select', item=item)

        #        item = psy_pm.CustomPrefItem(name = 'events',
        #                                     label = 'events',
        #                                     group = 'event selection',
        #                                     value = [],
        #                                     gui_class = EventListField,
        #                                     tool_tip = 'The start time of the detection time span (UTCDateTime string format YYYY-MM-DDTHH:MM:SS).')
        column_labels = [
            'db_id', 'start_time', 'length', 'public_id', 'description',
            'agency_uri', 'author_uri', 'comment'
        ]
        item = psy_pm.ListCtrlEditPrefItem(
            name='events',
            label='events',
            group='event selection',
            value=[],
            column_labels=column_labels,
            limit=[],
            hooks={'on_value_change': self.on_event_selected},
            tool_tip='The available events.')
        self.pref_manager.add_item(pagename='Select', item=item)

        item = psy_pm.ActionItem(name='load_events',
                                 label='load events',
                                 group='detection time span',
                                 mode='button',
                                 action=self.on_load_events)
        self.pref_manager.add_item(pagename='Select', item=item)

        item = psy_pm.FloatSpinPrefItem(
            name='pre_et',
            label='pre event time [s]',
            group='display range',
            value=5,
            limit=(0, 86400),
            digits=1,
            tool_tip=
            'The length of the time window to show before the event start.')
        self.pref_manager.add_item(pagename='Display', item=item)

        item = psy_pm.FloatSpinPrefItem(
            name='post_et',
            label='post event time [s]',
            group='display range',
            value=10,
            limit=(0, 86400),
            digits=1,
            tool_tip=
            'The length of the time window to show after the event end.')
        self.pref_manager.add_item(pagename='Display', item=item)

        item = psy_pm.CheckBoxPrefItem(
            name='show_event_limits',
            label='show event limits',
            value=True,
            hooks={'on_value_change': self.on_show_event_limits_changed},
            tool_tip='Show the limits of the selected event in the views.')
        self.pref_manager.add_item(pagename='Display', item=item)
Example #27
0
    def create_component_selector_preferences(self):
        ''' Create the preference items of the component selection section.

        '''
        components_page = self.pref_manager.add_page('components')
        comp_to_process_group = components_page.add_group(
            'components to process')
        process_time_span_group = components_page.add_group(
            'process time span')

        item = psy_pm.DateTimeEditPrefItem(
            name='start_time',
            label='start time',
            value=UTCDateTime('2015-01-01T00:00:00'),
            tool_tip=
            'The start time of the selection time span (UTCDateTime string format YYYY-MM-DDTHH:MM:SS).'
        )
        process_time_span_group.add_item(item)

        item = psy_pm.DateTimeEditPrefItem(
            name='end_time',
            label='end time',
            value=UTCDateTime('2015-01-01T00:00:00'),
            tool_tip=
            'The end time of the selection time span (UTCDateTime string format YYYY-MM-DDTHH:MM:SS).'
        )
        process_time_span_group.add_item(item)

        item = psy_pm.SingleChoicePrefItem(
            name='window_mode',
            label='window mode',
            limit=('free', 'daily', 'weekly', 'monthly'),
            value='free',
            hooks={'on_value_change': self.on_window_mode_selected},
            tool_tip='The mode of the window computation.')
        process_time_span_group.add_item(item)

        item = psy_pm.IntegerSpinPrefItem(
            name='window_length',
            label='window length [s]',
            value=300,
            limit=[0, 1209600],
            tool_tip='The sliding window length in seconds.')
        process_time_span_group.add_item(item)

        # The stations to process.
        item = psy_pm.MultiChoicePrefItem(
            name='stations',
            label='stations',
            limit=(),
            value=[],
            tool_tip='The stations which should be used for the processing.')
        comp_to_process_group.add_item(item)

        # The channels to process.
        item = psy_pm.MultiChoicePrefItem(
            name='channels',
            label='channels',
            limit=(),
            value=[],
            tool_tip='The channels which should be used for the processing.')
        comp_to_process_group.add_item(item)
Example #28
0
    def create_preferences(self):
        ''' Create the collection node preferences.
        '''
        pref_page = self.pref_manager.add_page('Preferences')
        gen_group = pref_page.add_group('general')
        thr_group = pref_page.add_group('threshold')
        sc_group = pref_page.add_group('stop criterium')
        filter_group = pref_page.add_group('filter')

        out_page = self.pref_manager.add_page('Output')
        cat_group = out_page.add_group('catalog')


        # The CF type.
        item = preferences_manager.SingleChoicePrefItem(name = 'cf_type',
                                                        label = 'cf type',
                                                        limit = ('abs', 'square', 'envelope', 'envelope^2'),
                                                        value = 'square',
                                                        tool_tip = 'The type of the characteristic function.'
                                                       )
        gen_group.add_item(item)


        # STA length
        item = preferences_manager.FloatSpinPrefItem(name = 'sta_length',
                                                     label = 'STA length [s]',
                                                     value = 1,
                                                     limit = (0, 3600))
        gen_group.add_item(item)


        # LTA length
        item = preferences_manager.FloatSpinPrefItem(name = 'lta_length',
                                                     label = 'LTA length [s]',
                                                     value = 5,
                                                     limit = (0, 3600))
        gen_group.add_item(item)


        # Threshold value
        item = preferences_manager.FloatSpinPrefItem(name = 'thr',
                                                     label = 'Threshold',
                                                     value = 3,
                                                     limit = (0, 100))
        thr_group.add_item(item)

        # Fine threshold value
        item = preferences_manager.FloatSpinPrefItem(name = 'fine_thr',
                                                     label = 'Fine threshold',
                                                     value = 2,
                                                     limit = (0, 100))
        thr_group.add_item(item)

        # Turn limit.
        item = preferences_manager.FloatSpinPrefItem(name = 'turn_limit',
                                                     label = 'turn limit',
                                                     value = 0.05,
                                                     limit = (0, 10))
        thr_group.add_item(item)



        # Stop criterium delay.
        item = preferences_manager.FloatSpinPrefItem(name = 'stop_delay',
                                                     label = 'Stop delay [s]',
                                                     value = 0.1,
                                                     limit = (0, 100),
                                                     tool_tip = 'The time prepend to the triggered event start to set the initial value of the stop criterium.')
        sc_group.add_item(item)

        # stop growth
        item = preferences_manager.FloatSpinPrefItem(name = 'stop_growth',
                                                     label = 'stop grow ratio',
                                                     value = 0.001,
                                                     digits = 10,
                                                     limit = (0, 0.1))
        sc_group.add_item(item)

        # stop growth exponent
        item = preferences_manager.FloatSpinPrefItem(name = 'stop_growth_exp',
                                                     label = 'stop grow exponent',
                                                     value = 1,
                                                     digits = 1,
                                                     limit = (0.1, 100))
        sc_group.add_item(item)

        # stop growth increase percentage
        item = preferences_manager.FloatSpinPrefItem(name = 'stop_growth_inc',
                                                     label = 'stop grow increase [%]',
                                                     value = 0,
                                                     digits = 10,
                                                     limit = (0, 100))
        sc_group.add_item(item)

        # stop growth increase percentage
        item = preferences_manager.FloatSpinPrefItem(name = 'stop_growth_inc_begin',
                                                     label = 'stop grow inc. begin',
                                                     value = 10,
                                                     digits = 3,
                                                     limit = (0, 100000),
                                                     tool_tip = "When to start growing the stop grow value using the stop grow increase percentage [s].")
        sc_group.add_item(item)

        # The target detection catalog.
        item = preferences_manager.SingleChoicePrefItem(name = 'detection_catalog',
                                                        label = 'detection catalog',
                                                        limit = [],
                                                        value = None,
                                                        tool_tip = 'The detection catalog to which the detections are written.'
                                                       )
        cat_group.add_item(item)

        # Detection reject length
        item = preferences_manager.FloatSpinPrefItem(name = 'reject_length',
                                                     label = 'reject lenght',
                                                     value = 0.5,
                                                     limit = (0, 10000),
                                                     tool_tip = 'Detections with a smaller length are rejected [s].')
        filter_group.add_item(item)