Vision Models
Vision change models for AMD simulations.
This module provides different implementations of vision change models for AMD disease progression simulations. It allows for consistent vision change calculations across different simulation types (ABS and DES).
- Classes:
BaseVisionModel: Abstract base class for vision change models SimplifiedVisionModel: Simple normally distributed vision change model LiteratureBasedVisionModel: Vision change model based on literature data ClinicalTrialVisionModel: Vision change model based on clinical trial data
- Notes:
This module centralizes vision change logic to ensure consistency across different simulation implementations (ABS and DES).
- class simulation.vision_models.BaseVisionModel[source]
Bases:
ABCBase class for vision change models.
This abstract base class defines the interface for all vision change models. Concrete implementations must provide a calculate_vision_change method.
- abstract calculate_vision_change(state, actions, phase)[source]
Calculate vision change based on patient state.
- Parameters:
state (dict) – Patient state dictionary containing: - current_vision: Current visual acuity - fluid_detected: Whether fluid was detected at last visit - treatments_in_phase: Number of treatments in current phase - interval: Current treatment interval in weeks - treatment_status: Dictionary with treatment status information
actions (list) – Actions performed during the visit (e.g., [“vision_test”, “oct_scan”, “injection”])
phase (str) – Current treatment phase (‘loading’ or ‘maintenance’)
- Returns:
(vision_change, fluid_detected) - vision_change: Change in visual acuity (ETDRS letters) - fluid_detected: Whether fluid was detected at this visit
- Return type:
tuple
- class simulation.vision_models.SimplifiedVisionModel(config=None)[source]
Bases:
BaseVisionModelSimple normally distributed vision change model.
This model uses fixed normal distributions for vision change, with different parameters for loading and maintenance phases. This matches the model used in the original treat_and_extend_des.py.
- Parameters:
config (simulation.config.SimulationConfig, optional) – Configuration object, by default None
- Variables:
loading_params (dict) – Parameters for loading phase vision change: - mean: Mean vision change in ETDRS letters - std: Standard deviation of vision change
maintenance_params (dict) – Parameters for maintenance phase vision change: - mean: Mean vision change in ETDRS letters - std: Standard deviation of vision change
fluid_detection_prob (float) – Probability of fluid detection (0.0-1.0)
- __init__(config=None)[source]
Initialize the model with optional configuration.
- Parameters:
config (simulation.config.SimulationConfig, optional) – Configuration object, by default None
- calculate_vision_change(state, actions, phase)[source]
Calculate vision change based on patient state.
- Parameters:
state (dict) – Patient state dictionary
actions (list) – Actions performed during the visit
phase (str) – Current treatment phase (‘loading’ or ‘maintenance’)
- Returns:
(vision_change, fluid_detected)
- Return type:
tuple
- class simulation.vision_models.LiteratureBasedVisionModel(clinical_model)[source]
Bases:
BaseVisionModelVision change model based on literature data.
This model uses the clinical_model’s simulate_vision_change method, which implements a more complex vision change model based on literature data and disease states.
- Parameters:
clinical_model (simulation.clinical_model.ClinicalModel) – Clinical model for disease progression and treatment effects
- Variables:
clinical_model (simulation.clinical_model.ClinicalModel) – Clinical model used for vision change calculations
- __init__(clinical_model)[source]
Initialize the model with a clinical model.
- Parameters:
clinical_model (simulation.clinical_model.ClinicalModel) – Clinical model for disease progression and treatment effects
- calculate_vision_change(state, actions, phase)[source]
Calculate vision change based on patient state.
- Parameters:
state (dict) – Patient state dictionary
actions (list) – Actions performed during the visit
phase (str) – Current treatment phase (‘loading’ or ‘maintenance’)
- Returns:
(vision_change, fluid_detected)
- Return type:
tuple
- simulation.vision_models.create_vision_model(model_type, config=None, clinical_model=None)[source]
Factory function to create a vision model.
- Parameters:
model_type (str) – Type of vision model to create: - ‘simplified’: SimplifiedVisionModel - ‘literature_based’: LiteratureBasedVisionModel
config (simulation.config.SimulationConfig, optional) – Configuration object, by default None
clinical_model (simulation.clinical_model.ClinicalModel, optional) – Clinical model for disease progression, by default None
- Returns:
Vision model instance
- Return type:
- Raises:
ValueError – If model_type is not recognized