GUIBRUSHR.GUIBRUSHR module

GUIBRUSHR - GUI for Bayesian Retrieval Using Spectroscopy at High Resolution.

This module contains the main application class for the GUIBRUSHR graphical user interface. The application provides a comprehensive interface for atmospheric retrieval analysis using spectroscopic data at both high and low resolution.

Classes:

WindowConfig: Configuration dataclass for window dimensions and scaling GUIBRUSHR: Main application class managing the GUI and its components

Functions:

main: Entry point for the GUIBRUSHR application

class GUIBRUSHR.GUIBRUSHR.WindowConfig(ASPECT_RATIO: float = 1.0, MIN_WIDTH: int = 800, MIN_HEIGHT: int = 600, MAX_WIDTH: int = 1920, MAX_HEIGHT: int = 1080, DEFAULT_WIDTH: int = 1200, DEFAULT_HEIGHT: int = 900, SCREEN_SCALE_FACTOR: float = 0.8, MACOS_SCALE_FACTOR: float = 1.0, PANEL_MARGIN: int = 20, PANEL_VERTICAL_SPACING: int = 40, INPUT_PANEL_RATIO: float = 0.7)[source]

Bases: object

Configuration class for window management in GUIBRUSHR.

This class manages window dimensions and scaling factors for the main application window. It provides a centralized way to handle window sizing and positioning across different screen resolutions and platforms.

ASPECT_RATIO: float = 1.0
MIN_WIDTH: int = 800
MIN_HEIGHT: int = 600
MAX_WIDTH: int = 1920
MAX_HEIGHT: int = 1080
DEFAULT_WIDTH: int = 1200
DEFAULT_HEIGHT: int = 900
SCREEN_SCALE_FACTOR: float = 0.8
MACOS_SCALE_FACTOR: float = 1.0
PANEL_MARGIN: int = 20
PANEL_VERTICAL_SPACING: int = 40
INPUT_PANEL_RATIO: float = 0.7
classmethod get_default_dimensions() Tuple[int, int][source]

Get the default fallback window dimensions.

Returns:

Tuple of default width and height in pixels

classmethod get_min_dimensions() Tuple[int, int][source]

Get the minimum allowed window dimensions.

Returns:

Tuple of minimum width and height in pixels

classmethod get_max_dimensions() Tuple[int, int][source]

Get the maximum allowed window dimensions.

Returns:

Tuple of maximum width and height in pixels

classmethod clamp_dimensions(width: int, height: int) Tuple[int, int][source]

Clamp window dimensions to min/max bounds while enforcing the fixed aspect ratio.

The more constraining dimension (width or height) is used, then the other is derived from ASPECT_RATIO so the ratio is always maintained.

Parameters:
  • width – Proposed window width in pixels

  • height – Proposed window height in pixels

Returns:

Tuple of clamped (width, height) with ASPECT_RATIO preserved

classmethod calculate_centered_position(window_width: int, window_height: int, screen_width: int, screen_height: int) Tuple[int, int][source]

Calculate window position to center it on the screen.

Parameters:
  • window_width – Width of the window in pixels

  • window_height – Height of the window in pixels

  • screen_width – Width of the screen in pixels

  • screen_height – Height of the screen in pixels

Returns:

Tuple of x and y displacement in pixels to center the window

__init__(ASPECT_RATIO: float = 1.0, MIN_WIDTH: int = 800, MIN_HEIGHT: int = 600, MAX_WIDTH: int = 1920, MAX_HEIGHT: int = 1080, DEFAULT_WIDTH: int = 1200, DEFAULT_HEIGHT: int = 900, SCREEN_SCALE_FACTOR: float = 0.8, MACOS_SCALE_FACTOR: float = 1.0, PANEL_MARGIN: int = 20, PANEL_VERTICAL_SPACING: int = 40, INPUT_PANEL_RATIO: float = 0.7) None
class GUIBRUSHR.GUIBRUSHR.GUIBRUSHR(path_default: Path)[source]

Bases: object

Main GUI application class for GUIBRUSHR.

This class manages the main application window and its components, including input/output panels and process management. It handles window initialization, panel creation, and proper cleanup on exit.

global_start

Flag indicating if the application is fully initialized

width

Window width in pixels

height

Window height in pixels

displace_x

Horizontal window displacement from screen edge

displace_y

Vertical window displacement from screen edge

path_default

Default application path for resources

dialog

Optional dialog window reference

window

Main application window (tkinter.Tk)

frame_input_master

Main input panel containing parameter controls

frame_output_table

Main output panel for displaying results

__init__(path_default: Path) None[source]

Initialize the GUIBRUSHR application.

This method sets up the main application window, initializes dimensions based on screen size, creates input/output panels, and prepares the application for user interaction.

Parameters:

path_default – Base path for the application resources

initialize_window() None[source]

Initialize window dimensions based on screen size and configuration.

This method detects the primary monitor dimensions and calculates appropriate window size using scaling factors. The window is automatically centered on the screen and dimensions are clamped to min/max bounds.

on_closing() None[source]

Handle window closing event with user confirmation.

This method is called when the user attempts to close the window. It shows a confirmation dialog and ensures proper cleanup of child processes before terminating the application.

initialize_DB() None[source]

Initialize the SQLite database for the application.

Creates the database file and tables if they do not already exist.

GUIBRUSHR.GUIBRUSHR.main() None[source]

Main entry point for the GUIBRUSHR application.

This function performs the following initialization steps: 1. Determines the default application path 2. Prints paths of user-editable files 3. Checks for configuration file, showing a setup dialog if missing 4. Creates the main GUI application (which initializes the database internally) 5. Sets up the window close event handler 6. Starts the main event loop

The function handles the complete lifecycle of the application from startup to shutdown.