Exemplo n.º 1
0
    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)
Exemplo n.º 2
0
    def create_parameters_prefs(self):
        ''' Create the preference items of the parameters section.
        '''
        par_page = self.pref_manager.add_page('plot parameters')
        plot_group = par_page.add_group('plot')

        pref_item = psy_pm.IntegerSpinPrefItem(
            name='plot_length',
            label='plot length [days]',
            value=7,
            limit=[1, 365],
            tool_tip='The length of PSD plots [days].')
        plot_group.add_item(pref_item)

        pref_item = psy_pm.CheckBoxPrefItem(
            name='with_average_plot',
            label='with average plot',
            value=False,
            tool_tip=
            'Add the temporal average with noise models to the PSD plot.')
        plot_group.add_item(pref_item)

        pref_item = psy_pm.FloatSpinPrefItem(
            name='lower_frequ',
            label='lower frequency [Hz]',
            value=0.1,
            limit=[1e-6, 1e9],
            tool_tip='The lower frequency limit of the plot.')
        plot_group.add_item(pref_item)

        pref_item = psy_pm.CheckBoxPrefItem(
            name='use_upper_frequ',
            label='use upper frequency',
            value=False,
            tool_tip=
            'Use the upper frequency value to set the upper frequency limit of the plot.',
            hooks={'on_value_change': self.on_use_upper_frequ_changed})
        plot_group.add_item(pref_item)

        pref_item = psy_pm.FloatSpinPrefItem(
            name='upper_frequ',
            label='upper frequency [Hz]',
            value=100,
            limit=[1e-6, 1e9],
            tool_tip='The upper frequency limit of the plot.')
        plot_group.add_item(pref_item)
Exemplo n.º 3
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)
Exemplo n.º 4
0
    def create_processing_preferences(self):
        ''' Create the preference items of the processing stack section.
        '''
        ps_page = self.pref_manager.add_page('processing')
        ch_group = ps_page.add_group('chunked')

        item = psy_pm.CheckBoxPrefItem(
            name='process_chunked',
            label='use chunked processing',
            value=False,
            tool_tip=
            'For large time windows splitting the time window into smaller chunks is more memory efficient. Not all looper child nodes support chunked processing.'
        )
        ch_group.add_item(item)

        item = psy_pm.IntegerSpinPrefItem(
            name='chunk_win_length',
            label='chunk window length [s]',
            value=3600,
            limit=[0, 1209600],
            tool_tip='The length of the chunked window.')
        ch_group.add_item(item)
Exemplo n.º 5
0
    def create_output_prefs(self):
        ''' Create the output preference items.
        '''
        pagename = '3 output'
        self.pref_manager.add_page(pagename)

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

        item = psy_pm.CheckBoxPrefItem(name = 'with_average_plot',
                                       label = 'with average plot',
                                       group = 'output',
                                       value = False,
                                       tool_tip = 'Add the temporal average with noise models to the PSD plot.')
        self.pref_manager.add_item(pagename = pagename,
                                   item = item)
Exemplo n.º 6
0
    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)
Exemplo n.º 7
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)