Virtual Table Model#
Virtual table model for efficient data display.
This module provides a virtual table model that can handle large datasets efficiently by loading data on-demand and caching frequently accessed items.
|
Virtual table model for handling large datasets efficiently. |
Abstract base class for data providers in virtual table models. |
|
|
Data provider for MDA file data in virtual table models. |
- class mdaviz.virtual_table_model.MDAVirtualDataProvider(scan_dict: dict[str, Any], cache_size: int = 1000)[source]#
Data provider for MDA file data in virtual table models.
This provider handles loading and caching of MDA file data for display in virtual table models.
- get_memory_usage_mb() float [source]#
Get the approximate memory usage in megabytes.
- Returns:
float: Memory usage in MB
- is_data_loaded(row: int) bool [source]#
Check if data for a specific row is loaded.
- Parameters:
row (int): Row index
- Returns:
bool: True if data is loaded, False otherwise
- load_data_range(start_row: int, end_row: int) None [source]#
Load data for a specific range of rows.
For MDA data, this is a no-op since all data is already loaded in the scan_dict. This method is provided for interface compatibility.
- Parameters:
start_row (int): Starting row index (inclusive) end_row (int): Ending row index (exclusive)
- class mdaviz.virtual_table_model.VirtualDataProvider[source]#
Abstract base class for data providers in virtual table models.
This class defines the interface that data providers must implement to work with the VirtualTableModel.
- clear_cache() None [source]#
Clear any cached data.
This method should clear any internal caches maintained by the data provider to free up memory.
- get_column_count() int [source]#
Get the total number of columns in the dataset.
- Returns:
int: Total number of columns
- get_column_headers() list[str] [source]#
Get the column headers.
- Returns:
list[str]: List of column header strings
- get_data(row: int, column: int) Any [source]#
Get data for a specific cell.
- Parameters:
row (int): Row index column (int): Column index
- Returns:
Any: Data for the specified cell
- get_row_count() int [source]#
Get the total number of rows in the dataset.
- Returns:
int: Total number of rows
- is_data_loaded(row: int) bool [source]#
Check if data for a specific row is loaded.
- Parameters:
row (int): Row index
- Returns:
bool: True if data is loaded, False otherwise
- load_data_range(start_row: int, end_row: int) None [source]#
Load data for a specific range of rows.
This method is called by the virtual table model when it needs to load data for a visible range of rows.
- Parameters:
start_row (int): Starting row index (inclusive) end_row (int): Ending row index (exclusive)
- class mdaviz.virtual_table_model.VirtualTableModel(*args: Any, **kwargs: Any)[source]#
Virtual table model for handling large datasets efficiently.
This model implements virtual scrolling by loading data on-demand and only keeping a subset of the data in memory at any time.
- Attributes:
data_provider (VirtualDataProvider): Provider for the actual data page_size (int): Number of rows to load per page preload_pages (int): Number of pages to preload
- _ensure_data_loaded(row: int) None [source]#
Ensure that data for a specific row is loaded.
- Parameters:
row (int): Row index
- set_visible_range(start_row: int, end_row: int) None [source]#
Set the currently visible range of rows.
This method is called by the view to inform the model about which rows are currently visible, allowing for preloading.
- Parameters:
start_row (int): Starting row index (inclusive) end_row (int): Ending row index (exclusive)