seed_vault.ui.components package
Submodules
seed_vault.ui.components.base module
- class seed_vault.ui.components.base.BaseComponent(settings, step_type, prev_step_type, stage, init_map_center={}, init_map_zoom=2)[source]
Bases:
object
Base class for handling the search and selection of seismic events and stations.
This class supports searching, selecting, and visualizing seismic data in a Streamlit application.
- settings
The current application settings.
- Type:
- old_settings
A deep copy of the initial settings before modifications.
- Type:
- TXT
Stores UI-related text constants based on the step type.
- Type:
- stage
The current processing stage.
- Type:
int
- all_current_drawings
A list of current geometry constraints.
- Type:
List[GeometryConstraint]
- all_feature_drawings
A list of feature-based geometry constraints.
- Type:
List[GeometryConstraint]
- df_markers
Dataframe containing marker information for events or stations.
- Type:
pd.DataFrame
- df_data_edit
Dataframe for editable data related to events or stations.
- Type:
pd.DataFrame
- catalogs
Holds seismic event catalog data.
- Type:
Catalog
- inventories
Holds station inventory data.
- Type:
Inventory
- map_disp
The main map display object.
- map_fg_area
Map layer displaying geographic areas.
- map_fg_marker
Map layer displaying markers for events or stations.
- map_fg_prev_selected_marker
Map layer for previously selected markers.
- map_height
Height of the map display.
- Type:
int
- map_output
Output container for map elements.
- selected_marker_map_idx
Index of the currently selected marker on the map.
- map_view_center
Dictionary storing the center coordinates of the map.
- Type:
dict
- map_view_zoom
Zoom level of the map.
- Type:
int
- marker_info
Information about the currently selected marker.
- clicked_marker_info
Information about the last clicked marker.
- warning
Warning message to be displayed in the UI.
- error
Error message to be displayed in the UI.
- Type:
str
- df_rect
Dataframe for rectangular selection areas.
- df_circ
Dataframe for circular selection areas.
- col_color
Column used for color coding markers.
- col_size
Column used for size scaling of markers.
- fig_color_bar
Color bar figure for the map visualization.
- df_markers_prev
Dataframe storing previously selected markers.
- Type:
pd.DataFrame
- delay_selection
Delay time before processing a new selection.
- Type:
int
- cols_to_exclude
List of columns to exclude from the display.
- Type:
List[str]
- has_error
Indicates whether an error has occurred.
- Type:
bool
Initializes the BaseComponent with the given settings and parameters.
- Parameters:
settings (SeismoLoaderSettings) – Configuration settings for loading seismic data.
step_type (Steps) – The current processing step (event or station).
prev_step_type (Steps) – The previous processing step, if applicable.
stage (int) – The current processing stage.
init_map_center (dict, optional) – Initial map center coordinates. Defaults to an empty dictionary.
init_map_zoom (int, optional) – Initial map zoom level. Defaults to 2.
-
TXT:
BaseComponentTexts
-
all_current_drawings:
List
[GeometryConstraint
] = []
-
all_feature_drawings:
List
[GeometryConstraint
] = []
-
catalogs:
Catalog
= <obspy.core.event.catalog.Catalog object>
- clicked_marker_info = None
- col_color = None
- col_size = None
- cols_to_exclude = ['detail', 'is_selected']
- data_table_view(ordered_col, config, state_key)[source]
Displays the full data table, allowing selection.
- delay_selection = 0
- df_circ = None
-
df_data_edit:
DataFrame
= Empty DataFrame Columns: [] Index: []
-
df_markers:
DataFrame
= Empty DataFrame Columns: [] Index: []
- df_markers_prev = Empty DataFrame Columns: [] Index: []
- df_rect = None
-
error:
str
= ''
- event_filter()[source]
Displays and manages event filtering options in the Streamlit sidebar.
This method allows users to filter seismic events based on: - Client selection - Time range (last month, last week, last day, or custom start/end dates) - Magnitude range - Depth range
Functionality: - Users select a client from a dropdown list. - A warning is displayed if the selected client does not support event services. - Users can set predefined time intervals (last month, last week, last day). - Users can manually set start and end dates/times. - Validation ensures that the end date is after the start date. - Users can adjust event magnitude and depth ranges using sliders. - Map interaction buttons are rendered. - Refreshes filters upon changes.
- fetch_data_with_loading(fetch_func, *args, spinner_message='🔄 Fetching data...', success_message='✅ Data loaded successfully.', **kwargs)[source]
- fig_color_bar = None
- get_geo_constraint()[source]
Retrieves the geographic constraints for the current step.
Geographic constraints define the search area on the map using bounding boxes or circles.
- Returns:
A list of geographic constraints (boxes or circles) that confine the search area. Returns an empty list if no constraints are set.
- Return type:
List[GeometryConstraint]
- get_key_element(name)[source]
Generates a unique key identifier for a UI element based on the step type and stage.
- Parameters:
name (str) – The base name of the element.
- Returns:
A formatted string representing the unique key for the element.
- Return type:
str
-
has_error:
bool
= False
-
inventories:
Inventory
= <obspy.core.inventory.inventory.Inventory object>
- is_valid_circle(lat, lon, max_radius, min_radius)[source]
Checks if the given latitude, longitude, and radius values define a valid circle.
A valid circle satisfies the following conditions: - Latitude (lat) must be within the range [-90, 90]. - Longitude (lon) must be within the range [-180, 180]. - max_radius must be greater than 0. - min_radius must be non-negative (>= 0). - min_radius must be less than or equal to max_radius.
- Parameters:
lat (float) – Latitude of the circle’s center.
lon (float) – Longitude of the circle’s center.
max_radius (float) – Maximum radius of the circle.
min_radius (float) – Minimum radius of the circle.
- Returns:
True if the circle data is valid, False otherwise.
- Return type:
bool
- is_valid_rectangle(min_lat, max_lat, min_lon, max_lon)[source]
Checks if the given latitude and longitude values define a valid rectangle.
A valid rectangle satisfies the following conditions: - Latitude values (min_lat, max_lat) must be within the range [-90, 90]. - Longitude values (min_lon, max_lon) must be within the range [-180, 180]. - min_lat must be less than or equal to max_lat. - min_lon must be less than or equal to max_lon.
- Parameters:
min_lat (float) – Minimum latitude value.
max_lat (float) – Maximum latitude value.
min_lon (float) – Minimum longitude value.
max_lon (float) – Maximum longitude value.
- Returns:
True if the rectangle is valid, False otherwise.
- Return type:
bool
- map_disp = None
- map_fg_area = None
- map_fg_marker = None
- map_fg_prev_selected_marker = None
- map_height = 500
- map_output = None
- map_view_center = {}
- map_view_zoom = 2
- marker_info = None
-
old_settings:
SeismoLoaderSettings
- property page_type: str
Determines the page type based on the previous or current step.
- Returns:
The page type, which is the previous step type if available, otherwise the current step type.
- Return type:
str
- refresh_filters()[source]
Refreshes and updates the filter settings based on configuration changes.
- refresh_map(reset_areas=False, selected_idx=None, clear_draw=False, rerun=False, get_data=True, recreate_map=True)[source]
- selected_items_view(state_key)[source]
Displays selected items using an actual st.multiselect, controlled by table selection.
- selected_marker_map_idx = None
- set_geo_constraint(geo_constraint)[source]
Sets the geographic constraints for the current step.
This method updates the geographic constraints, which define the search area on the map using bounding boxes or circles.
- Parameters:
geo_constraint (List[GeometryConstraint]) – A list of geographic constraints
step. ((boxes or circles) to be applied to the current)
- set_map_view(map_center, map_zoom)[source]
Sets the map view properties, including center coordinates and zoom level.
- Parameters:
map_center (dict) – A dictionary representing the center coordinates of the map.
map_zoom (int) – The zoom level for the map.
-
settings:
SeismoLoaderSettings
-
stage:
int
- station_filter()[source]
Displays and manages station filtering options in the Streamlit sidebar.
This method allows users to filter seismic stations based on: - Client selection - Time range (last month, last week, last day, or custom start/end dates) - Network, station, location, and channel filters - Highest sample rate option - Restricted data inclusion
Functionality: - Users select a client from a dropdown list. - A warning is displayed if the selected client does not support station services. - Users can set predefined time intervals (last month, last week, last day). - Users can manually set start and end dates/times with a one-hour shift if needed. - Validation ensures that the end date is after the start date. - Users can input station metadata filters (network, station, location, channel). - Users can enable highest sample rate filtering and restricted data inclusion. - Map interaction buttons are rendered. - Refreshes filters upon changes.
- update_filter_geometry(df, geo_type, geo_constraint)[source]
This method adds a new drawing (box or circle) to the existing drawings on the map.
- Parameters:
df (pd.DataFrame) – A DataFrame containing the new geometric constraints.
geo_type (GeoConstraintType) – The type of geographic constraint (bounding box or circle).
geo_constraint (List[GeometryConstraint]) – The existing list of geographic constraints.
- warning = None
- class seed_vault.ui.components.base.BaseComponentTexts(config_type)[source]
Bases:
object
Defines text constants for UI components in different configuration steps.
- CLEAR_ALL_MAP_DATA = 'Clear All'
- CONFIG_EVENT_FILE = 'config_event'
- CONFIG_STATION_FILE = 'config_station'
- CONFIG_TEMPLATE_FILE = 'config_template.cfg'
- DOWNLOAD_CONFIG = 'Download Config'
- SAVE_CONFIG = 'Save Config'
seed_vault.ui.components.card module
- seed_vault.ui.components.card.create_card(title, enforce_padding, content_func, *args, **kwargs)[source]
Creates a styled card container to display content in Streamlit.
Args: content_func (callable): A function that generates the content to be displayed inside the card. args, kwargs: Arguments and keyword arguments to be passed to content_func. enforce_padding: puts the content in columns to enforce artificial padding.
seed_vault.ui.components.continuous_waveform module
- class seed_vault.ui.components.continuous_waveform.ContinuousComponents(settings)[source]
Bases:
object
A component for managing continuous waveform data processing.
This class coordinates the interaction between the filter menu, display, and logging components for continuous waveform data processing.
- settings
Configuration settings for seismic data processing.
- Type:
Menu component for filtering waveforms.
- Type:
- display
Display component for waveform visualization.
- Type:
- console
Console for logging output.
- Type:
Initialize the ContinuousComponents.
- Parameters:
settings (SeismoLoaderSettings) – Configuration settings for seismic data processing.
- render()[source]
Render the complete continuous waveform interface.
This method creates the main UI for continuous waveform processing, including: - Download and log view tabs - Filter menu in sidebar - Real-time status updates - Log display and management
- render_polling_ui()[source]
Handle UI updates while monitoring background thread status.
This method processes log entries from the queue and updates the UI based on the background thread’s status.
Note
The method uses Streamlit’s rerun mechanism to update the UI when new logs are available or when the thread status changes.
- class seed_vault.ui.components.continuous_waveform.ContinuousDisplay(settings, filter_menu)[source]
Bases:
object
A component for displaying and managing continuous waveform data.
This class handles the display and processing of continuous waveform data, including data retrieval, logging, and UI updates.
- settings
Configuration settings for seismic data processing.
- Type:
Menu component for filtering waveforms.
- Type:
- console
Console for logging output.
- Type:
Initialize the ContinuousDisplay component.
- Parameters:
settings (SeismoLoaderSettings) – Configuration settings for seismic data processing.
filter_menu (ContinuousFilterMenu) – Menu component for filtering waveforms.
- process_continuous_data()[source]
Process continuous waveform data in a background thread with logging.
This method sets up a custom logging system, retrieves continuous waveform data, and handles any errors or cancellations during the process.
Note
The method updates the session state with processing status and logs.
- class seed_vault.ui.components.continuous_waveform.ContinuousFilterMenu(settings)[source]
Bases:
object
A menu component for filtering and controlling continuous waveform data.
This class provides a user interface for managing continuous waveform data retrieval, including time range selection and station filtering.
- settings
Configuration settings for seismic data processing.
- Type:
- old_settings
Previous state of settings for change detection.
- Type:
- old_time_state
Previous time range state for change detection.
- Type:
dict
- last_button_pressed
Last button interaction for UI state management.
- Type:
str
- todo_nets
List of networks to process.
- Type:
List[str]
Initialize the ContinuousFilterMenu.
- Parameters:
settings (SeismoLoaderSettings) – Configuration settings for seismic data processing.
- refresh_filters()[source]
Check for changes in time range and settings, trigger UI updates.
This method compares current settings with previous state and triggers a UI refresh if changes are detected. It also handles saving of settings.
Note
The method uses Streamlit’s rerun mechanism to update the UI when changes are detected.
- render()[source]
Render the continuous waveform filter menu interface.
This method creates the UI for continuous waveform data management, including: - Time range selection with year/month/week controls - Date and time input fields - Quick selection buttons for common time ranges - Network/station/location/channel information display
The interface is organized in expandable sections: - Time Range Adjustment - Submitted NSLCs Information
Note
The interface provides both manual input and quick selection options for time range management.
seed_vault.ui.components.data_explorer module
- class seed_vault.ui.components.data_explorer.DataExplorerComponent(settings)[source]
Bases:
object
-
db_manager:
DatabaseManager
-
queries:
deque
[dict
]
-
settings:
SeismoLoaderSettings
-
db_manager:
seed_vault.ui.components.display_log module
seed_vault.ui.components.map module
- seed_vault.ui.components.map.add_area_overlays(areas)[source]
Add overlays representing areas (Rectangles or Circles) to the map.
- seed_vault.ui.components.map.add_circle_area(feature_group, coords)[source]
Add circle area (inner and outer) to the feature group.
- seed_vault.ui.components.map.add_data_points(df, cols_to_disp, step, selected_idx=[], col_color=None, col_size=None)[source]
Add points to map
- seed_vault.ui.components.map.add_fullscreen_control(map_object)[source]
Add fullscreen control to the map.
- seed_vault.ui.components.map.add_marker_to_cluster(fg, latitude, longitude, color, edge_color, size, fill_opacity, popup, tooltip_text, step)[source]
Add a marker to a cluster with specific attributes.
- seed_vault.ui.components.map.clear_map_layers(map_object)[source]
Remove all FeatureGroup layers from the map object.
- seed_vault.ui.components.map.create_map(map_center=[0.0, 0.0], zoom_start=2, map_id=None)[source]
Create a base map with controls but without dynamic layers.
- seed_vault.ui.components.map.create_popup(index, row, cols_to_disp, step=None, truncate=False)[source]
- seed_vault.ui.components.map.get_color_map(df, c, offset=0.0, cmap='viridis')[source]
offset: 0.0 <= offset <= 1 -> it is used to lower the range of colors
- seed_vault.ui.components.map.normalize_bounds(geometry_constraint)[source]
Split bounds of a GeometryConstraint that crosses the 180° meridian or falls partly in a mirrored instance.
Args: - geometry_constraint: A GeometryConstraint instance containing RectangleArea bounds.
- Return type:
List
[GeometryConstraint
]
Returns: - A list of GeometryConstraint instances. If the rectangle crosses the 180° meridian or falls in a mirrored instance,
it will return one or two GeometryConstraints.
- seed_vault.ui.components.map.normalize_circle(geometry_constraint)[source]
Normalize circle bounds for circles that are completely located in the left or right mirrored instance.
Args: - geometry_constraint: A GeometryConstraint instance containing CircleArea bounds.
- Return type:
List
[GeometryConstraint
]
Returns: - A list with the normalized GeometryConstraint instance. If the circle falls entirely within the left or right mirrored instance,
the longitude will be adjusted to bring it within the [-180, 180] range.
seed_vault.ui.components.run_from_config module
- class seed_vault.ui.components.run_from_config.RunFromConfigComponent(settings)[source]
Bases:
object
A component for running seismic data processing from a configuration file.
This component provides a user interface for loading, editing, and executing seismic data processing configurations. It supports real-time logging and background processing with cancellation capabilities.
- settings
Configuration settings for seismic data processing.
- Type:
- is_editing
Flag indicating if the configuration is being edited.
- Type:
bool
- edited_config_str
The current edited configuration string.
- Type:
str
- config_str
The original configuration string.
- Type:
str
Initialize the RunFromConfigComponent.
- Parameters:
settings (SeismoLoaderSettings) – Configuration settings for seismic data processing.
- check_process_status()[source]
Check the status of the background process and update UI accordingly.
This method monitors the background processing thread and updates the UI based on the process status, handling completion, errors, and cancellations.
Note
The method triggers UI updates through Streamlit’s rerun mechanism and manages the session state for process status.
-
config_str:
str
= None
-
edited_config_str:
str
= None
-
is_editing:
bool
= False
- process_config_in_background(from_file)[source]
Process the configuration file in a background thread with logging.
This method sets up a custom logging system that captures both stdout and stderr, processes the configuration file, and handles any errors or cancellations.
- Parameters:
from_file (Path) – Path to the configuration file to process.
Note
This method runs in a background thread and updates the session state with processing status and logs.
- render_config()[source]
Render the configuration interface with editing capabilities.
This method creates the main UI for configuration management, including: - Configuration file display and editing - Validation messages - Process controls (run, cancel, edit) - Real-time log display
The interface is split into two columns: - Left column: Configuration display and editing - Right column: Log display and process status
- render_logs(container)[source]
Render logs in the provided Streamlit container.
This method processes any new log entries from the queue and displays them in a terminal-style format with auto-scrolling.
- Parameters:
container – A Streamlit container object where logs will be displayed.
Note
The logs are displayed in a terminal-style format with custom styling and auto-scrolling functionality.
-
settings:
SeismoLoaderSettings
- start_background_process(from_file)[source]
Start the background processing thread for configuration execution.
This method initializes and starts a new thread to process the configuration file, handling state management and thread lifecycle.
- Parameters:
from_file (Path) – Path to the configuration file to process.
Note
The thread is created as a daemon thread and will be terminated when the main program exits.
seed_vault.ui.components.settings module
- class seed_vault.ui.components.settings.SettingsComponent(settings)[source]
Bases:
object
- df_clients = None
- is_new_cred_added = None
-
old_settings:
SeismoLoaderSettings
-
settings:
SeismoLoaderSettings
seed_vault.ui.components.waveform module
- class seed_vault.ui.components.waveform.MissingDataDisplay(stream, missing_data, settings)[source]
Bases:
object
A component for displaying information about missing waveform data.
This class provides a user interface for showing which events or stations have missing data and what specific channels are missing.
- stream
List of waveform streams.
- Type:
List[Stream]
- missing_data
Dictionary tracking missing data.
- Type:
Dict
- settings
Configuration settings for seismic data processing.
- Type:
Initialize the MissingDataDisplay component.
- Parameters:
stream (List[Stream]) – List of waveform streams.
missing_data (Dict[str, Union[List[str], str]]) – Dictionary mapping event IDs to missing data information.
settings (SeismoLoaderSettings) – Configuration settings for seismic data processing.
- class seed_vault.ui.components.waveform.WaveformComponents(settings)[source]
Bases:
object
-
console:
ConsoleDisplay
-
continuous_components:
ContinuousComponents
-
settings:
SeismoLoaderSettings
-
waveform_display:
WaveformDisplay
-
console:
- class seed_vault.ui.components.waveform.WaveformDisplay(settings, filter_menu)[source]
Bases:
object
A component for displaying and managing waveform data visualization.
This class handles the display of seismic waveform data, including both event-based and station-based views, with support for filtering and pagination.
- settings
Configuration settings for seismic data processing.
- Type:
Menu component for filtering waveforms.
- Type:
- client
FDSN client for waveform data retrieval.
- Type:
Client
- ttmodel
Travel-time model for seismic phases.
- Type:
TauPyModel
- stream
List of waveform streams.
- Type:
List[Stream]
- missing_data
Dictionary tracking missing data.
- Type:
Dict
- console
Console for logging output.
- Type:
Initialize the WaveformDisplay component.
- Parameters:
settings (SeismoLoaderSettings) – Configuration settings for seismic data processing.
filter_menu (WaveformFilterMenu) – Menu component for filtering waveforms.
- apply_filters(stream)[source]
Apply filters to the waveform stream based on user selections.
- Parameters:
stream (Stream) – Input ObsPy Stream object to filter.
- Returns:
- Filtered stream containing only traces matching the selected
network, station, and channel filters.
- Return type:
Stream
- fetch_data()[source]
Fetch waveform data in a background thread with logging.
This method sets up a custom logging system, retrieves waveform data, and handles any errors or cancellations during the process.
Note
The method updates the session state with processing status and logs.
- plot_event_view(event, stream, page, num_pages)[source]
Plot event view with proper time alignment and improved layout.
- Parameters:
event – Event object containing event information.
stream (Stream) – ObsPy Stream object containing waveform data.
page (int) – Current page number for pagination.
num_pages (int) – Total number of pages.
- Returns:
Matplotlib figure object containing the plot.
- Return type:
Figure
- plot_station_view(station_code, stream, page, num_pages)[source]
Plot station view with event information.
- Parameters:
station_code (str) – Code of the station to display.
stream (Stream) – ObsPy Stream object containing waveform data.
page (int) – Current page number for pagination.
num_pages (int) – Total number of pages.
- Returns:
Matplotlib figure object containing the plot.
- Return type:
Figure
- class seed_vault.ui.components.waveform.WaveformFilterMenu(settings)[source]
Bases:
object
Initialize the WaveformFilterMenu.
- Parameters:
settings (SeismoLoaderSettings) – Configuration settings for seismic data processing.
-
available_channels:
List
[str
]
-
channel_filter:
str
-
display_limit:
int
-
network_filter:
str
- refresh_filters()[source]
Check for changes in filter settings and trigger UI updates.
This method compares current filter settings with previous state and triggers a UI refresh if changes are detected. It also handles saving of filter settings.
Note
The method uses Streamlit’s rerun mechanism to update the UI when changes are detected.
- render(stream=None)[source]
Render the waveform filter menu interface.
This method creates the UI for waveform filtering and control, including: - Network, station, and channel filters - Display limit controls - Status information - Reset functionality
- Parameters:
stream (Stream, optional) – Current waveform stream to filter. If None, only basic controls are shown.
Note
The interface is organized in expandable sections for better user experience and space management.
-
settings:
SeismoLoaderSettings
-
station_filter:
str
- update_available_channels(stream)[source]
Update the list of available channels based on the current stream.
This method extracts unique channel codes from the provided stream and updates the available_channels list.
- Parameters:
stream (Stream) – ObsPy Stream object containing waveform data.
Note
The method handles different types of stream objects and ensures “All channels” remains as the first option in the list.
- seed_vault.ui.components.waveform.get_tele_filter(tr)[source]
Calculate appropriate filter band for teleseismic data based on distance.
This function determines the optimal frequency band for filtering teleseismic data based on the distance from the source and the sensor type.
- Parameters:
tr (Trace) – ObsPy Trace object containing waveform data.
- Returns:
- A tuple of (f0, f1) where:
f0 (float): Lower frequency bound in Hz
f1 (float): Upper frequency bound in Hz
Returns (0, 0) for non-seismic sensors.
- Return type:
tuple
Note
The filter bands are optimized for different distance ranges: - < 50 km: 2.0-15 Hz - 50-100 km: 1.8-12 Hz - 100-250 km: 1.7-10 Hz - 250-500 km: 1.6-8 Hz - 500-1000 km: 1.5-6 Hz - 1000-2500 km: 1.4-5 Hz - 2500-5000 km: 1.2-4 Hz - 5000-10000 km: 1.0-3 Hz - > 10000 km: 0.7-2 Hz
seed_vault.ui.components.workflows_combined module
- class seed_vault.ui.components.workflows_combined.CombinedBasedWorkflow[source]
Bases:
object
-
err_message:
str
= ''
-
event_components:
BaseComponent
- handle_error(message)[source]
Handles errors gracefully by displaying a helpful message and providing a link to reset the config the settings.
-
has_error:
bool
= False
- render_stage_0()[source]
ToDo: We probably need a settings clean up in this stage, to ensure if user changes Flow Type, geometry selections and selected events + stations are cleaned for a fresh start of a new flow. Probably, we only need the clean up, if Flow Type selection changes. Also, probably, we do not need clean up on the filter settings (we actually may need to keep the filters as is).
-
settings:
SeismoLoaderSettings
-
stage:
int
= 0
-
station_components:
BaseComponent
- validate_and_adjust_selection(workflow_type)[source]
Validate selection based on workflow type and return True if valid, else trigger error.
-
waveform_components:
WaveformComponents
-
err_message: